Skip to content

fix: move ops secret store under its data dir and declare its mask - #34296

Open
JLargent42 wants to merge 1 commit into
mainfrom
fix/32681-ops-secrets-data-dir
Open

JLargent42 wants to merge 1 commit into
mainfrom
fix/32681-ops-secrets-data-dir

Conversation

@JLargent42

@JLargent42 JLargent42 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Ops Mission Control's provider-token store moves into the app's own data directory and is masked by the app's credentialMasks declaration, so the core no longer carries its hard-coded rows, and an existing install keeps its tokens.

Owner ruling 3 on #26967 approved app-declared credential masks as the replacement for the hard-coded ops_mission_control_secrets.json rows in the sandbox tables. #32652 added the seam but could not use it here: a declaration may only name files under the app's own data directory, and the store sat at the data-home root (<data home>/ops_mission_control_secrets.json). Dropping the rows before moving the store would have left the PagerDuty / Datadog tokens unmasked.

Why it matters

Until the store moves, the core keeps app-specific credential rows, which blocks Ops Mission Control from leaving the repository whole (#26967). Moving it carelessly risks the worst outcome for a credential store: lost tokens on upgrade (the operator has to mint new ones at the provider) or tokens that are briefly unmasked.

Not a goal

  • Feeding credentialMasks declarations into the agent tool gate. The seam is documented as tightening-only and read by nothing but the sandbox; this PR keeps an explicit tool-gate row instead.
  • Moving the autonomy ceiling (ops_mission_control_policy.json). It is a READONLY ceiling, not a credential, and credentialMasks only hides files.
  • Translating the rest of the Ops Mission Control settings panel in de / fr / it (only the one string this PR changes is translated).

What changed (motivation → approach → change)

Symptom → cause → change:

  • Store location (backend/secrets.py): secrets_path() is now apps/ops-mission-control/data/secrets.json. Writes still stage in the data home's masked auth-store-staging directory, never beside the file: publish_through_auth_store_staging gains home= (the staging home when the target is deeper than the root) and fsync=.
  • Migration (KeystoneFileBackend._migrate_legacy): at gateway startup (register_routes → migrate_legacy_store, before the loop serves anything, fail-open like the registry warm-up) and before the first save or revoke (both already off the loop), under the new store's lock and then the old store's lock, the root file is copied byte for byte, published with fsync, its directory synced, and only then is the root file removed. A store already at the new path wins and a root file next to it (restored backup) is left in place. A lookup never moves the store (the provider catalog reads it on the event loop); until the move succeeds it reads the root file where it is. A save or revoke whose move fails refuses, so it never starts a fresh store that would hide the old one's tokens. Corrupt content is moved as is, not dropped.
  • Declaration: app.json gets "credentialMasks": ["secrets.json"].
  • Core rows (issue item 3): the live store's hidden and hard-link protection now comes from the declaration (_hidden_leaves() / _hardlink_refused_leaves() add every declared leaf). The root name is kept as a retired leaf, treated exactly as browser-cookies.txt is: in sandbox_leaves._CREW_HIDDEN_LEAVES it moves to the retired block, and it stays in sandbox_aliases._CREW_HARDLINK_REFUSED_LEAVES, because a restored hard-linked backup of the root file is still live tokens (review finding on the first head).
  • Tool gate decision (issue item 4): a declaration feeds no tool-gate row, so security/paths_lists._CREW_SECRET_LEAVES now names apps/ops-mission-control/data/secrets.json, which keeps the agent's file tools off it, and the derived .lock / .tmp artifact fence covers the data dir. The root name stays fenced as a retired leaf for the same restored-backup reason as browser-cookies.txt. The other option, dropping the row, would leave the moved store readable to the agent's file tools wherever the sandbox is off.
  • UI copy: the retention note beside Revoke said "Stored outside the app's folder", which is no longer true. It now reads "Stored where the agent cannot read them. Note: uninstalling this app does not delete them. …" in every locale (translated per locale; en-XA regenerated). The stale TSX comment is corrected.
  • Docs: ops-mission-control.md ("Repository boundary", contract 4, the data layout), app-kit-platform.md §37 "Built-ins", security.md staging paragraph.

Backwards compatibility

Compatible: an existing install's root store is moved on first access with its bytes unchanged; every reader goes through secrets_path() / the backend.

Reader: src/kiro_crew/apps/builtins/ops_mission_control/backend/secrets.py:KeystoneFileBackend._read -- app -- reads the new path, or the root file until it is moved, without moving it (test_a_lookup_reads_the_old_store_without_moving_it)
Reader: src/kiro_crew/apps/builtins/ops_mission_control/backend/routes.py:register_routes -- app -- moves the root store at startup (test_registering_the_routes_moves_the_store, test_a_secret_store_move_fault_does_not_break_startup)
Reader: src/kiro_crew/apps/builtins/ops_mission_control/backend/secrets.py:KeystoneFileBackend.put -- app -- migrates (refusing on failure) before the locked read-modify-write (test_a_save_keeps_every_token_already_stored, test_a_failed_move_keeps_the_old_store_and_refuses_the_save)
Reader: src/kiro_crew/sandbox_leaves.py:_CREW_HIDDEN_LEAVES -- chat|cron|subagent -- the root name stays masked as a retired leaf; the new path is masked via credentialMasks (test_sandbox_governance_mask.py MASKED)
Reader: src/kiro_crew/sandbox_aliases.py:_hardlink_refused_leaves -- chat|cron|subagent -- includes the declared leaf (test_the_manifest_declares_the_store_a_credential_mask)
Reader: src/kiro_crew/security/paths_lists.py:_CREW_SECRET_LEAVES -- chat|subagent -- fences both names and the new .lock (test_agent_file_tools_cannot_touch_it)

Tests

  • test_security.py: TestTheRootStoreMovesToTheDataDirectory (byte-for-byte move at startup, register_routes moves it, a lookup reads the root store without moving it, save keeps old tokens, corrupt store moved not dropped, existing new store wins, failed move refuses the save and keeps the old file, staging only in the masked dir); keystone tests now pin the manifest declaration, the hard-link set and the tool gate for the new path.
  • test_sandbox_governance_mask.py: the moved store is masked in every mode on Linux and denied read/write/link on Seatbelt, as the root store was.
  • test_config_routes.py: retention boundary rewritten for the new layout (declared, fenced, default uninstall keeps data).
  • test_app_credential_masks.py: pins the shipped built-in declarations; other cases isolate from them.
  • Pins updated: decoupling list, leaf-only ratchet (+6 per tier, recorded), live-adapter tier lists, launcher golden isolates shipped declarations.

Proof: PROVEN test_sandbox_governance_mask.py::TestSecretsAreMaskedInEveryMode[apps/ops-mission-control/data/secrets.json-*] (18 cases), test_config_routes.py::TestManifestCrons::test_secrets_live_in_the_masked_data_dir_that_uninstall_keeps, test_security.py (collection error on main: no APP_NAME / legacy path) (head 75876c6)

Local: ~11.9k tests across every test/test_sandbox*, test/test_security*, test/test_app_credential*, test/test_app_backend*, the decoupling gate and all ops-mission-control tests at -n 2; the only failure is test_the_seatbelt_profile_is_the_golden, which fails identically on main on this host (path-regex escaping of the runner's tmp path). Frontend: src/apps/ops-mission-control vitest 398/398, eslint, i18n:check with I18N_BASE_REF=origin/main all PASS.

Manual verification

Rendered the Settings PagerDuty card with a stored credential on main and on this branch (static build of a local capture page, Playwright), dark and light. Below.

Screenshots / video

Before (main), dark:

Before, dark: retention note says stored outside the app folder

After (this branch), dark:

After, dark: retention note says stored where the agent cannot read them

Light theme

Before, light

After, light

Related Issues

Fixes #32681
Part of #26967

Sibling sweep

Swept: git grep -nE "ops_mission_control_secrets|SECRETS_FILENAME|outside the app's folder" -- src test docs website
Sibling: src/kiro_crew/apps/builtins/ops_mission_control/tests/test_notify_out.py -- changed here
Sibling: src/kiro_crew/apps/builtins/ops_mission_control/tests/test_slack_out.py -- changed here
Sibling: website/src/i18n/locales/en.json -- changed here
Sibling: src/kiro_crew/apps/builtins/ops_mission_control/backend/policy_store.py -- not affected -- a READONLY ceiling, not a credential the mask seam covers

Pattern harvest

Not generalizable: a one-off relocation of the only core-named app credential store onto the app-declared mask seam.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license.

@JLargent42
JLargent42 requested review from a team and KiroCrewCaptain as code owners November 10, 2026 02:50
@JLargent42 JLargent42 self-assigned this Nov 10, 2026
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/sandbox_aliases.py

  • src/kiro_crew/sandbox_leaves.py

  • src/kiro_crew/security/paths_lists.py

  • @JLargent42 posted a complete reasoning template for 75876c6.

@JLargent42

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head: 5385b02

  • What rule changed: Ops Mission Control's provider-token store moved from the data-home root (ops_mission_control_secrets.json) to apps/ops-mission-control/data/secrets.json, masked by the app's own credentialMasks. The root name left sandbox_aliases._CREW_HARDLINK_REFUSED_LEAVES and moved to the retired block of sandbox_leaves._CREW_HIDDEN_LEAVES; security/paths_lists._CREW_SECRET_LEAVES gained the new path and keeps the root name as retired.
  • Before -> after: before, the root file was hidden, hard-link refused and tool-gate fenced by core rows. After, the moved file is hidden and hard-link refused through the declaration (_hidden_leaves / _hardlink_refused_leaves add every declared leaf) and fenced by an explicit tool-gate row; the root name stays hidden and fenced as a retired leaf.
  • Worst case if wrong: provider tokens readable by a sandboxed agent, or lost on upgrade. Both are pinned: the masks by the governance mask test, the tokens by the migration tests (byte-for-byte move, failed move refuses the save and keeps the old file).
  • No regression:
    • Evidence checked: test_sandbox_governance_mask.py asserts the new path is bind-masked on Linux and denied read, write and link on Seatbelt in all three modes, at both crew prefixes, the same assertions the root store had; the 18 new cases fail on main and pass here. The union-of-dispositions pin still holds with the new tool-gate row.
    • Tools still work: the gateway is the only writer and opens the path directly; writes stage in the masked auth-store-staging at the data-home root, never beside the file. Ops vitest 398/398 and the ops Python suites pass.
    • Backward compatible: an existing root store is moved on first access under both stores' locks, fsynced with its directory synced before the root copy is removed; a restored root copy beside a moved store is left alone and stays masked.
  • Existing tests: about 11.9k sandbox, security, app-credential-mask and ops tests at -n 2 pass; the one failure, the Seatbelt profile golden, fails identically on main on this host (tmp-path regex escaping).
  • How to undo: revert this commit. The old code reads the root path only, so a host that already migrated would need apps/ops-mission-control/data/secrets.json moved back to the root by hand.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 10, 2026
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 75876c619a78324c2fa67fb6f57d96af6910cd68 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Only one string changes: the retention note. The blind reader read the new wording correctly ("sure") and it fits on one line in both themes.

Notes

  • credential_retention_note says "them" in its first two sentences and "the credential" in its last, and only one api_key is on screen. The reader asked: "I can't tell whether Revoke deletes just this key or several saved secrets." Pick singular or plural and use it in all three sentences.

[UX-REVIEWED] 75876c6

Description read

[DESCRIPTION-READ] 4315d2bbaab406e825b040ae0a00d4ab807f0672f10a9923631796c270706b2a

That sha256 names everything this verdict read: the PR description, plus the 7 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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 75876c619a78324c2fa67fb6f57d96af6910cd68 — 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 does not.

First-Principles-Verdict: PASS

Nothing blocks. Every item traces to owner ruling 3 on #26967 or to the risk of losing or exposing tokens on upgrade. One gap in the framing is a note below.

Notes

  • Item 6 — undeclared framing gap: the Goal says "so the core no longer carries its hard-coded rows". The diff still keeps "ops_mission_control_secrets.json" in _CREW_HIDDEN_LEAVES, _CREW_HARDLINK_REFUSED_LEAVES and _CREW_SECRET_LEAVES, and adds + "apps/ops-mission-control/data/secrets.json" to _CREW_SECRET_LEAVES. After this PR the core holds four app-specific rows where it held three. ## What changed admits this, but the Goal line overstates what the PR achieves for Move every built-in app out to KiroCrewApps and forbid built-in apps #26967.

What this change ships

Inventory (8 items) — 7 justified

Intent: let Ops Mission Control's provider tokens live in the app's own data directory, masked by its own declaration, without losing existing tokens. FIX, serving the app's move out of core.

  1. Token store now lives at apps/ops-mission-control/data/secrets.json — justified
  2. Gateway startup moves an existing root store, byte for byte — justified
  3. A save or revoke moves the store first, and refuses if the move fails — justified
  4. A lookup reads the old root file until it has been moved — justified
  5. app.json declares secrets.json in credentialMasks — justified
  6. Core tables keep the root name as a retired leaf and add a tool-gate row for the new path — undeclared: the Goal says the rows go, but they stay
  7. publish_through_auth_store_staging gains home= and fsync= parameters — justified
  8. Retention note beside Revoke reworded in every locale — justified

[FIRST-PRINCIPLES-REVIEWED] 75876c6

Description read

[DESCRIPTION-READ] e610a68c023ac8e147bd99ed24cbe023c23f5450650ac1aae7dc546a16a66d19

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 75876c619a78324c2fa67fb6f57d96af6910cd68 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the store keeps its bytes when it moves, a failed move refuses the write instead of hiding the old tokens, and rendered evidence is attached.

Notes

  • The goal says "the core no longer carries its hard-coded rows", but security/paths_lists._CREW_SECRET_LEAVES now names apps/ops-mission-control/data/secrets.json. The core still hard-codes this app's id. When the app leaves under Move every built-in app out to KiroCrewApps and forbid built-in apps #26967, that row becomes an orphan. File the follow-up issue now: feed credentialMasks declarations into the tool gate.
  • The retired root leaf now sits in three core tables (sandbox_leaves, sandbox_aliases, paths_lists) with no planned removal. Name the condition that lets them go, as browser-cookies.txt should too, so they don't stay forever.

[DESIGN-REVIEWED] 75876c6

Description read

[DESCRIPTION-READ] 6a7fb304d84fcb02c08c90974854f1758a347b9981c41865f8ba08693697965a

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@JLargent42
JLargent42 force-pushed the fix/32681-ops-secrets-data-dir branch from 5385b02 to 1543414 Compare November 10, 2026 03:24
@JLargent42

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head: 1543414

  • What rule changed: Ops Mission Control's provider-token store moved from the data-home root (ops_mission_control_secrets.json) to apps/ops-mission-control/data/secrets.json, masked by the app's own credentialMasks. The root name left sandbox_aliases._CREW_HARDLINK_REFUSED_LEAVES and moved to the retired block of sandbox_leaves._CREW_HIDDEN_LEAVES; security/paths_lists._CREW_SECRET_LEAVES gained the new path and keeps the root name as retired.
  • Before -> after: before, the root file was hidden, hard-link refused and tool-gate fenced by core rows. After, the moved file is hidden and hard-link refused through the declaration (_hidden_leaves / _hardlink_refused_leaves add every declared leaf) and fenced by an explicit tool-gate row; the root name stays hidden and fenced as a retired leaf.
  • Worst case if wrong: provider tokens readable by a sandboxed agent, or lost on upgrade. Both are pinned: the masks by the governance mask test, the tokens by the migration tests (byte-for-byte move, failed move refuses the save and keeps the old file).
  • No regression:
    • Evidence checked: test_sandbox_governance_mask.py asserts the new path is bind-masked on Linux and denied read, write and link on Seatbelt in all three modes, at both crew prefixes, the same assertions the root store had; the 18 new cases fail on main and pass here. The union-of-dispositions pin still holds with the new tool-gate row.
    • Tools still work: the gateway is the only writer and opens the path directly; writes stage in the masked auth-store-staging at the data-home root, never beside the file. Ops vitest 398/398 and the ops Python suites pass.
    • Backward compatible: an existing root store is moved on first access under both stores' locks, fsynced with its directory synced before the root copy is removed; a restored root copy beside a moved store is left alone and stays masked.
  • Existing tests: about 11.9k sandbox, security, app-credential-mask and ops tests at -n 2 pass; the one failure, the Seatbelt profile golden, fails identically on main on this host (tmp-path regex escaping).
  • How to undo: revert this commit. The old code reads the root path only, so a host that already migrated would need apps/ops-mission-control/data/secrets.json moved back to the root by hand.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — 🔴 changes requested (blocking)

Reviewed 75876c619a78324c2fa67fb6f57d96af6910cd68 — this comment is updated in place on each push.

Blocks merge: the token store now sits in a directory the agent can rename, so on the Linux namespace sandbox every saved provider token can be read from the next session. It also adds a new core path row naming the app, plus a matching exemption in a list that may only shrink.

BLOCKING — src/kiro_crew/apps/builtins/ops_mission_control/backend/secrets.py:129
return app_data_dir(APP_NAME) / SECRETS_FILENAME
Trigger: A prompt-injected agent's shell in a Linux namespace sandbox renames the agent-writable apps/ops-mission-control/data to data2. The bind mask is a mount, so it moves with the renamed parent. The only rename guard for declared leaves, app_mask_parents in sandbox_argv.py, is () when namespace. The next sandboxed spawn (a new session or a subagent) only masks the declared apps/ops-mission-control/data/secrets.json and its .ops-mission-control-data-tmp twin. Neither exists any more, so data2/secrets.json is a plain single-link file at a path nothing masks, hard-link-refuses or fences.
Outcome: Every stored PagerDuty/Datadog token is readable by the agent. The old store was a direct data-home child, which sandbox_leaves.py (the host-exec-grants comment) calls "the pattern that cannot be renamed around"; this change gives that up for the live credential.
Anchor: residual/security
Fix: Keep the live store as a direct data-home child, for example a generic top-level masked directory keyed by app name, like host-exec-grants. Or have the namespace launcher pin each declared leaf's parent chain against rename, for example by binding data/ onto itself so a rename fails with EBUSY.

BLOCKING — src/kiro_crew/security/paths_lists.py:608
"apps/ops-mission-control/data/secrets.json",
("security/paths_lists.py", "apps/ops-mission-control/data/secrets.json"), (in test/test_core_ops_mission_control_decoupling.py)
Trigger: This adds a new core string that addresses one app by its id, as a tool-gate row. The PR's own text says the reason is that "a declaration feeds no tool-gate row", which is an App Kit seam gap. The PR then adds an exemption row to KNOWN_NAME_REFERENCES. The gate's docstring says "a new one fails here … add a generic, app-keyed seam the app fills instead. Do not add an exemption", and ops-mission-control.md calls the list one that "may only shrink".
Outcome: Core grows a new reference to a built-in app it is meant to shed, and the shrink-only decoupling ratchet is loosened to fit the diff. That gap is repeated for the next app that declares credentialMasks.
Anchor: no-new-builtin-apps
Fix: Feed credential_masks.declared_crew_leaves() into the tool gate's sensitive-path check as a generic seam. Then drop the hard-coded row and the new KNOWN_NAME_REFERENCES entry.

[BLOCK-MERGE] 75876c6
[OPUS-REVIEWED] 75876c6

Verdict parsed from the review's SHA-scoped output markers for commit 75876c619a78324c2fa67fb6f57d96af6910cd68.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 75876c619a78324c2fa67fb6f57d96af6910cd68 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — 🔴 changes requested (blocking)

GPT 6.1 found at least one blocking issue that must be resolved before merging 75876c619a78324c2fa67fb6f57d96af6910cd68. Adjudication upheld 1 of 1 blocking finding(s); those must be resolved before merging.

This comment is updated in place on each push.

BLOCKING -- src/kiro_crew/apps/builtins/ops_mission_control/backend/routes.py:529 -- Secret-store migration performs durability flushes on the event loop

migrate_legacy_store()
Trigger: An upgraded installation with a legacy store reaches start_dashboard() → register_all() → system.register() → register_routes() on the running asyncio loop; _migrate_legacy() synchronously copies the file and fsyncs the file and destination directory.
Outcome: Storage latency blocks the entire gateway loop until those operations return, preventing pending tasks from progressing and freezing startup before the dashboard serves requests. The except OSError handles failures only after the blocking operation returns.
Anchor: no-blocking-call-on-event-loop
Fix: Register an async startup callback that awaits asyncio.to_thread(migrate_legacy_store), preserving failure handling and completing migration before requests are served.

[BLOCK-MERGE] 75876c6
[GPT-REVIEWED] 75876c6

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

F1: UPHOLD (autosde-blocking-rule)

  • Harm: MEDIUM. The migration does two file locks, a copy, and two fsyncs inline, so a slow disk stalls the event loop while the gateway starts. It happens once per upgraded install that has a legacy store, and the except OSError fallback recovers from errors.

  • Conditions confirmed: register_all(app) runs inside async def start_dashboard (src/kiro_crew/dashboard/server.py:736, :951), so it is on the running loop, not before the loop starts. The migration is called inline at routes.py:529, and its work is in secrets.py:262-275.

  • Why the weighing doesn't apply: the finding cites no-blocking-call-on-event-loop, which has blocking: true in .review-base-rules/AUTOSDE.yaml:103-104. Its "before the loop starts" exemption does not cover this call, and the rule's flag outranks the cost-benefit test. The fix is cheap anyway: offload the call to a thread and await it.

    [ADJUDICATION] 75876c6 total=1 uphold=1 downgrade=0
    UPHOLD F1 src/kiro_crew/apps/builtins/ops_mission_control/backend/routes.py:529 reason=autosde-blocking-rule
    [GPT-ADJUDICATED] 75876c6

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 75876c619a78324c2fa67fb6f57d96af6910cd68 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

Which legitimate operations does 75876c619a78324c2fa67fb6f57d96af6910cd68 newly refuse? Updated in place on each push. A script-confirmed regression blocks; the model proposes candidates and never decides a refusal.

Verdict basis: adjudicated, zero confirmed regressions.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 15 classified, 0 newly refused, 15 still allowed.
  • ubuntu-latest (platform posix): 15 classified, 0 newly refused, 15 still allowed.
  • windows-latest (platform windows): 9 classified, 0 newly refused, 9 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: PASS

Reason: The stricter rule is in the path gate and sandbox mask tables. None of the three shell checks reads those tables: is_sensitive_bash_command says plainly "This gate does NOT match PATHS in command text", so the 21 shell rows I submitted are expected to come back allowed. The real tightening is in the file-tool path gate (is_sensitive_path), the publish-artifact fence and the sandbox's credential-mask and hard-link checks. The classifier can't judge any of these, so they are listed under UNADJUDICATED and are not cleared.

TIGHTENING: The keystone read+write floor _CREW_SECRET_LEAVES gains "apps/ops-mission-control/data/secrets.json", and app.json gains "credentialMasks": ["secrets.json"]. The one threat refused: an agent's own tools, or a sandboxed process, reading, overwriting or hard-linking the provider-token store once it moves from the data-home root into the app's data directory (security/paths_lists.py: + "apps/ops-mission-control/data/secrets.json",).

ADJUDICATED: 21 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE: I wrote rows for posix, windows and any.

  • posix: the ~/.kiro/crew prefix, the legacy ~/.kirocrew prefix and a $KIROCREW_HOME row. This covers the diff's two changes on this side: the new /-separated leaf path, and secrets_path() moving to app_data_dir (which follows KIROCREW_HOME).
  • windows: cmd %USERPROFILE%\…, PowerShell $env:USERPROFILE\…, a C:\Users\… drive-letter path, and backslash spellings of pytest and findstr. These test whether the posix-spelled leaf over-matches when written the Windows way.
  • any: git grep, git log -S and git commit -m. Here the fenced names appear only as data (a search pattern or a commit message).
  • Not probed: UNC paths, because no shell row reaches the path tables.

UNADJUDICATED:

  • 1. Publish-artifact fence (file-tool gate). is_sensitive_path → _is_keystone_publish_artifact → _KEYSTONE_ARTIFACT_PARENTS, which is built from every _CREW_SECRET_LEAVES entry by rsplit("/", 1)[0].
    • The new entry adds <prefix>/apps/ops-mission-control/data as a parent. From now on, every *.tmp and *.lock file sitting directly in that directory is refused for reads and writes. That is more than secrets.json.lock.
    • It also catches the app's existing .ledger.lock (backend/ledger.py:146), .config.lock (backend/providers/__init__.py:42), and the tmpXXXXXXXX.tmp temp files atomic_write creates for config.json and rotation.yaml. None of these hold secrets.
    • Inputs I would have submitted:
      • an agent fs_read or fs_write of ~/.kiro/crew/apps/ops-mission-control/data/.ledger.lock or .config.lock, for example to check or remove a stale lock after a crash;
      • the same on %USERPROFILE%\.kiro\crew\….
    • I can argue this narrowing but not confirm it. If it matters, the narrow fix is to move the store into its own subdirectory, or to fence only secrets.json.* in this one directory.
  • 2. Hard-link refusal at spawn (sandbox). credential_masks.declared_crew_leaves() → sandbox_aliases._hardlink_refused_leaves().
    • A second hard link to apps/ops-mission-control/data/secrets.json now refuses every agent spawn.
    • Input I would have submitted: an operator's cp -al ~/.kiro/crew ~/.kiro/crew.bak (or an rsnapshot-style backup) of the data home.
    • The retired root name already had this behaviour, so the risk moves rather than widens. It still can't be verified here.
  • 3. Sandbox mask and leaf-only hold count. Every tier's tier_dirs gains the declared leaf (test_sandbox_plan.py), and the leaf-only holds grow by 6 per tier (test_sandbox_protected_name_holds.py).
    • Input I would have submitted: an agent's sandboxed shell reading data/ledger.jsonl, data/rotation.yaml or data/incidents/index.json. These must stay visible, because only the leaf is masked, not the directory.
  • 4. Staging home for the publish. publish_through_auth_store_staging(..., home=config_dir()) now stages a file that is two directories deep through the root's auth-store-staging folder. The move stays on one filesystem only if apps/ is not a separate mount; that is not a gate the shell classifier sees.

[SCOPE-REVIEWED] 75876c6

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 10, 2026
@JLargent42
JLargent42 force-pushed the fix/32681-ops-secrets-data-dir branch from 1543414 to 75876c6 Compare November 10, 2026 03:55
@JLargent42

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head: 75876c6

  • What rule changed: Ops Mission Control's provider-token store moved from the data-home root (ops_mission_control_secrets.json) to apps/ops-mission-control/data/secrets.json, masked by the app's own credentialMasks. The root name stays in sandbox_aliases._CREW_HARDLINK_REFUSED_LEAVES and moves to the retired block of sandbox_leaves._CREW_HIDDEN_LEAVES; security/paths_lists._CREW_SECRET_LEAVES gained the new path and keeps the root name as retired.
  • Before -> after: before, the root file was hidden, hard-link refused and tool-gate fenced by core rows. After, the moved file is hidden and hard-link refused through the declaration (_hidden_leaves / _hardlink_refused_leaves add every declared leaf) and fenced by an explicit tool-gate row; the root name stays hidden, hard-link refused and fenced as a retired leaf.
  • Worst case if wrong: provider tokens readable by a sandboxed agent, or lost on upgrade. Both are pinned: the masks by the governance mask test, the tokens by the migration tests (byte-for-byte move, failed move refuses the save and keeps the old file).
  • No regression:
    • Evidence checked: test_sandbox_governance_mask.py asserts the new path is bind-masked on Linux and denied read, write and link on Seatbelt in all three modes, at both crew prefixes, the same assertions the root store had; the 18 new cases fail on main and pass here. The union-of-dispositions pin still holds with the new tool-gate row.
    • Tools still work: the gateway is the only writer and opens the path directly; writes stage in the masked auth-store-staging at the data-home root, never beside the file. Ops vitest 398/398 and the ops Python suites pass.
    • Backward compatible: an existing root store is moved at gateway startup (before the loop serves) or by the first save/revoke, never by a lookup on the loop, under both stores' locks, fsynced with its directory synced before the root copy is removed; a restored root copy beside a moved store is left alone and stays masked.
  • Existing tests: about 11.9k sandbox, security, app-credential-mask and ops tests at -n 2 pass; the one failure, the Seatbelt profile golden, fails identically on main on this host (tmp-path regex escaping).
  • How to undo: revert this commit. The old code reads the root path only, so a host that already migrated would need apps/ops-mission-control/data/secrets.json moved back to the root by hand.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 10, 2026
@JLargent42

Copy link
Copy Markdown
Contributor Author

AI review dispositions for 1543414, addressed in 75876c6:

  • Opus 5.5 / GPT 6.1 F1, sandbox_aliases.py:149, retired root name dropped from the hard-link refusal set: fixed. ops_mission_control_secrets.json is back in _CREW_HARDLINK_REFUSED_LEAVES with its bullet, next to the other retired credential leaves, and its row is back in test_sandbox_absent_ceiling_seal_hard_links.py. The retired name now gets exactly what browser-cookies.txt gets: hidden, hard-link refused, fenced.
  • GPT 6.1 F2, secrets.py, the move ran on the gateway loop through catalog() → has_secrets() → _read(): fixed by taking the move off the lookup path entirely. _read never moves the store; it reads the root file where it is until the move happens (test_a_lookup_reads_the_old_store_without_moving_it fails if a lookup reaches the fsync). The move runs at gateway startup in register_routes, which runs synchronously before the loop serves anything (the same reasoning as the registry warm-up there), and fail-open (test_registering_the_routes_moves_the_store, test_a_secret_store_move_fault_does_not_break_startup). Save and revoke still move it first; both already run in asyncio.to_thread.
  • Design note 2, a file created at the new path before the move hides the old tokens: narrowed by the same change. The move now runs at gateway startup, before any agent spawn, not lazily on first access, so the window where the new path is absent and unmasked is gone on every host that starts once.
  • Design note 1, core rows left for when the app leaves: out of goal. The rows left are the retired root name and the tool-gate row, both named in KNOWN_NAME_REFERENCES with their reason; removing them is Move every built-in app out to KiroCrewApps and forbid built-in apps #26967's work (a tool-gate reader for declarations is a seam decision, not this fix).
  • UX note, "the credential" vs "Revoke stored credentials": held. It is wording-only and would need a new pass over 13 locales and new captures; the sentence it sits in is correct as it stands.

@JLargent42

Copy link
Copy Markdown
Contributor Author

Held, per the security findings on 75876c6, until two seam PRs land: #34339 (credentialMasks parents pinned against rename on the Linux namespace backend) and #34346 (built-in credentialMasks on the agent tool gate, so this PR drops its app-named tool-gate row and its KNOWN_NAME_REFERENCES entry). This PR will be rebased onto them and pushed once.

@Zedmor

Zedmor commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Code change approver recommendation: A person should decide

Automated, not a person, and not a review: a maintainer still decides.

decider-v3c@217fe607 · p_defect 0.9 · router R0 (approves only when p_defect <= 0.12, on changes of at most 400 changed lines) · head 75876c619a · 606 changed lines

Why: the decider flagged 2 possible problems (p_defect 0.9); a person should check them.

The migration design is careful: the copy is byte for byte and fsynced, a failed move refuses the save, and an existing new store wins. But the head breaks CI in two places, both caused by this PR. (1) The rewritten test_config_routes imports kiro_crew.apps.manager_uninstall directly, which fails the manager-facade import gate on Linux, Windows and macOS. (2) The new French retention note uses a plain space before ':' where U+202F is required, which fails the fr style gate and, through it, the coverage gate. Both fixes are small. Separately, a maintainer should weigh three things: the namespace-sandbox rename residual the live token store now inherits, the synchronous fsyncs on the event loop at startup, and the new app-named core tool-gate row.

Things to check (the decider's concerns; it is right less than half the time):

  • [regression/medium] The rewritten retention test imports a manager owner module (manager_uninstall) directly instead of going through the kiro_crew.apps.manager facade. The repo's import gate allows only the manager family to import owners, so this PR breaks a backend test on every platform. Fix: import uninstall_ (src/kiro_crew/apps/builtins/ops_mission_control/tests/test_config_routes.py`)
  • [regression/low] The new French string has a plain space before the colon in Remarque :. style/fr.md §1 requires U+202F there, so the fr spacing gate fails. With it the Coverage Gate fails closed and frontend CI is red. (website/src/i18n/locales/fr.json)

If this recommendation is wrong, reply here; the replies are how the approver is evaluated.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 11, 2026
@bolichen97

Copy link
Copy Markdown
Contributor

Layout note from the #26967 campaign, so this PR and the external repo agree on where the Ops Mission Control provider tokens live.

The external repo (kirocrew-app-ops-mission-control, main 5883fd43d4, release 0.1.1) keeps them at <data dir>/secrets/secrets.json and declares "credentialMasks": ["secrets/"] (a directory entry, App Kit level 8, #36346), so the temp an atomic rewrite stages beside the store is masked too. On first access with no store in the data dir it copies <data home>/ops_mission_control_secrets.json there and keeps the root file as the one-release downgrade backup (rewritten on every save/revoke, never created). This PR currently moves the wheel copy's store to data/secrets.json (a file entry) and removes the root file after the move.

If both land as they stand, an install that ran this wheel copy and then adopts the repo copy finds neither data/secrets/secrets.json nor the root file, and its tokens look lost. Suggested alignment, either of:

  • use the repo's layout here: data/secrets/secrets.json with "credentialMasks": ["secrets/"], or
  • keep the move but leave the root file in place (as the repo does), so the repo's one-time copy still finds it.

On the tool gate: a shipped built-in's credentialMasks already reaches security._CREW_SECRET_LEAVES on main (credential_masks.declared_crew_leaves(installed=False)), so the explicit paths_lists row for the moved file is redundant with the declaration. #37459 adds the other half: the gate also honours an installed / adopted record's declared masks (owner ruling 3, comment 6713005850), so the adopted copy keeps the fence. #37459 does not touch this PR's files beyond the shared docs; no push to this branch.

This branch has not been deployed

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

Labels

merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ops-mission-control: move the secret store under its data dir so credentialMasks replaces its core rows

3 participants