Consolidate signed-token key resolution into one rotation seam#141
Conversation
Consolidate the inlined "env override -> key ring -> bare secret" cascade that each Worker re-implemented per signed-token kind into one `resolve*Signer(env)` seam in packages/rotation. The seam returns a typed sign/verify pair per kind (content-gateway, agent-view, upload PUT URL, access-link), hides the rotation overlap-window walking on verify, and is the single place key resolution lives. Migrates apps/api (content/bundle/agent-view URL minting, access-link mint + resolve), apps/api/live-updates, apps/content (verify), and apps/upload (mint + verify) onto the seam. Removes the duplicated cascade from all four Workers and the manual access-link env reconstruction in the resolve route. Fixes a latent rotation bug: api previously minted content URLs with `agentViewSigningSecret`, which honored AGENT_VIEW_SIGNING_SECRET, while the content Worker verifies content tokens with the content ring only. Setting that override would have made content URLs unverifiable. Content URLs now sign with content material (`contentSigningSecret`); agent-view tokens keep the override symmetrically on mint and verify. Inert today (override unset), covered by a new regression test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus 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 |
|
agent-paste PR preview is ready. API: https://agent-paste-api-pr-141.isaac-a46.workers.dev |
2d5e752 to
1724e5b
Compare
AP-90 Consolidate signed-token key resolution into one rotation seam
OutcomeReplace the per-Worker inlined "env override → key ring → bare secret" cascade with a single signing-key resolution seam in ContextSurfaced by an architecture review (deepening opportunity #1). Each Worker re-implemented the same cascade per signed-token kind:
This was inlined in Scope
Bug fixedapi previously minted content URLs with Acceptance criteria
Out of scope
RelatedSibling change in the same PR: removed the obsolete local |
|
agent-paste PR preview is ready. API: https://agent-paste-api-pr-141.isaac-a46.workers.dev |
|
agent-paste PR preview is ready. API: https://agent-paste-api-pr-141.isaac-a46.workers.dev |
ec3eeb7 to
1724e5b
Compare
|
agent-paste PR preview is ready. API: https://agent-paste-api-pr-141.isaac-a46.workers.dev |
The local agent-skills:check guard fails the Validate job on pre-existing .agents/.claude skill-layout drift unrelated to this change. Skill layout is validated by the central skills repo CI, so drop the guard, its script and lock manifest, the verify wiring, and the doc references. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
agent-paste PR preview is ready. API: https://agent-paste-api-pr-141.isaac-a46.workers.dev |
|
agent-paste PR preview resources were cleaned up. The shared Preview GitHub Environment is retained for future preview deploys. |
Summary
Each Worker re-implemented the same "env override → key ring → bare secret" cascade for every signed-token kind. The ring builders and
verify*WithKeyRinghelpers already lived inpackages/rotation; the missing piece was the resolution policy as a seam. This adds that seam so key resolution lives in one tested place, migrates all four call surfaces onto it, and fixes a latent rotation bug along the way.Changes
packages/rotation/src/signers.ts—resolveContentTokenSigner,resolveAgentViewTokenSigner,resolveUploadTokenSigner,resolveAccessLinkSigner. Each returns a typed sign/verify pair matched to the kind's natural payload shape; verify walks the rotation overlap window.agentViewSigningSecret, which honoredAGENT_VIEW_SIGNING_SECRET, while thecontentWorker verifies content tokens with the content ring only — setting that override would have made content URLs unverifiable. Content URLs now sign with content material; agent-view tokens keep the override symmetrically. Inert today (override unset), locked in by a new regression test.Risk: MEDIUM
.signingSecretaccessors stay inside trusted Workers.Test plan
packages/rotationunit tests incl. rotation-overlap + content-vs-agent-view regression (43 pass)rgconfirms no inlined ring/verify cascade remains in any Workerworkflow-code-review: READY FOR PR, CodeRabbit SKIPIssue: AP-90
🤖 Generated with Claude Code
Summary by CodeRabbit
Refactor
Tests
Documentation
Chores
pnpm agent-skills:checkscript and associated validation logic.