Skip to content

Commit 2093e0e

Browse files
authentik-automation[bot]alex9smithBeryJu
authored
sources/oauth: Make PKCE verifier 128 characters (cherry-pick #17763 to version-2025.10) (#17765)
Co-authored-by: Alex Whitehead-Smith <alex.me.smith@gmail.com> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
1 parent 2791d87 commit 2093e0e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

authentik/sources/oauth/clients/oauth2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def get_redirect_args(self) -> dict[str, str]:
143143
if self.source.source_type.urls_customizable and self.source.pkce:
144144
pkce_mode = self.source.pkce
145145
if pkce_mode != PKCEMethod.NONE:
146-
verifier = generate_id()
146+
verifier = generate_id(length=128)
147147
self.request.session[SESSION_KEY_OAUTH_PKCE] = verifier
148148
# https://datatracker.ietf.org/doc/html/rfc7636#section-4.2
149149
if pkce_mode == PKCEMethod.PLAIN:

authentik/sources/oauth/tests/test_views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ def test_source_redirect_pkce(self):
205205
session = self.client.session
206206
state = session[f"oauth-client-{self.source.name}-request-state"]
207207
verifier = session[SESSION_KEY_OAUTH_PKCE]
208+
self.assertEqual(len(verifier), 128)
208209
challenge = pkce_s256_challenge(verifier)
209210

210211
self.assertEqual(qs["redirect_uri"], ["http://testserver/source/oauth/callback/test/"])

0 commit comments

Comments
 (0)