Repository navigation
feat(app-kit): tool gate honours installed apps' credential masks - #37459
Conversation
|
Campaign note (#26967): authorized by owner ruling 3 (#26967 (comment)) and #26967 (comment). Follow-up once this lands: Ops Mission Control is pinned in the next pin PR at |
Sensitive Change ReviewSensitive files changed:
|
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The only frontend change is the SDK level constant ( [UX-REVIEWED] 687e1ed Description read[DESCRIPTION-READ] 9e62f6fad13f9674faa86646e5e4065d7fac3bddd426d975ae01960d9810825c That sha256 names everything this verdict read: the PR description, plus the 3 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 |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: it closes a real gap between the gate and the sandbox, it only adds refusals, and it reuses the listing that the write gate's Notes
[DESIGN-REVIEWED] 687e1ed Description read[DESCRIPTION-READ] d81fb2d6392f9adc0e8134eb6008e31d8bc8065e2477a1defb779d36d9048ffe 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 Nothing blocks. One note: the generation and overtake machinery is more than a 1-second reuse window calls for. Notes
What this change shipsInventory (8 items) — 7 justifiedIntent: the agent's file tools keep refusing a former built-in's credential files after it moves out of the wheel into an installed app. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 687e1ed Description read[DESCRIPTION-READ] b54966ec3ef83fbc2117e5f59512705713388fb67b75453aeea6a9a86ce05318 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: |
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 stricter rule is in the agent's file-tool path gate (read, write, inline and bulk-root checks). The shell deny composite never consults that gate, so no shell candidate can flip, and the classifier has no verdict to give on the guard that actually changed. That guard is named under UNADJUDICATED, and its one plausible over-refusal (a whole app's TIGHTENING: the agent file-tool sensitive-path gate ( ADJUDICATED: 17 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: I wrote candidates for posix, windows and any. The diff's platform assumptions are both data-home prefixes ( UNADJUDICATED: The guard is
[SCOPE-REVIEWED] 687e1ed |
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: A person should decideWhy: the decider thinks the change is probably fine but estimates a 20% chance that this change introduces a defect, above the 12% limit for approving on its own. The agent's file tools now refuse an installed app's declared credential files, so adopting a former built-in no longer loosens that fence. This covers the read gate, the write gate, the inline worker-thread gate and the bulk-root check. Every recorded install, update and uninstall bumps a generation counter, so the gate drops an older list of declarations on the next check. Tests cover joining an old listing, being overtaken once and being overtaken twice; this fixes the blocking finding from GPT's review of the earlier head. Listed rows can only name paths under the app's own data directory or its staged copy. A manifest or record that can't be read fences only that app's data. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
95ebcaf to
5d889cf
Compare
|
Review issue 1 — fail-closed fence reached
|
|
Review issue 2 —
|
|
Review issue 3 — the app pass doubled the read/write gate's cost:
|
|
Review notes on head 5d889cf. These are the CI reds that come from this PR's own new code, collected in one place. The GPT 6.1 lane's open finding is not repeated here.
|
5d889cf to
01e5678
Compare
Sensitive change review
|
|
Head |
The agent file-tool gate read only the shipped built-ins' credentialMasks (a static row list), so an installed or adopted app's declared credential was fenced by the OS sandbox mask alone. After adoption, Ops Mission Control's data/secrets/ store would be readable to the agent's file tools on a host without a sandbox backend, while today's root store is refused. The read gate, the write gate, the inline worker-thread gate and the bulk-root check now also match every installed tree's and retained record's declared masks, with the .tmp/.lock artifacts beside each declared leaf, listed within the resolver budget, reused for a second and retired when the gateway records an install, update or uninstall. Each check resolves the path once for all its lists and matches the static list before it takes the listing; an installed mask adds one anchor lookup, and a row the static lists already hold (a built-in's record) is left out, so a built-in-only host checks what it did. A manifest or record that is present but does not read cleanly fences that app's whole data dir, with no artifact rule beside it; an unlistable apps/ fences apps/. No row can leave the app's own data dir, and sensitive_home_dirs() keeps only the static rows. The write gate's agentReadOnlyDirs listing shares the same listing code. App Kit seam level 10; the pin scanner reports credentialMasks as a level-10 use, so a former built-in declaring one is pinned at 10. Part of #26967
01e5678 to
687e1ed
Compare
Sensitive change review
|
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving. On head 687e1ed I checked the following. Both the read gate and the write gate now refuse installed and adopted apps' declared credentialMasks, and an unreadable app.json fails closed. Every listed row comes from the app's own location and stays under apps//data, its move-aside, or apps/. sensitive_home_dirs() stays static. The generation and overtake logic never serves or caches a stale listing. The new tests pass, and a mutation pass over 21 of the new invariant lines turned 20 of them red.
Done well: the tests check both sides of every fence. Each refusal comes with a healthy sibling that stays readable, and _fenced_both_ways fails if the two gates ever disagree.
Optional:
- A stalled apps/ listing makes both gates refuse every path, including paths outside the crew home (paths.py:293-320). Skipping the listing when no candidate form is under /apps would keep the fence and narrow the stall. The Design note on this head is still unanswered.
- No test covers the KIROCREW_HOME re-check at its call site (paths_targets.py:1293). If you swap the partial(_list_for_home, ...) wiring for the bare lister, all 86 tests in the two touched suites still pass.
- The body says no adoption pin declares credentialMasks. That is no longer true: #37572 pinned md-notebook at level 8 with state/. #38333 also claims APP_SDK_LEVEL 10, so it would help to name it next to #37492 in the batch note.
Ports every change the built-in got after the af94fac51f sync, so an adopted record keeps what a built-in user has: - the ledger's episode import into Crew's memory is skipped while a memory provider replaces it (kirodotdev/KiroCrew#37218), through a new memory_provider row of the host table; a gateway without the resolver indexes nothing - the Japanese strings without the stray source line breaks (kirodotdev/KiroCrew#38368) - two comment-only changes (kirodotdev/KiroCrew#37469, kirodotdev/KiroCrew#37953) The test pin and docs/spec.md move to KiroCrew main 2e2503671f, and the fixtures follow the host's scrubber (kirodotdev/KiroCrew#37408) and the gh PATH probe pin (kirodotdev/KiroCrew#37597). PORTING.md has a row per core change and records that the pin needs App Kit level 10, where the agent's file-tool gate fences the credentialMasks directory (kirodotdev/KiroCrew#37459). Part of kirodotdev/KiroCrew#26967. Co-authored-by: KiroCrewCaptain <312312717+KiroCrewCaptain@users.noreply.github.com>
Agent Worlds and Ops Mission Control now live in their own repositories under KiroCrewCaptain, carrying every wheel-copy change on main, with green CI on ubuntu, macOS and Windows. Their rows are the output of scripts/adoption_pin.py compute and are added to adoption-pins.json and the _SHIPPED_PINS table, so a host whose record is builtin-owned moves onto the app's own tree at its next restart and keeps data/, the app secret, the grants, the crons and enabled. Agent Worlds is pinned at minAppSdkLevel 8, the level of the useHostSessions export its page calls. Ops Mission Control is pinned at 10: its tree keeps the provider tokens in data/secrets/ behind a credentialMasks directory entry, which the agent's file tools fence from that level (#37459); it copies the data-home root store in on first read and keeps it as the downgrade copy. Each wheel built-in app.json version moves to its pinned version, since a first-adoption pin must equal it (D12). Both repositories declare the same permissions as their wheel copy (Ops Mission Control adds only the mask, which narrows), so E9 holds nothing back. The owning specs record the adoption. Part of #26967
Agent Worlds and Ops Mission Control now live in their own repositories under KiroCrewCaptain, carrying every wheel-copy change on main, with green CI on ubuntu, macOS and Windows. Their rows are the output of scripts/adoption_pin.py compute and are added to adoption-pins.json and the _SHIPPED_PINS table, so a host whose record is builtin-owned moves onto the app's own tree at its next restart and keeps data/, the app secret, the grants, the crons and enabled. Agent Worlds is pinned at minAppSdkLevel 8, the level of the useHostSessions export its page calls. Ops Mission Control is pinned at 10: its tree keeps the provider tokens in data/secrets/ behind a credentialMasks directory entry, which the agent's file tools fence from that level (#37459); it copies the data-home root store in on first read and keeps it as the downgrade copy. Each wheel built-in app.json version moves to its pinned version, since a first-adoption pin must equal it (D12). Both repositories declare the same permissions as their wheel copy (Ops Mission Control adds only the mask, which narrows), so E9 holds nothing back. The owning specs record the adoption. Part of #26967
Agent Worlds and Ops Mission Control now live in their own repositories under KiroCrewCaptain, carrying every wheel-copy change on main, with green CI on ubuntu, macOS and Windows. Their rows are the output of scripts/adoption_pin.py compute and are added to adoption-pins.json and the _SHIPPED_PINS table, so a host whose record is builtin-owned moves onto the app's own tree at its next restart and keeps data/, the app secret, the grants, the crons and enabled. Agent Worlds is pinned at minAppSdkLevel 8, the level of the useHostSessions export its page calls. Ops Mission Control is pinned at 10: its tree keeps the provider tokens in data/secrets/ behind a credentialMasks directory entry, which the agent's file tools fence from that level (#37459); it copies the data-home root store in on first read and keeps it as the downgrade copy. Each wheel built-in app.json version moves to its pinned version, since a first-adoption pin must equal it (D12). Both repositories declare the same permissions as their wheel copy (Ops Mission Control adds only the mask, which narrows), so E9 holds nothing back. The owning specs record the adoption. Part of #26967
…8443) Agent Worlds and Ops Mission Control now live in their own repositories under KiroCrewCaptain, carrying every wheel-copy change on main, with green CI on ubuntu, macOS and Windows. Their rows are the output of scripts/adoption_pin.py compute and are added to adoption-pins.json and the _SHIPPED_PINS table, so a host whose record is builtin-owned moves onto the app's own tree at its next restart and keeps data/, the app secret, the grants, the crons and enabled. Agent Worlds is pinned at minAppSdkLevel 8, the level of the useHostSessions export its page calls. Ops Mission Control is pinned at 10: its tree keeps the provider tokens in data/secrets/ behind a credentialMasks directory entry, which the agent's file tools fence from that level (#37459); it copies the data-home root store in on first read and keeps it as the downgrade copy. Each wheel built-in app.json version moves to its pinned version, since a first-adoption pin must equal it (D12). Both repositories declare the same permissions as their wheel copy (Ops Mission Control adds only the mask, which narrows), so E9 holds nothing back. The owning specs record the adoption. Part of #26967
The md-notebook adoption row was computed at minAppSdkLevel 8 just before #37459 made any credentialMasks declaration a level-10 use, so scripts/adoption_pin.py verify now refuses that row. Recomputed at the same commit with --min-sdk-level 10: only the level changes; the commit, version and both digests are identical. The _SHIPPED_PINS table and the md-notebook spec carry the same level. Part of #26967
Problem / Motivation
Goal: The agent's file tools refuse an installed app's declared credential files, an adopted former built-in's included, exactly as they refuse a shipped built-in's, so moving an app out of the wheel never loosens that fence.
The agent file-tool gate (
security.is_sensitive_pathand the write gate) read only the shipped built-ins'credentialMasks(credential_masks.declared_crew_leaves(installed=False), a static row list). An installed app's declaration reached the OS sandbox mask and nothing else. Concretely (security finding from the wave-7 pin phase, not overridden):kirocrew-app-ops-mission-control(main5883fd43d4) keeps its provider tokens indata/secrets/behind"credentialMasks": ["secrets/"]. After adoption,is_sensitive_path(<home>/apps/ops-mission-control/data/secrets/secrets.json)isFalse, while today's<home>/ops_mission_control_secrets.jsonisTrue: on a host with no sandbox backend, or for any reader that only consults the gate, the adopted store is open.Why it matters
Adoption must be byte-equivalent for protection (#26967). Without this, pinning Ops Mission Control (and any other former built-in that keeps a credential under
credentialMasks) trades a gate-fenced credential for a sandbox-only one, so its next pin PR is blocked on a security regression.Not a goal
ops_mission_control_secrets.jsonstays fenced: the external repo keeps that file as its downgrade backup). That is fix: move ops secret store under its data dir and declare its mask #34296's lane.sensitive_home_dirs(), or any fence derived from it (the ENFORCED harness credential mask, the posture page).adoption-pins.json, the catalog, or any built-in's manifest.app.jsontamper-proof (the stated residual of §37).What changed (motivation → approach → change)
Owner ruling 3 in #26967 (comment 6713005850: app-declared masks under the app's own data dir, tightening only) and ruling 6841699202 (no user impact) cover this seam. It follows the shape #33589 gave the write gate for
agentReadOnlyDirs.credential_masks.tool_gate_crew_leaves()/tool_gate_home_rows()(ToolGateLeaves): every installed tree's and retained record's masks, atdata/and the move-aside spelling. Fails closed only over the app's own data: anapp.jsonor record that is present but does not read cleanly fences that app's whole data dir (unreadable, no artifact rule); anapps/that cannot be listed fencesapps/. Names come from location, so no row can leaveapps/<name>/data/.security.paths._matches_gate_rows, in the read gate, the write gate and the inline worker-thread gate: resolves the path once, matches the static list, then the listed rows, then the artifact rule over_KEYSTONE_ARTIFACT_PARENTSplus the declared leaves' directories. An installed mask costs one anchor lookup; a row the static lists already hold (a built-in's record) is left out.path_contains_sensitiveadds the rows to its targets.paths_targets: the write gate's one-off listing becomes_AppRowsListing/_listed_rows, shared by both declarations. Listed on themc-pathresthreads within the rebuild budget (inline for the worker-thread gate), a miss refuses as a stall, a listing is reused for a second, andremember_declarationbumpsdeclarations_generationso a recorded install, adoption, update or uninstall is seen on the next check without a restart. No check is served rows from an earlier generation: it never joins a listing begun before the change, a listing the change overtook is taken again within the same budget, and one overtaken twice refuses as a stall. A pooled listing that starts afterKIROCREW_HOMEchanged refuses rather than list another data home (_list_for_home).apps/app_sdk_level.py, mirrored inwebsite/src/app-sdk/sdkLevel.ts): below it an installed app's masks are sandbox-only, soscripts/adoption_pin.pyreports anycredentialMasksas a level-10 use and a former built-in that declares one is pinned atminAppSdkLevel10. Level 9 is already in the v0.13.0 release candidates.app-kit-platform.md§32 / §37,security.md,manifest-reference.md,api-reference.md; security line-budget row.Built-ins moved onto the seam: none needed. The one shipped declaration (md-notebook
state/) already reaches the gate through the static rows, unchanged. No per-app decoupling row shrinks: the only Ops Mission Control credential rows name the data-home root file, which the external repo keeps as its downgrade backup, so they must stay. Follow-up: once this lands, Ops Mission Control is pinned in the next pin PR atminAppSdkLevel10.Other seam in this batch: #37492 (
permissions.chatLaunch) shares level 10; whichever lands second resolves the level summary lines. Overlap: #34296 (named above; commented there with the repo'sdata/secrets/path).Backwards compatibility
Compatible: only an installed (non-shipped) app that declares
credentialMasks, or whose manifest is present but unreadable, gains refusals; no shipped built-in, core row or sandbox mask changes. No adoption pin declarescredentialMaskstoday, so the scanner's new level-10 use refuses no existing pin.Reader: src/kiro_crew/hooks.py:on_tool_call -- chat|subagent|cron -- the agent's file tools now refuse the declared leaf; intended (test_app_credential_masks_tool_gate.py::TestAnInstalledDeclarationIsFenced)
Reader: src/kiro_crew/apps/backend_sdk/paths.py:contains_sensitive_path -- app -- an app's own sweep rooted at its data dir now sees its masked dir; no adopted app calls it (test_a_bulk_root_above_the_mask_contains_it)
Reader: src/kiro_crew/skills_discovery.py:_iter_skill_files -- chat -- inline gate lists on its own thread, no pool submission (test_an_inline_caller_lists_on_its_own_thread)
Reader: src/kiro_crew/security/paths.py:sensitive_write_path_refusal -- chat|subagent -- agentReadOnlyDirs rows unchanged on the shared listing (test_app_agent_readonly_dirs.py::TestTheDeclarationsAreListedWithinADeadline)
Reader: src/kiro_crew/agent_sdk/tool_gate.py:adapter_hidden_credential_dirs -- subagent -- reads sensitive_home_dirs(), which stays static (test_the_static_view_is_unchanged)
Reader: scripts/adoption_pin.py:_seam_level_uses -- release -- no current pin declares credentialMasks (test_builtin_adoption_pins.py::test_the_pin_tool_finds_every_seam_above_level_one)
Tests
test/test_app_credential_masks_tool_gate.py(new): file and directory masks, artifacts and the staged copy fenced on both gates and both prefixes; a fail-closed dir fences no.tmp/.lockbeside it;TestWhatAMaskCostsACheck(one path resolution per check, one extra lookup per installed mask, a built-in's record costs nothing, tier names); an adopted former built-in's installed declaration; a directory link into the mask (make_dir_link, a junction on Windows); the bulk-root direction; the static view unchanged; a retained record after uninstall; fail-closed cases (unparseable, misnamed, non-object, invalid entry, corrupt record, unlistableapps/); the negative case that../, absolute and impostor-named declarations fence nothing outside their own data dir; recorded install/uninstall seen at once, an unrecorded one after expiry; one listing per window on and off the loop; inline caller makes no pool submission; a wedged listing refuses as a stall; a check never joins a listing begun before a recorded change, an overtaken listing is taken again, one overtaken twice refuses, and a pooled listing lists only the home it was taken for.test_app_agent_readonly_dirs.py(shared listing names),test_builtin_adoption_pins.py(level-10 use),conftest_resets.py+conftest.py(listings reset per test),test_conftest_parts_reach.py(every part fixture is bound by its conftest),test_security_sensitive_paths.py(tier-name scan reads_matches_gate_rows),test/integration/test_boot_smoke.py(thecredential_masks._generationcounter is a documented second-boot change);test_terminal_handler_completion.pyandtest_folder_steering.pyspy on the globalos.scandir, which the gate'sapps/listing also calls, so each now judges only its own directory's listings.-n 4 --dist load; the clock is patched, the held listings are Events with bounded waits and a bounded join, the cost tests count calls rather than time them. The four generation tests fail on the parent's_listed_rows(a stall refusal, two unfenced answers, a missing helper) and pass on this head.Proof: not provable -- other: feat PR; the new tests fail on main because the gate never read installed declarations
Local: the 33 test modules that reference
paths_targets,credential_masksor the inline gate, plustest_install_receipt.py,test_facade_mirror_guards.py,test_security_sensitive_paths.py,test_security_gate_liveness.pyand the updated modules, at-n 6: green apart fromtest_the_seatbelt_profile_is_the_golden, which fails identically on a pristineorigin/mainworktree.test_boot_smoke.py::test_a_second_boot_touches_only_known_module_globalspasses withKIROCREW_INTEGRATION=1. mypy, flake8, isort, black, comment-history, brand, harness-parity, line-cap, flake-pattern ratchet and docs-lint gates clean; semgrep is not installed on this host, and no autouse fixture in the new file requestsmonkeypatch.Manual verification
N/A. Unit coverage is sufficient: the change is the path gate's decision, which the tests drive directly.
Related Issues
Part of #26967
Ruling: #26967 (comment) (item 3), #26967 (comment)
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement