Skip to content
This repository has been archived by the owner on Nov 29, 2021. It is now read-only.

JWT header parsing is too strict. #321

Open
PipocaQuemada opened this issue Oct 9, 2020 · 1 comment
Open

JWT header parsing is too strict. #321

PipocaQuemada opened this issue Oct 9, 2020 · 1 comment

Comments

@PipocaQuemada
Copy link

Currently, JWTtyp requires that the 'typ' in a JWT header is the string JWT.

However, the JWT spec (see https://tools.ietf.org/html/rfc7519#section-5.1) says

If present, it is RECOMMENDED that its value be "JWT" to indicate that this object is a JWT. While media type names are not case sensitive, it is RECOMMENDED that "JWT" always be spelled using uppercase characters for compatibility with legacy implementations.

I'm currently running into some problems because an external application is sending me JWTs with "typ"="at+jwt", so parsing the header fails.

@PipocaQuemada
Copy link
Author

Looking at the spec, https://www.rfc-editor.org/rfc/rfc7515.html#section-4.1.9 mentions that

This parameter is ignored by JWS implementations; any processing of this parameter is performed by the JWS application.

Based on that, I think tsec should just parse it as an Option[String], and accept anything in there as valid. Particularly because none of the RFCs specify valid values for that field, only recommended ones. We should default to generating "typ"="JWT", but not require that when parsing a JWT.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant