Add PKCE (RFC 7636) to mithrandir OAuth flow#1053
Open
luke-hagar-sp wants to merge 3 commits intomainfrom
Open
Add PKCE (RFC 7636) to mithrandir OAuth flow#1053luke-hagar-sp wants to merge 3 commits intomainfrom
luke-hagar-sp wants to merge 3 commits intomainfrom
Conversation
Protect the authorization code grant against interception attacks by generating a code_verifier/code_challenge pair (S256) during auth initiation and sending the verifier during token exchange. The verifier is stored in DynamoDB and never exposed in API responses. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
luke-hagar-sp
commented
Mar 13, 2026
backend/src/mithrandir/index.ts
Outdated
| tokenExchangeURL.searchParams.set('client_id', validatedClientId); | ||
| tokenExchangeURL.searchParams.set('code', code); | ||
| tokenExchangeURL.searchParams.set('redirect_uri', redirectUri); | ||
| tokenExchangeURL.searchParams.set('code_verifier', codeVerifier); |
There was a problem hiding this comment.
Are these form-data params or query params?
Contributor
Author
There was a problem hiding this comment.
This is building a URL, so query params. I DM'd you about the flows that need updating
Updated the token exchange functions to utilize URLSearchParams for constructing the request body, improving readability and maintainability. Removed the redirectUri parameter from the exchangeCodeForToken function as it is no longer needed.
4368da6 to
0ed38b9
Compare
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.
Protect the authorization code grant against interception attacks by generating a code_verifier/code_challenge pair (S256) during auth initiation and sending the verifier during token exchange. The verifier is stored in DynamoDB and never exposed in API responses.