Repository navigation
fix(agents): review the Parent a reset adopts, not the spec it replaces - #12202
Conversation
|
Intent: A whole-Parent reset must have its permission review gate inspect the Parent it adopts, so a Parent carrying |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify no supported Parent legitimately carries What this change shipsInventory (4 items) — 4 justifiedIntent: FIX — stop a whole-Parent reset from writing unreviewed auto-approval permissions into a Crew member. Provenance is checkable: two added tests fail on base, and the harm sits on named boundaries (external content is untrusted; the agent cannot choose its own ceiling). Verified against the code:
[FIRST-PRINCIPLES-REVIEWED] d516449 |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify [DESIGN-REVIEWED] d516449 |
c36fad6 to
d5b765d
Compare
|
Rebased: this branch opened on |
GPT 5.6 Review —
|
1 similar comment
GPT 5.6 Review —
|
Opus 4.8 Review — ✅ no blocking findingsReviewed Review detailsI've verified the change thoroughly:
No candidate existed to falsify, and I found no grounded defect in the changed lines. No findings. [OPUS-REVIEWED] d516449 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
A whole-Parent reset builds its new member spec from the Parent, but the permission review gate inspected the member's own spec. A Parent carrying `toolsSettings` `allowed*`/`trusted*`/`auto*` grants, `autoAllowReadonly`, or a `permissions` block the derive does not produce therefore reached the member without raising `alternate_permissions_require_review`. A project-scoped Parent is a file in a repository, and the reset intent pins the descriptor rather than a content digest, so a repository could carry permissions into a member. The gate now reads the same `base` dict the projection is built from -- the Parent on a reset, the member's current spec otherwise -- and it runs on every reset, not only when the request names `allowedTools`/`autoApprove`/`tools` or the grant list changes.
d5b765d to
d516449
Compare
|
Rebased: |
bolichen97
left a comment
There was a problem hiding this comment.
Approved: fix-class, security fix in the fail-closed direction. The review gate read snap["spec"] — the member spec a reset DISCARDS — so a Parent carrying alternate permission grants went straight in unreviewed; it now reads base, which is the Parent on a reset and the member's current spec on an ordinary apply. Verified both halves in the diff: the _align_permissions(base, spec) swap and the added reset_parent or on the gate condition. The narrower condition was kept deliberately rather than gating every apply, which the body backs with a constructed case rather than a green suite. Breaking change disclosed with a writer sweep naming the only reset_parent=True caller and both existing error handlers. 2 files only.
…es (kirodotdev#12202) A whole-Parent reset builds its new member spec from the Parent, but the permission review gate inspected the member's own spec. A Parent carrying `toolsSettings` `allowed*`/`trusted*`/`auto*` grants, `autoAllowReadonly`, or a `permissions` block the derive does not produce therefore reached the member without raising `alternate_permissions_require_review`. A project-scoped Parent is a file in a repository, and the reset intent pins the descriptor rather than a content digest, so a repository could carry permissions into a member. The gate now reads the same `base` dict the projection is built from -- the Parent on a reset, the member's current spec otherwise -- and it runs on every reset, not only when the request names `allowedTools`/`autoApprove`/`tools` or the grant list changes. Co-authored-by: Joe Guo <zejiangg@amazon.com>
Problem / Motivation
A whole-Parent reset could hand a Crew member permissions nobody reviewed.
Reset throws the member's private copy away and rebuilds it from the Parent. The review gate that is supposed to stop unreviewed permissions read the member's own spec — the spec being thrown away — and never looked at the Parent it was resetting to. So a Parent carrying
toolsSettingsallowed*/trusted*/auto*grants,autoAllowReadonly, or apermissionsblock the derive does not produce went straight into the member without raisingalternate_permissions_require_review.Why it matters
A Parent can be project-scoped, which means a file inside a repository. The reset intent pins the Parent's descriptor, not a digest of its contents, so the file can change between the pin and the reset. A repository could therefore carry auto-approval grants into a member, and the member's agent would run tool calls without a permission card. Crew's deny floor and sensitive-path check never run for an auto-approved call, so the grant is the whole control.
What changed (motivation → approach → change)
snap["spec"]— the member spec a reset discardsbase— the dict the new spec is built fromallowedTools/autoApprove/tools, or the grant list changesbaseis already the right answer in both directions: on a reset it is the Parent, and on an ordinary apply it is the member's current spec. The fields the gate reads —toolsSettings,autoAllowReadonly,permissions,allowedTools— are not ordinary fields, so on an ordinary applybasecarries exactly whatsnap["spec"]carried. The member namebaseholds reaches the derive only as a log label, never as part of a rule, so a reset onto a correctly derived Parent still passes.The second half is needed because a reset names no sections and changes no grant list, so the old condition skipped the gate on the exact path that adopts a whole foreign spec.
Dropping the condition and gating every apply was measured, not assumed: it rejects an ordinary prompt-only apply on a member whose spec holds a hand-edited
permissionsblock, which is a refusal this defect does not need. All 477 tests intest/test_agent_capabilities.pypass either way, so the narrower form was kept on the evidence of a constructed case rather than a green suite.Backwards compatibility
Breaking: a reset onto a Parent that carries alternate permission shortcuts or a hand-edited
permissionsblock now returnsalternate_permissions_require_review(HTTP 409) instead of writing those permissions into the member. Writer sweep on origin/main @7e8f2c459fe073048162dcfcc54c595b23a6ddc8:CapabilityService.resetis the onlyreset_parent=Truecaller; its only production caller issrc/kiro_crew/dashboard/handlers/agent_capabilities.py:134, which already catchesCapabilityErrorand answers with the code and its status; the only frontend caller isagentResetinwebsite/src/api/client.ts, reached fromAgentTemplateDetail.tsx, which already catches the failure and tells the owner the change did not land. Nothing else reaches the path, so no writer needs a change.Tests
Four tests in
test/test_agent_capabilities.py:toolsSettingscarries anallowedCommandsgrant raisesalternate_permissions_require_review, and the member spec on disk is untouched;permissionsblock the derive would not produce raises the same error, member spec untouched;permissionsequal the value derived from its ownallowedTools;permissionsblock.The first two fail on unpatched source with
DID NOT RAISE. The last two hold both ways and guard against a refusal this fix must not introduce.Manual verification
N/A — unit coverage sufficient: both the refusal and the clean-reset path run through
CapabilityService.resetend to end against real files in the test's isolated config, sidecar and agent homes.Related Issues
no linked issue: the defect was found by reading the code that shipped with the capability-inheritance work, and no tracking issue exists for it.
Pattern harvest
Rule candidate: review-prompt
Pattern: a validation gate passed the state a write REPLACES instead of the state the write ADOPTS
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)