Skip to content

revert: #13273 apps-tree mask breaks every app script cron (release/0.8.0) - #16075

Merged
bolichen97 merged 1 commit into
release/0.8.0from
backport/0.8.0-revert-13273
Oct 2, 2026
Merged

bolichen97 merged 1 commit into
release/0.8.0from
backport/0.8.0-revert-13273

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Summary

Backport of #16072 to release/0.8.0. This reverts #13273's apps-tree cron mask, which breaks every app script cron (Taskei Mesh-3988, Mesh-3989). Owner decision, P0.

#13273 came into release/0.8.0 inside the batch-2 squash 4b9e9f0 (#15631, which squashed 8 PRs). So this reverts only #13273's changes, on release's own layout. It keeps the #15255 command-shell helpers (_no_command_shell_message, _command_argv) that the batch resolved against. #13929, #14960 and #13348 from the same batch are untouched.

#13273 replaced ~/.kiro/crew/apps/ with an empty mask inside the cron sandbox and re-exposed only each app's data/. That hid every app cron's own code and the sibling modules, lib/ and node_modules/ it imports, so every app cron failed with ModuleNotFoundError / MODULE_NOT_FOUND.

Changes (same as #16072)

  • Removed: the cron call-site mask, its data windows, identity pin and alias inodes. Also 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/test_cron_apps_secret_mask.py.
  • Kept: the caller-pinned extra_*_ids parameters and the launcher's pinned window staging, nested re-mask and stage retirement. With no caller passing identities they behave as name-only. Their tests move to test/test_sandbox_caller_pinned_ids.py.

Security trade-off

After this revert, cron children can again read other apps' .app_secret, as they could before #13273. The plan is to re-land the protection through #16061 (re-exposes app code read-only) on main, then backport it.

Regression test

test/test_app_script_cron_sibling_import.py covers a command cron running python <bundle>/run.py, whose code imports a sibling helper.py and a lib/ package. Release has no bundle-script resolution for script crons (#12046 is main-only), so the script-cron cases from #16072 are not included here. There are two cases:

  • a recording wrap_argv passthrough, which requires that no requested mask hides the bundle;
  • a real sandboxed spawn, which skips on hosts that cannot carry masks (CI Linux runners).

Both fail on the pre-revert release tree and pass after.

Validation

  • pytest test/test_cron*.py test/test_sandbox*.py test/test_mcp_cron*.py + the new file: 4654 passed, 3 skipped
  • black 26.3.1 baselined gate: passed
  • isort (full scope): clean
  • flake8 on the changed files: clean
  • mypy src/kiro_crew/: no issues (1861 files)
  • comment-history: passed

….8.0)

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.
@bolichen97
bolichen97 requested a review from a team as a code owner October 2, 2026 06:16
@bolichen97
bolichen97 requested review from kyleseaman and removed request for a team October 2, 2026 06:16
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 2, 2026
@bolichen97
bolichen97 merged commit b254576 into release/0.8.0 Oct 2, 2026
14 of 18 checks passed
@bolichen97
bolichen97 deleted the backport/0.8.0-revert-13273 branch October 2, 2026 06:17
@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 0deb92ddcdde961d42612c5eabd4768196bea22a — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify the #16061 re-land is tracked against release/0.8.0 — until it backports, cron children read cross-app .app_secret, as the description states.

[DESIGN-REVIEWED] 0deb92d

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — 🟡 CONCERNS

Premise-level review of 0deb92ddcdde961d42612c5eabd4768196bea22a — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The revert keeps wrap_argv's identity-pin parameters and a 576-line test file pinning them, with zero production callers left — retained only for a planned #16061 backport.

Not justified as shipped

What this change ships

Inventory (7 items) — 6 justified

Intent: FIX — restore every app's cron (broken by #13273's apps-tree mask with ModuleNotFoundError) by reverting that mask on release/0.8.0; linked issues Mesh-3988/3989, regression test fails on base.

  1. App script and command crons can run their own bundle code again — justified
  2. Cron children regain read access to every app's .app_secret (declared trade-off, protection deferred to fix(cron): re-expose an app's code directories read-only inside the apps-tree mask #16061) — justified
  3. The eight app-mask helpers deleted from sandbox.py — justified
  4. wrap_argv's identity-pin parameters kept with no remaining caller — zero consumers, kept on "so we can later"
  5. New test_sandbox_caller_pinned_ids.py pinning that kept surface — rides along (with item 4)
  6. New regression test test_app_script_cron_sibling_import.py; real-sandbox case skips where masks aren't carried — justified
  7. test_cron_apps_secret_mask.py deleted — its pins pinned the reverted mask; deletion and trade-off declared with evidence — justified

[FIRST-PRINCIPLES-REVIEWED] 0deb92d

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — 🔴 changes requested (blocking)

GPT 5.6 found at least one blocking issue that must be resolved before merging 0deb92ddcdde961d42612c5eabd4768196bea22a. 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

This comment is updated in place on each push.

BLOCKING -- src/kiro_crew/cron_script.py:2063 -- Cron jobs can read installed apps' bearer secrets
wrap_argv(argv, mode=sandbox_mode, extra_hidden_dirs=hidden) / wrap_argv(argv, mode="cc")
Agent-authored cron -> sandbox leaves apps/ readable -> child reads .app_secret and exchanges it for an app token.
Anchor: residual/security
Fix: Keep apps/ masked while re-exposing app code and data without .app_secret in both cron paths.
[BLOCK-MERGE] 0deb92d
[GPT-REVIEWED] 0deb92d

Adjudication (Opus 5) — is blocking on each finding proportionate?

F1 — harm rung: UNBOUNDED (bearer-credential exposure); .app_secret is a per-app bearer validated at src/kiro_crew/dashboard/token_auth.py:1224 and read from config_dir()/apps/<app>/.app_secret at token_auth.py:1233, written for every installed app at apps/manager.py:3449.
Conditions confirmed: cron spawns under strict/cc at src/kiro_crew/cron_script.py:2062-2065 with extra_hidden_dirs limited to the crons dir and the script's parent (cron_script.py:2036-2043), and _CREW_HIDDEN_LEAVES masks only specific app data subtrees, never apps/ itself (src/kiro_crew/sandbox.py:305, :321, :341) — so no condition beyond "an app is installed and a cron runs" is required; recovery path: none (a leaked app secret is exchangeable until rotated).
Real fix cost is the one the revert's own message names (re-expose app code/data while keeping apps/ masked, re-landing via #16061) — non-trivial but finite, and a finite cost cannot exceed an unbounded harm term; the ordinary-operation condition set leaves no rarity argument for a FLAG.

[ADJUDICATION] 0deb92ddcdde961d42612c5eabd4768196bea22a total=0 uphold=0 downgrade=0
[GPT-ADJUDICATED] 0deb92ddcdde961d42612c5eabd4768196bea22a

[ADJUDICATION-FENCED] 0deb92ddcdde961d42612c5eabd4768196bea22a fenced=1 flagged=0
UPHOLD-FENCED F1 src/kiro_crew/cron_script.py:2063 -- Every installed app's `.app_secret` bearer sits under the unmasked `apps/` tree that both cron spawn paths leave readable, so the exposure needs no unusual timing or input and the only condition is that an app is installed and a cron runs.
[GPT-ADJUDICATED-FENCED] 0deb92ddcdde961d42612c5eabd4768196bea22a

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 0deb92ddcdde961d42612c5eabd4768196bea22a: <one-sentence reason>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant