-
-
Notifications
You must be signed in to change notification settings - Fork 747
Closed
Description
Empty key sets give the wrong exception. The error is here:
Lines 80 to 84 in 24b29ad
| if not keys or not isinstance(keys, list): | |
| raise PyJWKSetError("Invalid JWK Set value") | |
| if len(keys) == 0: | |
| raise PyJWKSetError("The JWK Set did not contain any keys") |
When keys is the empty list, not keys is true so the second check is never reached (unless some list subclass overrides __bool__).
Expected Result
Should raise PyJWKSetError("The JWK Set did not contain any keys").
Actual Result
Raises PyJWKSetError("Invalid JWK Set value").
Reproduction Steps
import jwt
jwt.PyJWKSet.from_dict({"keys": []})Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels