Repository navigation
feat(agent): DPoP-bind the delegated grant to a per-run key - #5706
Conversation
Each hosted run with a delegated grant gets a non-extractable ECDSA P-256 key, kept in the grant's private store. Every renewal proves it, the run binds its grant with one renewal before tools are offered, and a grant that names cnf.jkt is sent only as Authorization: DPoP with a fresh proof (jti, htm, htu, iat, ath). Unbound grants stay Bearer, so today's API keeps working. The runtime registration advertises delegated_user_dpop. Refs veryfront/veryfront-issue-inbox#5141 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
📦 Client bundle boundary
A server module in a client graph aborts hydration in the browser. New leaks fail CI; known leaks are tracked in |
A lowercase standard method such as "post" goes out as POST, but the proof named "post", so an API that checks htm would refuse a bound grant. The snapshot now normalizes the method the way fetch does, so the proof and the request agree. Refs veryfront/veryfront-issue-inbox#5141 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
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. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
… global fetch The semantic unit-boundary audit counts withMockFetch as a network effect. Replacing only the trusted host transport keeps the test hermetic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Bun upper-cases every fetch method while Deno and Node leave patch as is, so a lower-case method reached the API spelled differently from the proof's htm on Bun. The client now sends the method upper-cased and signs that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|



Problem
Phase 4 of delegated user actions (veryfront/veryfront-issue-inbox#5132) mints admin capabilities only into grants that are sender-constrained with DPoP (RFC 9449). The hosted runtime's delegated API client only knows bearer grants: it has no key, sends no proof, and would send a bound grant as
Bearer, which the A23 verifier refuses. C9 (veryfront/veryfront-issue-inbox#5141) adds the runtime side.Root cause
src/agent/hosted/delegated-user-credential.tskeeps the grant in a private store and presents it asAuthorization: Bearer <grant>on every request and renewal. Nothing in the run can prove possession of a key, so the API has nothing to bind a grant to.Fix
src/agent/hosted/delegated-user-dpop.ts: makes an ECDSA P-256 key pair withextractable: falseand signs ES256dpop+jwtproofs. Every WebCrypto, JSON, encoding and URL intrinsic is captured when the module loads. The public JWK (public members only) and its RFC 7638 thumbprint are made once with the key.registerHostedDelegatedUserCredentialstarts making the key when the grant is registered and keeps the promise in the same private weak store as the grant. The client, the tools, the tool context and project code have no accessor for it.jti,htm,htu(the resolved API URL without query or fragment),iat, andath(base64url SHA-256 of the grant). A grant whose payload namescnf.jktis sent asAuthorization: DPoP <grant>with aDPoPheader and is never downgraded toBearer(no key means the call fails locally). A grant withoutcnfis sent asBearerwith no proof, as before, so today's API keeps working. The 401 retry after a renewal signs a new proof. A caller-suppliedDPoPheader is dropped.ath, as A24 specifies. When the grant renews itself,athcovers the grant.bind()on the client: one renewal per run, shared by every client of the run.createAgentRuntimeawaits it before tools are offered, so both the capability list and the first tool call see the bound grant. Calls made while it is in flight wait for it. An API that does not bind returns an unbound grant (Bearer, as before). A 404 or a refusal keeps the dispatch grant.delegated_user_dpop.docs/architecture/native-request-processing.mddescribes the key, the proofs and the new capability.Tests
deno task test:fileonsrc/agent/hosted/delegated-user-credential.test.ts,src/agent/hosted/cloud-agent-delegated-user.test.ts,src/agent/service/registration.test.ts, thensrc/agent/hostedandsrc/agent/serviceas a whole. Alsodeno check,deno lintanddeno fmt --checkon the touched files.New tests (each fails on
main):exportKeyof the private key rejects forjwkandpkcs8), the header JWK has only public members, and WebCrypto patched after load never sees a proof;CryptoKeyand no thumbprint can be reached from the client, the delegated tools or the request;jti, the righthtm, anhtuwithout query,iatandath, and verifies against its JWK;jti), and not for a dispatch grant that is already bound;ath), calls made meanwhile wait for it, binding happens once, and later renewals prove the same key;WWW-Authenticateecho the proof and grant) becomes the plain "can no longer act" message, with no proof, grant or run token in the error or logs;delegated_user_dpop.Existing tests that waited for a renewal by spinning on microtasks now wait on macrotasks, because a renewal now signs a proof first.
Not in this PR
DPoP-Noncehandling. Phase 4 uses no server nonce.Refs veryfront/veryfront-issue-inbox#5141
🤖 Generated with Claude Code