You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
authn: refuse repeated keys and invalid UTF-8 when decoding tokens #594
Why.Validator decodes the payload with encoding/json (through golang-jwt), so a repeated member is accepted
and the last value wins. WithStrictDecoding only covers base64 padding. TrustSet.Verify also decodes the
unverified payload to read iss for routing (authn/trustset.go), again last-wins. The protected header is decoded
the same way. encoding/json also replaces invalid UTF-8 with U+FFFD instead of refusing it.
Two parsers that read different values from the same signed bytes are a risk. Consumers that classify a caller from
the shape of its claims, or that today refuse repeated keys, can't move onto authn until it does the same.
Reproduce: sign a token whose payload has "sub":"a" and then "sub":"b". Validate accepts it with Subject == "b".
What. Refuse, with ReasonMalformed, a token whose header or payload repeats a member name at any depth, or
contains invalid UTF-8. Decode once for routing and for verification, or decode both the same strict way. This is
the default, with no option: a signed token with repeated keys is never legitimate.
Done when. Tests cover a repeated top-level key, a repeated nested key, a repeated header member, a repeated iss through TrustSet.Verify, and a raw invalid UTF-8 byte in a string claim.
Activity