Repository navigation
docs: forbid unrequested sandbox widening in guidance and review rules - #12200
Conversation
What the OS sandbox seals, masks or no-follow pins is an operator-facing contract about which of their own files their agent can still reach. A widening nobody asked for does not surface as a failed review; it surfaces days later as work that stopped, reported as a pattern instead of a cause, with no record that anyone chose to lose the operation. So the scope is the operator's to widen: not an author's to add on the way past something else, and not a reviewer's to request. Two incidents this generalizes, both on record: #11556 added a module-level assert over the full sealed-leaf union while writing wording for two of five leaves, so `import kiro_crew.sandbox` raised on main and every backend test failed at COLLECTION -- including `test_every_strict_leaf_of_either_shape_is_covered_by_the_delegated_guard`, written to pin that exact invariant, which could not report the gap because it could not be collected. An import-time self-check silences its own witness. Fixed on main by 2b7d378; this records the rule. #12103 spent eleven review rounds on one span, each round naming one more environment variable that "also reaches it". A review comment is not the operator's authorization, and that direction converges on nothing. Three placements, one per reader: AUTOSDE.yaml gets a blocking rule so the Claude and Codex reviewers flag an unrequested seal, a fence tightened past the named threat, hardening added only to answer a "spelling Y reaches it too" comment, a widening justified solely as defense in depth with no reachable input, and an invariant whose own inputs the diff leaves incomplete. AGENTS.md carries the same rule as a security invariant, beside the "regex spelling-chase is a review smell" entry it generalizes. gpt-repo-context.md bounds the lane: it was already told to prefer a finding on the SANDBOX, with nothing saying it may not ask for a wider one.
dbbffc0 to
1cabbbd
Compare
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsFINDING -- AUTOSDE.yaml:755 -- False positive or not applicable? A repository writer can comment: |
Opus 4.8 Review — ✅ no blocking findingsReviewed Review detailsThe YAML is well-formed — indentation matches the sibling No findings. [OPUS-REVIEWED] 1cabbbd Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify the lane's "or report nothing" bound still lets a reviewer surface a genuinely unfenced new credential leaf via the disposition-pin rule, not a fence request. [DESIGN-REVIEWED] 1cabbbd |
Problem / Motivation
Two incidents this week share one missing rule: nothing in the repository says
that widening the sandbox needs asking for.
#11556 added a module-level
assertover the full sealed-leaf union whilewriting wording for two of five leaves.
import kiro_crew.sandboxthen raisedon
main, so every backend test in the repository failed at collection —including
test_every_strict_leaf_of_either_shape_is_covered_by_the_delegated_guard,written to pin that exact invariant, which could not report the gap because it
could not be collected either. An import-time self-check silences its own
witness. (Reported as #12182; the code is fixed on
mainby2b7d378116. ThisPR records the rule, and carried the same code fix until that landed.)
#12103 spent eleven review rounds on one span, each round naming one
more environment variable that "also reaches it" —
PYTHONPATH,PYTHONHOME,PYTHONUSERBASE, zip/egg loaders,.pthhooks, per-user site. Each round was areal new mechanism, and that is the point: enumerating them does not terminate.
Why it matters
What the sandbox seals, masks or no-follow pins is an operator-facing
contract about which of their own files their agent can still reach. A
widening nobody asked for does not surface as a failed review. It surfaces days
later as work that stopped, reported as a pattern instead of a cause, with the
legitimate operation gone and no record that anyone chose to lose it.
security-scope.mdalready owns one direction of this — "which legitimateoperations does this change newly refuse" — and explicitly hands the stricter
direction to the other lanes. Those lanes had no upper bound written down.
What changed (motivation → approach → change)
The scope is the operator's to widen: not an author's to add on the way past
something else, and not a reviewer's to request. Three placements, one per
reader, because each reads a different file:
AUTOSDE.yaml— a new blocking rulea-sandbox-widening-is-not-incidental-scope, scoped tosandbox.py,security.py,hooks.py. It flags an unrequested seal/mask/deny, a fencetightened past the threat the PR names, hardening added only to answer a
reviewer's "spelling Y reaches it too", a widening justified solely as defense
in depth with no reachable input named, and an invariant whose own inputs the
diff leaves incomplete. It explicitly does NOT flag a widening the PR's intent
names with its input and consequence written down, a completion of an existing
invariant's data, or any narrowing.
AGENTS.md— the same rule as a security invariant, placed beside theexisting "a regex spelling-chase is a review smell" entry it generalizes. The
review lanes read
AGENTS.mdtoo, so this is also where the rule reaches thereviewer.
.github/review-prompts/gpt-repo-context.md— a bound on the lane. It wasalready told to "prefer a finding on the SUBJECT or the SANDBOX", with nothing
saying it may not ask for a wider sandbox. Now it must cite a seal that fails
on a path the PR already changes, or report nothing.
Backwards compatibility
Breaking for review, deliberately, and only for review: a new
blockingAutoSDE rule means a PR that widens the sandbox without saying why can now be
flagged where it previously passed. That is the intent, and it is what
blockingis for. The rule states its own allowed cases so a legitimate widening still
passes by naming its input and consequence.
No runtime effect: three text files, no Python touched,
src/unchanged.Tests
N/A — no executable change. The files are consumed by the Claude and Codex PR
reviewers and by agents reading
AGENTS.md; there is no unit-testable behaviour.Verified instead:
AUTOSDE.yamlparses (20 rules, no duplicateid, the newrule present with
blocking: trueand its three file patterns); 1,172 tests passacross the six suites that read
AUTOSDE.yaml, the review workflows and theprepare-pr profiles (
test_ci_surface_tests.py,test_ai_review_workflows.py,test_fix_loop_discipline.py,test_agent.py,test_prepare_pr_profiles.py,test_skill_home_paths.py); docs-lint, black and subprocess-encoding gates green.Manual verification
Read each of the three files in place to confirm the rule lands in the section a
reader actually reaches: the AutoSDE rule after
a-ratchet-may-only-tighten(whose "may only tighten" direction it bounds), the
AGENTS.mdentry inside"Security invariants (do NOT weaken)", and the lane bound as the bullet
immediately after the one that sends findings toward the sandbox.
Related Issues
Context: #12182 (the import failure this generalizes), #12103 (the eleven-round
span), #11556 (the incomplete invariant).