Skip to content

fix(identitybroker): apply the session-open review follow-ups - #2601

Merged
ChrisJBurns merged 1 commit into
mainfrom
fix/identitybroker-session-open-review
Oct 29, 2026
Merged

ChrisJBurns merged 1 commit into
mainfrom
fix/identitybroker-session-open-review

Conversation

@ChrisJBurns

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #2593 with the three review suggestions.

  • Oversized responses keep their classification (authserverclient/client.go). The size check ran before the status check, so a body over 1 MiB lost its meaning. Now:
    • a refusal keeps its status, so a 502/504 is still resent once and a 503/429 is still UNAVAILABLE;
    • an oversized success counts as an undecodable answer, so session open closes the session.
  • Converted tokens are remembered broker-wide. Check 5 compared only the jti of the grant the session currently held, so a replaced grant or a closed session forgot it, and a delayed open could present a spent token to AS-1 again. The broker now keeps every jti AS-1 may have converted until the token's exp plus a skew, across sessions (design step (3): "never presents a spent access token for a second session"). An open with such a token returns the session if it holds a live refresh token, and otherwise gets token_used without calling AS-1.
  • Revocation reasons keep the design's broker status. signed_out, upstream_revoked, and owner_action_required return their own codes (FAILED_PRECONDITION, PERMISSION_DENIED, FAILED_PRECONDITION); the 401 at session open is the mecak8s outcome, which the server PR applies.

Issue relationship

Part of #2492

API compatibility

None on the wire: in-process internal/identitybroker and its adapter only, and AS-1 is not configured in production yet.

Test plan

  • go test -race on internal/identitybroker/..., internal/testutil/identityharness, cmd/mecak8s, and the internal/app identity broker tests; repeated runs of the session-open tests
  • New tests: oversized 200/502/503/429 at the adapter and through session open; A→B→A, A→expiry→B→A, echo mismatch then A, and pruning after exp plus skew; which outcomes record a converted token; revocation reasons with their design codes
  • task lint: clean except the pre-existing gosec finding in environment/microvm/launch_ownership_darwin.go

Oversized AS-1 responses keep their classification: a refusal keeps its
status (so 502/504 are resent and 503/429 stay unavailable) and an
oversized success is an undecodable answer. The broker remembers every
access-token jti AS-1 may have converted, across sessions, until the
token's exp plus a skew, so a spent token is never presented again.
signed_out, upstream_revoked, and owner_action_required keep the
design's broker status; the session-open 401 is mecak8s's outcome.

Part of #2492.

Co-authored-by: Mecatl <[email protected]>
@ChrisJBurns
ChrisJBurns requested a review from jhrozek October 29, 2026 14:08
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.

2 participants