fix(cli): match intercept args after global options - #1344
Conversation
Signed-off-by: Dustin Persek <dustin.persek@protonmail.com>
PR Review SummarySize
Affected crates
Blast radius — ModerateThis PR touches: source code,configuration / policy files Updated automatically on each push to this PR. |
SequeI
left a comment
There was a problem hiding this comment.
Left some review comments, thank you for the PR!
Signed-off-by: Dustin Persek <dustin.persek@protonmail.com>
SequeI
left a comment
There was a problem hiding this comment.
lgtm, thank you! Welcome to the community :)
|
Nice fix for the
There's also a whole separate class around environment variables. Two different shapes:
Might be worth treating this as "the matcher needs richer predicate matching" (and possibly needs to observe post-expansion argv, not pre-expansion) rather than a series of point fixes — each gap keeps showing up as its own bypass report otherwise. |
Linked Issue
Closes #1328
Summary
argsas a contiguous sequence withinargv[1..], so command-global options before a subcommand do not bypass a configured intercept action.git -c foo=bar push --forceagainst an intercept rule for["push", "--force"].Agent Disclosure
This PR was prepared with assistance from an AI coding agent and reviewed by the human contributor before submission.
Relevant files and sections consulted:
AGENTS.mdCoding Agent Contribution Policy, coding standards, and security considerations.NOGENT.mdtool-sandbox/security review guidance.SECURITY.mdresponsible disclosure guidance..github/pull_request_template.mdPR and agent-compliance requirements.crates/nono-cli/src/tool-sandbox/policy.rsintercept and invocation policy matching code.crates/nono-cli/src/command_policy.rsInterceptRuleConfigdocs and validation context.docs/cli/features/tool-sandbox.mdxTool Sandbox intercept documentation.crates/nono-cli/data/nono-profile.schema.jsonprofile schema descriptions.Compliance confirmation: this change is scoped to the existing public issue, follows the repository's coding and security requirements for the affected area, avoids forbidden
unwrap/expectpatterns, and does not change path handling or NonoError behavior.Test Plan
cargo test -p nono-cli resolve_intercept_actioncargo fmt --all -- --checkmake test-cliOperation not permitted; the same command passed when rerun outside that sandbox.make clippygit diff --checkScope / Caveat
This changes intercept
argsmatching from strict index-0 prefix matching to command-agnostic contiguous sequence matching withinargv[1..]. It intentionally does not add command-specific option parsing.Checklist
CHANGELOG.mdif neededAgent Compliance Check (Required for AI/Automated PRs)