Repository navigation
fix(agent-audit): a grant to start a nested agent holds all three trifecta legs, and is named - #1127
Merged
sandstream merged 4 commits intoNov 27, 2026
Conversation
…ule classes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bash(claude --print --dangerously-skip-permissions:*) and Bash(claude:*) passed the trifecta audit while Bash(bash:*) warned. nestedAgentGrant() reads a shell grant with the gate's shared table (nested-agent-bypass.ts): approvals-off flags give "nested agent with approvals off", a wildcard after an agent CLI gives "nested agent with arbitrary flags". Both hold all three legs and the write row, like Bash(bash:*). The rule ledger gives Codex prefix_rule and Cursor Shell grants the same class and named rows. Found by kit-research#236 (artex-cc-vs-kit). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from
claude/web-kit-status-sync-p6fg9a-protected-nested-agent-bypass
to
main
November 27, 2026 11:27
…audit-nested-agent
|
Docker image built, scanned, and smoke-tested in CI. The PR image is local to this run and is not published. |
sandstream
deleted the
claude/web-kit-status-sync-p6fg9a-protected-audit-nested-agent
branch
November 27, 2026 13:38
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.
Protected — owner merges. This PR is stacked on #1119 (
nested-agent-bypass, the shared classifier) and importsnestedAgentBypassandnestedAgentClifrom it. It also carries #1121 (the rule ledger), merged in, because the Codex and Cursor cases need the ledger's classes. Merge #1121 and #1119 first; this diff then shrinks to its own commit.Found by kit-research#236 (
artex-cc-vs-kit), Measurement §5 "Gap repro" and Plan step 2. Also kit-research#239 (prismor-always-allowed-rules-vs-kit), which re-records the same fixture.What changes
nestedAgentGrant(arg)insrc/agent-trifecta.tsreads a shell grant using the gate's own table fromsrc/nested-agent-bypass.ts, so the gate and the audit share one table. There is no separate internal table.claude --print --dangerously-skip-permissions:*,claude -p --permission-mode bypassPermissions *,codex exec --dangerously-bypass-approvals-and-sandbox,gemini --yolo,npx -y @anthropic-ai/claude-code --dangerously-skip-permissions.claude:*,claude -p *,codex exec:*, and CursorShell(claude).claude --version, bareclaude) stays narrow.Both kinds now hold all three trifecta legs and count as a write, the same as
Bash(bash:*). Each also gets a named row:nested agent with approvals off: <unit>, severity high;nested agent with arbitrary flags: <unit>, severity medium.The rule ledger gives Codex
prefix_ruleand CursorShellgrants the same class and the same named rows (agent rules: nested agent with …).Before / after
scripts/nested-demo.sh(scratch): a fresh project with one allow rule in.claude/settings.json, or one Codex rule.origin/mainBash(claude --print --dangerously-skip-permissions:*)✓ lethal trifecta no agent holds …! write access without confirmation,! nested agent with approvals off: main session,! lethal trifecta: main sessionBash(claude:*)✓ …! write access …,! nested agent with arbitrary flags: main session,! lethal trifecta: main sessionBash(claude --version)✓ …✓ …(narrow).codex/rules/default.rules:prefix_rule(pattern=["codex","exec","--dangerously-bypass-approvals-and-sandbox"], decision="allow")✓ …(rule not read)! agent rules: nested agent with approvals off, classall three legs, writes, nested agent with approvals off, unsandboxedTest:
src/agent-audit-nested-agent.test.ts. Onmainit fails at import, becausenestedAgentGrantdoes not exist there. On this branch, 59/59 pass across it,agent-trifecta,agent-rule-ledgerand the flag-surface tests.Harness coverage
prefix_rule.Shell(…).run_shell_command(…).The last three go through the ledger. Agents the shared table names: claude, codex, gemini, qwen, cursor-agent, copilot, kiro-cli, droid. Antigravity and Copilot rule stores are not read; see #1121.
Test-Growth:trailer: the 661 net new test lines are mostly #1119's and #1121's. This PR's own test is about 125 lines.macOS is unverified. The code is pure string handling, with no paths.
Generated by Claude Code