fix: require PKCE S256 on public OAuth clients#44
Open
nanookclaw wants to merge 1 commit into
Open
Conversation
Reject authorization requests that omit code_challenge or use a method other than S256. Without this, an attacker who intercepts the auth code can exchange it for a token at /oauth/token with no proof of client identity. Closes Freedisch#31 Signed-off-by: Nanook <nanookclaw@users.noreply.github.com>
|
@nanookclaw is attempting to deploy a commit to the freedisch's projects Team on Vercel. A member of the Team first needs to authorize it. |
Owner
|
Thanks for your contribution |
Author
|
Ran the local Go test suite from the module root after re-checking this branch: cd havril && go test ./...Result: all packages pass; the repo currently has no Go test files, so this verifies compile/package integrity rather than exercising an auth integration test. I also manually re-read the OAuth flow touched by this PR:
So this should not break the current Claude auth flow; it only rejects clients that omit PKCE or use a non-S256 method. |
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.
Problem
authorizeSubmitandautoAuthorizepasscode_challengethrough toissueCodewithout checking whether it is present. When a client omits the challenge, theTokenhandler's PKCE verification is silently skipped because the storedcodeChallengeis empty. For public clients (no client secret), PKCE is the only proof-of-identity during code exchange.Fix
Both authorization paths now reject requests where
code_challengeis absent orcode_challenge_methodis notS256, returning 400 before any code is issued. This moves PKCE from opt-in to mandatory.Closes #31