Repository navigation
fix(server): type access tokens at+jwt for clients with an ID-JAG policy - #5179
Conversation
nabokihms
left a comment
There was a problem hiding this comment.
Thanks for the quick fix! A dex-specific claim in every ID token is visible to all OIDC clients, and once it ships we have to keep it. Could you go with typ: at+jwt on access tokens instead (RFC 9068)?
SignWithType already exists for ID-JAGs, and KeySet rejects any typ other than JWT, so VerifyIDToken refuses a typed access token without new checks. Userinfo and introspection verify access tokens through the same KeySet, so they'll need to accept at+jwt. Untyped access tokens issued before the upgrade would still pass until they expire, and that's fine since ID-JAG hasn't been released yet.
…ect_token Dex signs access tokens with ID token claims, so VerifyIDToken accepted a dex access token as the Identity Assertion of an ID-JAG request. Access tokens are now signed with typ at+jwt (RFC 9068). The KeySet already refuses any typ other than JWT, so VerifyIDToken refuses them without a new check. Userinfo and introspection set KeySet.AcceptAccessTokens to keep accepting them. Refs dexidp#5177 Signed-off-by: Tymofii Pidlisnyi <tima@aeoess.com>
96bd44a to
0308a5e
Compare
|
@nabokihms Updated the fix to use One detail worth confirming: Dex still uses its existing access token claims, so this adds the RFC 9068 header without implementing the full profile, including its required The |
nabokihms
left a comment
There was a problem hiding this comment.
Thanks, the typed token works. One problem I missed when suggesting it: Spring Security resource servers reject typ: at+jwt by default (Nimbus only accepts JWT or no typ), so this breaks anyone who verifies dex access tokens with a stock NimbusJwtDecoder. Probably there are more.
Only a client with an ID-JAG policy can exchange its own access token, so could you type access tokens as at+jwt only for clients that have idJAGPolicies? Everyone else keeps today's format, and the KeySet changes stay as they are. On your client_id question: with typing limited to ID-JAG clients I'm fine without the full RFC 9068 profile for now.
…G policy Signed-off-by: Tymofii Pidlisnyi <tima@aeoess.com>
|
@nabokihms Updated in 43e55ae. Access tokens now use Tests cover rejection of another client's untyped access token, including when the policy client appears among its audiences. Tokens issued to a client before its policy was enabled remain untyped and may still be accepted by ID-JAG until they expire. |
Signed-off-by: maksim.nabokikh <max.nabokih@gmail.com>
10 commits since 60f28dd: ID-JAG audience binding and auth_time, the allowedGroups enforcement fix, ent blocked_until NULL handling, api username validation, LDAP startTLS port default, implicit/hybrid fragment encoding, and connector fixes. No changes are proposed upstream. * 'master' of https://github.com/dexidp/dex: feat(oauth2): let an ID-JAG policy set the client's ID at each audience (dexidp#5181) feat(oauth2): carry auth_time from the subject token into the ID-JAG (dexidp#5180) fix(connector/github): return UserNotInRequiredGroupsError when user lacks org or team access (dexidp#5100) fix(storage/ent): store an unset blocked_until as NULL (dexidp#5163) fix(api): require a username in CreatePassword (dexidp#5162) fix(ldap): default to port 389 when startTLS is set (dexidp#5184) fix(server): don't double-encode the implicit and hybrid fragment (dexidp#5183) fix(oidc)!: enforce allowedGroups when insecureEnableGroups is unset (dexidp#5185) feat(server): allow starting without connectors when the connectors API is enabled (dexidp#5061) fix(server): type access tokens at+jwt for clients with an ID-JAG policy (dexidp#5179)
Overview
Fixes #5177 for newly issued access tokens by adding a distinct JWT
typheader for clients with an ID-JAG policy. Previously issued untyped tokens remain an exception until they expire.What this PR does / why we need it
Dex currently signs access tokens with ID token claims. Without a way to distinguish the two token types, an ID-JAG exchange can accept an access token as an identity assertion.
This change:
typ: at+jwtfor clients that haveidJAGPolicies. The access tokens of every other client and all ID tokens remain unchanged.KeySettyp handling, introspection and userinfo with a typed token, and the ID-JAG rejections.An earlier regression run on
db226a7returned HTTP 200 where HTTP 400 was expected.Closes #5177
Special notes for your reviewer
azpchecks inVerifyIDToken. A test covers the single-audience case and the cross-client case where the policy client is among the audiences.typheader. For those clients the authorization and logout endpoints also stop accepting access tokens supplied asid_token_hint.go test ./server/... ./storage/...andgolangci-lint run ./...pass locally.