Repository navigation
Add opt-in signed operator approval for Tier-3 confirmations - #299
Merged
Merged
Conversation
RELAY_SHELL_CONFIRM_APPROVAL=signature (ADR 0015) makes a Tier-3 confirmation token armable only by an SSH signature (SSHSIG, namespace relay-shell-confirm) over the one-line challenge the server issued with that token. The challenge names the tool, the redacted arguments, the operation hash and the expiry. Allowed operator keys come from an OpenSSH allowed_signers file (RELAY_SHELL_CONFIRM_ALLOWED_SIGNERS), read once at startup with strict parsing. Verification is asyncssh's. A host-side approval verb would not work here: shell_exec runs as the service account, which has sudo on the privileged deployment, so the model could approve its own call. An off-host key cannot be used that way. operation_confirm gains an optional signature argument. In signature mode the arm record adds approver and signature_sha256, and server_info.confirm adds approval and signers. The default (client) keeps ADR 0009 behaviour and a byte-identical record. Binding, TTL, single use, client binding and deny/mode-first ordering are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds an opt-in mode in which only the operator can arm a Tier-3 confirmation:
RELAY_SHELL_CONFIRM_APPROVAL=signature(ADR 0015). It addresses a gap found in a review against a sibling MCP control plane.Problem. With
RELAY_SHELL_CONFIRM_TIER3=true, ADR 0009 lets the same client that received a token arm it. That is friction, not a human approval. A deployment with the broker on pays for the extra step without getting one.Why not a host-side approval verb.
relay-shell --confirm <id>, or a marker file the server reads, would not help.shell_execruns as the service account, which has sudo on the privileged deployment, so the model could approve its own call. The approval has to come from a key the host does not hold.How it works:
relay-shell-confirm v1 {"args":…,"exp":…,"id":…,"op":…,"server":…,"tool":…}.argsis the redacted audit view, so no raw secret reaches the operator.opis the existingsha256(tool \0 op_key)binding.ssh-keygen -Y sign -n relay-shell-confirm -f <key> <file>. The client passes the.sigcontents tooperation_confirm(token, signature=…).relay-shell-confirmnamespace, which relay-shell checks itself, so a git or file signature by the same key is refused;RELAY_SHELL_CONFIRM_ALLOWED_SIGNERS.asyncssh.validate_sshsig, already a runtime dependency; there is no custom crypto.--check-config): an unparsable line, a wildcard or negated principal, acert-authorityentry, an empty file, or a file writable by group or other. On its own, asyncssh silently skips unparsable lines.approver(the verified principal) andsignature_sha256.server_info.confirmaddsapprovalandsigners(principals and fingerprints). The raw token and the signature body are never logged.Unchanged: the default (
client, ADR 0009 behaviour, byte-identical record), binding, TTL, single use, client binding (A14-C10b), deny/mode-first ordering, and re-classification of the retried call. No new tool.Residual risk (documented in the ADR, the deployment guide and the module docstring):
server_info, and coverage by AIDE or a drift check is recommended.Type of change
Runbook §3.1 checklist
approval.pyis in thedocs/architecture.mdtable, the runbook §3.3 security-sensitive list and the PR template list.operation_confirmhas an optionalsignatureargument;docs/tools.mdis updated..env.example(template test passes),Settingsanddocs/deployment.md(§8a and §8c).asyncssh.sshsigfrom the pinned asyncssh 2.24.1.Security-sensitive diff (runbook §3.3)
broker.py, the newapproval.py,config.py, and inserver.pythe confirmation block ofRelay.run()andoperation_confirm./security-reviewwas not run.operation_confirm. The output body is still only hashed.policy_textpassed toRelay.run()is unchanged.STPA: in ADR 0015.
Test plan
ruff check .,ruff format --check .,mypyandpytest -qpass locally (Ubuntu 26.04 / CPython 3.14,development-py3.14.txt): 1542 passed, 19 skipped. The skips are the root-,chattr +a- andCAP_SYS_ADMIN-gated tests. The py3.12 profile was not run locally; CI covers it.pytest -m fuzzpasses.tests/test_confirm_signature.pyhas 31 tests, with keys generated per test by asyncssh. They cover:op);armrefused, signed arm, single use, cross-plan refusal, foreign client, expiry, read-onlycheck_signature; the client-mode broker is unchanged;approveris recorded, the raw token and signature body are absent from the audit log, and a replayed signature does not arm the next plan;server_infosigners;mkdocs) was not run locally; CI's docs job covers it. The ADR is added tomkdocs.ymlnav.Not verified
ssh-keygen -Y signwith a hardware-skkey against this server. The tests use asyncssh'screate_sshsig, which produces the same SSHSIG format.🤖 Generated with Claude Code