fix(sandbox): parse launcher option arity - #701
Merged
gouhongshen merged 3 commits intoSep 4, 2026
Merged
Conversation
9 tasks
Collaborator
Author
gouhongshen
marked this pull request as ready for review
September 4, 2026 14:29
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow up on #696 by closing a destructive-command policy bypass discovered during the synchronized
mainreview in #697.The transparent-launcher resolver previously treated every unrecognized option as a flag without a value. For example,
exec -a alias dd ...therefore misidentifiedaliasas the executable and failed to classify the realddinvocation.This change:
command,builtin,exec,nohup,env,sudo,doas, andpkexec) an explicit short/long option grammar and value arity;env -Scannot be proven;timeout,nice,ionice, andsetsid, with explicit option/value grammar andtimeoutduration handling;execute_bashvalidator coverage for destructive and benign cases.Related issue
N/A — follow-up to merged PR #696 and synchronized review fix from #697.
Change type
User and compatibility impact
Actual destructive commands hidden behind launcher options are blocked correctly. Benign heredoc/interpreter data remains unaffected. No API, configuration, persistence, or migration changes.
Architecture and complexity delta
astra-sandboxBash AST command resolver now owns launcher option arity.astra-toolspublic Bash validation.rm -rfguard remain inastra-tools; destructive executable classification remains solely inastra-sandbox.Verification
cargo fmt --all -- --check;cargo test -p astra-sandbox --lib(153 passed);cargo test -p astra-tools --lib validate_execute_bash(11 passed);cargo clippy -p astra-sandbox -p astra-tools --all-targets -- -D warnings.validate_execute_bash_commandthrough theastra-toolsvalidator tests.exec -a, short-option clusters, dynamic option values,sudo -D,doas -a,pkexec --user,env -u, destructive and benign commands behindtimeout/nice/ionice/setsid, nested wrappers, unknown option arity,env -S, and benign launcher arguments.Final checklist