-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: Add PKCE and JWKS support for upstream OIDC providers #5993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -177,6 +177,8 @@ func toAPIResponse(idp *types.IdentityProvider) api.IdentityProvider { | |
| Name: idp.Name, | ||
| Issuer: idp.Issuer, | ||
| ClientId: idp.ClientID, | ||
| Pkce: &idp.PKCE, | ||
| JwksUrl: &idp.JWKSURL, | ||
| } | ||
| if idp.ID != "" { | ||
| resp.Id = &idp.ID | ||
|
|
@@ -186,11 +188,18 @@ func toAPIResponse(idp *types.IdentityProvider) api.IdentityProvider { | |
| } | ||
|
|
||
| func fromAPIRequest(req *api.IdentityProviderRequest) *types.IdentityProvider { | ||
| return &types.IdentityProvider{ | ||
| idp := &types.IdentityProvider{ | ||
| Type: types.IdentityProviderType(req.Type), | ||
| Name: req.Name, | ||
| Issuer: req.Issuer, | ||
| ClientID: req.ClientId, | ||
| ClientSecret: req.ClientSecret, | ||
| } | ||
| if req.Pkce != nil { | ||
| idp.PKCE = *req.Pkce | ||
| } | ||
| if req.JwksUrl != nil { | ||
| idp.JWKSURL = *req.JwksUrl | ||
| } | ||
|
Comment on lines
+198
to
+203
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Because Consider propagating the pointer (or a tri-state) all the way down to the merge step, e.g. by carrying 🤖 Prompt for AI Agents |
||
| return idp | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Root cause of the PKCE/JWKS silent-reset risk on partial updates.
The acknowledged limitation here is the underlying cause of a real data-loss bug: because
cfg.PKCEis a plainbool, this merge cannot distinguish "client omitted the field" from "client set it tofalse". Any update from a client that doesn't echopkce(curl/scripted updates, future UIs that only patch some fields, etc.) will flip a previously-enabled PKCE configuration off without the user's knowledge.The cleanest fix is to plumb
*bool(and*stringforJWKSURLif you want the same semantics) through the call chain —api.IdentityProviderRequestalready uses*bool/*string, so the information is currently being thrown away infromAPIRequest(management/server/http/handlers/idp/idp_handler.go). Either:types.IdentityProvider.PKCEanddex.ConnectorConfig.PKCE*bool, and only overwrite when non-nil; orUpdate*path read the existingIdentityProvider, copy over only fields explicitly set in the request, and pass the merged struct down (so this merge becomes unnecessary for these fields).Also note
JWKSURLhas the inverse asymmetry:mergeConnectorConfigpreserves it on empty input, so a user can never clear a previously-set JWKS URL via update once the field is set.🤖 Prompt for AI Agents