fix(rust): fail-closed token auth on both shadow daemons (delegation seam P1)#470
Merged
Conversation
…on seam P1) Closes the auth gaps the seam-design review surfaced (ground truth #7): - argent-execd had NO auth on any route incl. POST /v1/executive/shutdown. Adds bearer-token auth on every route (constant-time compare) and refuses to start without a token unless ARGENT_EXECD_ALLOW_NO_AUTH=1. - argentd was fail-open when ARGENTD_AUTH_TOKEN was empty (ws.rs only rejects on mismatch when the expected token is non-empty). Adds a fail-closed startup guard mirroring the same opt-out flag. - TS ExecutiveShadowClient learns a bearer token; status resolves it from ARGENT_EXECD_AUTH_TOKEN or ~/.argentos/rust-execd/auth-token so argent status keeps reaching a token-enforcing installed daemon. Verified: new execd auth test (401 missing/wrong incl. unauth shutdown, 200 correct), argentd startup guard (refuses tokenless, starts with opt-out), 56 argentd + execd Rust tests green, 26 TS execd/status tests green, live daemon 401→200 with token. Live-arming the installed execd token is a coordinated operator step (staged: plist opt-out keeps status green until this ships); no net-new TS errors. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T3dkQzz2mSrSNtGBE9cmXr
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
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.
What
Implements P1 from the delegation seam design (PR #469, §4) — the security prerequisite that gates all read-only adoption work. Closes the auth gaps the seam review surfaced (doc ground truth #7):
POST /v1/executive/shutdown. Now every route requires a bearer token (constant-time compare), and the daemon refuses to start without a token unlessARGENT_EXECD_ALLOW_NO_AUTH=1.ARGENTD_AUTH_TOKENwas empty (the ws connect gate only rejects on mismatch when the expected token is non-empty). Adds a matching fail-closed startup guard with the same opt-out flag.ExecutiveShadowClientlearns a bearer token;getExecutiveShadowSummaryresolves it fromARGENT_EXECD_AUTH_TOKENor~/.argentos/rust-execd/auth-token, soargent statuskeeps reaching a token-enforcing installed daemon.Verification
curl→ 401 without token, 200 with; status-path via the token file →kernel: fail-closed.Rollout note (operator step)
Arming the installed execd token is a coordinated deploy step: this PR's daemon binary + CLI token-reader must land together. The live plist is currently staged with
ARGENT_EXECD_ALLOW_NO_AUTH=1(its prior unauthenticated behavior — no regression,argent statusgreen). On deploy: drop the opt-out, setARGENT_EXECD_AUTH_TOKENin the plist (token staged at~/.argentos/rust-execd/auth-token), bounce the LaunchAgent.Follows the seam doc's I6 (no unauthenticated/fail-open daemon surface). Closet 🔴 item resolved by this PR.
🤖 Generated with Claude Code
https://claude.ai/code/session_01T3dkQzz2mSrSNtGBE9cmXr