-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
OIDC: too short a secret breaks the self-created JWT process #22969
Comments
/cc @pedroigor, @sberyozkin |
@FroMage It is https://datatracker.ietf.org/doc/html/rfc7518#section-8.8 recommendation which |
See also https://datatracker.ietf.org/doc/html/rfc7518#section-3.2, and specifically |
Well, you're quoting JWT specs, not OIDC ones, so unless there's something that forces OIDC secrets to be of that size, we might need to not throw when making our own internal JWT token based on that secret. |
@FroMage Steph, |
@FroMage I think I'll introduce that system property anyway as there could be other cases where relaxing may be required, ex, some legacy provider expects RSA keys with 1024 bits, etc; as far as |
It's during testing I've noticed this, but I thought that it may apply to prod in some cases. This is not about key lengths, I think, this is about how we generate our own internal JWT by creating a public static SecretKey createSecretKeyFromSecret(String secret) {
byte[] secretBytes = secret.getBytes(StandardCharsets.UTF_8);
return new SecretKeySpec(secretBytes, "AES");
} What I mean, is that if the OIDC spec (or JWA indirectly) forces those client secrets to be of a minimum length, then fine, we're safe. But if not, it's entirely possible that we find someone in the future using short client secrets and this code will blow up for them. |
@FroMage yeah, this code is fine, I believe even Jose4J uses |
Describe the bug
For Github and Facebook we have to create our own JWT token because they don't include an ID Token. If the secret is too short like
SECRET
then I get the following exception during that token creation:I am not sure we should really be throwing if the secret is short, unless there's a real requirement of OIDC to have long secrets.
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
No response
Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: