Repository navigation
feat(step-up): record step-up methods in the session auth context - #529
Merged
Merged
Conversation
A passkey or TOTP step-up now adds its method to sessions.authMethods and moves authTime, so the provider acr, amr and auth_time reflect it. The auth-context lookup reads the current row of the refresh chain, where step-up records and what /oidc/sign checks. Refs #510
A TOTP step-up on a passkey session no longer refreshes auth_time, so the signed acr is never paired with the time of a weaker factor. Refs #510
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
The API side of #510 (ADR 0001, D3, D5, D9). Step-up now feeds the session auth context that
/oidc/signandGET /oidc/sessions/:id/auth-contextderiveacr,amrandauth_timefrom.recordStepUpVerificationadds the step-up's method tosessions.authMethods: a passkey step-up as{ method: 'passkey', at, deviceBound, userVerified }(fromcredentialDeviceTypeand the UV flag, the same sources sign-in uses), a TOTP step-up (/totp/verify-mfa) as{ method: 'totp', at }. A repeat of the same kind replaces its earlier record, so the list stays bounded.authTimemoves to the step-up only when the step-up on its own earns at least the session's currentacr(none <phr<phrh).auth_timeis read as the time of the authenticationacrdescribes, so a TOTP step-up on a passkey session must not make the passkey look recent. A session without anacrgets a freshauth_timefrom any step-up.getOidcAuthContextnow reports the current row of the refresh chain (falling back to the recorded row when the chain is dead). Step-up writes to the row the access token names, which after a refresh is later than the row the provider recorded, and/oidc/signalready checks the current row. Before this, a session refreshed and then stepped up would report stale values that/oidc/signthen refused. Both now share oneauth_timerule (authTime ?? chainStartedAt ?? createdAt).No route, schema, types or migration change.
npm run generate:apileavesopenapi.jsonandadapter-manifest.jsonunchanged.acr_valuesandmax_agePer ADR D3 and D9 these are evaluated by the edge, which holds the authorization request. The API's part is to record step-up and sign only what the session earned. What the edge must do:
acr_values_supported: ["phr", "phrh"];phrhsatisfies a request forphr.GET /oidc/sessions/:id/auth-context?clientId=(after saving the Grant).max_age=Nis met iffnow - authTime <= N;acr_valuesis met iff the reportedacrranks at least the requested value.max_age=0orprompt=loginis never met by an existing session./step-up/webauthn/startand/finish(needed for anyacr, and for freshness on a session that already has anacr), or/totp/verify-mfa(freshness only, on a session without anacr). Both are access passthroughs in the adapter manifest.acr,amrandauth_timeverbatim./oidc/signrefuses anything else withauth_context_mismatch.phrhis essential), answerunmet_authentication_requirementsrather than issuing a loweracr.Not in this PR
phr/phrh.OidcSignRequesthas no grant field, so/oidc/signcannot enforce that today. It belongs with feat(oidc): device authorization grant for clients without a browser (RFC 8628) #515.Refs #510
Checks
npm run typecheck: cleannpm run lint: cleannpm run format:check: cleannpm run coverage: 164 files, 2543 passed, 1 todo; 98.99% statements, 95.7% branchesTEST_DB=postgressuite on a throwaway Postgres 18 after the full migration chain: 8 files, 48 passed, including a step-up on a refreshed row reported through the originally recorded session idauth_timeunder an older passkeyacr), fixed in the second commit with a test