Repository navigation
feat(app-kit): let an app's manifest mask its own credential files - #32652
Conversation
|
Seam lane Decision: Ops Mission Control is not moved onto the seam in this PR, so its decoupling-gate rows stay. The ruling limits the seam to leaves under the app's OWN data directory. The store it names, Seam level: Overlap: Meetings' Not run locally: semgrep (not installed on this host; CI's SAST covers it), and the model-pinned local review and cold-reader subagents (no |
Sensitive Change ReviewSensitive files changed:
|
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The only website change raises the [UX-REVIEWED] cf4d49b Description read[DESCRIPTION-READ] 6e5ba190d751ccf25b371237c85cf9f5ec23632a489792f32efaf5ff2ea0177e 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 seam only adds masks: core's rows, carve-outs and gates are unchanged, and the sandbox plans exactly as before when no app declares anything. Notes
[DESIGN-REVIEWED] cf4d49b Description read[DESCRIPTION-READ] 0864d9a46b285b3997bc3bc4b02befe2f8e8200e93a3572a16fcfaf408807c1b 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 owner approved this seam on #26967 (ruling 3), and every core reader of the manifest field is wired. Its one gap is that nothing in this repository declares a mask yet. Notes
What this change shipsInventory (10 items) — 9 justifiedIntent: an app can hide its own on-disk credentials from every sandboxed agent process without core naming the app. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] cf4d49b Description read[DESCRIPTION-READ] 6d18928a833b63d2d828a5edeec86a81362dc7b8ade22f2c41c208f1cb8913bd 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: |
daab378 to
b2aea4d
Compare
|
Review fixes, pushed in b2aea4d (amended, rebased on main):
Gates rerun: black/isort/flake8/mypy, file-line cap, docs-lint, comment-history, brand, harness parity, flake-pattern ratchet, |
b2aea4d to
953863d
Compare
|
|
|
|
Sensitive change review
|
|
Driver decision (campaign autonomy, #26967) on the open question in the review-fix comment above, item 3: keep the
The frozen Goal / Why it matters / Not a goal sections are unchanged. |
b5a3345 to
1ead9c1
Compare
|
Conflict-only rebase:
Gates on this head: 2539 passed in the touched and related tests (including #32659's |
Sensitive change review
|
An app lists files under its own data directory in a new `credentialMasks` manifest field, and every sandbox hides each one as it hides a core HIDDEN crew-home leaf: masked in every mode, sealed on Seatbelt, re-anchored under a relocated home, refused when reached through a symlink, and masked or refused on a second hard link. Only the app's own backend gets its declared leaves back, from the manifest of the code it runs. Entries outside the app's data directory are refused, so the seam only adds masks. APP_SDK_LEVEL becomes 3. No built-in declares a mask yet, so every current sandbox is unchanged. Ops Mission Control's secret store sits at the data-home root, outside its data directory, so its core rows stay. Part of #26967
1ead9c1 to
cf4d49b
Compare
|
|
Sensitive change review
This push fixes the two GPT findings on 1ead9c1 (dispositions above) and rebases onto main |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
This review checked head cf4d49b. The credentialMasks grammar refuses absolute paths, .. and empty segments, backslashes, colons and control characters. The app name comes from where the manifest sits, so one app cannot declare paths in another app's data directory. A manifest that does not read cleanly yields no masks and does not refuse spawns. Declared leaves join the existing hidden-leaf, hard-link and relocated-home lists. Update and keep-data uninstall roll back if the record cannot be written. The review re-ran test_app_credential_masks.py on this head and all 78 cases passed. Two control mutations went red as expected.
Done well: the seam is strictly additive. A home whose apps declare nothing plans the same sandbox as before, and a test pins that.
Security: the backend lift hands a path back only while it is absent or a regular file with one name. It drops core leaves and the directories that hold one, so it cannot reopen a core mask or return core credential bytes through a hard link. Banning the backslash means an entry can never break out of a quoted macOS sandbox profile string. The PR body discloses the remaining gap: an agent that rewrites app.json and deletes the record removes that app's masks for its next spawn. Before this PR no app mask existed at all, so nothing regresses.
Optional:
- Add a Seatbelt test under a relocated data home for a nested entry such as
tokens/oauth.json. If the relocated operand ofapp_mask_parentsinsandbox_argv.pyis removed today, no test goes red. - A misdeclared directory, symlink or extra hard link at one app's leaf refuses every sandboxed spawn on the host, and the retained record keeps that refusal after a keep-data uninstall. Consider naming the app and
apps/.<name>-credential-masks.jsonin the refusal message so an operator can recover. - Open PR #32983 also claims
APP_SDK_LEVEL = 3. Name the merge order in both bodies. Whichever PR lands second should move to level 4.
Problem / Motivation
Goal: A third-party app can list files under its own data directory in its manifest, and every Kiro Crew sandbox then hides them and refuses hard links on them, exactly as it hides Kiro Crew's own credential files.
Today only core can hide a file from agent sandboxes, by naming it in the sandbox leaf tables. An app that stores a provider token or a cookie under
apps/<name>/data/has no way to keep a prompt-injected agent shell from reading it, and a built-in that leaves the repository loses its rows, because core may not name an app.Why it matters
Every app that keeps a credential on disk is readable by any sandboxed agent process unless core hard-codes the file. That blocks moving built-ins out (#26967): core can't keep naming them, and dropping the rows would expose the files. The owner approved this seam on 2026-11-07 (#26967 (comment), ruling 3): tightening only, leaves under the app's OWN data directory, nothing outside it.
Not a goal
<data home>/ops_mission_control_secrets.json, at the data-home root and outside the app's data directory, so the seam can't express it, and moving a live credential store is a data migration. Its core rows stay; see "What changed".app-mcp-tools), auto-approve (app-auto-approve), data outsidedata/(app-data-root), stdio MCP servers (app-stdio-mcp), chat panels (app-chat-panel), agent turns and protected subdirectories such as Meetings'data/edits(app-agent-turns), public core APIs (public-core-apis) and the desktop window host (desktop-window-host).What changed (motivation → approach → change)
An app declares
"credentialMasks": ["secrets.json", "tokens/oauth.json"]. Each entry names a file by its path relative toapps/<name>/data/. The app's name comes from where its manifest sits: a built-in package's own name, or an installed app's directory. So one app can't declare a leaf under another app's directory. Escaping, malformed or over-cap entries are refused at install and dropped at spawn. A manifest the parser can't read, however it fails, declares nothing.Each declared leaf joins the lists a core
HIDDENleaf already sits in, so it gets the same treatment: masked in every mode, write- and link-sealed on macOS, re-anchored under a relocated home, a symlink at the leaf or below the data home refuses the spawn, and a second hard link is masked (inside a data home) or refuses (outside one, reported bykirocrew doctor). A directory at a declared path refuses the spawn, because an entry names a file. On macOS, whose masks are path rules, the folders above each declared file can't be renamed from inside the sandbox; files in them stay writable. The app's own backend, which reads the file, is the one spawn left free to create, rotate and remove those folders.The masks follow the data. Each entry is also masked at
apps/.<name>-data-tmp/, where install and update parkdata/. The declaration is kept inapps/.<name>-credential-masks.jsonbeside the app directory, so the data a default uninstall keeps stays masked. The gateway refreshes that record whenever it records the installed app, and again before an update or a keep-data uninstall moves the data; if it can't write the record, the update or uninstall refuses before anything moves. Only a manifest that reads cleanly changes the record: a broken, misnamed or invalidapp.jsonleaves it as it was.The app's own spawned backend gets back only its own declared files, only from the manifest of the code it runs, and only while each is absent or a regular file with one name. A second hard link keeps it masked for the backend too: those bytes may be a core credential's. A declared leaf that is already a core leaf, or a directory holding one, is never lifted. The signature covers a non-empty declaration.
APP_SDK_LEVELgoes to 3 (level 2 isctx.lifecycle,ctx.turns,ctx.untrustedandagentTools).Where:
apps/credential_masks.pyholds the grammar, the reader and the record;apps/manifest.pyandapps/discovery.pyparse, validate, sign and keep the field;apps/manager_records.py,apps/manager_install.pyandapps/manager_uninstall.pyrefresh the record;sandbox_argv.py,sandbox_aliases.pyandsandbox_tiers.pymask, judge and lift;apps/backend.pypasses the lift;sandbox.pyandapps/manager.pyname the new symbols.apps/app_sdk_level.pyandwebsite/src/app-sdk/sdkLevel.tscarry the level; the specs anddocs/app-kit/describe it.No shipped built-in declares a mask, so every current sandbox plans byte-identically. Ops Mission Control's core rows stay: its store is at the data-home root, outside its data directory. The PR that moves the app onto this seam relocates the store into
apps/ops-mission-control/data/with a migration and drops the rows, keeping the root name masked as a retired leaf (#32681).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), and with no declaration the sandbox plan, the Seatbelt profile and the apps directory are unchanged (test_a_home_with_no_declaration_plans_as_before,test_no_shipped_built_in_declares_a_mask). For an app that declares nothing, install, update, uninstall, enable and disable write no record and refuse on nothing new. The seam level rises from 2 to 3; every adoption pin requires 1.Removes nothing: the seam only adds masks; no core leaf, carve-out, seal or tool-gate row is removed or reclassified.
Tests
test/test_app_credential_masks.py(new, 78 cases): the entry grammar (lone surrogates included), the manifest round trip, validation and signature; where declarations are read (installed apps, name mismatch, sidecars, malformed and over-deep JSON, cache refresh, per-source read); the namespace plan masks the declared leaf and its move-aside spelling in every mode and under a relocated home; the Seatbelt rules equal a core credential's, and every parent of a declared leaf gets a rename guard (none on the namespace plan); symlinks, linked components and outside hard links refuse, inside ones are masked, any second name refuses on the macOS pass, and a directory at a declared path refuses at both spellings while a directory on the way to a declared file does not; the app's own backend's Seatbelt profile leaves its leaf's folders unguarded while every other spawn keeps them guarded; the backend lift returns only the app's own files, never one hard-linked totoken_signing.keyor with any second name (until the extra link goes) and never a directory;../, absolute and impostor declarations reach nothing; a real install writes the record, a default uninstall keeps the kept data masked, a not-JSON, empty, over-deep, misnamed or invalidapp.jsonkeeps the record throughremember_declarationand a default uninstall, a clean manifest declaring nothing removes it, an uninstall that can't write the record refuses, and an update keeps the parked data masked while the manifest is gone.test/test_app_backend_spawn_env.py::TestTheBackendSpawnLiftsTheAppsDeclaredMasks:start_app_backendpasses the app's own declared leaves toextra_visible_dirs, asked with the spawn's provenance. It runs on every OS;TestExecBackendShebangShimkeeps its POSIX-only skip.test/integration/conftest.py: the harness reset clearscredential_masks._cachebetween boots, sotest_a_second_boot_touches_only_known_module_globalsholds.test_app_bridges_agent_configs.py: the built-in snapshot keepscredentialMasks.test_sandbox_governance_mask.py,test_sandbox_refactor_facade.py,test_manager_facade.pyandtest_app_backend_composition_contract.pyname the new symbols.-n 4and once serially in a fixed-seed shuffled order (seed 32652). Manifest mtimes are set withos.utime, never slept for; no port is bound.credential_masksoragentTools, plus the facade-mirror guard, the SDK-level mirror and the app manager and manifest suites (3313 passed), and the flake-pattern ratchet. Semgrep was not run locally (not installed on this host); CI's SAST job runs it.Proof: not provable -- other: new feature seam with no pre-existing defect to revert onto
Manual verification
Rendered the macOS profile for a scratch home with an app declaring
tokens/oauth.json: the declared path gets the same six deny rules astoken_signing.key, andapps/demo,apps/demo/data,apps/demo/data/tokensand the move-aside folders get a literal write deny each, none of them without the declaration. Rendered again with that app's lifted targets asextra_visible_dirs, asapps/backend.pypasses them:apps/demo/data/tokenshas no write deny, so the backend can create it, and the move-aside folders keep theirs.Screenshots / video
Why no screenshot: the only frontend change is the
APP_SDK_LEVELconstant, which renders nothing.Related Issues
Part of #26967
Follow-up: #32681 (move Ops Mission Control's store into its data directory so its core rows can go)
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)