Skip to content

Conversation

@alex9smith
Copy link
Contributor

Details

The PKCE spec requires the code verifier to be 43-128 characters1.

The default length argument to generate_id is 40 characters, which meant the verifier is always shorter than required by the spec. This could cause issues integrating authentik with PKCE-compliant OIDC providers.

For transparency, I work on GOV.UK One Login (an OIDC OP) and am looking at @brendanarnold's integration with us which is also being discussed in issue #17491.

I would like to add a test to this PR that the generated verifier is of the correct length, but it wasn't clear to be where that should go. If you can point me to the right place I'll add it.

Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

Footnotes

  1. https://datatracker.ietf.org/doc/html/rfc7636#section-4.1

The PKCE spec requires the code verifier to be 43-128 characters
inclusive[^1].

The default `length` argument to `generate_id` is 40 characters, which
meant the verifier is always shorter than required by the spec.
This could cause issues integrating authentik with PKCE-compliant OIDC
providers.

[^1]: https://datatracker.ietf.org/doc/html/rfc7636#section-4.1
@alex9smith alex9smith requested a review from a team as a code owner October 28, 2025 14:17
@netlify
Copy link

netlify bot commented Oct 28, 2025

Deploy Preview for authentik-docs canceled.

Name Link
🔨 Latest commit e388ef2
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6900d3a2d67c730008b6663c

@netlify
Copy link

netlify bot commented Oct 28, 2025

Deploy Preview for authentik-integrations canceled.

Name Link
🔨 Latest commit e388ef2
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6900d3a26f19a100086f5ac1

@netlify
Copy link

netlify bot commented Oct 28, 2025

Deploy Preview for authentik-storybook canceled.

Name Link
🔨 Latest commit e388ef2
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6900d3a4ecf2d60008459fe5

@BeryJu BeryJu added area:backend backport/version-2025.10 Add this label to PRs to backport changes to version-2025.10 labels Oct 28, 2025
@BeryJu BeryJu self-assigned this Oct 28, 2025
@BeryJu BeryJu added this to the Release 2025.10.1 milestone Oct 28, 2025
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
@github-project-automation github-project-automation bot moved this from Todo to In Progress in authentik Core Oct 28, 2025
@codecov
Copy link

codecov bot commented Oct 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.88%. Comparing base (e2904d1) to head (e388ef2).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17763      +/-   ##
==========================================
- Coverage   92.97%   92.88%   -0.09%     
==========================================
  Files         869      869              
  Lines       47949    47950       +1     
==========================================
- Hits        44582    44540      -42     
- Misses       3367     3410      +43     
Flag Coverage Δ
e2e 45.19% <0.00%> (-0.07%) ⬇️
integration 23.11% <0.00%> (-0.07%) ⬇️
unit 91.07% <100.00%> (+<0.01%) ⬆️
unit-migrate 91.12% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BeryJu BeryJu merged commit 6b43ddc into goauthentik:main Oct 28, 2025
87 of 90 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in authentik Core Oct 28, 2025
authentik-automation bot pushed a commit that referenced this pull request Oct 28, 2025
* sources/oauth: Make PKCE verifier 128 characters

The PKCE spec requires the code verifier to be 43-128 characters
inclusive[^1].

The default `length` argument to `generate_id` is 40 characters, which
meant the verifier is always shorter than required by the spec.
This could cause issues integrating authentik with PKCE-compliant OIDC
providers.

[^1]: https://datatracker.ietf.org/doc/html/rfc7636#section-4.1

* add length test

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Jens Langhammer <jens@goauthentik.io>
@authentik-automation
Copy link
Contributor

🍒 Cherry-pick to version-2025.10 created: #17765

rissson pushed a commit that referenced this pull request Oct 28, 2025
…to version-2025.10) (#17765)

Co-authored-by: Alex Whitehead-Smith <alex.me.smith@gmail.com>
Co-authored-by: Jens Langhammer <jens@goauthentik.io>
kensternberg-authentik added a commit that referenced this pull request Nov 10, 2025
* main: (28 commits)
  ci: use hashes for actions everywhere (#17803)
  website/integrations: fixed paperless-ngx yml syntax issue and added additional info (#17739)
  core, web: update translations (#17782)
  ci: rework internal repo (#17797)
  root: use hashes for dockerfile FROM (#17795)
  web: bump validator from 13.15.15 to 13.15.20 in /packages/prettier-config (#17776)
  tasks: delay startup signals (#17769)
  website: bump the build group in /website with 6 updates (#17712)
  core, web: update translations (#17660)
  web: bump vite from 7.1.11 to 7.1.12 in /web (#17689)
  website: bump validator from 13.15.15 to 13.15.20 in /website (#17741)
  web: bump eslint-plugin-react-hooks from 7.0.0 to 7.0.1 in /packages/eslint-config in the eslint group across 1 directory (#17714)
  web: bump validator from 13.15.15 to 13.15.20 in /packages/eslint-config (#17742)
  packages/django-postgres-cache: use upsert instead of select/update in a transaction (#17760)
  providers/radius: fix panic when no cert is configured (#17762)
  sources/oauth: Make PKCE verifier 128 characters (#17763)
  providers/proxy: fix missing JWT/claims header (#17759)
  providers/proxy: add gorm logging (#17758)
  web: bump the sentry group across 1 directory with 2 updates (#17743)
  root: Add Dockerfile label org.opencontainers.image.source (#17756)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend backport/version-2025.10 Add this label to PRs to backport changes to version-2025.10

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants