Repository navigation
Conversation
The owner authorizes a Custom secret for one exact https origin with `kiro-crew secrets authorize`. An agent in a private member conversation can then call that API through the opt-in `kirocrew-secrets` MCP tool (`call_api_with_secret`). The gateway reads the vault, injects the value, runs the SSRF-checked request and returns a sanitized result, so the secret never enters the sandbox. Caller identity uses the current model on main: the MCP stub forwards over the loopback transport with the internal secret, and the host routes accept only an attested member session (`member_request_scope`). Each call also redeems a single-use capability minted by the ACP approval for that exact tool call, so a direct member call that skipped the approval gate cannot reach the egress route. The forwarder talks only to the owner-only dashboard Unix socket after checking the answering peer is the gateway. Windows has no such attested channel, so there the tool returns an explicit unsupported-platform error instead of an opaque socket failure. By default the result is a fixed constant that reveals nothing about the upstream response. The owner can opt an origin into the real response with `secrets authorize --return-body`. Fixes #8628
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level blocker: the capability is minted only on an explicit approval, bound to the exact arguments and usable once, so every unsupported path fails closed. Notes
[DESIGN-REVIEWED] 4779ec7 Description read[DESCRIPTION-READ] ebfc6c7d816a5a1a616df876ac87df2ec5ec4c9a54582b691bb02bc165fa2aa6 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 |
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 copy this PR ships. Both committed screenshots show an older, longer Custom-secrets paragraph, not the new Evidence gaps
Notes
[UX-REVIEWED] 4779ec7 Description read[DESCRIPTION-READ] de3deacb844ac1476780b38d0e4db5297bed0432fe274299b3a1355dbfe6305e 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS No blocker. The tool is opt-in, the defect has a linked issue (#8628), and the one heavier-than-needed layer (policy signing) can be removed later. Notes
What this change shipsInventory (10 items) — 8 justifiedIntent: let an agent in a member chat make one owner-approved HTTPS write with a stored Custom secret, without the secret entering the sandbox. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 4779ec7 Description read[DESCRIPTION-READ] 724549cb0f45b6a5a806edf649090a531b8f08e3996373b3368f3bd84c268d16 That sha256 names the PR description this verdict read. 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: |
| "mediated_secret_authorize succeeded but its success audit could not be recorded" | ||
| ) | ||
| if args.remove: | ||
| print(f"Removed mediated-request authorization for {name!r}.") |
| if args.remove: | ||
| print(f"Removed mediated-request authorization for {name!r}.") | ||
| else: | ||
| print(f"Authorized {name!r} for {authorizations[name]['origin']} (policy signed).") |
| ev = authz[-1] | ||
| assert ev["outcome"] == "ok" | ||
| assert "MY_KEY" in ev["resources"] and "authorize" in ev["resources"] | ||
| assert "api.example.com" in ev["resources"] |
Sensitive Change ReviewSensitive files changed:
How to clear this check:
Only the author's comment counts this way. A reviewer can instead |
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/acp/client_permissions.py:322 -- Capability is redeemable before approval commits
BLOCKING -- test/test_mediated_secret_request_handler.py:796 -- Lifetime tests replace the worker-wide monotonic clock
BLOCKING -- test/test_mediated_request_dispatch.py:391 -- Correct deadline handling fails under scheduling delays
[BLOCK-MERGE] 4779ec7 Adjudication (Opus 5.5) — is blocking on each finding proportionate?F2: This is a determinism-class flake, a timing degradation inside one worker while the patch is active, so the harm itself is LOW to MEDIUM. F3: Also a determinism flake. The test asserts real-time upper bounds: F1 (fenced): 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: The only existing guards this change makes stricter are path-based. It adds a new TIGHTENING: Agent file-tool floor and sandbox hidden-leaf mask now cover the crew-home ADJUDICATED: 14 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: posix: UNADJUDICATED:
[SCOPE-REVIEWED] 4779ec7 |
Address the first review round on the mediated-secret call: - Route the mediated dispatch through link_unfurl.vet_unfurl_url and pinned_connector instead of a second SSRF vet, DNS pin and requests/urllib3 transport; drop secrets_mediation/ssrf.py and the direct urllib3 dependency. - Give an approved, not-yet-claimed grant a lifetime that covers the bounded shared-dispatch queue, so a call queued behind a 60 s call is no longer refused; a claimed grant keeps the short redemption TTL. - Point the feature-map secrets row at handlers/mediated_secrets.py. - Shorten the Custom-secrets card copy in all 13 catalogs and label `kirocrew secrets authorize` as a terminal command. - Re-pin the dashboard composition census for the two new routes and the post-bind signing-root kick.
Sensitive change review
|
|
Superseded by #23843: the same change rebuilt as one commit on current main, with the round-2 review fixes (capability minted under the ACP write lock and revoked pending or claimed on an undelivered answer, module-local test clocks, no secret-derived staging names). 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 #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.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 and revokes it when the answer write fails.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 on the head: 800 passed across the feature, CLI, doctor, link-unfurl, secrets and composition-contract suites, plus 63 in
SecretsPanel.test.tsx;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 #10383.
Checklist
Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.