core/oauth2: don't set state in responses if not supplied#9735
core/oauth2: don't set state in responses if not supplied#9735alxndrsn wants to merge 1 commit intogoauthentik:mainfrom
Conversation
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
Thanks for the PR! I'll have to do some reading but iirc as part of OIDC the state parameter is required? In that case we'd have to enforce it being set when the openid scope is set |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9735 +/- ##
==========================================
- Coverage 92.46% 92.31% -0.15%
==========================================
Files 669 704 +35
Lines 32751 34404 +1653
==========================================
+ Hits 30282 31760 +1478
- Misses 2469 2644 +175
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I may be reading the wrong place, but https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest reads:
|
|
Hi! Any chance this would be a straightforward review for you @BeryJu or someone else given the spec clarification above? Thanks! |
* pass `next` value to IdP as `state`, with additional random prefix * this makes the "next" value more trusted * fix support for Authentik and other IdPs which do not support auth URLs without `state` (goauthentik/authentik#9735) * may also improve support for IdPs which lack PKCE support (see: https://github.com/panva/openid-client/blob/1486c3a020af8d12449d1d6a4bdf4f2bf4d32b77/README.md#authorization-code-flow) Closes #1134 Closes #1135
I think this fixes a bug in OAuth2 / OpenID Connect (OIDC) implementation, as reported at getodk/central-backend#1135 (comment)
I guess this PR would ideally include tests which would fail without the code changes.