mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Add indeterminate test to pyjwt
This commit is contained in:
@@ -3,15 +3,15 @@ import jwt
|
||||
# Encoding
|
||||
|
||||
# good - key and algorithm supplied
|
||||
jwt.encode({"foo": "bar"}, "key", "HS256")
|
||||
jwt.encode({"foo": "bar"}, key="key", algorithm="HS256")
|
||||
jwt.encode(token, "key", "HS256")
|
||||
jwt.encode(token, key="key", algorithm="HS256")
|
||||
|
||||
# bad - both key and algorithm set to None
|
||||
jwt.encode({"foo": "bar"}, None, None)
|
||||
jwt.encode(token, None, None)
|
||||
|
||||
# bad - empty key
|
||||
jwt.encode({"foo": "bar"}, "", algorithm="HS256")
|
||||
jwt.encode({"foo": "bar"}, key="", algorithm="HS256")
|
||||
jwt.encode(token, "", algorithm="HS256")
|
||||
jwt.encode(token, key="", algorithm="HS256")
|
||||
|
||||
# Decoding
|
||||
|
||||
@@ -25,3 +25,7 @@ jwt.decode(token, key, options={"verify_signature": False})
|
||||
# good - verified decoding
|
||||
jwt.decode(token, verify=True)
|
||||
jwt.decode(token, key, options={"verify_signature": True})
|
||||
|
||||
|
||||
def indeterminate(verify):
|
||||
jwt.decode(token, key, verify)
|
||||
|
||||
Reference in New Issue
Block a user