Repository navigation
Description
Part of "Delegated client access to a user's connections" (#6406). Hardening for resolved redemptions: not a blocker of
"Delegated access: turn on subject resolution at ID-JAG redemption"
(#7247), needed before Mecatl phase 2 is done.
Problem: A provider-identity row records the upstream's name and the subject value, and nothing else (storage.ProviderIdentity: ProviderID, ProviderSubject, UserID). It does not record which IdP issuer or which claim produced the value. Sign-in (handlers/callback.go, handlers/user.go) and the subject resolver (subjectresolver.Resolve) both find the user by (upstream name, value).
If an operator keeps the store and changes what an upstream name points at, old rows still match:
- They move upstream
defaultfromhttps://acme.okta.comto another IdP. - Or they change its
subject_claimfromsubtoemployee_id.
A user whose new value equals an old row's value is then signed in as that row's user. Once ID-JAG subject resolution is enabled ("Delegated access: turn on subject resolution at ID-JAG redemption" (#7247)), they can also be resolved to that user and get a marked token.
The resolver checks upstream_subject's issuer and claim against the current configuration. Nothing checks them against the row.
This is the reverse of the startup check in #6980. That check refuses one issuer under two names; this issue covers one name whose issuer or claim changed.
Change:
-
Store the issuer and subject claim on each provider-identity row when it is created, in both the memory and Redis backends.
-
A lookup matches only when the stored issuer and claim equal the upstream's current issuer and claim. A mismatch counts as not found:
- sign-in creates a new user;
- resolution refuses with
subject_unknown.
-
Decide how existing rows, which have no issuer or claim, are handled:
- stamp them with the current configuration on first match, accepting that a change made before the upgrade goes unnoticed;
- or treat them as not found, which forces new users.
Document the choice and log once at startup when unstamped rows are found, if that's cheap.
-
Document what an operator should do when they really are migrating IdPs, since users will get new local accounts.
Acceptance:
- After an upstream's issuer or subject claim changes, a row created under the old values matches neither sign-in nor resolution. Tested on both backends.
- A row created under the current values keeps working.
- The handling of existing rows is decided, implemented and documented.
Activity