Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PKCE code verifier does not respect the RFC 7636 #1607

Open
smarting8m opened this issue Jan 10, 2024 · 0 comments
Open

PKCE code verifier does not respect the RFC 7636 #1607

smarting8m opened this issue Jan 10, 2024 · 0 comments

Comments

@smarting8m
Copy link

smarting8m commented Jan 10, 2024

module: openid-connect-client
version : 1.3.4

First of all, thanks for your work :), it simplifies the OIDC connection a lot.
But it seems the openid-connect-client does not respect the RFC 7636 - section 4.1 about the PKCE.
Indeed, the RFC mentions that the code verifier should be included between 43 and 128 characters.

But the method that generates the code verifier in OIDCAuthenticationFilter generates 50 bits and converts it in hexadecimal after, which results in a code verifier of length of 12 or 13...

Incriminated method :

/**
 * Create a random code challenge and store it in the session
 * @param session
 * @return
 */
protected static String createCodeVerifier(HttpSession session) {
	String challenge = new BigInteger(50, new SecureRandom()).toString(16);
	session.setAttribute(CODE_VERIFIER_SESSION_VARIABLE, challenge);
	return challenge;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant