oauth-wg / oauth-selective-disclosure-jwt

https://datatracker.ietf.org/doc/draft-ietf-oauth-selective-disclosure-jwt/
Other
56 stars 27 forks source link

Definitively distinguishing SD-JWT #345

Closed andrewwhitehead closed 5 months ago

andrewwhitehead commented 9 months ago

Considering an SD-JWT-aware processor that also processes non-SD JWTs, there seem to be multiple ways to determine whether SD processing should be performed and I wonder if this needs clarification.

Apologies if this is covered and I missed it.

Sakurann commented 9 months ago

If you are trying to separate normal JWT with SD-JWT,

we would not recommend using typ JOSE header because by the time you get it, you need to have already done JWT or SD-JWT specific processing

Sakurann commented 9 months ago

If you are talking about distinguishing SD-JWT with and without selectively disclosable claims, those do not need to be separated because they can be processed using the same processor. (I wasn't sure what exactly you meant by non-SD JWTs so to be sure)

andrewwhitehead commented 9 months ago

I spoke to Torsten a bit about this yesterday.

I think my issue is mainly with a hostile prover, who does not have to send the correct content-type (if there is a place to put one) and can change the token. If the holder strips off any disclosures, the trailing tilde, and optional KB-JWT, the result is still a valid JWT and the signature would verify, although the token might have some strange claims such as _sd and {"...": hash}. Conversely, the holder could take a traditional JWT and add a tilde, potentially triggering SD-JWT processing (although I can't see any concrete risk here).

For me, the best way to resolve this ambiguity would be to modify the signing procedure for an SD-JWT such that the signature would NOT match that of a corresponding JWT, likely by adding something to the plaintext, thus requiring the verifier to be informed about which type of token they are processing.

Otherwise, I believe that adding a standard claim in the SD-JWT protected header could help prevent confusion ("_sd": true for example).

Sakurann commented 8 months ago

hostile prover cannot change the typ value in the header of an issuer-signed JWT, so if the issuer issued it with "typ": "sd+jwt", the verifier will be able to detect it.