Repository navigation
feat(secrets): mediate Custom-secret API calls from member chats - #23855
Conversation
Sensitive change review
|
Design Review (Opus 5.5) — ✅ PASSDesign-level review of 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
[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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of 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
What this change shipsInventory (9 items) — 8 justifiedIntent: 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.
[FIRST-PRINCIPLES-REVIEWED] 4fc1629 Description read[DESCRIPTION-READ] 9025a1720e60c2bb53f86213a99edc24add6df78881e9b68860e7a6bdf327f78 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of 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. BlockersThe authorize step uses unexplained terms and gives an incomplete command
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:
Notes
[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 |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Security Scope Review -- ✅ PASSWhich legitimate operations does Verdict basis: adjudicated, zero confirmed regressions. Security scope review -- adjudicated candidates
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 TIGHTENING: The agent file-tool floor ADJUDICATED: 16 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: The diff makes three platform assumptions: the
UNADJUDICATED:
[SCOPE-REVIEWED] 4fc1629 |
8e0f09b to
a87e09a
Compare
5e682cd to
9e3fd1a
Compare
Sensitive change review
|
|
Note on the CodeQL rename in this PR: the 9 "clear-text logging of sensitive information" alerts on |
9e3fd1a to
af7ab44
Compare
Sensitive change review
|
af7ab44 to
c3d87e7
Compare
Sensitive change review
|
c3d87e7 to
a75e409
Compare
Sensitive change review
Since c3d87e7: one docs-only change, the |
a75e409 to
b608688
Compare
Sensitive change review
Since c3d87e7: docs only (the |
b608688 to
79077ae
Compare
Sensitive change review
Since b608688: in both approval transports ( |
Sensitive change review
|
|
|
self-added: yes
|
Sensitive change review
|
|
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. Open notes on this head with no reply:
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) |
Sensitive change review
|
|
self-added: yes
|
Sensitive change review
|
Sensitive change review
|
Sensitive change review
|
Sensitive change review
|
|
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 |
Sensitive change review
|
Sensitive change review
|
|
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 For the human reviewer:
AI findings judged non-blocking:
To clear: a maintainer reviews the egress, approval, signing-key and sandbox changes and rules on the points above. — crew-pr-reviewer (r134) |
Sensitive change review
|
|
Sensitive change review
|
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
Sensitive change review
|
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
kirocrew-secretsis opt-in like the other assignable sets.What changed (motivation → approach → change)
End-to-end flow:
Where each piece lives:
kirocrew-secretsstub, toolcall_api_with_secretmcp_secrets.py; registered inmcp_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 inconfig/integration_sections.py(opt-in egress stays an explicit stub choice)dashboard/handlers/mediated_secrets.py,dashboard/server_runtime/mcp_routes.py,dashboard/server_internal_paths.py,dashboard/token_secret.pysecrets_mediation/policy.py,secrets_mediation/provenance.py,secrets_mediation/dispatch.pymediated_request_capability.py, minted inacp/client_permissions.pyandacp/session_handle_permissions.py, revoked on cancel inacp/client_turn_control.pyandacp/session_handle_lifecycle.pysecrets authorizeCLIcli_commands_secrets.py,cli_parser_admin.py,cli.py,cli_commands.py,cli_help.pysandbox.py,sandbox_leaves.py,sandbox_precreate.py,security/paths_lists.py,security_posture.pywebsite/src/i18ncatalogs (all 13)docs/system-specs/modules/security.md,docs/architecture/mcp.md,docs/feature-map/README.mdCaller identity. Both routes are strict internal paths behind
member_request_scope: the internal secret plus an attestedX-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 passeshooks.on_tool_call, so the server has noautoApproveand 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_urland sends throughpinned_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.pyalso covers the shared vet: a private/loopback target is refused throughvet_unfurl_url, and the send usespinned_connectorfor 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.ManualClock().install(...)on the module under test and a module-localasynciostand-in, never the stdlibtimemodule or real-time ceilings.test/test_cli_mcp_doctor.py::test_auto_fix_never_blanket_allows_mediated_secret: doctor never pre-approves@kirocrew-secrets.test_mcp_stub_overrides.py) listskirocrew-secretsas 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 cleanorigin/mainworktree 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.tsx67 passed;mypy src/kiro_crewclean; 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:
Dark
Related Issues
Fixes #8628
Supersedes #23843, #23756 and #10383.
Checklist
Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.