lepture / authlib

The ultimate Python library in building OAuth, OpenID Connect clients and servers. JWS,JWE,JWK,JWA,JWT included.
https://authlib.org/
BSD 3-Clause "New" or "Revised" License
4.49k stars 448 forks source link

jws: correctly handle empty payload with JSON serialization #523

Closed zeldovich closed 1 year ago

zeldovich commented 1 year ago

Previously the code checked if the payload value was True when converted to bool by the if statement, but that conflates None (i.e., no payload field in the JSON serialization) and the empty string (a specific payload), because both are False when converted to bool. The proper check (as verified by the added test case) is to check if the payload is None.

What kind of change does this PR introduce? (check at least one)


lepture commented 1 year ago

@zeldovich Thanks for the fix.