fix(agent): expose --scope admin + regression test for SEC-A-09#412
Closed
intendednull wants to merge 1 commit into
Closed
fix(agent): expose --scope admin + regression test for SEC-A-09#412intendednull wants to merge 1 commit into
intendednull wants to merge 1 commit into
Conversation
Issue #311 (SEC-A-09) original fix in PR #389 added `--scope {messaging,read,full}` with Messaging default. Two gaps remain. 1. Issue spec called for `readonly|messaging|full|admin`. The `admin` value is not exposed on the CLI even though `TokenScope::Admin` exists in scopes.rs and is semantically distinct from Full for audit log consumers. Added Admin variant to ScopeArg with mapping to TokenScope::Admin. 2. No test verified that omitting --scope yields the safer Messaging default — the regression that was the heart of SEC-A-09. Added tests::default_scope_is_messaging plus parse coverage for every documented value, an unknown-value-rejected case, and the ScopeArg → TokenScope wiring map. Covers behaviour at the lowest tier (Rust unit on the binary) per CLAUDE.md test-tier guidance. Doc on ScopeArg now lists per-scope tool sets so operators can pick without reading scopes.rs. Refs #311 Tradeoffs: - Considered changing TokenScope::default() from Full to Messaging to remove the footgun globally. Rejected: stdio transport (serve_stdio uses WillowMcpServer::new which reads the Default) is a local-process channel where Full is appropriate; flipping Default would either break stdio silently or force every test in tests/e2e.rs to call with_scope(TokenScope::Full). Out of scope for this issue. Worth a follow-up to make the Default explicit per call site and remove the Default impl entirely.
Owner
Author
|
Is this still needed? |
Owner
Author
|
good catch. #389 already shipped what #412 actually adds:
3 options:
your call. defaulting to close if no preference. Generated by Claude Code |
Owner
Author
|
Clean up please |
This was referenced Apr 28, 2026
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.
Why
PR #389 closed bulk of #311 (SEC-A-09): added
--scope {messaging,read,full}, defaultMessaging, threaded intoserve_http. Two gaps remained.readonly|messaging|full|admin.adminvalue not exposed on CLI even thoughTokenScope::Adminexists inscopes.rs(semantically distinct fromFullfor audit log consumers).--scope fulldefault.What
Adminvariant toScopeArg. Maps toTokenScope::Admin.ScopeArgnow lists per-scope tool sets.mod testsincrates/agent/src/main.rs:default_scope_is_messaging— pins SEC-A-09 fix.messaging/read/full/admin).ScopeArg→TokenScopewiring map.Lowest tier covering behaviour per CLAUDE.md: clap
Cli::parse_fromon the bin. No process spawn needed.Behaviour change
None vs current
claude/adoring-euler-3axK7. PR #389 already flipped HTTP defaultFull→Messaging. This PR only addsadminvalue (additive) and locks the existing default with a test.Tradeoff considered
Considered flipping
TokenScope::default()fromFulltoMessagingto kill the footgun globally. Rejected. Stdio transport (serve_stdiousesWillowMcpServer::newwhich reads theDefault) is local-process —Fullappropriate. FlippingDefaultwould breaktests/e2e.rssilently or force every test towith_scope(TokenScope::Full). Worth a follow-up issue to remove theDefaultimpl entirely and force each call site explicit.Test plan
cargo fmt --checkcleancargo clippy -p willow-agent --all-targets -- -D warningscleancargo test -p willow-agent --bin willow-agent7/7 new tests passcargo test -p willow-agent --lib31/31 passcargo test -p willow-agent --test e2e32/32 passRefs #311
https://claude.ai/code/session_014KLEYzesqZwWdFQnUeXtrJ
Generated by Claude Code