Repository navigation
Conversation
Follow-up to the id_token hardening (LNVPS#431). Every authorization request now carries a code_challenge and the token exchange presents the code_verifier (RFC 7636, S256). The verifier rides the signed, short-lived state token, so the flow stays stateless; states minted before PKCE simply carry no verifier and the token request omits it. Mitigates authorization-code interception (RFC 9700 section 4.6): a code stolen from redirects, referrers or logs is useless without the verifier, which never leaves the server and the provider's browser session. docs/config.md documents the behavior; API_CHANGELOG.md records it. Found by the 2026-11-01 security audit (LNVM-013 follow-up).
mptfire
force-pushed
the
audit/oauth-pkce
branch
from
November 2, 2026 06:35
21d7ed4 to
8ebacac
Compare
v0l
requested changes
Nov 2, 2026
v0l
left a comment
Contributor
There was a problem hiding this comment.
This PR contains all of #431 (it was branched from it), so please rebase onto master once #431 lands and keep only the PKCE commit here. Reviewing as one change makes it hard to land either.
On the PKCE part itself:
- Facebook does not support PKCE for the confidential web flow the way Google/GitHub/Apple do, and providers that reject unknown params will now fail login closed (your changelog says so). Please confirm each built-in provider (
google,github,facebook,apple) still logs in with thecode_challengeparams present, or make PKCE a per-flavour default with anoidcopt-out. A note on which ones you actually tested end-to-end would settle it. - The verifier sits in the
statequery param, which is visible to the browser, the provider and any log of the callback URL. With a confidential client that also sendsclient_secret, PKCE still adds code-injection protection, but say so in the doc rather than calling the verifier "Secret". Alternatively store it server side keyed by the nonce. - Doc comments: we keep comments out of new code (see
docs/agents/code-style.md); the new///blocks onpkce_verifier,pkce_challenge,VerifiedStateand the tests can go.
Contributor
|
Correction to point 1: Facebook does support PKCE (https://developers.facebook.com/documentation/facebook-login/guides/advanced/oidc-token/). The ask stands as a smoke test: confirm each built-in provider still completes a login with the PKCE params. The rebase onto #431 is the main blocker. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #431 (stacked on it — merge that first; I'll rebase after). Found by the same independent audit (2026-11-01).
What
The OAuth authorization-code flow now uses PKCE with
S256(RFC 7636):code_verifier(43 chars, RFC charset);code_challenge+code_challenge_method=S256;statetoken — the flow stays stateless (no server-side session table), and a state minted before PKCE simply carries none, so the token request omits it;Why
Authorization-code interception (RFC 9700 §4.6): a code leaked through redirects, referrer headers, proxy logs or browser history is useless without the verifier, which never leaves the server and the provider's browser session. RFC 9700 recommends PKCE for all OAuth clients regardless of client type.
Standards-compliant providers (Google, Apple, generic OIDC) accept PKCE; GitHub supports it. A provider that rejected the extra authorization parameters would fail login closed rather than degrade security —
docs/config.mdsays so.Validation
lnvps_api_commongreen (638), build clean.