Skip to content

feat(pm-aggregator): wire break-glass token consumption into the identity-registry gate (#9608) - #13009

Merged
dezren39 merged 1 commit into
mainfrom
lane-hi/9608-break-glass-auth
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane-hi/9608-break-glass-auth

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

What

Wires break-glass token consumption into the /api/admin/identity-registry gate — 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, consumeBreakGlassToken existed but nothing in server.ts imported it: a break-glass token authorized nothing.

Behavior

  • Access-verified owner: proceeds exactly as today; a presented token is never touched on this path.
  • Otherwise (the Access/IdP-outage path): a presented Authorization: Bearer token is consumed atomically via the new authorizeWithBreakGlassToken helper, which records the break-glass-token-consumed audit event (actor owner:break-glass:<id>) and authorizes exactly that one admin request; downstream registry audit events carry that actor.
  • Fail closed both ways: invalid/expired/replayed token — or no token — returns 403 with the consume error, responses otherwise unchanged. 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 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).
  • Manual boot check against the real server: 403 / 200-with-registry / 403-on-replay, and the break-glass-token-consumed event with actor owner:break-glass:<id> present in the events file.
  • Neighboring suites green: identity-registry, access-identity, stack-token. tsc --noEmit clean.
  • boot.test.ts still 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.


Run Proof on this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…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.
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5ee54e12-69e5-4087-b7a7-a69a92aa1a4a
Commits

Reviewing files that changed from the base of the PR and between 80abb63 and 02c164a.

Files selected for processing: 4

  • pm-stack/aggregator/src/break-glass.ts
  • pm-stack/aggregator/src/server.ts
  • pm-stack/aggregator/test/break-glass-route-9608.test.ts
  • pm-stack/aggregator/test/break-glass.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@dezren39
dezren39 merged commit db0b5c2 into main Nov 23, 2026
1 check passed
@dezren39
dezren39 deleted the lane-hi/9608-break-glass-auth branch November 23, 2026 06:59
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T07:01:03.761399Z 02c164a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant