Skip to content

feat(secrets): mediate Custom-secret API calls from member chats - #23855

Merged
iamwhatever merged 1 commit into
mainfrom
feat/mediated-secret-egress-v4
Oct 29, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
feat/mediated-secret-egress-v4

Conversation

@RohanK6

@RohanK6 RohanK6 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: An agent in a member conversation can call an owner-approved HTTPS API with a stored Custom secret, without the secret ever entering the sandbox.

Today a Custom secret can only reach a tool by being injected into an MCP server's environment at launch (secret://NAME). An agent in chat has no way to make a single authenticated call to, say, a webhook or a ticketing API with a key the owner stored, short of the owner wiring a whole MCP server for it. Issue #8628 asks for a mediated path: the agent names the secret and the request, the host injects the value and sends it.

This replaces #23843 and #23756 (the same change; each review round that would have taken it past two commits was rebuilt as one fresh commit on current main) and, before them, #10383, which was built on the member-proof model that #11780 removed (member_proof_header_value, issue_member_session_proof) and could no longer merge. This PR is a rebuild on the current caller-identity model, not a port of that one.

Why it matters

Without it, owners either hand the raw key to the agent (it lands in the transcript and the sandbox) or build an MCP server per API. A host-mediated call keeps the key in the vault, keeps the destination under the owner's control, and keeps each call behind an approval.

Not a goal

  • Reading API responses. The tool is write-only (POST/PUT/PATCH/DELETE) and every call returns the same fixed result, so a reflected credential has no channel back into the sandbox. Returning bodies is a separate decision.
  • Windows support. The trust argument depends on an attested Unix socket that Windows does not have; there the tool refuses explicitly.
  • Making the tool available by default. kirocrew-secrets is opt-in like the other assignable sets.

What changed (motivation → approach → change)

End-to-end flow:

owner:  kirocrew secrets authorize NAME https://api.example.com [--header X-Api-Key]
          -> signed policy in <data home>/secret-request-policy/ (masked in every sandbox)

agent (member chat) -> call_api_with_secret(secret_name, method, url, headers, query, json_body)
  -> ACP permission prompt -> owner approves
       -> under the ACP write lock, after the withdrawal / liveness / grant-deadline
          checks: mint a single-use capability bound to (session, tool_call_id, exact args),
          then write the answer frame (an undelivered answer revokes it, pending or claimed)
  -> kirocrew-secrets MCP stub (in sandbox)
       -> owner-only dashboard Unix socket; checks the answering peer is the gateway
          (SO_PEERCRED principal + published pid/start-token) before sending anything
       -> POST /api/mediated-secret-capability   (claim the capability for this call)
       -> POST /api/mediated-secret-request      (consume it; X-Mediated-Secret-Capability)
  -> gateway: internal secret + attested member scope (member_request_scope) required;
       Global chat (no member store) refused 403
       -> verify signed policy, exact-origin match, link_unfurl.vet_unfurl_url
          (public-address vet) + pinned_connector (connect only to vetted IPs),
          inject secret, send over aiohttp, cap redirects/timeouts
       -> fixed withheld result back to the agent

Where each piece lives:

Piece Where
kirocrew-secrets stub, tool call_api_with_secret mcp_secrets.py; registered in mcp_shared.py, mcp_shared_dispatch.py, mcp_entry.py, mcp_caller.py, mcp_cleanup.py, mcp_discovery_managed.py, mcp_gateway/backend.py, mcp_gateway/backend_stubs.py, mcp_gateway/backend_wire.py, mcp_gateway/stub_register.py, agent.py; kept out of the stub followers in config/integration_sections.py (opt-in egress stays an explicit stub choice)
Gateway routes dashboard/handlers/mediated_secrets.py, dashboard/server_runtime/mcp_routes.py, dashboard/server_internal_paths.py, dashboard/token_secret.py
Policy, signing, send secrets_mediation/policy.py, secrets_mediation/provenance.py, secrets_mediation/dispatch.py
Single-use capability mediated_request_capability.py, minted in acp/client_permissions.py and acp/session_handle_permissions.py, revoked on cancel in acp/client_turn_control.py and acp/session_handle_lifecycle.py
secrets authorize CLI cli_commands_secrets.py, cli_parser_admin.py, cli.py, cli_commands.py, cli_help.py
Masked policy directory sandbox.py, sandbox_leaves.py, sandbox_precreate.py, security/paths_lists.py, security_posture.py
Card copy website/src/i18n catalogs (all 13)
Docs docs/system-specs/modules/security.md, docs/architecture/mcp.md, docs/feature-map/README.md

Caller identity. Both routes are strict internal paths behind member_request_scope: the internal secret plus an attested X-Session-Key. A process holding only the loopback secret and a session key is refused. The approval-minted capability is the per-call binding. It is issued only when the call passes hooks.on_tool_call, so the server has no autoApprove and doctor never blanket-allows it.

Policy integrity. The policy MAC key is derived, never stored: an HMAC of a purpose label under token_signing.key, which every sandbox tier hides. Rotating that key invalidates signatures (fail closed); the owner re-authorizes with --reset. Only 64-character lowercase hex is a valid signature. The policy directory is masked whole in every tier and precreated before any spawn.

SSRF and transport. Dispatch reuses link_unfurl.vet_unfurl_url and sends through pinned_connector, so it only connects to a vetted address. No new HTTP dependency.

Approval ordering. Both transports mint the capability last, under the ACP write lock, after the withdrawal, liveness and deadline checks. No grant exists while an approval waits. An undelivered answer revokes the grant, pending or claimed. Cancelling a turn invalidates that session's grants only. Other tools' approvals are unchanged.

Grant lifetime. A pending grant lives for the bounded queue depth times the per-call budget, so a call queued behind a 60 s call is not refused. A claimed grant gets 30 s.

Windows. The stub refuses with an explicit unsupported-platform error, gated on platform_compat.IS_WINDOWS.

Backwards compatibility

Compatible: the server is opt-in and new, the CLI subcommand and routes are new, and the existing secret:// launch injection is untouched.

Removes nothing: the diff only adds a server, routes, a CLI subcommand, a masked directory and copy; no existing key, path or behavior is narrowed.

Tests

  • test/test_mediated_request_dispatch.py: method allowlist, exact-origin match, userinfo/redirect/timeout handling, vault read only after policy checks, and the withheld constant for every post-send outcome.
  • test/test_mediated_request_dispatch.py also covers the shared vet: a private/loopback target is refused through vet_unfurl_url, and the send uses pinned_connector for the vetted address.
  • test/test_mediated_request_policy.py, test/test_mediated_request_provenance.py: signature verification, torn/unsigned policy refusal, no key file written, rotation of the token secret invalidating signatures, an unreadable token secret failing closed, signatures under another key or purpose label refused, and non-hex/non-ASCII signatures refused without raising; neither gateway entrypoint does mediation work at boot.
  • test/test_secrets_authorize_cli.py: add/remove/reset, refusal without the gateway-owned directory, publication only inside the hidden directory.
  • test/test_mediated_secret_request_handler.py: internal-auth, attested member scope, Global refusal, capability claim/consume/replay, bounded body read across multiple chunks, and a pending grant that outlives a queued 60 s call while a claimed grant keeps the short TTL.
  • test/test_mcp_secrets.py: stub peer verification, payload caps, Windows refusal.
  • test/test_transport_permission_floor.py: approval mints the capability under the write lock and revokes it when the answer write fails; nothing is minted when the member is withdrawn while the approval waits for the lock; a grant claimed during a failed write is revoked and cannot be consumed (both transports); cancelling a turn on either transport revokes that session's pending and claimed grants and leaves another session's alone.
  • Clock-dependent tests use ManualClock().install(...) on the module under test and a module-local asyncio stand-in, never the stdlib time module or real-time ceilings.
  • test/test_cli_mcp_doctor.py::test_auto_fix_never_blanket_allows_mediated_secret: doctor never pre-approves @kirocrew-secrets.
  • Contract updates: dashboard composition census (+2 MCP routes; no boot steps), link-screen site baseline (the authorize CLI refuses a linked policy directory), sandbox leaf-only counts (+1 per tier for the masked directory), security package line budget (+3 for one deny-list entry), MCP route table (+2 rows), MCP registry/shared-dispatch tests, and the stub-follower ratchet (test_mcp_stub_overrides.py) lists kirocrew-secrets as excluded.
  • website/src/pages/settings/SecretsPanel.test.tsx: new card copy.

Local run: scripts/local-gate.py's related backend set; every red node also fails on a clean origin/main worktree on this host (symlinked home, setfacl, env --default-signal, mise node shim). On the final rebase: 1681 passed across the feature, transport-floor, MCP, sandbox, CLI, composition-contract and telegram suites; SecretsPanel.test.tsx 67 passed; mypy src/kiro_crew clean; flake8, black, isort, comment-history, brand-name, file-line-cap and the flake-pattern ratchet pass.

Manual verification

Not run end to end against a live upstream API on this host. The dispatch, handler and stub paths are covered by the tests above with the network and vault faked.

Screenshots / video

Custom secrets card with the updated copy:

Custom secrets card, light

Dark

Custom secrets card, dark

Related Issues

Fixes #8628

Supersedes #23843, #23756 and #10383.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • 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.

@RohanK6

RohanK6 commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 8e0f09b
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks the whole directory, so agent processes cannot read or write it, and the agent file tools refuse it. Only the host gateway and the owner kirocrew secrets authorize CLI open it. It holds only the owner-signed policy and its lock; the signing key is derived from the already-hidden token_signing.key and is never written anywhere. No existing path gains or loses access. The posture entry only classifies the dispatcher: it runs both redactors over agent-supplied URL/body/headers/query only to refuse the request when either would change a value, before any vault read, and returns a fixed constant, never redacted text.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the mask failed, an agent could read the allowlist or plant entries. A planted entry still fails signature verification unless the agent can also read token_signing.key, which this PR does not touch. If the precreate failed, a policy published after a sandbox started would sit outside the mask. A wrong posture classification would only mislabel a module that returns no redacted text. No existing command or user path is touched, so nothing existing breaks and no one is locked out.
  • Evidence checked (which sandbox result proves it): The sandbox leaf-only census tests count one more hidden leaf per tier, and test/test_sandbox_precreate_secret_dirs.py passes with the new directory precreated before spawn. test/test_secrets_authorize_cli.py proves the CLI refuses to publish without the precreated directory and only publishes inside it. test/test_mediated_request_provenance.py and test/test_mediated_request_policy.py prove that a tampered, unsigned, non-hex, foreign-key or foreign-label signature is refused, and that no key file is written.
  • No regression:
    • Tools still work (which tools/commands were run, result): Targeted suites on this change (feature, ACP client/session and transport floor, session-handle bindings, CLI, doctor, MCP secrets stub, secrets handler, link unfurl, link screen, dashboard startup and composition contract): 2412 passed, and 729 again after the final rebase onto main. flake8, black, isort and mypy are clean on the changed files; the feature-map, file-line-cap, agent-SDK boundary, sync-IO and subprocess-encoding gates pass. test_sandbox_protected_name_holds.py::TestEnclosingHoldsNeverRegress fails the same way on unmodified main on this host (a local md-notebook directory), so it is not this change. SecretsPanel.test.tsx passed 63 on the same card copy earlier; it cannot load locally right now because main added a vite plugin the shared node_modules lacks.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory is new and the opt-in kirocrew-secrets server is new. secret:// launch injection and every existing deny or mask entry are unchanged (the diff only adds entries). Existing secrets handler and secret:// resolution tests pass unchanged.
    • Existing tests (which suites passed on this head): test_mediated_, test_mcp_secrets, test_transport_permission_floor, test_session_handle, test_acp_client*, test_secrets_authorize_cli, test_secrets_handler, test_link_unfurl*, test_link_screen_hold_pin, test_check_feature_map, test_cli, test_cli_doctor, test_cli_mcp_doctor, test_dashboard_server_composition_contract*, test_dashboard_server_startup_coverage, test_sandbox_precreate_secret_dirs, test_security_gate_liveness.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list and posture entries together with the feature. Any leftover secret-request-policy/ directory in a data home is inert once nothing reads it, and can be deleted by hand.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the feature is opt-in and fails closed, the policy directory is new so masking it hides nothing anyone read before, and both screenshots of the reworded Secrets card are committed.

Notes

  • The grant is tied to the call by assuming the harness sends progressToken equal to its ACP toolCallId, which only kiro-cli is described as doing. On other harnesses every claim is refused, so the tool shows up but never works. Either say in the spec which harnesses it is supported on, or keep the tool off those backends by checking the backend positively (is_kiro_backend).
  • The tool returns the same fixed result every time, so the agent can't tell a successful call from one the upstream rejected. That's a deliberate choice, but people will run into it, and it belongs in the user-facing docs, not just the spec.

[DESIGN-REVIEWED] 4fc1629

Description read

[DESCRIPTION-READ] acb64a64c6e2d91c27e865e42b7b35784b4f97634d369e86cbf0ebfbac8f9dc1

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.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 4fc1629c804ab3830850e9cfa9b2d9c18f2fbf28 — 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 follows from issue #8628 or from a boundary that keeps the secret away from the agent. The one note is a rewording of existing card copy that no reported problem asked for.

Notes

  • Item 7 — unjustified move: the existing description changes from "…the gateway injects the value at launch — it is never exposed in chat." to "Encrypted keys for MCP servers and .env settings. … the value is never shown in chat." No harm or report is named for changing copy that already existed, and the launch-time injection explanation is dropped. Subtraction: put the original settings.secrets.custom_description string back in all 13 catalogs and keep only the added custom_authorize line.

What this change ships

Inventory (9 items) — 8 justified

Intent: let an agent in a member chat make one authenticated API call, approved by the owner, using a stored Custom secret that never enters the sandbox. ADDITION.

  1. New opt-in kirocrew-secrets MCP server with the write-only call_api_with_secret tool — justified
  2. New kirocrew secrets authorize NAME ORIGIN [--header] [--reset] CLI binding a secret to one origin — justified
  3. Two new internal gateway routes for claiming and using the capability; Global chat refused — justified
  4. Approving that tool mints a single-use grant; deny, cancel or an undelivered answer revokes it — justified
  5. New secret-request-policy/ directory, masked in every sandbox tier and created before spawn — justified
  6. Policy signatures keyed off token_signing.key; rotating the key invalidates every authorization — justified
  7. Custom secrets card's existing description reworded and shortened — unjustified move: no harm named
  8. Custom secrets card gains an "authorize" line with the CLI command — justified
  9. Server left out of the managed stub followers; dispatcher listed as a refusal gate in the posture list — justified

[FIRST-PRINCIPLES-REVIEWED] 4fc1629

Description read

[DESCRIPTION-READ] 9025a1720e60c2bb53f86213a99edc24add6df78881e9b68860e7a6bdf327f78

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 Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

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

UX-Verdict: PASS

First-time readers can't follow the new authorize instructions on the Custom secrets card. That card is the only place the dashboard explains this PR's feature. The blind reader said "no idea" about the sentence and would not dare run the command.

Blockers

The authorize step uses unexplained terms and gives an incomplete command
Trigger: An owner opens Settings → Secrets to let a chat agent call an API with a stored key.
Outcome:

  • The new string custom_authorize says "an agent in a member chat … grant the agent {{server}}". No other string in the UI uses "member chat", and nothing on the page shows where or how to grant @kirocrew-secrets. The blind reader said: "I don't know what a 'member chat' is, or what 'grant the agent @kirocrew-secrets' asks me to do, or where."
  • The command kirocrew secrets authorize NAME https://api.example.com has placeholders nobody explains, and it leaves out --header, which the PR's own flow uses. The blind reader would "not dare … I don't know what to put in place of NAME or the web address."
  • The result is that the owner can't set up the feature from the dashboard.

Severity: every owner who tries this hits it (high frequency), they can't finish the task (failure), and it happens on every visit (persistent).

Fix:

  • Replace "member chat" with the product's own name for that chat, and link "grant the agent" to the page where agents get their tool sets.
  • Say that NAME is the secret's key from the list below and the URL is the API's origin.
  • Mention --header.
  • Add a copy button, as the sibling command blocks have (e.g. SlackPanel.tsx, SecurityPanelTailnet.tsx).

Notes

  • The new custom_description, "Encrypted keys for MCP servers and .env settings", now sits next to a second explanatory paragraph. The blind reader also couldn't tell which list "+ Add secret" adds to. Consider making the authorize step its own small labelled sub-block, such as "Use a secret from chat", below the list.

[UX-REVIEWED] 4fc1629

Description read

[DESCRIPTION-READ] d3df839c9f5453a9583453416cd10963fd44618aeedf0f9c2013ff9bbfd2be62

That sha256 names everything this verdict read: the PR description, plus the 5 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 Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 4fc1629c804ab3830850e9cfa9b2d9c18f2fbf28 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 4fc1629

Verdict parsed from the review's SHA-scoped output markers for commit 4fc1629c804ab3830850e9cfa9b2d9c18f2fbf28.

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

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 4fc1629c804ab3830850e9cfa9b2d9c18f2fbf28 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 4fc1629

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

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

Which legitimate operations does 4fc1629c804ab3830850e9cfa9b2d9c18f2fbf28 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): 13 classified, 0 newly refused, 13 still allowed.
  • ubuntu-latest (platform posix): 13 classified, 0 newly refused, 13 still allowed.
  • windows-latest (platform windows): 10 classified, 0 newly refused, 10 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: PASS

Reason: Every tightening here is in a path floor, a sandbox mask, or an approval-path hook. The shell deny composite reads none of these, because is_sensitive_bash_command deliberately matches no paths in command text and the patch leaves the sensitive-bash, exfil and deny-rules tiers alone. So the candidates can only confirm that the shell side is unchanged. The real tightenings are the file-tool floor, the sandbox mask and the approval mint, and they are named under UNADJUDICATED with no verdict to rest on.

TIGHTENING: The agent file-tool floor _CREW_SECRET_LEAVES gains a whole-directory leaf, and that leaf is also masked and precreated in every sandbox -- the one threat it refuses is an agent reading the owner-signed origin allowlist, or writing it to "authorize its own origin" (+ # Mediated-secret owner-signed egress policy: writable, it would let an agent try / + # to authorize its own origin. ... / + "secret-request-policy", in src/kiro_crew/security/paths_lists.py, plus _SECRET_REQUEST_POLICY_LEAF added to _CREW_HIDDEN_LEAVES and _CREW_PRECREATE_HIDDEN_DIR_LEAVES).

ADJUDICATED: 16 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE: The diff makes three platform assumptions: the ~/.kiro/crew/secret-request-policy home-relative path, the Linux-namespace precreate step, and the macOS Seatbelt / sandbox-off branch where authorize creates the directory itself.

  • posix rows: crew-home listings, a direct listing of the new directory, an rg for the leaf literal, a path-scoped git log, and a targeted pytest run.
  • windows rows: dir %USERPROFILE%\.kiro\crew\secret-request-policy, Get-ChildItem $env:USERPROFILE\.kiro\crew, and a backslash-separated pytest run. These cover the sandbox-off host where the CLI creates the directory.
  • any rows: every form of the new kirocrew secrets authorize verb (origin, explicit-port origin, --header, --remove, --reset), the sibling secrets import --apply, and kirocrew mcp-secrets. None of these carry a path or separator.
  • Not covered: the Linux-namespace and macOS-Seatbelt split is a spawn-time backend decision, not a shell spelling, so no candidate can probe it.

UNADJUDICATED:

  • File-tool read/write floor (security.paths.is_sensitive_path / is_sensitive_write_path over _SENSITIVE_HOME_DIRS, extended by _CREW_SECRET_LEAVES).
    • Call path: an agent file-tool call goes through hooks.on_tool_call, then the path tier, then _path_in_home_dirs against <crew-prefix>/secret-request-policy.
    • Inputs I would have submitted:
      • read ~/.kiro/crew/config.json and ~/.kirocrew/sessions.db, siblings that must stay readable;
      • write ~/.kiro/crew/secret-request-policy-notes.md, a prefix-sharing sibling, to probe the target + os.sep boundary;
      • read C:\Users\u\.kiro\crew\config.json.
    • The new leaf is bare, so _KEYSTONE_ARTIFACT_PARENTS derives the crew home root as its parent. That root is already present from other bare leaves, so I expect no new *.tmp / *.lock fence, but nothing here verified it.
  • Sandbox mask and precreate (sandbox_leaves._CREW_HIDDEN_LEAVES, sandbox_precreate._CREW_PRECREATE_HIDDEN_DIR_LEAVES).
    • Call path: the spawn preflight builds the namespace mask and precreates the directory before every Linux spawn.
    • Inputs I would have submitted: an in-sandbox ls ~/.kiro/crew and a sandboxed app run while the directory is masked. I would check that the mask leaves the parent listable and that the precreate does not fail on a read-only or relocated KIROCREW_HOME.
  • ACP approval path (approve_tool in acp/client_permissions.py and acp/session_handle_permissions.py; reject_tool; cancel_session / cancel).
    • Call path: a permission request goes through approve_tool, then ApprovalMint(...), then before_write under the write lock, which runs the withdrawal check, the grant deadline and then capability.mint(), and finally capability.settle(sent=...).
    • The before_write wiring now depends on capability.applies, and session_handle_permissions now wraps grant_deadline_guard inside a new closure. The legitimate inputs at risk are ordinary non-kirocrew-secrets tool approvals (a file edit, a shell call, a different MCP tool) with and without a human-wait deadline. I would check that mint() is a true no-op for them and never raises under the lock.
  • Mediated endpoint gates (api_mediated_secret_request / api_mediated_secret_capability: member-scope check, then the single-use capability consume).
    • These are new routes, not a tightening of an existing operation. The inputs I would probe are a member V2 session's approved call_api_with_secret on Windows over loopback TCP rather than a Unix socket, and a call whose harness does not set _meta.progressToken. The spec says the second is refused fail-closed, which would make the tool unusable on such a harness.

[SCOPE-REVIEWED] 4fc1629

@RohanK6
RohanK6 force-pushed the feat/mediated-secret-egress-v4 branch from 8e0f09b to a87e09a Compare October 24, 2026 22:38
@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Oct 24, 2026
@RohanK6
RohanK6 force-pushed the feat/mediated-secret-egress-v4 branch 2 times, most recently from 5e682cd to 9e3fd1a Compare October 24, 2026 23:38
@RohanK6

RohanK6 commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 9e3fd1a
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. New on this head: dashboard/token_secret.py remembers whether its memoized signing secret is the loader's ephemeral fallback, and adds get_persisted_secret(), which refuses that fallback. The policy key's root reads through it.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks the whole directory, so agent processes cannot read or write it, and the agent file tools refuse it. Only the host gateway and the owner kirocrew secrets authorize CLI open it. The signing key is derived from the already-hidden token_signing.key and is never written anywhere. On this head: with token_signing.key unreadable, authorize used to sign with a process-local random key and publish a policy the gateway could never verify. Now it refuses and publishes nothing. Every other token_secret caller (_get_secret, load_boot_secret) behaves exactly as before.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the mask failed, an agent could read the allowlist or plant entries; a planted entry still fails signature verification unless the agent can also read token_signing.key. If get_persisted_secret misjudged a persisted key as ephemeral, authorize would refuse and mediated requests would be refused (fail closed, no secret leaves); the existing token, boot and dashboard paths do not call it.
  • Evidence checked (which sandbox result proves it): The sandbox leaf-only census tests count one more hidden leaf per tier, and test/test_sandbox_precreate_secret_dirs.py passes with the directory precreated. test/test_secrets_authorize_cli.py::test_first_authorize_publishes_nothing_on_an_ephemeral_signing_key and three new tests in test/test_mediated_request_provenance.py drive the real loader: the ephemeral case refuses (also when an earlier caller memoized it), and the persisted case signs and verifies. All three ephemeral tests fail when provenance is pointed back at _get_secret.
  • No regression:
    • Tools still work (which tools/commands were run, result): On this head: test_mediated_request_provenance, test_secrets_authorize_cli, test_mediated_request_policy, test_mediated_request_dispatch: 92 passed. test_token_auth_signing_secret, test_signing_key_preflight, test_token_auth, test_sandbox_signing_key_mask_unreadable, test_token_auth_facade, test_inline_payload_scoped_regressions: 434 passed. flake8, black, isort and mypy are clean on the changed files. test_sandbox_protected_name_holds.py::TestEnclosingHoldsNeverRegress fails locally only because of a real md-notebook directory in this host's data home; CI's clean home decides it.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. secret:// launch injection and every existing deny or mask entry are unchanged. _get_secret and load_boot_secret return the same values with the same memoization; the token suites above pass unchanged.
    • Existing tests (which suites passed on this head): the suites listed above; the wider set (test_transport_permission_floor, test_mediated_secret_request_handler, test_mcp_secrets) passed on the parent commit, which differs only by a constant rename.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture and get_persisted_secret changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

@RohanK6

RohanK6 commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Note on the CodeQL rename in this PR: the 9 "clear-text logging of sensitive information" alerts on a87e09a came from the constant name SECRET_POLICY_DIRNAME. Its value is the directory name "secret-request-policy", not a secret, and that path reaches ordinary path logging in atomic_write. CodeQL keys on names, so the word "secret" marked the path as sensitive. Renaming it to REQUEST_POLICY_DIRNAME makes the name match what it holds. The on-disk name and every behavior are unchanged, and no secret value reaches those logs.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 24, 2026
@RohanK6
RohanK6 force-pushed the feat/mediated-secret-egress-v4 branch from 9e3fd1a to af7ab44 Compare October 25, 2026 00:04
@RohanK6

RohanK6 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: af7ab44
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every namespace spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. dashboard/token_secret.py remembers whether its memoized signing secret is the loader's ephemeral fallback and adds get_persisted_secret(), which refuses it; the policy key's root reads through it. New on this head: kirocrew secrets authorize creates the directory itself (0700, refusing a link at the name) when the spawn backend is NOT the Linux namespace one.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks or denies the whole directory and the agent file tools refuse it; only the host gateway and the owner CLI open it. With token_signing.key unreadable, authorize refuses and publishes nothing instead of signing with a process-local key. On macOS Seatbelt and sandbox-off hosts, where nothing precreates the directory, authorize used to exit 1 on every run; it now creates the directory and works. On the Linux namespace backend it still never creates it.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the backend predicate wrongly answered "not namespace" on a Linux host, the CLI could create the directory while a sandbox started before it existed is running, so that sandbox would see it unmasked. It holds only the signed allowlist (no secret value), and a tampered entry fails signature verification. An unanswerable probe reads as "namespace" and keeps the refusal. If the mask failed, a planted entry still fails verification unless the agent can read token_signing.key, which stays hidden.
  • Evidence checked (which sandbox result proves it): sandbox_argv.sandbox_exec_argv documents that a Seatbelt deny holds for a name that does not exist yet, and detect_backend returns "none" for agent.sandbox: off. test/test_secrets_authorize_cli.py covers the non-namespace create (owner-only, then publishes), a planted link (refused, nothing written through it), the predicate for namespace / sandbox-exec / none, and the probe failure (fails closed). The create test fails with the create removed. The leaf census and test/test_sandbox_precreate_secret_dirs.py cover the mask and the precreate.
  • No regression:
    • Tools still work (which tools/commands were run, result): On this head: test_secrets_authorize_cli, test_mediated_request_provenance, test_mediated_request_policy, test_mediated_request_dispatch, test_mediated_secret_request_handler, test_mcp_secrets, test_cli_mcp_doctor, test_token_auth_signing_secret, test_signing_key_preflight, test_inline_payload_scoped_regressions, test_security_gate_liveness, test_agent_refactor_contracts, test_check_feature_map: 546 passed. flake8, black, isort and mypy are clean on the changed files.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. The Linux namespace path behaves as before (pinned by the existing refuse-without-directory test). _get_secret and load_boot_secret are unchanged for every other caller, and the token suites above pass unchanged.
    • Existing tests (which suites passed on this head): the 13 suites listed above. test_transport_permission_floor passed on an earlier head of this PR; its code is unchanged since.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture, get_persisted_secret and CLI-create changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

@RohanK6
RohanK6 force-pushed the feat/mediated-secret-egress-v4 branch from af7ab44 to c3d87e7 Compare October 25, 2026 00:51
@RohanK6

RohanK6 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: c3d87e7
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every namespace spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. dashboard/token_secret.py remembers whether its memoized signing secret is the loader's ephemeral fallback and adds get_persisted_secret(), which refuses it; the policy key's root reads through it. Since the previous head: kirocrew secrets authorize creates the directory itself (0700, refusing a link at the name) when the spawn backend is NOT the Linux namespace one.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks or denies the whole directory and the agent file tools refuse it; only the host gateway and the owner CLI open it. With token_signing.key unreadable, authorize refuses and publishes nothing instead of signing with a process-local key. On macOS Seatbelt and sandbox-off hosts, where nothing precreates the directory, authorize used to exit 1 on every run; it now creates the directory and works. On the Linux namespace backend it still never creates it.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the backend predicate wrongly answered "not namespace" on a Linux host, the CLI could create the directory while a sandbox started before it existed is running, so that sandbox would see it unmasked. It holds only the signed allowlist (no secret value), and a tampered entry fails signature verification. An unanswerable probe reads as "namespace" and keeps the refusal. If the mask failed, a planted entry still fails verification unless the agent can read token_signing.key, which stays hidden.
  • Evidence checked (which sandbox result proves it): sandbox_argv.sandbox_exec_argv documents that a Seatbelt deny holds for a name that does not exist yet, and detect_backend returns "none" for agent.sandbox: off. test/test_secrets_authorize_cli.py covers the non-namespace create (owner-only, then publishes), a planted link (refused, nothing written through it), the predicate for namespace / sandbox-exec / none, and the probe failure (fails closed). The create test fails with the create removed. The leaf census and test/test_sandbox_precreate_secret_dirs.py cover the mask and the precreate.
  • No regression:
    • Tools still work (which tools/commands were run, result): On this head: test_secrets_authorize_cli, test_mediated_request_provenance, test_mediated_request_policy, test_mediated_request_dispatch, test_mediated_secret_request_handler, test_mcp_secrets, test_cli_mcp_doctor, test_token_auth_signing_secret, test_signing_key_preflight, test_inline_payload_scoped_regressions, test_security_gate_liveness, test_agent_refactor_contracts, test_check_feature_map: 546 passed. flake8, black, isort and mypy are clean on the changed files.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. The Linux namespace path behaves as before (pinned by the existing refuse-without-directory test). _get_secret and load_boot_secret are unchanged for every other caller, and the token suites above pass unchanged.
    • Existing tests (which suites passed on this head): after rebasing onto main (conflicts only in two count lines, now stacked on main's new member-records leaf: leaf-only holds 294/301/302, package budget 32,530): test_security_gate_liveness, test_sandbox_protected_name_holds (leaf-only counts pass; the enclosing-hold check fails only on this host's real md-notebook dir), test_secrets_authorize_cli, test_mediated_*, test_transport_permission_floor, test_mcp_secrets, test_sandbox_precreate_secret_dirs: 276 passed.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture, get_persisted_secret and CLI-create changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

@RohanK6
RohanK6 force-pushed the feat/mediated-secret-egress-v4 branch from c3d87e7 to a75e409 Compare October 25, 2026 00:59
@RohanK6

RohanK6 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: a75e409
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every namespace spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. dashboard/token_secret.py remembers whether its memoized signing secret is the loader's ephemeral fallback and adds get_persisted_secret(), which refuses it; the policy key's root reads through it. Since the previous head: kirocrew secrets authorize creates the directory itself (0700, refusing a link at the name) when the spawn backend is NOT the Linux namespace one.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks or denies the whole directory and the agent file tools refuse it; only the host gateway and the owner CLI open it. With token_signing.key unreadable, authorize refuses and publishes nothing instead of signing with a process-local key. On macOS Seatbelt and sandbox-off hosts, where nothing precreates the directory, authorize used to exit 1 on every run; it now creates the directory and works. On the Linux namespace backend it still never creates it.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the backend predicate wrongly answered "not namespace" on a Linux host, the CLI could create the directory while a sandbox started before it existed is running, so that sandbox would see it unmasked. It holds only the signed allowlist (no secret value), and a tampered entry fails signature verification. An unanswerable probe reads as "namespace" and keeps the refusal. If the mask failed, a planted entry still fails verification unless the agent can read token_signing.key, which stays hidden.
  • Evidence checked (which sandbox result proves it): sandbox_argv.sandbox_exec_argv documents that a Seatbelt deny holds for a name that does not exist yet, and detect_backend returns "none" for agent.sandbox: off. test/test_secrets_authorize_cli.py covers the non-namespace create (owner-only, then publishes), a planted link (refused, nothing written through it), the predicate for namespace / sandbox-exec / none, and the probe failure (fails closed). The create test fails with the create removed. The leaf census and test/test_sandbox_precreate_secret_dirs.py cover the mask and the precreate.
  • No regression:
    • Tools still work (which tools/commands were run, result): On this head: test_secrets_authorize_cli, test_mediated_request_provenance, test_mediated_request_policy, test_mediated_request_dispatch, test_mediated_secret_request_handler, test_mcp_secrets, test_cli_mcp_doctor, test_token_auth_signing_secret, test_signing_key_preflight, test_inline_payload_scoped_regressions, test_security_gate_liveness, test_agent_refactor_contracts, test_check_feature_map: 546 passed. flake8, black, isort and mypy are clean on the changed files.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. The Linux namespace path behaves as before (pinned by the existing refuse-without-directory test). _get_secret and load_boot_secret are unchanged for every other caller, and the token suites above pass unchanged.
    • Existing tests (which suites passed on this head): after rebasing onto main (conflicts only in two count lines, now stacked on main's new member-records leaf: leaf-only holds 294/301/302, package budget 32,530): test_security_gate_liveness, test_sandbox_protected_name_holds (leaf-only counts pass; the enclosing-hold check fails only on this host's real md-notebook dir), test_secrets_authorize_cli, test_mediated_*, test_transport_permission_floor, test_mcp_secrets, test_sandbox_precreate_secret_dirs: 276 passed.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture, get_persisted_secret and CLI-create changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

Since c3d87e7: one docs-only change, the kirocrew-secrets row moved into the managed-server table in docs/architecture/mcp.md. No code or test changed.

@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 25, 2026
@RohanK6
RohanK6 force-pushed the feat/mediated-secret-egress-v4 branch from a75e409 to b608688 Compare October 25, 2026 01:20
@RohanK6

RohanK6 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: b608688
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every namespace spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. dashboard/token_secret.py remembers whether its memoized signing secret is the loader's ephemeral fallback and adds get_persisted_secret(), which refuses it; the policy key's root reads through it. Since the previous head: kirocrew secrets authorize creates the directory itself (0700, refusing a link at the name) when the spawn backend is NOT the Linux namespace one.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks or denies the whole directory and the agent file tools refuse it; only the host gateway and the owner CLI open it. With token_signing.key unreadable, authorize refuses and publishes nothing instead of signing with a process-local key. On macOS Seatbelt and sandbox-off hosts, where nothing precreates the directory, authorize used to exit 1 on every run; it now creates the directory and works. On the Linux namespace backend it still never creates it.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the backend predicate wrongly answered "not namespace" on a Linux host, the CLI could create the directory while a sandbox started before it existed is running, so that sandbox would see it unmasked. It holds only the signed allowlist (no secret value), and a tampered entry fails signature verification. An unanswerable probe reads as "namespace" and keeps the refusal. If the mask failed, a planted entry still fails verification unless the agent can read token_signing.key, which stays hidden.
  • Evidence checked (which sandbox result proves it): sandbox_argv.sandbox_exec_argv documents that a Seatbelt deny holds for a name that does not exist yet, and detect_backend returns "none" for agent.sandbox: off. test/test_secrets_authorize_cli.py covers the non-namespace create (owner-only, then publishes), a planted link (refused, nothing written through it), the predicate for namespace / sandbox-exec / none, and the probe failure (fails closed). The create test fails with the create removed. The leaf census and test/test_sandbox_precreate_secret_dirs.py cover the mask and the precreate.
  • No regression:
    • Tools still work (which tools/commands were run, result): On this head: test_secrets_authorize_cli, test_mediated_request_provenance, test_mediated_request_policy, test_mediated_request_dispatch, test_mediated_secret_request_handler, test_mcp_secrets, test_cli_mcp_doctor, test_token_auth_signing_secret, test_signing_key_preflight, test_inline_payload_scoped_regressions, test_security_gate_liveness, test_agent_refactor_contracts, test_check_feature_map: 546 passed. flake8, black, isort and mypy are clean on the changed files.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. The Linux namespace path behaves as before (pinned by the existing refuse-without-directory test). _get_secret and load_boot_secret are unchanged for every other caller, and the token suites above pass unchanged.
    • Existing tests (which suites passed on this head): after rebasing onto main (conflicts only in two count lines, now stacked on main's new member-records leaf: leaf-only holds 294/301/302, package budget 32,530): test_security_gate_liveness, test_sandbox_protected_name_holds (leaf-only counts pass; the enclosing-hold check fails only on this host's real md-notebook dir), test_secrets_authorize_cli, test_mediated_*, test_transport_permission_floor, test_mcp_secrets, test_sandbox_precreate_secret_dirs: 276 passed.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture, get_persisted_secret and CLI-create changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

Since c3d87e7: docs only (the kirocrew-secrets row moved into the managed-server table in docs/architecture/mcp.md) and a test-only change (the two symlink-creating tests in test/test_secrets_authorize_cli.py now carry @requires_symlinks; 22 passed). No product code changed.

@RohanK6
RohanK6 force-pushed the feat/mediated-secret-egress-v4 branch from b608688 to 79077ae Compare October 25, 2026 01:58
@RohanK6

RohanK6 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 79077ae
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every namespace spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. dashboard/token_secret.py remembers whether its memoized signing secret is the loader's ephemeral fallback and adds get_persisted_secret(), which refuses it; the policy key's root reads through it. Since the previous head: kirocrew secrets authorize creates the directory itself (0700, refusing a link at the name) when the spawn backend is NOT the Linux namespace one.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks or denies the whole directory and the agent file tools refuse it; only the host gateway and the owner CLI open it. With token_signing.key unreadable, authorize refuses and publishes nothing instead of signing with a process-local key. On macOS Seatbelt and sandbox-off hosts, where nothing precreates the directory, authorize used to exit 1 on every run; it now creates the directory and works. On the Linux namespace backend it still never creates it.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the backend predicate wrongly answered "not namespace" on a Linux host, the CLI could create the directory while a sandbox started before it existed is running, so that sandbox would see it unmasked. It holds only the signed allowlist (no secret value), and a tampered entry fails signature verification. An unanswerable probe reads as "namespace" and keeps the refusal. If the mask failed, a planted entry still fails verification unless the agent can read token_signing.key, which stays hidden.
  • Evidence checked (which sandbox result proves it): sandbox_argv.sandbox_exec_argv documents that a Seatbelt deny holds for a name that does not exist yet, and detect_backend returns "none" for agent.sandbox: off. test/test_secrets_authorize_cli.py covers the non-namespace create (owner-only, then publishes), a planted link (refused, nothing written through it), the predicate for namespace / sandbox-exec / none, and the probe failure (fails closed). The create test fails with the create removed. The leaf census and test/test_sandbox_precreate_secret_dirs.py cover the mask and the precreate.
  • No regression:
    • Tools still work (which tools/commands were run, result): On this head: test_secrets_authorize_cli, test_mediated_request_provenance, test_mediated_request_policy, test_mediated_request_dispatch, test_mediated_secret_request_handler, test_mcp_secrets, test_cli_mcp_doctor, test_token_auth_signing_secret, test_signing_key_preflight, test_inline_payload_scoped_regressions, test_security_gate_liveness, test_agent_refactor_contracts, test_check_feature_map: 546 passed. flake8, black, isort and mypy are clean on the changed files.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. The Linux namespace path behaves as before (pinned by the existing refuse-without-directory test). _get_secret and load_boot_secret are unchanged for every other caller, and the token suites above pass unchanged.
    • Existing tests (which suites passed on this head): after rebasing onto main (conflicts only in two count lines, now stacked on main's new member-records leaf: leaf-only holds 294/301/302, package budget 32,530): test_security_gate_liveness, test_sandbox_protected_name_holds (leaf-only counts pass; the enclosing-hold check fails only on this host's real md-notebook dir), test_secrets_authorize_cli, test_mediated_*, test_transport_permission_floor, test_mcp_secrets, test_sandbox_precreate_secret_dirs: 276 passed.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture, get_persisted_secret and CLI-create changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

Since b608688: in both approval transports (acp/client_permissions.py, acp/session_handle_permissions.py) a final-floor refusal inside approve_tool now invalidates any mediated-secret grant an earlier approval minted for the same call id, before delegating to reject_tool (which found the event already popped). New test_a_floor_refused_reprompt_drops_the_earlier_grant_for_its_call_id covers both transports and fails without the fix. On this head: test_transport_permission_floor, test_security_gate_liveness, test_secrets_authorize_cli, test_mediated_, test_mcp_secrets, test_agent_refactor_contracts: 312 passed; test_acp_client and test_session_handle*: 1271 passed.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 25, 2026
@RohanK6

RohanK6 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 9dc3c48
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every namespace spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. dashboard/token_secret.py adds get_persisted_secret(), which refuses the loader's ephemeral fallback, and the policy key's root reads through it. kirocrew secrets authorize creates the directory itself (0700, refusing a link at the name) only when agent spawns are not on the Linux namespace backend. The sandboxed kirocrew-secrets stub sends its credential only after the socket peer passes the kernel principal check and the shared cli_server_peer._connected_unix_peer_is_recorded_gateway proof.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks or denies the whole directory and the agent file tools refuse it; only the host gateway and the owner CLI open it. It holds only the owner-signed allowlist and its lock, never a secret value. With token_signing.key unreadable, authorize refuses and publishes nothing. On macOS Seatbelt and sandbox-off hosts, authorize creates the directory instead of exiting 1. No existing path gains or loses access.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the mask failed, an agent could read the allowlist or plant entries; a planted entry still fails signature verification unless the agent can also read token_signing.key, which stays hidden. If the backend predicate misread a Linux host, the CLI could create the directory under a running sandbox that would see it unmasked; an unanswerable probe keeps the refuse-unless-precreated path. If the peer proof wrongly refused, the mediated call fails closed with nothing sent. No existing command or user path is touched.
  • Evidence checked (which sandbox result proves it): test/test_sandbox_protected_name_holds.py holds the directory leaf-only like every other data-home root directory, three entries per tier, and test_no_hold_is_unrecorded passes. test/test_secrets_authorize_cli.py proves the CLI publishes only inside it and refuses a link at the name. test/test_mcp_secrets.py::test_refuses_a_rebound_dashboard_socket_before_sending drives the shared peer proof and refuses a principal mismatch, an unverifiable principal, another pid, a recycled pid, an absent record and an unreadable peer.
  • No regression:
    • Tools still work (which tools/commands were run, result): test_security_gate_liveness, test_sandbox_protected_name_holds, test_mediated_request_policy, test_secrets_authorize_cli, test_mcp_stub_overrides, test_dashboard_server_composition_contract_reach, test_mcp_secrets and test_mediated_secret_request_handler, 171 passed on the parent of this head. This head adds only refreshed screenshot PNGs and a rebase onto main; the sensitive files' hunks are unchanged. flake8, black, isort, comment-history and brand-name clean on the touched test file.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. secret:// launch injection and every existing deny or mask entry are unchanged (the diff only adds entries). cli_server_peer itself is unchanged; the stub only calls it.
    • Existing tests (which suites passed on this head): the suites listed above.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture, get_persisted_secret, CLI and stub changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

@RohanK6

RohanK6 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author
  • Screenshots show an older custom_description copy

fixed in 9dc3c48: both committed screenshots were recaptured with website/scripts/capture-secrets-custom-description.mjs against a fresh build of this revision, so they now show the shipped two-sentence settings.secrets.custom_description copy.

@RohanK6

RohanK6 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: outbound credential scan in _refuse_if_outbound_redacted

  • span=e9d67b1d0c44 Leaf-only scanning loses credential context before egress

fixed in f72c482: the outbound gate keeps the per-leaf scan and also scans the serialized json_body, each caller header as a joined name: value line, and the URL with its query map assembled, all before the vault read.
Every site named (body Authorization field, nested JSON fields, X-Authorization header, query token) now reaches redact_credentials with its key context.
test_contextual_outbound_credentials_are_refused pins all three shapes (red on the parent, green on the fix); test_clean_contextual_outbound_payload_passes keeps a clean payload passing.

@RohanK6

RohanK6 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: f72c482
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every namespace spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. dashboard/token_secret.py adds get_persisted_secret(), which refuses the loader's ephemeral fallback, and the policy key's root reads through it. kirocrew secrets authorize creates the directory itself (0700, refusing a link at the name) only when agent spawns are not on the Linux namespace backend. The sandboxed kirocrew-secrets stub sends its credential only after the socket peer passes the kernel principal check and the shared cli_server_peer._connected_unix_peer_is_recorded_gateway proof.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks or denies the whole directory and the agent file tools refuse it; only the host gateway and the owner CLI open it. It holds only the owner-signed allowlist and its lock, never a secret value. With token_signing.key unreadable, authorize refuses and publishes nothing. On macOS Seatbelt and sandbox-off hosts, authorize creates the directory instead of exiting 1. No existing path gains or loses access.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the mask failed, an agent could read the allowlist or plant entries; a planted entry still fails signature verification unless the agent can also read token_signing.key, which stays hidden. If the backend predicate misread a Linux host, the CLI could create the directory under a running sandbox that would see it unmasked; an unanswerable probe keeps the refuse-unless-precreated path. If the peer proof wrongly refused, the mediated call fails closed with nothing sent. No existing command or user path is touched.
  • Evidence checked (which sandbox result proves it): test/test_sandbox_protected_name_holds.py holds the directory leaf-only like every other data-home root directory, three entries per tier, and test_no_hold_is_unrecorded passes. test/test_secrets_authorize_cli.py proves the CLI publishes only inside it and refuses a link at the name. test/test_mcp_secrets.py::test_refuses_a_rebound_dashboard_socket_before_sending drives the shared peer proof and refuses a principal mismatch, an unverifiable principal, another pid, a recycled pid, an absent record and an unreadable peer.
  • No regression:
    • Tools still work (which tools/commands were run, result): On this head: test_mediated_request_dispatch, test_mediated_secret_request_handler, test_mcp_secrets, test_mediated_request_policy, test_secrets_authorize_cli, test_security_gate_liveness and test_link_unfurl, 306 passed; test_mediated_request_dispatch 5 repeats, 39 passed each; flake-pattern ratchet 64 passed; mypy src/kiro_crew clean; flake8, black, isort, comment-history and brand-name clean. Beyond a rebase, this head changes only secrets_mediation/dispatch.py (the outbound credential gate also scans the serialized body, joined header lines and the assembled URL, refusing more, never less) and its tests; the sensitive files' hunks are unchanged.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. secret:// launch injection and every existing deny or mask entry are unchanged (the diff only adds entries). cli_server_peer itself is unchanged; the stub only calls it.
    • Existing tests (which suites passed on this head): the suites listed above.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture, get_persisted_secret, CLI and stub changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

@iamwhatever

Copy link
Copy Markdown
Contributor

Recommend HOLD at f72c482. This PR needs a human reviewer, and it currently has a merge conflict with main.

The change adds a credential-bearing outbound HTTPS path, two new gateway routes, approval-minted capabilities in the ACP permission paths, and new sandbox and file-tool deny rows. Changes like these are reserved for a person. In the parts I read I found no defect. _admit requires internal auth plus an attested member scope, and the pre-send checks refuse a bad method, origin or credential-shaped payload before the vault is read. I did not read the policy, provenance, capability store, CLI or ACP hunks line by line. CI is green.

Open notes on this head with no reply:

  • Design: rotating token_signing.key silently invalidates every authorization. The refusal should tell the owner to re-authorize with --reset.
  • First Principles item 9: the Custom-secrets card copy is reworded in all 13 locales, beyond the authorize pointer the goal needs.
  • UX: the card names kirocrew secrets authorize without the required NAME and URL, and does not mention assigning the kirocrew-secrets tool set.

To clear: rebase onto main to resolve the conflict, reply to the notes above, and have a maintainer review the egress, approval and sandbox changes.

— crew-pr-reviewer (r131)

@RohanK6

RohanK6 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 283ce47
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every namespace spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. dashboard/token_secret.py adds get_persisted_secret(), which refuses the loader's ephemeral fallback, and the policy key's root reads through it. kirocrew secrets authorize creates the directory itself (0700, refusing a link at the name) only when agent spawns are not on the Linux namespace backend. The sandboxed kirocrew-secrets stub sends its credential only after the socket peer passes the kernel principal check and the shared cli_server_peer._connected_unix_peer_is_recorded_gateway proof.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks or denies the whole directory and the agent file tools refuse it; only the host gateway and the owner CLI open it. It holds only the owner-signed allowlist and its lock, never a secret value. With token_signing.key unreadable, authorize refuses and publishes nothing. On macOS Seatbelt and sandbox-off hosts, authorize creates the directory instead of exiting 1. No existing path gains or loses access.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the mask failed, an agent could read the allowlist or plant entries; a planted entry still fails signature verification unless the agent can also read token_signing.key, which stays hidden. If the backend predicate misread a Linux host, the CLI could create the directory under a running sandbox that would see it unmasked; an unanswerable probe keeps the refuse-unless-precreated path. If the peer proof wrongly refused, the mediated call fails closed with nothing sent. No existing command or user path is touched.
  • Evidence checked (which sandbox result proves it): test/test_sandbox_protected_name_holds.py holds the directory leaf-only like every other data-home root directory, three entries per tier, and test_no_hold_is_unrecorded passes. test/test_secrets_authorize_cli.py proves the CLI publishes only inside it and refuses a link at the name. test/test_mcp_secrets.py::test_refuses_a_rebound_dashboard_socket_before_sending drives the shared peer proof and refuses a principal mismatch, an unverifiable principal, another pid, a recycled pid, an absent record and an unreadable peer.
  • No regression:
    • Tools still work (which tools/commands were run, result): On this head: test_security_gate_liveness, test_dashboard_server_composition_contract_reach, test_sandbox_protected_name_holds, test_mediated_request_dispatch, test_mediated_secret_request_handler, test_mcp_secrets, test_mediated_request_policy, test_secrets_authorize_cli and test_mcp_stub_overrides, 210 passed. flake8, black, isort, comment-history and brand-name clean on the two files the rebase touched. This head differs from the reviewed product code only by a rebase onto main; the sensitive files' hunks are unchanged.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. secret:// launch injection and every existing deny or mask entry are unchanged (the diff only adds entries). cli_server_peer itself is unchanged; the stub only calls it.
    • Existing tests (which suites passed on this head): the suites listed above.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture, get_persisted_secret, CLI and stub changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

@RohanK6

RohanK6 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: hand-rolled session-key ladder in mcp_secrets._resolve_session_key

  • span=dcde9e0932fc Resolve signed session identity for native member calls

fixed in 0209c57: after the verified per-call caller key, _resolve_session_key uses the shared mcp_caller.resolve_own_identity() ladder, so the signed per-session token resolves an unbrokered member session.
A protected-binding refusal or a failed resolution returns an empty key, so the host endpoint still refuses; nothing falls through to the env key.
test_resolve_session_key_uses_the_signed_session_token is red on the parent and green on the fix; the two real_ladder tests pin both refusals through the shared resolver.

@RohanK6

RohanK6 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 0209c57
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every namespace spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. dashboard/token_secret.py adds get_persisted_secret(), which refuses the loader's ephemeral fallback, and the policy key's root reads through it. kirocrew secrets authorize creates the directory itself (0700, refusing a link at the name) only when agent spawns are not on the Linux namespace backend. The sandboxed kirocrew-secrets stub sends its credential only after the socket peer passes the kernel principal check and the shared cli_server_peer._connected_unix_peer_is_recorded_gateway proof, and names its session through the shared mcp_caller.resolve_own_identity() ladder after the verified per-call caller key.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks or denies the whole directory and the agent file tools refuse it; only the host gateway and the owner CLI open it. It holds only the owner-signed allowlist and its lock, never a secret value. With token_signing.key unreadable, authorize refuses and publishes nothing. On macOS Seatbelt and sandbox-off hosts, authorize creates the directory instead of exiting 1. No existing path gains or loses access.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the mask failed, an agent could read the allowlist or plant entries; a planted entry still fails signature verification unless the agent can also read token_signing.key, which stays hidden. If the backend predicate misread a Linux host, the CLI could create the directory under a running sandbox that would see it unmasked; an unanswerable probe keeps the refuse-unless-precreated path. If the peer proof or the session resolution wrongly refused, the mediated call fails closed with nothing sent. No existing command or user path is touched.
  • Evidence checked (which sandbox result proves it): test/test_sandbox_protected_name_holds.py holds the directory leaf-only like every other data-home root directory, three entries per tier, and test_no_hold_is_unrecorded passes. test/test_secrets_authorize_cli.py proves the CLI publishes only inside it and refuses a link at the name. test/test_mcp_secrets.py::test_refuses_a_rebound_dashboard_socket_before_sending drives the shared peer proof; the two real_ladder tests in that file prove an explicit invalid protected record and a raising probe still refuse through the shared resolver, never falling through to the env key.
  • No regression:
    • Tools still work (which tools/commands were run, result): test_mcp_secrets, test_mediated_secret_request_handler, test_mcp_caller, test_mediated_request_dispatch, test_security_gate_liveness, test_dashboard_server_composition_contract_reach, test_cli_lazy_imports and test_mcp_shared, 324 passed; on this head after the final rebase, test_security_gate_liveness, test_dashboard_server_composition_contract_reach, test_mcp_secrets and test_mcp_stub_overrides, 84 passed; test_mcp_secrets 5 repeats, 24 passed each; flake-pattern ratchet 64 passed; mypy src/kiro_crew clean; flake8, black, isort, comment-history, brand-name and file-line-cap clean. Beyond a rebase, this head changes only mcp_secrets.py (session resolution) and its tests; the sensitive files' hunks are unchanged.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. secret:// launch injection and every existing deny or mask entry are unchanged (the diff only adds entries). cli_server_peer and mcp_caller are unchanged; the stub only calls them.
    • Existing tests (which suites passed on this head): the suites listed above.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture, get_persisted_secret, CLI and stub changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

@RohanK6

RohanK6 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: ed18228
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every namespace spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. dashboard/token_secret.py adds get_persisted_secret(), which refuses the loader's ephemeral fallback, and the policy key's root reads through it. kirocrew secrets authorize creates the directory itself (0700, refusing a link at the name) only when agent spawns are not on the Linux namespace backend. The sandboxed kirocrew-secrets stub sends its credential only after the socket peer passes the kernel principal check and the shared cli_server_peer._connected_unix_peer_is_recorded_gateway proof, and names its session through the shared mcp_caller.resolve_own_identity() ladder after the verified per-call caller key.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks or denies the whole directory and the agent file tools refuse it; only the host gateway and the owner CLI open it. It holds only the owner-signed allowlist and its lock, never a secret value. With token_signing.key unreadable, authorize refuses and publishes nothing. On macOS Seatbelt and sandbox-off hosts, authorize creates the directory instead of exiting 1. No existing path gains or loses access.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the mask failed, an agent could read the allowlist or plant entries; a planted entry still fails signature verification unless the agent can also read token_signing.key, which stays hidden. If the backend predicate misread a Linux host, the CLI could create the directory under a running sandbox that would see it unmasked; an unanswerable probe keeps the refuse-unless-precreated path. If the peer proof or the session resolution wrongly refused, the mediated call fails closed with nothing sent. No existing command or user path is touched.
  • Evidence checked (which sandbox result proves it): test/test_sandbox_protected_name_holds.py holds the directory leaf-only like every other data-home root directory, three entries per tier, and test_no_hold_is_unrecorded passes. test/test_sandbox_governance_mask.py and test/test_sandbox_precreate_secret_dirs.py pass. test/test_secrets_authorize_cli.py proves the CLI publishes only inside it and refuses a link at the name. test/test_mcp_secrets.py drives the shared peer proof and pins both protected-binding refusals through the real shared resolver.
  • No regression:
    • Tools still work (which tools/commands were run, result): On the parent of this head (same tree apart from main's newer docs, i18n and CLI commits): every test file this PR changes plus test_mcp_caller, test_link_unfurl, test_sandbox_governance_mask, test_sandbox_precreate_secret_dirs and test_sandbox_unavailable, 2437 passed; SecretsPanel.test.tsx 67 passed; flake8, black, isort, mypy src/kiro_crew, comment-history, brand-name, file-line-cap, harness-parity, docs-lint and the flake-pattern ratchet clean. This head differs from the reviewed product code only by rebases onto main; the sensitive files' hunks are unchanged.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. secret:// launch injection and every existing deny or mask entry are unchanged (the diff only adds entries). cli_server_peer and mcp_caller are unchanged; the stub only calls them.
    • Existing tests (which suites passed on this head): the suites listed above.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture, get_persisted_secret, CLI and stub changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

@RohanK6

RohanK6 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: eea559e
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every namespace spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. dashboard/token_secret.py adds get_persisted_secret(), which refuses the loader's ephemeral fallback, and the policy key's root reads through it. kirocrew secrets authorize creates the directory itself (0700, refusing a link at the name) only when agent spawns are not on the Linux namespace backend. The sandboxed kirocrew-secrets stub sends its credential only after the socket peer passes the kernel principal check and the shared cli_server_peer._connected_unix_peer_is_recorded_gateway proof, and names its session through the shared mcp_caller.resolve_own_identity() ladder after the verified per-call caller key.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks or denies the whole directory and the agent file tools refuse it; only the host gateway and the owner CLI open it. It holds only the owner-signed allowlist and its lock, never a secret value. With token_signing.key unreadable, authorize refuses and publishes nothing. On macOS Seatbelt and sandbox-off hosts, authorize creates the directory instead of exiting 1. No existing path gains or loses access.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the mask failed, an agent could read the allowlist or plant entries; a planted entry still fails signature verification unless the agent can also read token_signing.key, which stays hidden. If the backend predicate misread a Linux host, the CLI could create the directory under a running sandbox that would see it unmasked; an unanswerable probe keeps the refuse-unless-precreated path. If the peer proof or the session resolution wrongly refused, the mediated call fails closed with nothing sent. No existing command or user path is touched.
  • Evidence checked (which sandbox result proves it): test/test_sandbox_protected_name_holds.py holds the directory leaf-only like every other data-home root directory, three entries per tier, and test_no_hold_is_unrecorded passes. test/test_sandbox_governance_mask.py passes. test/test_secrets_authorize_cli.py proves the CLI publishes only inside it and refuses a link at the name. test/test_mcp_secrets.py drives the shared peer proof and pins both protected-binding refusals through the real shared resolver.
  • No regression:
    • Tools still work (which tools/commands were run, result): On this head: test_sandbox_refactor_facade, test_sandbox_protected_name_holds, test_sandbox_governance_mask, test_dashboard_server_composition_contract_reach, test_security_gate_liveness and test_secrets_authorize_cli, 1303 passed. On its parent (differs only by main's sandbox.py commit): every test file this PR changes plus test_mcp_caller and test_sandbox_governance_mask, 2256 passed; mypy src/kiro_crew clean; flake8, black, isort, comment-history, brand-name, file-line-cap, harness-parity and docs-lint clean. The sensitive files' hunks are unchanged by the rebases.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. secret:// launch injection and every existing deny or mask entry are unchanged (the diff only adds entries). cli_server_peer and mcp_caller are unchanged; the stub only calls them.
    • Existing tests (which suites passed on this head): the suites listed above.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture, get_persisted_secret, CLI and stub changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

@RohanK6

RohanK6 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: ee76e6e
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every namespace spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. dashboard/token_secret.py adds get_persisted_secret(), which refuses the loader's ephemeral fallback, and the policy key's root reads through it. kirocrew secrets authorize creates the directory itself (0700, refusing a link at the name) only when agent spawns are not on the Linux namespace backend. The sandboxed kirocrew-secrets stub sends its credential only after the socket peer passes the kernel principal check and the shared cli_server_peer._connected_unix_peer_is_recorded_gateway proof, and names its session through the shared mcp_caller.resolve_own_identity() ladder after the verified per-call caller key.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks or denies the whole directory and the agent file tools refuse it; only the host gateway and the owner CLI open it. It holds only the owner-signed allowlist and its lock, never a secret value. With token_signing.key unreadable, authorize refuses and publishes nothing. On macOS Seatbelt and sandbox-off hosts, authorize creates the directory instead of exiting 1. No existing path gains or loses access.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the mask failed, an agent could read the allowlist or plant entries; a planted entry still fails signature verification unless the agent can also read token_signing.key, which stays hidden. If the backend predicate misread a Linux host, the CLI could create the directory under a running sandbox that would see it unmasked; an unanswerable probe keeps the refuse-unless-precreated path. If the peer proof or the session resolution wrongly refused, the mediated call fails closed with nothing sent. No existing command or user path is touched.
  • Evidence checked (which sandbox result proves it): test/test_sandbox_protected_name_holds.py holds the directory leaf-only like every other data-home root directory, three entries per tier, and test_no_hold_is_unrecorded passes. test/test_sandbox_governance_mask.py passes. test/test_secrets_authorize_cli.py proves the CLI publishes only inside it and refuses a link at the name. test/test_mcp_secrets.py drives the shared peer proof and pins both protected-binding refusals through the real shared resolver.
  • No regression:
    • Tools still work (which tools/commands were run, result): On this head: every test touching security_posture or NON_EGRESS_REDACTION_MODULES plus test_mediated_request_dispatch and test_mcp_secrets, 2166 passed; mypy src/kiro_crew clean. On its parent (differs only by main's three-line security_posture.py deletion, which keeps this PR's entry): every test file this PR changes, 1621 passed; with test_mcp_caller, test_link_unfurl, the sandbox mask and precreate suites and test_host_git_repo_exec_neutralization, 2513 passed; SecretsPanel.test.tsx 67 passed; black, isort, flake8, comment-history, brand-name, file-line-cap, harness-parity, docs-lint and the flake-pattern ratchet clean.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. secret:// launch injection and every existing deny or mask entry are unchanged (the diff only adds entries). cli_server_peer and mcp_caller are unchanged; the stub only calls them.
    • Existing tests (which suites passed on this head): the suites listed above.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture, get_persisted_secret, CLI and stub changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

@RohanK6

RohanK6 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Frontend Lint & Type Check (and Coverage Gate, which waits on it) is red on ee76e6e for a main-wide reason, not this diff: the one error is website/src/components/RedactionCards.tsx:1102 (no-restricted-syntax, portal through OverlayPortal), introduced on main by #19843; this PR does not touch that file. The fix is #25429. Waiting for it to land, then rebasing.

@RohanK6

RohanK6 commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: fc7cdef
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every namespace spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. dashboard/token_secret.py adds get_persisted_secret(), which refuses the loader's ephemeral fallback, and the policy key's root reads through it. kirocrew secrets authorize creates the directory itself (0700, refusing a link at the name) only when agent spawns are not on the Linux namespace backend. The sandboxed kirocrew-secrets stub sends its credential only after the socket peer passes the kernel principal check and the shared cli_server_peer._connected_unix_peer_is_recorded_gateway proof, and names its session through the shared mcp_caller.resolve_own_identity() ladder after the verified per-call caller key.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks or denies the whole directory and the agent file tools refuse it; only the host gateway and the owner CLI open it. It holds only the owner-signed allowlist and its lock, never a secret value. With token_signing.key unreadable, authorize refuses and publishes nothing. On macOS Seatbelt and sandbox-off hosts, authorize creates the directory instead of exiting 1. No existing path gains or loses access.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the mask failed, an agent could read the allowlist or plant entries; a planted entry still fails signature verification unless the agent can also read token_signing.key, which stays hidden. If the backend predicate misread a Linux host, the CLI could create the directory under a running sandbox that would see it unmasked; an unanswerable probe keeps the refuse-unless-precreated path. If the peer proof or the session resolution wrongly refused, the mediated call fails closed with nothing sent. No existing command or user path is touched.
  • Evidence checked (which sandbox result proves it): test/test_sandbox_protected_name_holds.py holds the directory leaf-only like every other data-home root directory, three entries per tier, and test_no_hold_is_unrecorded passes. test/test_sandbox_governance_mask.py passes. test/test_secrets_authorize_cli.py proves the CLI publishes only inside it and refuses a link at the name. test/test_mcp_secrets.py drives the shared peer proof and pins both protected-binding refusals through the real shared resolver.
  • No regression:
    • Tools still work (which tools/commands were run, result): On the parent of this head (this head only adds main commits that touch none of this PR's files): every test file this PR changes, plus test_mcp_caller, test_link_unfurl, the sandbox mask and precreate suites and every suite referencing security_posture or NON_EGRESS_REDACTION_MODULES, 5014 passed; frontend npm run lint clean; SecretsPanel.test.tsx 67 passed; black, isort, flake8, mypy src/kiro_crew, comment-history, brand-name, file-line-cap, harness-parity, docs-lint and the flake-pattern ratchet clean. The sensitive files' hunks are unchanged by the rebase.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. secret:// launch injection and every existing deny or mask entry are unchanged (the diff only adds entries). cli_server_peer and mcp_caller are unchanged; the stub only calls them.
    • Existing tests (which suites passed on this head): the suites listed above.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture, get_persisted_secret, CLI and stub changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

@RohanK6

RohanK6 commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 97064d2
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every namespace spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. dashboard/token_secret.py adds get_persisted_secret(), which refuses the loader's ephemeral fallback, and the policy key's root reads through it. kirocrew secrets authorize creates the directory itself (0700, refusing a link at the name) only when agent spawns are not on the Linux namespace backend. The sandboxed kirocrew-secrets stub sends its credential only after the socket peer passes the kernel principal check and the shared cli_server_peer._connected_unix_peer_is_recorded_gateway proof, and names its session through the shared mcp_caller.resolve_own_identity() ladder after the verified per-call caller key.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks or denies the whole directory and the agent file tools refuse it; only the host gateway and the owner CLI open it. It holds only the owner-signed allowlist and its lock, never a secret value. With token_signing.key unreadable, authorize refuses and publishes nothing. On macOS Seatbelt and sandbox-off hosts, authorize creates the directory instead of exiting 1. No existing path gains or loses access.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the mask failed, an agent could read the allowlist or plant entries; a planted entry still fails signature verification unless the agent can also read token_signing.key, which stays hidden. If the backend predicate misread a Linux host, the CLI could create the directory under a running sandbox that would see it unmasked; an unanswerable probe keeps the refuse-unless-precreated path. If the peer proof or the session resolution wrongly refused, the mediated call fails closed with nothing sent. No existing command or user path is touched.
  • Evidence checked (which sandbox result proves it): test/test_sandbox_protected_name_holds.py holds the directory leaf-only like every other data-home root directory, three entries per tier, and test_no_hold_is_unrecorded passes. test/test_sandbox_governance_mask.py passes. test/test_secrets_authorize_cli.py proves the CLI publishes only inside it and refuses a link at the name. test/test_mcp_secrets.py drives the shared peer proof and pins both protected-binding refusals through the real shared resolver.
  • No regression:
    • Tools still work (which tools/commands were run, result): On this head: test_security_gate_liveness, test_dashboard_server_composition_contract_reach, test_sandbox_protected_name_holds, test_secrets_authorize_cli, test_mcp_secrets, test_mediated_request_dispatch and test_denied_commands_security, 212 passed; mypy src/kiro_crew clean; flake8, black and comment-history clean on the touched test file. On its parent: every test file this PR changes plus test_mcp_caller and test_sandbox_governance_mask, 2281 passed; black, isort, flake8, file-line-cap and docs-lint clean; one base earlier, frontend npm run lint clean and SecretsPanel.test.tsx 67 passed. Beyond rebases, only the two contract counts moved: the security package line budget to the measured 32,801 and the MCP route table to 318 rows. The sensitive files' hunks are unchanged.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. secret:// launch injection and every existing deny or mask entry are unchanged (the diff only adds entries). cli_server_peer and mcp_caller are unchanged; the stub only calls them.
    • Existing tests (which suites passed on this head): the suites listed above.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture, get_persisted_secret, CLI and stub changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

@iamwhatever

Copy link
Copy Markdown
Contributor

Hold for human review (policy-sensitive) at 97064d2.

This PR adds a credential-bearing outbound HTTPS path, two new gateway routes, approval-minted capabilities in the ACP permission paths, a policy MAC derived from token_signing.key, and new sandbox and file-tool deny rows. These are reserved for a maintainer. In the parts I read I found no defect: the policy key is derived from the persisted signing key only and fails closed on the ephemeral fallback (provenance.py#L56-L115, token_secret.py#L829-L906), and capabilities are single use and bound to the exact request (mediated_request_capability.py#L379-L423). The merge conflict from r131 is resolved and CI is green.

For the human reviewer:

  • First Principles item 4 has no reply: the tool depends on kiro-cli sending the tool-call id as _meta.progressToken, and no test proves it against kiro-cli. If that is wrong, every call fails closed.
  • On sandbox-off hosts nothing masks secret-request-policy/ (security.md#L855-L866), so the signed policy only holds while the agent cannot read token_signing.key; per-call owner approval stays the gate. Confirm that is the intended posture.
  • First Principles item 3: the separate claim route could be folded into the request route.

AI findings judged non-blocking:

  • Design: the fixed withheld result hides 2xx vs 5xx. A deliberate 'Not a goal' trade-off.
  • UX: the card copy omits the NAME URL arguments and the word 'authorize' reads as risky. Copy nits.

To clear: a maintainer reviews the egress, approval, signing-key and sandbox changes and rules on the points above.

— crew-pr-reviewer (r134)

@RohanK6

RohanK6 commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 043b926
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every namespace spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. dashboard/token_secret.py adds get_persisted_secret(), which refuses the loader's ephemeral fallback, and the policy key's root reads through it. kirocrew secrets authorize creates the directory itself (0700, refusing a link at the name) only when agent spawns are not on the Linux namespace backend. The sandboxed kirocrew-secrets stub sends its credential only after the socket peer passes the kernel principal check and the shared cli_server_peer._connected_unix_peer_is_recorded_gateway proof, and names its session through the shared mcp_caller.resolve_own_identity() ladder after the verified per-call caller key.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks or denies the whole directory and the agent file tools refuse it; only the host gateway and the owner CLI open it. It holds only the owner-signed allowlist and its lock, never a secret value. With token_signing.key unreadable, authorize refuses and publishes nothing. On macOS Seatbelt and sandbox-off hosts, authorize creates the directory instead of exiting 1. No existing path gains or loses access.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the mask failed, an agent could read the allowlist or plant entries; a planted entry still fails signature verification unless the agent can also read token_signing.key, which stays hidden. If the backend predicate misread a Linux host, the CLI could create the directory under a running sandbox that would see it unmasked; an unanswerable probe keeps the refuse-unless-precreated path. If the peer proof or the session resolution wrongly refused, the mediated call fails closed with nothing sent. No existing command or user path is touched.
  • Evidence checked (which sandbox result proves it): test/test_sandbox_protected_name_holds.py holds the directory leaf-only like every other data-home root directory, three entries per tier, and test_no_hold_is_unrecorded passes. test/test_sandbox_governance_mask.py passes. test/test_secrets_authorize_cli.py proves the CLI publishes only inside it and refuses a link at the name. test/test_mcp_secrets.py drives the shared peer proof and pins both protected-binding refusals through the real shared resolver.
  • No regression:
    • Tools still work (which tools/commands were run, result): On the parent of this head (this head only adds main commits that touch none of this PR's files): every test file this PR changes, plus test_mcp_caller, test_link_unfurl, the sandbox mask and precreate suites and every suite referencing security_posture or NON_EGRESS_REDACTION_MODULES, 5023 passed; mypy src/kiro_crew clean on a base that includes fix(crew-mode): import _frame_parents from crew_filing after the move #25706; frontend npm run lint clean; SecretsPanel.test.tsx 67 passed; black, isort, flake8, comment-history, brand-name, file-line-cap, harness-parity, docs-lint and the flake-pattern ratchet clean. Beyond the rebase, only contract counts moved, each set to the measured value: the security package line budget to 32,802, the MCP route table to 324 rows, and the dashboard boot census to 101 deferred steps. The sensitive files' hunks are unchanged.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. secret:// launch injection and every existing deny or mask entry are unchanged (the diff only adds entries). cli_server_peer and mcp_caller are unchanged; the stub only calls them.
    • Existing tests (which suites passed on this head): the suites listed above.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture, get_persisted_secret, CLI and stub changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

@RohanK6

RohanK6 commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author
  • The authorize instruction leaves out what else is needed

fixed in dcf4c80: the card names the whole recipe: an agent in a member chat, the opt-in @kirocrew-secrets grant, and where to run it (a shell or the Terminal page).
The command renders verbatim from a code constant in a element as kirocrew secrets authorize NAME https://api.example.com, so no translation can change it.
custom_description keeps only the vault and secret:// sentences; the new custom_authorize key is translated in all 11 catalogs with en-XA regenerated, and both screenshots are recaptured from this revision.

@RohanK6

RohanK6 commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: dcf4c80
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every namespace spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. dashboard/token_secret.py adds get_persisted_secret(), which refuses the loader's ephemeral fallback, and the policy key's root reads through it. kirocrew secrets authorize creates the directory itself (0700, refusing a link at the name) only when agent spawns are not on the Linux namespace backend. The sandboxed kirocrew-secrets stub sends its credential only after the socket peer passes the kernel principal check and the shared cli_server_peer._connected_unix_peer_is_recorded_gateway proof, and names its session through the shared mcp_caller.resolve_own_identity() ladder after the verified per-call caller key.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks or denies the whole directory and the agent file tools refuse it; only the host gateway and the owner CLI open it. It holds only the owner-signed allowlist and its lock, never a secret value. With token_signing.key unreadable, authorize refuses and publishes nothing. On macOS Seatbelt and sandbox-off hosts, authorize creates the directory instead of exiting 1. No existing path gains or loses access.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the mask failed, an agent could read the allowlist or plant entries; a planted entry still fails signature verification unless the agent can also read token_signing.key, which stays hidden. If the backend predicate misread a Linux host, the CLI could create the directory under a running sandbox that would see it unmasked; an unanswerable probe keeps the refuse-unless-precreated path. If the peer proof or the session resolution wrongly refused, the mediated call fails closed with nothing sent. No existing command or user path is touched.
  • Evidence checked (which sandbox result proves it): test/test_sandbox_protected_name_holds.py holds the directory leaf-only like every other data-home root directory, three entries per tier, and test_no_hold_is_unrecorded passes. test/test_sandbox_governance_mask.py passes. test/test_secrets_authorize_cli.py proves the CLI publishes only inside it and refuses a link at the name. test/test_mcp_secrets.py drives the shared peer proof and pins both protected-binding refusals through the real shared resolver.
  • No regression:
    • Tools still work (which tools/commands were run, result): On this head: test_security_gate_liveness, test_dashboard_server_composition_contract_reach, test_mcp_secrets, test_mediated_request_dispatch and test_sandbox_protected_name_holds, 115 passed. On its parent: every test file this PR changes plus the sandbox mask, precreate and security_posture suites, 5023 passed; mypy src/kiro_crew clean; frontend npm run lint, tsc -p tsconfig.app.json, npm run i18n:check and npm run build clean; SecretsPanel.test.tsx 67 passed; every i18n test including catalogParity, 1039 passed. Beyond the rebase, this head changes only the Custom-secrets card copy (SecretsPanel.tsx, its test, the i18n catalogs and the two screenshots); the sensitive files' hunks are unchanged.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. secret:// launch injection and every existing deny or mask entry are unchanged (the diff only adds entries). cli_server_peer and mcp_caller are unchanged; the stub only calls them.
    • Existing tests (which suites passed on this head): the suites listed above.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture, get_persisted_secret, CLI and stub changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

Add an opt-in kirocrew-secrets MCP server whose call_api_with_secret
tool lets an agent in a member conversation make one owner-authorized
HTTPS write call with a stored Custom secret. The gateway injects the
value host-side, so the plaintext never enters the sandbox, and every
call returns the same fixed result.

- `kirocrew secrets authorize NAME ORIGIN` binds a secret to one exact
  https origin in a policy signed with a key derived from the dashboard
  token-signing secret under its own purpose label (no key file, no
  boot-time mint). The policy and its lock live in
  secret-request-policy/, which every sandbox tier hides whole and
  which is precreated before any spawn. Only 64-char lowercase hex is
  accepted as a signature.
- Approving the tool mints a single-use capability bound to the call
  id and its exact arguments. Both approval transports mint it as the
  last check under the ACP write lock, after the withdrawal, liveness
  and grant-deadline checks, and revoke it, pending or claimed, when
  the answer is not delivered. Cancelling a turn on either ACP path
  revokes that session's grants first.
- The host routes require the internal secret plus an attested member
  scope (member_request_scope), then claim and consume the capability.
- Dispatch vets every hop with link_unfurl.vet_unfurl_url and sends
  through pinned_connector, pads completion to the request deadline,
  and refuses outbound values the redactors would change.
- The stub verifies the gateway peer on the owner-only socket and
  refuses explicitly on Windows.

Fixes #8628
@RohanK6

RohanK6 commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 4fc1629
  • What rule changed: One new data-home directory, secret-request-policy/, is added to the crew hidden leaves (sandbox_leaves.py), precreated as a hidden directory before every namespace spawn (sandbox_precreate.py), and added to the agent file-tool secret deny list (security/paths_lists.py). secrets_mediation/dispatch.py is registered in NON_EGRESS_REDACTION_MODULES (security_posture.py) as a refusal gate. dashboard/token_secret.py adds get_persisted_secret(), which refuses the loader's ephemeral fallback, and the policy key's root reads through it. kirocrew secrets authorize creates the directory itself (0700, refusing a link at the name) only when agent spawns are not on the Linux namespace backend. The sandboxed kirocrew-secrets stub sends its credential only after the socket peer passes the kernel principal check and the shared cli_server_peer._connected_unix_peer_is_recorded_gateway proof, and names its session through the shared mcp_caller.resolve_own_identity() ladder after the verified per-call caller key.
  • Before -> after (what was allowed/blocked, now): Before, the directory did not exist and nothing read it. After, every sandbox tier masks or denies the whole directory and the agent file tools refuse it; only the host gateway and the owner CLI open it. It holds only the owner-signed allowlist and its lock, never a secret value. With token_signing.key unreadable, authorize refuses and publishes nothing. On macOS Seatbelt and sandbox-off hosts, authorize creates the directory instead of exiting 1. No existing path gains or loses access.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the mask failed, an agent could read the allowlist or plant entries; a planted entry still fails signature verification unless the agent can also read token_signing.key, which stays hidden. If the backend predicate misread a Linux host, the CLI could create the directory under a running sandbox that would see it unmasked; an unanswerable probe keeps the refuse-unless-precreated path. If the peer proof or the session resolution wrongly refused, the mediated call fails closed with nothing sent. No existing command or user path is touched.
  • Evidence checked (which sandbox result proves it): test/test_sandbox_protected_name_holds.py holds the directory leaf-only like every other data-home root directory, three entries per tier, and test_no_hold_is_unrecorded passes. test/test_sandbox_governance_mask.py passes. test/test_secrets_authorize_cli.py proves the CLI publishes only inside it and refuses a link at the name. test/test_mcp_secrets.py drives the shared peer proof and pins both protected-binding refusals through the real shared resolver.
  • No regression:
    • Tools still work (which tools/commands were run, result): On this head: frontend npm run i18n:check against the merge base (19 checks pass), tsc -p tsconfig.app.json and npm run lint clean, SecretsPanel.test.tsx plus every i18n test including catalogParity, 1106 passed. On its parent: test_security_gate_liveness, test_dashboard_server_composition_contract_reach, test_mcp_secrets, test_mediated_request_dispatch and test_sandbox_protected_name_holds, 115 passed; and one base earlier, every test file this PR changes plus the sandbox mask, precreate and security_posture suites, 5023 passed with mypy src/kiro_crew clean. This head changes only frontend copy plumbing beyond its parent: the two card literals move into secretsAuthorizeCommand.ts with a one-file exemption in eslint.i18n.config.js. The sensitive files' hunks are unchanged.
    • Backward compatible (old config / old data / old callers still work, how checked): The directory and the opt-in kirocrew-secrets server are new. secret:// launch injection and every existing deny or mask entry are unchanged (the diff only adds entries). cli_server_peer and mcp_caller are unchanged; the stub only calls them.
    • Existing tests (which suites passed on this head): the suites listed above.
  • How to undo: Revert this PR's commit. That removes the leaf, precreate, deny-list, posture, get_persisted_secret, CLI and stub changes together with the feature. A leftover secret-request-policy/ directory is inert once nothing reads it.

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.

feat(secrets): mediate custom-secret API calls from chat

2 participants