Repository navigation
revert: #13273 apps-tree mask breaks every app script cron - #16072
Conversation
#13273 masked `<config_dir>/apps` from both cron exec paths and re-exposed only each app's `data/`. An app's cron code lives in that bundle -- the script a script cron names, the file a command cron runs, and the sibling modules, `lib/` and `node_modules/` they import -- so every app cron failed before its first line with ModuleNotFoundError / MODULE_NOT_FOUND / "can't open file". This removes the behaviour #13273 added at the cron call sites and the helpers that existed only for it: * `run_script_sandboxed` and `run_command_sandboxed` no longer pass the apps tree as a mask, its data windows, its identity pin or its alias inodes; the command path keeps the shell helpers later commits added. * `sandbox` drops `materialize_caller_masked_dir`, `materialize_app_data_window`, `masked_dir_identity`, `refuse_if_an_app_secret_is_linked`, `aliased_app_secret_ids`, `app_data_window_targets`, `AppDataWindow` and `MAX_APP_DATA_WINDOWS`. * `test_cron_apps_secret_mask.py` goes with them. Kept, because later commits built on them and other callers' windows go through them: the caller-pinned `extra_hidden_dir_ids` / `extra_private_dir_ids` / `extra_alias_credential_ids` parameters, the launcher's descriptor-pinned window staging, nested re-mask and stage retirement, and `_MNT_DETACH`. With no caller passing identities they behave as name-only. Their tests move to `test_sandbox_caller_pinned_ids.py` unchanged apart from dropping the cron wiring cases. Trade-off: a cron child can again read other apps' `.app_secret`, as it could before #13273. The protection is to re-land via #16061, which re-exposes app code read-only. `test_app_script_cron_sibling_import.py` pins the regression on both exec paths: a recording passthrough requires that no requested mask hides the bundle, and where the host can carry masks a real sandboxed spawn must import the bundle's sibling modules. All four cases fail on the pre-revert tree. This reverts commit 0496784.
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Confirm the owner's P0 sign-off is recorded on the PR, since this knowingly reopens #12518 until #16061 re-lands. The deleted pin ( [DESIGN-REVIEWED] aa6fca7 Description read[DESCRIPTION-READ] 96f4c087a7341132a77e33ecfa3bd0204e8a145a95b3210452da3357524cad7c 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 (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify #16061 re-lands: the kept identity-pin params ( The defect has checkable provenance: the regression test this PR adds ( What this change shipsInventory (8 items) — 8 justifiedIntent: restore every app's cron, which #13273's apps-tree mask broke before its first line — a FIX (revert).
[FIRST-PRINCIPLES-REVIEWED] aa6fca7 Description read[DESCRIPTION-READ] 60df84df4971f090696d65885f1ef4afd56a8f8fa72fa6f9c8f40d346ad31c9d That sha256 names the PR description this verdict read. Recompute it with |
GPT 5.6 Review — 🔴 changes requested (blocking)GPT 5.6 found at least one blocking issue that must be resolved before merging This comment is updated in place on each push. BLOCKING -- src/kiro_crew/cron_script.py:2213 -- Cron children can steal another app’s credential Adjudication (Opus 5) — is blocking on each finding proportionate?UNBOUNDED (security-class): False positive or not applicable? A repository writer can comment: |
….8.0) (#16075) Backport of #16072. #13273 reached release/0.8.0 inside the batch-2 squash 4b9e9f0 (#15631), so this reverts only #13273's changes from it, on release's own layout; the #15255 command-shell helpers that batch resolved against are kept. #13273 masked `<config_dir>/apps` from both cron exec paths and re-exposed only each app's `data/`, hiding every app cron's own code and the sibling modules it imports, so every app cron failed with ModuleNotFoundError / MODULE_NOT_FOUND. Removed: the cron call-site mask, windows, identity pin and alias inodes; the app-only `sandbox` helpers (`materialize_caller_masked_dir`, `materialize_app_data_window`, `masked_dir_identity`, `refuse_if_an_app_secret_is_linked`, `aliased_app_secret_ids`, `app_data_window_targets`, `AppDataWindow`, `MAX_APP_DATA_WINDOWS`); and `test_cron_apps_secret_mask.py`. Kept, as on main: the caller-pinned `extra_*_ids` parameters and the launcher's pinned window staging, nested re-mask and stage retirement, which behave as name-only with no caller passing identities; their tests move to `test_sandbox_caller_pinned_ids.py`. Trade-off: a cron child can again read other apps' `.app_secret`, as before #13273. The protection is to re-land via #16061. `test_app_script_cron_sibling_import.py` pins the regression for a command cron running bundle code that imports its siblings (release has no bundle-script resolution for script crons); both cases fail on the pre-revert tree.
Opus 5 Review — 🔴 changes requested (blocking)Reviewed BLOCKING: both cron exec paths lose the BLOCKING — src/kiro_crew/cron_script.py:2213 and at [BLOCK-MERGE] aa6fca7 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
Summary
Reverts #13273 ("fix(cron): mask the apps tree from every cron child that runs model-supplied code", 0496784) on main. Owner decision, P0.
#13273 replaced
~/.kiro/crew/apps/with an empty mask inside the cron sandbox and re-exposed only each app'sdata/. An app's cron code lives in that bundle: the script a script cron names, the file a command cron runs, and the sibling modules,lib/andnode_modules/they import. So every app cron failed before its first line withModuleNotFoundError/MODULE_NOT_FOUND/ "can't open file".What is removed
run_script_sandboxedandrun_command_sandboxedno longer pass the apps tree as a mask, its data windows, its identity pin or its alias inodes. The command path keeps the shell helpers later commits added (fix(cron): run command crons where /bin/sh is bash, incl. macOS #15253).sandboxdrops the helpers that existed only for the apps mask:materialize_caller_masked_dir,materialize_app_data_window,masked_dir_identity,refuse_if_an_app_secret_is_linked,aliased_app_secret_ids,app_data_window_targets,AppDataWindow,MAX_APP_DATA_WINDOWS.test/test_cron_apps_secret_mask.pyis deleted.What is kept, and why
Later commits (#13715/#15252, #14021, #15729, #15309) built on these, and other callers' private windows (the ACP scratch windows) go through them:
extra_hidden_dir_ids/extra_private_dir_ids/extra_alias_credential_idsparameters onwrap_argvand the backends;_MNT_DETACH/umount2.No caller passes identities any more, so these behave as name-only. Their tests move to
test/test_sandbox_caller_pinned_ids.py, unchanged apart from dropping the cron wiring cases and the producer helpers.Security trade-off
After this revert, cron children can again read other apps'
.app_secret, as they could before #13273. #12518 is open again in practice. The plan is to re-land the protection through #16061, which re-exposes app code read-only, rebased as a full re-land on top of this revert.Regression test
test/test_app_script_cron_sibling_import.pycovers both exec paths. In each case the app's bundle code imports a siblinghelper.pyand alib/package:wrap_argvrequires that no requested mask covers the bundle unless a window re-exposes the bundle itself. The real child must also succeed.credential_mask_applies("cc")): a real sandboxed spawn with nothing patched must succeed.I checked it against the pre-revert tree. All 4 cases fail there: the call-site check names the apps mask with only
data/windowed, the real script cron fails openingjob.py, and the real command cron exits 2. After the revert, all 4 pass. CI Linux runners forbid unprivilegedunshare, so the two real-sandbox cases skip there. I ran them on a host with user namespaces.Validation
pytest test/test_cron*.py test/test_sandbox*.py test/test_mcp_cron*.py test/test_app_cron*.py+ the new file: 5154 passed, 4 skippedscripts/check_black_formatting.py): passedisort --check-only src/kiro_crew test conftest.py xdist_budget.py: cleanmypy src/kiro_crew/: no issues (2046 files)scripts/check_comment_history.py: passedRefs: Taskei Mesh-3988, Mesh-3989; follow-up #16061.