Repository navigation
feat(pm-aggregator): wire break-glass token consumption into the identity-registry gate (#9608) - #13009
Merged
Conversation
…tity-registry gate (#9608) consumeBreakGlassToken existed but nothing in server.ts imported it, so a break-glass token authorized nothing. Now the /api/admin/identity-registry gate works as designed (#1253 section 6): - Access-verified owner proceeds exactly as before; a presented token is never touched on that path. - Otherwise a presented Authorization: Bearer token is consumed atomically via authorizeWithBreakGlassToken, which records the break-glass-token-consumed audit event (actor owner:break-glass:<id>) and authorizes exactly that one admin request; the registry audit actor becomes owner:break-glass:<id>. - Fail closed both ways: invalid/expired/replayed token (or none) returns 403 with the consume error; if the consumption audit write fails the request is not authorized and the token is already burned, so it cannot be replayed. break-glass.ts gains presentedBreakGlassToken (the codebase's Bearer convention), breakGlassConsumptionAuditEvent (mirrors the issuance event), and the consume+audit authorize helper. Tests: unit coverage for the helper (consume-once + audit, audit-failure burns the token, event shape, Bearer extraction) and a boot-based route test (no token 403; valid token 200 once; replay 403). 12 pass across break-glass + route suites; identity-registry/access-identity/stack-token suites green. boot.test.ts still fails in a fresh worktree for the pre-existing reason: the live aggregator holds freshness port 4871 (EADDRINUSE), unrelated to this change. Refs #9608 — the outage-queueing remainder and the #1253-Q4-gated comment surface stay open on the issue, as scoped.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 55 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
What
Wires break-glass token consumption into the
/api/admin/identity-registrygate — the slice designed on #9608 (Lane HI's record) and held until Drew's 2026-11-23 approval of the flagged worktree.Before this PR,
consumeBreakGlassTokenexisted but nothing inserver.tsimported it: a break-glass token authorized nothing.Behavior
Authorization: Bearertoken is consumed atomically via the newauthorizeWithBreakGlassTokenhelper, which records thebreak-glass-token-consumedaudit event (actorowner:break-glass:<id>) and authorizes exactly that one admin request; downstream registry audit events carry that actor.break-glass.tsgainspresentedBreakGlassToken(the codebase's Bearer convention),breakGlassConsumptionAuditEvent(mirrors the issuance event), and the consume+audit helper.Verification
bun test test/break-glass.test.ts test/break-glass-route-9608.test.ts— 12 pass / 0 fail: unit coverage (consume-once + audit, audit-failure burns the token, event shapes, Bearer extraction) plus a boot-based route test (no token ⇒ 403; valid token ⇒ 200 once; replay ⇒ 403).break-glass-token-consumedevent with actorowner:break-glass:<id>present in the events file.tsc --noEmitclean.boot.test.tsstill fails in a fresh worktree for the pre-existing environmental reason: the live aggregator holds freshness port 4871 (EADDRINUSE). Unrelated to this change; the new route test pins a free freshness port.Refs #9608 — the issue stays open: the outage-queueing remainder and the #1253-Q4-gated comment surface are untouched, as scoped.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.