mirror of https://github.com/google/oss-fuzz.git
pyjwt: catch PyJWTError exceptions (#8645)
jwt functions like jwt.decode could raise PyJWTError exceptions (e.g. ExpiredSignatureError if the token is expired) Fix error handling for issue: - 50696 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50696)
This commit is contained in:
parent
647284cd19
commit
5b854a4468
|
@ -44,8 +44,11 @@ def test_roundtrip(data):
|
|||
return
|
||||
|
||||
key = "fuzzing"
|
||||
jwt_message = jwt.encode(payload, key, algorithm="HS256")
|
||||
decoded_payload = jwt.decode(jwt_message, key, algorithms=["HS256"])
|
||||
try:
|
||||
jwt_message = jwt.encode(payload, key, algorithm="HS256")
|
||||
decoded_payload = jwt.decode(jwt_message, key, algorithms=["HS256"])
|
||||
except jwt.exceptions.PyJWTError:
|
||||
return
|
||||
assert decoded_payload == payload
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue