JWT signature error validations aren't passed through #567
trombonekenny
started this conversation in
Ideas
Replies: 2 comments 7 replies
-
I recently had same problem with new key size validations on thanks |
Beta Was this translation helpful? Give feedback.
5 replies
-
The reason it does not expose "the error" is that it is potentially looping over a set of applicable keys, not just one. So "the error" can be multiple errors and if so it's not so cut and dry as to which one to expose. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the bug
The openid-client bug is that any errors in the client.js
jose.compactVerify
function are not made visible or passed up the chain. The client throws a "failed to validate JWT signature" signature but doesn't include anymore data on why. It's not clear how I would get that troubleshooting if not from inside openid-client.I think this area needs to be refactored:
https://github.com/panva/node-openid-client/blob/10e3a37efe2635c4b21fba30f5646ef7cf2f4b95/lib/client.js#L1045
The error handling for that stanza should include data from the jose error, IMO. Maybe move the
throw new RPError
on L1055 up into that catch block?To Reproduce
I was having a hard time troubleshooting why my authentication sessions were working with 4.9.1 and failing with anything newer. I realized that 5.0.0 updated the jose version, which had different tolerances for RSA key length. The dev suite I was working with had <2048 bit keys, and it was eventually resolved by updating the keys in the suite.
Expected behaviour
I worked around this by sneaking some logging into the library (at the catch line link above).
I'm not sure how else to get the troubleshooting data from jose (maybe it has a debug setting? Or somewhere outside of openid-client could somehow capture that data?). It would make more sense to report that back in the error, like other RPError statements in client.js do.
Environment:
Additional context
Beta Was this translation helpful? Give feedback.
All reactions