Repository navigation
feat(app-kit): let an app's manifest fence its own dirs from agent writes - #33589
Conversation
55ada67 to
4d60102
Compare
Sensitive Change ReviewSensitive files changed:
|
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. This PR changes no user-visible control. The only website changes are an SDK level constant (6 → 7) and a test assertion. The "blind read not performed" result doesn't apply because there was nothing on screen for a reader to see. [UX-REVIEWED] 03e91f4 Description read[DESCRIPTION-READ] 83453ccdafd27be75bfac2f372c4f9ad9353cb98634e3ce3eeca2dab38539554 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. The change reuses the Notes
[DESIGN-REVIEWED] 03e91f4 Description read[DESCRIPTION-READ] fe6e12c242bd4945025b1ad5ffd9bb48cd5bde60b03abd4c41cfd4fdc5ee8219 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: the new key has two real consumers, and it replaces the core table rows that the move-out (#26967) has to delete. What this change shipsInventory (8 items) — 8 justifiedIntent: let an app protect its own data directories from agent writes without core naming the app, so built-in apps can move out with their protections intact. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 03e91f4 Description read[DESCRIPTION-READ] 546ee5eaab91e8711c92332fd13b3ceee67bf28eb734968368b66cf09a484673 That sha256 names the PR description this verdict read. Recompute it with |
Security Scope Review -- ✅ human override accepted@bolichen97 overrode this lane for [SCOPE-REVIEWED] 03e91f4 |
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: |
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: |
4d60102 to
b1a24a5
Compare
|
span=45569118eb57
|
b1a24a5 to
7a1d6db
Compare
|
span=45569118eb57
|
7a1d6db to
3d04a9b
Compare
|
span=84e76614317b
|
3d04a9b to
c193159
Compare
|
span=84e76614317b
|
c193159 to
cd6b2de
Compare
|
self-added: no
|
|
resolution: deferred #33612 (no narrow fix inside the seam; a security finding, so the lane needs a writer's ruling)
|
Human judgment recorded@bolichen97 recorded a deferred release (class
This decision applies only to this commit. A new push requires a new judgment. |
|
Main red, not this PR: |
…ites An app lists directories under its own data directory in a new agentReadOnlyDirs manifest field. Agents may read them and never write them: the file-edit tool gate refuses a write under each one as it does under a write-protected core row, and every sandbox mode seals each one read-only like a core READONLY leaf, with its parents guarded against rename. A link at a declared directory, or between the data home and it, refuses the spawn; on Linux an absent one is created so its seal is never empty. Only the app's own backend gets its exact spellings back, never a core leaf. The declaration is read by the credentialMasks engine under its own key, so it has the same grammar, the same name-from-location rule and its own retained record across update and uninstall. APP_SDK_LEVEL becomes 5. Meetings declares notes/ and Spec Builder declares trust/, replacing the core write row for apps/meetings/data/notes and moving the decision record from the data home's trust/ into apps/spec-builder/data/trust/, migrated once on first read. Part of #26967
|
Red-main rebase: e9f563f -> 03e91f4, base 9b32941 -> 27e9359. This is not a green-age re-sync: it picks up main's fix for #36279 ( The rebase was clean, with no conflicts. Verified on this head: black (baseline check), subprocess-encoding, isort, flake8, comment-history, brand-name and file-line-cap exit 0, and mypy is clean. The superseded macOS run on e9f563f was cancelled. |
|
[operator: bolichen97] Sensitive change review
|
|
Security Scope Review on 03e91f4 is red only because of the installation API rate limit, not because of a finding.
GPT 6.1 Review and Opus 5.5 Review hit the same limit on attempt 1 and both passed on rerun. GPT's first run had already computed "no findings" for this head before its publish step was rate-limited. |
|
/ai-review override scope 03e91f4 false-positive: agent: no finding. Attempt 1 failed closed on the installation API rate limit (no head, comment or prior check-run readable). Attempt 2 published Scope-Verdict PASS for this head (30 rows, 0 newly refused) and is red only because the per-head floor holds that unread failure. |
Human judgment recorded@bolichen97 recorded a false-positive release (class
This decision applies only to this commit. A new push requires a new judgment. |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved at the owner's request. The deep review of this head is still running, and anything it finds will be posted here as a follow-up.
Problem / Motivation
Goal: An app can list directories under its own data directory in its manifest that agents may read but never write, and Kiro Crew fences them from agent writes in every sandbox mode while the app's own backend keeps writing them.
Today only core can make an app's directory read-only to agents, by naming it in its own tables:
apps/meetings/data/notesis a core write-protected row, and Spec Builder keeps its decision record under the data home'strust/(the SEL trust root) because nothing else fenced it. Core may not name an app, so neither protection can leave core with its app, and a third-party app has no way to stop a prompt-injected agent from rewriting state it must not forge.Why it matters
Moving built-ins out (#26967) needs the protections they rely on to travel with them; dropping the rows would let any agent rewrite a user's meeting notes or forge and erase Spec Builder's recorded answers. The campaign driver approved this seam on 2026-11-09 under the maintainer's delegation (#26967 (comment), decision 3): generic, tightening only, the app's own data directory only, the same shape and limits as
credentialMasks(#32652).Not a goal
data/editscore leaf (a read+writeHIDDENleaf,credentialMasks-shaped) or thetrust/row itself, which stays for the SEL key.READONLYdirectory has, no more.What changed (motivation → approach → change)
An app declares
"agentReadOnlyDirs": ["notes", "trust"], each entry a path relative toapps/<name>/data/. The declaration is read by thecredentialMasksengine under its own key:apps/credential_masks.pygains aDeclarationKindthat every function takes, defaulting tocredentialMasks, so the two seams share one grammar, one name-from-location rule, one source list, one cache and the same retained-record logic (apps/.<name>-agent-readonly-dirs.json, refreshed by the same three lifecycle calls). Its record-name regex became a string check.Two layers then fence each declared directory, at
apps/<name>/data/<entry>and at the lifecycle's move-asideapps/.<name>-data-tmp/<entry>, under both data-home prefixes:security.paths.sensitive_write_path_refusalmatches the declared rows in their own_path_in_home_dirscall after the core write tier, so an agent's file-edit write under one is refused with the same anchoring,KIROCREW_HOMEre-anchoring and symlink resolution as a_WRITE_PROTECTED_HOME_PATHSrow.write_protected_home_paths()lists them too, so the posture page and Auto-Improvement's harness mask see what they saw for the old row. Reads stay open.security.paths_targets._app_readonly_dir_rowslists the declarations on themc-pathresthreads within the anchor rebuild's budget for every caller, one listing in flight at a time, reused for a second on the event loop; a miss refuses, and later checks refuse at once while it runs.sandbox_argv._live_plan_hostadds every declared spelling to the crew-homeREADONLYtargets and its parents to the seal parents, so it is a read-only bind on Linux and afile-write*/file-linkdeny on Seatbelt, with every parent guarded against rename on both. A declared spelling a mask covers stays masked.sandbox_aliases._establish_app_readonly_dirsrefuses a spawn when a link sits at a declared directory or between the data home and it, and on Linux creates an absent one (only inside an existingdata/, neverdata/itself) and hands it to the launcher as a required target with its identity, so the seal is never empty.The app's own spawned backend gets its exact spellings back through
sandbox_tiers.app_declared_readonly_targets(passed asextra_visible_dirsbyapps/backend.py, read from the manifest of the code it runs). That lift drops any leaf that is, holds or sits beneath a core leaf of any disposition, and any spelling under another mask or behind a planted link, so it lifts no core fence and cancels no mask.Meetings declares
notesand its core write row goes. Spec Builder declarestrustand keeps its decision record atapps/spec-builder/data/trust/spec-builder-decisions.json; the first read that finds it absent moves the old record from the data home'strust/(a regular file with one name only: copy, then remove) or writes an empty one, so the old location is never read again.APP_SDK_LEVELbecomes 7 on both sides (website/src/app-sdk/sdkLevel.ts) andadoption_pin.pyscans the new key at level 7. Sandbox owners:sandbox_argv.py,sandbox_aliases.py,sandbox_tiers.py, forwarded bysandbox.py. Specs:app-kit-platform.md§39,security.md,meetings.md, and the App Kit references.The two app repositories carry the same declaration: KiroCrewCaptain/kirocrew-app-meetings#4 and KiroCrewCaptain/kirocrew-app-spec-builder#1 (which keeps the record at the old location on a host below the seam's level, where the key is ignored).
Backwards compatibility
Compatible: the field is new and optional; a manifest without it parses, validates and signs as before (
signing_payloadadds the key only when non-empty). Every agent spawn now also sealsapps/meetings/data/notesandapps/spec-builder/data/trustread-only; the two apps write them from the gateway, which no sandbox applies to.Reader: src/kiro_crew/security/paths.py:sensitive_write_path_refusal -- chat|cron|subagent -- the removed
apps/meetings/data/notesrow is matched from the Meetings manifest declaration (test_the_built_in_rows_core_used_to_carry_still_fence, Meetings'test_the_tree_is_on_the_write_only_fence_and_stays_readable)Reader: src/kiro_crew/security/paths.py:write_protected_home_paths -- crew page -- the posture list and the Auto-Improvement harness mask still get the notes rows, now from the declaration
Reader: src/kiro_crew/apps/builtins/spec_builder/backend/decisions.py:_read_decisions -- app -- the record at the data home's
trust/is moved on first read and every answer kept, and with none an empty record is settled so the old location is never read again (test_an_earlier_releases_record_is_moved_and_kept,test_a_record_planted_at_the_old_location_later_is_never_imported,test_a_link_planted_at_the_old_location_never_copies_its_target,test_a_move_that_cannot_write_keeps_the_old_record,test_an_unreadable_old_record_is_an_unusable_store)Reader: src/kiro_crew/apps/builtins/spec_builder/backend/decisions.py:_save_decisions -- app -- writes the new location;
atomic_writecreatestrust/(test_the_ledger_parent_is_created_on_first_write)Outside this repository, the Spec Builder app repository reads the old location below the seam's level and moves the record at or above it (KiroCrewCaptain/kirocrew-app-spec-builder#1). It names that level as 7 (
READONLY_DIRS_SDK_LEVEL, KiroCrewCaptain/kirocrew-app-spec-builder#3), because main gave level 5 toctx.app_token(#35533) and level 6 to the SDK's issue list (#34732); a host at level 6 or below keeps the record where it is. The decision record becomes readable by agents, which the decision's "read but not write" names; it holds no secret. A purge uninstall of Spec Builder now removes the record with the app's data.Tests
test/test_app_agent_readonly_dirs.py(new, 53 cases): manifest round trip, validation (.., absolute,., backslash, colon, non-list, an entry at or beneath acredentialMasksfile) and signature; both built-ins declare exactlynotesandtrust; the two declarations never read each other; a declaration cannot reach another app's data (../, absolute, impostor name); the tool gate refuses writes under a declared directory, keeps it readable and leaves a sibling alone, and still fences both former core rows at both prefixes; on the event loop the listing runs on another thread and is reused until it expires; on the loop and on a worker thread a wedged listing refuses every write and is never started twice, and once past its deadline it refuses later checks at once; off the loop each check takes its own listing, on the pool; the Linux plan seals exactly the declared directory and its staged spelling in every mode and under a relocated home; Seatbelt denies writes and links under it and no read; every parent is rename-guarded on both backends; a declared coreHIDDENleaf stays masked; the backend lifts only its own spellings, never another app's, another source's, a core leaf, a leaf beneath one or a directory holding one; a symlinked directory or linked component refuses the spawn; an absent directory is created only inside an existingdata/, never at or beneath a declared credential mask, and a name planted at the move-aside spelling does not stop it; a spawn after a keep-data uninstall killed past its move-aside creates nodata/, so the reinstall restores the held data; install records the declaration and a default uninstall keeps the kept data fenced; and a real Linux namespace spawn in all three modes reads a declared file and getsEROFSwriting or creating in the directory while its sibling stays writable, and the app's own backend spawn writes it.spec_builder/tests/test_routes_decision_ledger.py: the record's location is write-fenced and readable, the manifest declarestrust, and the one-time move keeps every answer, prefers the new record, never imports a record planted at the old location after the first read, survives a failed copy, reports an unreadable old record as unusable, and never copies the target of a symlink (a junction on Windows) or a second hard link planted at the old location.test_security_gate_liveness.py's package line budget, re-measured for the bounded listing and its facade manifest rows;test_sandbox_protected_name_holds.pyrecords the four new leaf-only directories and why;test_sandbox_refactor_generated_programs.pypins the declarations empty like its other tables; the facade, backend inventory, bridge snapshot, adoption-pin scan and both decoupling lists name the new pieces;MeetingsNote.test.tsxreads the declaration from the manifest.-n0and 10 at-n 4beside both whole files, and both files (91 cases) passed serially in a shuffled order (seed 11033). Forced conditions: with every listing job started 200 ms late, the class passes, where the earlier spelling of the wedged-listing test fails (it counted starts before the held listing ran); with every anchor rebuild 200 ms slower, it passes too, because the tests hold only the listing's own_APP_READONLY_ROWS_BUDGET_SECS. No sleep and no port: the listing's expiry reads_app_readonly_rows_clock, frozen by the tests, a held listing waits on an event the test sets, and every join is bounded.27e9359419): main took App Kit level 5 forctx.app_token(fix(apps): give an in-process app its app token after the secret left its folder #35533) and level 6 for the SDK's issue list (feat(app-sdk): issue list components (useIssues, IssueList, IssueCard) #34732), so this seam is level 7. The leaf-only counts are main's 336/343/344 plus this PR's twelve (348/355/356) and the security package line budget is main's 35,824 plus this PR's 77 (35,901); main did not move either since. Gates on this head: black (baseline check), subprocess-encoding, isort, flake8, comment-history, brand-name and file-line-cap exit 0, and mypy onsrc/kiro_crewis clean. The flake-pattern ratchet passes (68), and the PR's test files with the manifest, governance-mask, UI-prefs and worker spawn-gate test files pass (2,743);test_reply_format_once.py, red on the earlier base, passes (88). The frontend tests and semgrep could not run on this host (no usablenode_modules, no semgrep); CI runs both. On the same diff at earlier bases: the three creation cases passed 20 runs at-n0, the whole file (53 cases) passed in a shuffled order (seed 35746), and reverting the creation rule fails the absent-data/case and the interrupted-uninstall case; ate3d358a255the repository's semgrep rules found 0 on the diff. The full suites are CI's.Proof: not provable -- other: new feature seam; the real-spawn EROFS cases are the behavioural check
Known residual, deferred to #33612: a Linux sandbox already running when the lifecycle moves an app's data (update, keep-data uninstall, adoption) does not follow the move, so the move-aside spelling and the data moved back are not sealed for it until it respawns, and a Linux spawn made while
apps/<name>/datais absent finds a declared directory it does not create (credentialMasksshares the move-aside half). Stated inapp-kit-platform.mdsection 39 and in the manifest reference.Manual verification
N/A: the real namespace spawn cases above run the launcher on this host and observe the read-only seal from inside the sandbox; the Seatbelt half is checked on the rendered profile.
Related Issues
Part of #26967
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.