JWK parsing does not tolerate leading whitespace #29086
Labels
release bug
This bug is present in a released version of Open Liberty
release:24008
team:Security SSO
Describe the bug
The JwKRetriver code used for parsing JWKS documents cannot tolerate strings that have leading whitespace.
Failing (current) behavior:
Expected (correct) behavior:
Between the two examples, the only difference (aside from unique values in the JWK objects) is a single leading space character that I added to the JWK response in the failing scenario. The Liberty code doesn’t do any kind of trimming on the response back from the server. If the response doesn’t immediately start with a
{
character, we assume we need to Base64 decode the response. Decoding the response ends up producing the junk string that you see in the trace with the exception, and we fail to parse the result as JSON.Steps to Reproduce
jwkEndpointUrl
of the OIDC client to an endpoint that produces a valid JWKS document, but with some kind of leading whitespaceExpected behavior
The Liberty server should trim the JWKS document for leading and trailing whitespace and correctly parse the JSON document.
Diagnostic information:
The text was updated successfully, but these errors were encountered: