Repository navigation
fix(security): put built-in apps' credentialMasks on the agent tool gate - #34346
Conversation
Sensitive change reviewHead: f16d95f
|
Sensitive Change ReviewSensitive files changed:
|
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level concerns: the tool gate reads the one fixed source, the shipped manifests, and only adds refusals, so no core row has to name an app. Notes
[DESIGN-REVIEWED] ef934d3 Description read[DESCRIPTION-READ] b3009e57f0fd3edc4a56cebb654137b1c097147e3e9eb98999f3e3cd3a0e38d4 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS No built-in declares Notes
What this change shipsInventory (5 items) — 3 justifiedIntent: let a built-in app's declared credential file be refused by the agent's file tools and the gateway's file surfaces, with no core row that names the app. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] ef934d3 Description read[DESCRIPTION-READ] 706c16597df56b33961c8a0e01d3754e691df07bf1d08ddaf44d3a408a912d4f That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 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: |
Code change approver recommendation: ApproveAutomated, not a person, and not a review: a maintainer still decides.
Why: the decider approves with p_defect 0.12 <= 0.12 and every rail passes. At import, the shipped built-ins' declared credentialMasks leaves are added to security._CREW_SECRET_LEAVES; installed apps are left out on purpose. Checked: (1) no import cycle: kiro_crew.apps loads its exports lazily, and credential_masks imports only atomic_write and config.paths, which security already imports; (2) the built-in-only read never touches config_dir and returns nothing on any error instead of raising, so importing security can't break; (3) app_declared_mask_targets judges 'core' from the sandbox_leaves tables, not the security list, so a built-in's backend still gets its declared file back; (4) the governance-mask pin compares the tool gate with the spawn plan, which already hides declared leaves; (5) the other readers of sensitive_home_dirs (adapter credential mask, papyrus/office_slides) only gain refusals. No built-in declares masks on main, so nothing changes at runtime today. A fresh-interpreter test proves the import-time wiring. The earlier @_POSIX_ONLY misplacement is fixed at this head. If this recommendation is wrong, reply here; the replies are how the approver is evaluated. |
Security Scope Review -- ✅ PASSWhich legitimate operations does Verdict basis: adjudicated, zero confirmed regressions. Security scope review -- adjudicated candidates
No candidate flipped from allowed to refused. Scope-Verdict: PASS Reason: The change adds the built-in apps' declared TIGHTENING: the crew-home secret-leaf list behind ADJUDICATED: 14 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: posix and windows. The diff assumes crew-home-relative leaves ( UNADJUDICATED:
[SCOPE-REVIEWED] ef934d3 |
f16d95f to
bd7b110
Compare
Sensitive change reviewHead: bd7b110
|
|
AI review notes on f16d95f, addressed in bd7b110:
|
bd7b110 to
4262a1d
Compare
Sensitive change reviewHead: 4262a1d
|
|
Backend Tests (3.12, 1) on bd7b110: |
4262a1d to
ef934d3
Compare
Sensitive change reviewHead: ef934d3
|
|
Re-head only, same tree as 4262a1d ( |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving. On head ef934d3 the review read the whole diff and checked four things. First, _CREW_SECRET_LEAVES now takes credential_masks.declared_crew_leaves(installed=False). Second, the import-time read never raises and reads only the shipped builtins tree, not the data home. Third, there is no import cycle. Fourth, the governance reconciliation pin still holds. CI on this head shows all 8 Linux and all 8 Windows Backend Tests shards passed, along with the Flake Pattern Ratchet and the Static Ratchet Gate.
Security: this PR touches the agent tool gate's refusal floor and credential handling. The risk is not realized, because the change can only add refusals. It reads only the shipped manifests, which are fixed for the process, and never the agent-writable installed manifests. The built-in's own backend carve-out in sandbox_tiers is built from separate static tables, so it is unaffected. On main no built-in declares a mask yet, so runtime behaviour is unchanged until #34296 lands.
Done well: test_the_gate_takes_a_shipped_declaration_when_it_loads proves the import-time wiring in a fresh interpreter. It checks that the declared file is refused and that a sibling file stays readable, without reloading a shared module in-process.
Optional:
test/test_app_credential_masks.py:356: passtimeout=FALLBACK_TIMEOUT_SECSto the childsubprocess.run. A hang would then fail this test by name instead of costing the xdist worker on Windows.test/test_app_credential_masks.py:367:test_every_shipped_declaration_is_on_the_tool_gate_floorloops over an empty set until a built-in declares a mask. A one-line docstring saying so would keep readers from treating it as current evidence.- No test fails if the gate call at
paths_lists.py:833changes toinstalled=True. The fresh-interpreter test could install a demo app under a tmpKIROCREW_HOMEand assert that its leaf stays off the gate.
Problem / Motivation
Goal: A credential file a built-in app declares in
credentialMasksis refused by the agent's file tools as a core credential is, without a core row that names the app.credentialMaskshides a declared file in every sandbox, but nothing feeds it to the agent tool gate (security._CREW_SECRET_LEAVES/is_sensitive_path). That gate also guards gateway-side file surfaces (dashboard file I/O, artifacts, knowledge indexing) and sessions without a sandbox, so a declaring app has to get a hand-written core row. PR #34296 (Ops Mission Control's token store moving onto the seam) needed exactly that:"apps/ops-mission-control/data/secrets.json"inpaths_lists.py, plus a newKNOWN_NAME_REFERENCESrow in the shrink-only decoupling gate. Review blocked that row.Why it matters
Without this, every built-in that moves a credential onto
credentialMasksmust grow the core again with an app-named tool-gate row, which is the coupling #26967 is removing. Without either, the declared file is readable through the gateway's own file surfaces.Not a goal
app.jsonis sandbox-writable and read per spawn; the gate's list is static. Stated in the docs, not sealed.What changed (motivation → approach → change)
Goal → approach → change. The tool gate's crew-home list is built once at import, so the seam reads the one source that is fixed for the process: the shipped built-in packages' manifests.
credential_masks.declared_crew_leaves(installed=False)returns their declared leaves at both data spellings (apps/<app>/data/<entry>and the lifecycle's move-aside), and_CREW_SECRET_LEAVESsplats it. Everything derived from that list follows with no second entry: the read+write floor at both crew prefixes and the.tmp/.lockpublish-artifact fence beside the leaf. A declared leaf is HIDDEN in the spawn plan, so the governance-mask pin (every tool-gate crew entry has a sandbox disposition) holds for it.Ratchets: the shrink-only decoupling list does not grow (the seam names no app; #34296 can drop its proposed row). The security package's line budget (35,160) does not grow either: the import and the splat in
paths_lists.py, and theTYPE_CHECKINGline thepathsfacade needs for any name an owner imports from outside the family (test_paths_facade.py), are offset by collapsing three redundant double blank lines between top-level assignments inpaths_lists.py, two of them beside the lists this change feeds. No baseline or budget was edited.Docs:
security.mdandapp-kit-platform.mdsection 37 (the statement that no tool-gate row reads a declaration), thecredential_masksmodule docstring.Backwards compatibility
Compatible: on main no built-in declares a mask, so the gate list is unchanged until one does; for a declaring built-in, the gate only adds refusals.
Removes nothing: the change only adds entries to the tool gate's refusal floor.
Tests
test_only_the_shipped_manifests_feed_the_gate: a shipped manifest feeds it, an installed one does not.test_the_gate_takes_a_shipped_declaration_when_it_loads: a fresh interpreter with a patched shipped manifest loadskiro_crew.security; the declared file is refused and a sibling is not, which proves the import-time wiring.test_every_shipped_declaration_is_on_the_tool_gate_floor: live pin over the real shipped set.Proof: PROVEN test_app_credential_masks.py::TestTheToolGateReadsTheShippedDeclarations (3 tests) (head ef934d3)
Local: every
test/test_sandbox*,test/test_security*,test/test_app_credential*,test/test_app_backend*, every facade/mirror test and the decoupling gate at-n 2: 15,150 passed; the one failure,test_the_seatbelt_profile_is_the_golden, fails identically on main on this host. Line budget 35,160 / 35,160.Manual verification
N/A — unit coverage sufficient, including a clean-interpreter test of the import-time wiring.
Related Issues
Part of #32681. Needed by #34296; companion seam #34339.
Sibling sweep
Swept: git grep -n "declared_crew_leaves|credential_masks" -- src/kiro_crew
Sibling: src/kiro_crew/sandbox_aliases.py -- not affected -- already reads every declaration per spawn
Sibling: src/kiro_crew/sandbox_argv.py -- not affected -- already reads every declaration per spawn
Pattern harvest
Not generalizable: the one consumer of a declaration that is built at import instead of per spawn.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.