Skip to content

fix(authn): oauth pcke challenge for github and a correct oidc nonce#5647

Merged
kodiakhq[bot] merged 1 commit into
v2from
rd/v2/pkce
Apr 2, 2026
Merged

fix(authn): oauth pcke challenge for github and a correct oidc nonce#5647
kodiakhq[bot] merged 1 commit into
v2from
rd/v2/pkce

Conversation

@erka

@erka erka commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

This pull request adds support for Proof Key for Code Exchange (PKCE) to the GitHub and OIDC authentication flows. PKCE is an additional security layer for OAuth2, and these changes allow it to be enabled via configuration. The implementation includes updates to configuration files, backend logic for storing and verifying challenges, and comprehensive tests to ensure correct behavior and error handling.

PKCE Support for GitHub and OIDC Authentication

Configuration and Schema Updates:

  • Added the use_pkce boolean option to the GitHub and OIDC authentication configuration schemas (config/flipt.schema.cue, config/flipt.schema.json, internal/config/authentication.go). [1] [2] [3]

GitHub Authentication Flow:

  • Implemented PKCE challenge generation, storage, and verification in the GitHub OAuth2 flow. The server now generates a verifier, stores it, and includes the challenge in the authorization URL if use_pkce is enabled, and verifies it during the callback. [1] [2] [3]
  • Added and updated tests to cover PKCE-enabled flows, error handling (e.g., missing state, missing/expired challenge), and store interactions. Added test utilities for challenge capture and error injection. [1] [2] [3] [4] [5] [6] [7] [8] [9]

OIDC Authentication Flow:

  • Added PKCE support to OIDC: when enabled, the server generates and stores a verifier, passing it as the nonce, and verifies it during the callback. [1] [2] [3] [4] [5]

Testing and Validation:

  • Updated struct tag validation to special-case the usePKCE field for naming conventions.
  • Improved test coverage for PKCE scenarios, including correct challenge round-tripping, error cases, and integration with the authentication store. [1] [2] [3] [4] [5] [6] [7] [8] [9]

These changes collectively enhance the security of the OAuth2 authentication flows by supporting PKCE, and ensure robust handling and testing of the new logic.

@codecov

codecov Bot commented Apr 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.94%. Comparing base (2e0e3ed) to head (63290d4).
⚠️ Report is 4 commits behind head on v2.

Files with missing lines Patch % Lines
internal/server/authn/method/oidc/server.go 68.00% 5 Missing and 3 partials ⚠️
internal/storage/authn/redis/store.go 80.00% 3 Missing and 2 partials ⚠️
internal/storage/authn/memory/store.go 84.00% 2 Missing and 2 partials ⚠️
internal/server/authn/method/github/server.go 90.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               v2    #5647      +/-   ##
==========================================
+ Coverage   60.70%   60.94%   +0.24%     
==========================================
  Files         141      141              
  Lines       14023    14122      +99     
==========================================
+ Hits         8513     8607      +94     
+ Misses       4784     4781       -3     
- Partials      726      734       +8     
Flag Coverage Δ
integrationtests 34.34% <1.05%> (-0.20%) ⬇️
unittests 51.96% <83.33%> (+0.35%) ⬆️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@erka erka added automerge Used by Kodiak bot to automerge PRs v2 Flipt v2 labels Apr 1, 2026
@erka erka added the needs docs Requires documentation updates label Apr 1, 2026
@erka
erka marked this pull request as ready for review April 1, 2026 21:52
@erka
erka requested a review from a team as a code owner April 1, 2026 21:52
@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Apr 1, 2026

@markphelps markphelps left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amazing

@kodiakhq
kodiakhq Bot merged commit a146a1c into v2 Apr 2, 2026
51 of 52 checks passed
@kodiakhq
kodiakhq Bot deleted the rd/v2/pkce branch April 2, 2026 20:04
@github-project-automation github-project-automation Bot moved this to Done in Flipt V2 Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge Used by Kodiak bot to automerge PRs needs docs Requires documentation updates size:XL This PR changes 500-999 lines, ignoring generated files. v2 Flipt v2

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants