Repository navigation
Conversation
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 gateway-certified key. The key, policy and lock live in secret-request-policy/, which every sandbox tier hides whole and which is precreated before any spawn. - 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. - 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
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the feature is opt-in, it fails closed, and the take-aways only touch a brand-new masked directory that nothing else reads. Notes
[DESIGN-REVIEWED] 8653c3f Description read[DESCRIPTION-READ] e5f48536210ccc5624538dd3a2c731dba2e23aff0e2e813e3701bc226b524718 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) — 🔴 BLOCKPremise-level review of First-Principles-Verdict: BLOCK The policy-signing key ( Notes
What this change shipsInventory (9 items) — 7 justifiedIntent: let a member-chat agent make an owner-approved HTTPS call with a stored Custom secret it never sees (an ADDITION).
BlockersStored certified key re-implements an existing derived purpose key — duplicate of [FIRST-PRINCIPLES-REVIEWED] 8653c3f Description read[DESCRIPTION-READ] ad65e34324d1f7cb4c2585571e76e1c9a0c424dbf21108610ae3a1203ea73d81 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 cannot evaluate: missing a screenshot of the Custom secrets description as this commit ships it. Both committed screenshots show an older, longer paragraph, so nobody has cold-read the new copy. Evidence gaps
Notes
[UX-REVIEWED] 8653c3f Description read[DESCRIPTION-READ] f5ac7343dd7b10e43fecdbe8f5395c2b72631943cee46ca10c95d32ed2b7dba4 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 |
Sensitive change review
|
Opus 5.5 Review — ✅ no blocking findingsReviewed Review detailsNo findings. Notes:
[OPUS-REVIEWED] 8653c3f 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 — 🔴 changes requested (blocking)GPT 6.1 found at least one blocking issue that must be resolved before merging This comment is updated in place on each push. BLOCKING -- src/kiro_crew/secrets_mediation/provenance.py:251 -- Non-ASCII signatures crash policy recovery
[BLOCK-MERGE] 8653c3f Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 (fenced): I'm flagging it. The defect is real, but it fails closed and nothing leaks.
🏷️ Fenced finding(s) machine-flagged as likely edge caseThe security fence keeps these findings blocking regardless of adjudication; the only clearance path is a human override. The annotate-only pass judged the condition combination each one requires extreme, and pre-drafted the override rationale below. A repository writer must independently verify a rationale before posting it — it is machine-authored, and a wrong override on a security-class finding ships exactly the class the fence exists to stop.
Replace False positive or not applicable? A repository writer can comment: |
- Cancelling a turn on either ACP path (AcpSessionHandle.cancel, AcpClient.cancel_session) now revokes that session's pending and claimed mediated-secret grants before the cancel goes out, so a call the operator stopped cannot claim and send on an approval it already received. Other sessions' grants are untouched. - A present signing key that no longer certifies is never repaired by the gateway, so `secrets authorize` and the degradation audit now say how to recover (remove secret-request-policy/key.json, restart, then re-authorize) instead of "start the gateway". A missing key still says to start the gateway.
Sensitive change review
|
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: The only part of this change that refuses more is a new TIGHTENING: ADJUDICATED: 17 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: The new leaf is a bare directory name joined under
UNADJUDICATED:
[SCOPE-REVIEWED] 8653c3f |
|
Superseded by #23855: the same change as one commit on current main. It takes the round-3 fixes: the policy MAC key is now derived from token_signing.key under its own purpose label, so there is no stored key, boot-time mint or recovery path, and only 64-char lowercase hex is accepted as a signature. A third commit here would have broken the two-commit limit. |
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 #23756 (same change; a review round would have taken it past two commits, so it is one fresh commit on current main) and, before it, #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:
Caller identity. Main's current model is
member_request_scope: the internal secret plus a transport attestation ofX-Session-Key(session_key_is_attested: peer ancestry, or the signed per-session token on pooled backends). Both new routes are strict internal paths and use it, so a process that only read the loopback secret and a session key is refused. That answers the earlier GPT finding that the documented member path could not mint the proof it needed: there is no separate proof to mint now; the approval-minted capability is the per-call binding, and it is only issued when the call goes throughhooks.on_tool_call, which is why the server has noautoApproveand doctor never blanket-allows it.Policy integrity. The policy is signed with a gateway-certified key minted after bind (
secrets_mediation/signing_root.py, kicked off in both gateway entrypoints so the listener never waits). The key, policy and authorize lock live in one directory that every sandbox tier masks whole and that is precreated before any spawn, so publications rename inside it and never over a mount point.Windows. #10383 used
unix_socket_urlopenunconditionally, which fails opaquely on Windows. The stub now returns an explicit unsupported-platform error there, gated onplatform_compat.IS_WINDOWS(nothasattr(socket, "AF_UNIX"), which modern Windows Python passes).Other pieces: the
secrets authorizeCLI (cli_commands_secrets.py, parser incli_parser_admin.py), capability registry (mediated_request_capability.py), mint/revoke wired into both approval transports (acp/client_permissions.py,acp/session_handle_permissions.py), registry/discovery/cleanup entries for the new opt-in server,secret-request-policyadded to the agent file-tool deny list, a short two-sentence Custom-secrets card copy in all 13 catalogs that labelskirocrew secrets authorizeas a terminal command, and docs indocs/system-specs/modules/security.md.SSRF and transport. Dispatch has no URL vet or transport of its own: it calls
link_unfurl.vet_unfurl_url(the same vet link previews, the remote MCP probe and calendar use) and sends throughpinned_connector, so the connection can only reach an address the vet approved. No new HTTP dependency.Approval ordering. Both approval transports (
acp/client_permissions.py,acp/session_handle_permissions.py) mint the capability as the last check under the ACP write lock, after the withdrawal, the runtime's liveness check and the grant deadline (ApprovalMintinmediated_request_capability.py). So no grant exists while an approval waits for the lock, and stopping the member during that wait leaves nothing to claim. If the answer frame is not delivered,revoke_mintedremoves the grant whether it is still pending or already claimed. An approval for any other tool hands the transport no extra write check and is sent exactly as before. Cancelling a turn on either ACP path (AcpSessionHandle.cancel,AcpClient.cancel_session) callsinvalidate_sessionfirst, so a call the operator stopped cannot claim or consume an approval it already received. Other sessions' grants are untouched.Key recovery. A signing key document that no longer certifies (for example after
token_signing.keywas recreated) is never repaired by the gateway, so a restart alone reproduces the failure.provenance.host_key_problemseparates the two cases. A missing key tells the operator to start the gateway. An unusable key gives the remedy in both thesecrets authorizeerror and the gateway's degradation audit: removesecret-request-policy/key.json, restart, then re-authorize.Grant lifetime. An approved grant waits for its call to reach the shared
kirocrew-secretsbackend, which runs calls one at a time with each padded to its deadline. So a pending (approved, unclaimed) grant lives for the bounded queue depth times the per-call budget, and a claimed grant gets the short 30 s redemption lifetime. A call queued behind a 60 s call is no longer refused. Cancellation and single use still hold.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,test/test_mediated_signing_root.py: signature verification, torn/unsigned policy refusal, post-bind key mint.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.test/test_mediated_request_provenance.py/test/test_mediated_signing_root.py: an uncertifiable key's error and degradation audit name the remedy; a missing key says to start the gateway.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.website/src/pages/settings/SecretsPanel.test.tsx: new card copy.Local run: 2172 passed on the first commit across the feature, ACP transport, session-handle bindings, CLI, doctor, link-unfurl, secrets and composition-contract suites. On the second commit, a further 2086 passed across the feature, ACP client/session, transport floor, stop/cancel and composition suites (
SecretsPanel.test.tsxpassed 63 on the same card copy before this rebase; it cannot load locally right now because current main added a vite plugin the sharednode_moduleslacks);mypy src/kiro_crew/clean; flake8, black, isort clean on changed files; file-line-cap, agent-SDK boundary, sync-IO-in-async, ACP fixture and lockdown gates pass; i18n check and parity 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 #23756 and #10383.
Checklist
Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.