-
Notifications
You must be signed in to change notification settings - Fork 44
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
[BUG] Library forces presence of optional "use" field in JWKS key #87
Comments
Thanks for the message, we'll consider this and reach out to you. A work around, might you be interested: import { SimpleJwksCache } from "aws-jwt-verify/jwk";
class CustomJwksCache extends SimpleJwksCache {
async getJwks(jwksUri: string) {
return super.getJwks(jwksUri).then(jwks => {
jwks.keys.forEach(jwk => jwk.use = "sig");
return jwks;
})
}
}
const verifier = CognitoJwtVerifier.create({
...config
}, {
jwksCache: new CustomJwksCache()
}); |
Way ahead of you on the workaround (works perfectly), but thanks for posting that here, in case someone else needs it. I would've posted mine, but again, internal stuff 😄 |
Can't locate you to DM you @CaerusKaru Please share your alias or ping me? |
Status: agreed that we should make the check on the Asked @CaerusKaru if he'd be interested to create a PR for this |
Describe the bug
If you have a JWKS with a key without the use field, the library will throw and error because it is missing. This violates the spec on this, which states that
Use of the "use" member is OPTIONAL, unless the application requires its presence.
, which I believe means this should not be on the library side to enforce, and should be optional on the part of app owners.Versions
Which version of
aws-jwt-verify
are you using? 3.1.0Are you using the library in Node.js or in the Web browser? NodeJS
If Node.js, which version of Node.js are you using? (Should be at least 14) 16
If Web browser, which web browser and which version of it are you using? N/A
If using TypeScript, which version of TypeScript are you using? (Should be at least 4) 4.7.4
To Reproduce
If you can, please provide a minimal code example that reproduces the bug.
I am an Amazon employee, using Amazon JWKS provides, so please DM me internally for a reproduction of my exact case. Otherwise, simply refer to the unit tests for the library, which cover this case explicitly.
The text was updated successfully, but these errors were encountered: