We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 126f07b commit 00c51d7Copy full SHA for 00c51d7
1 file changed
jose/jwt.py
@@ -185,10 +185,15 @@ def get_unverified_claims(token):
185
raise JWTError('Error decoding token claims.')
186
187
try:
188
- return json.loads(claims.decode('utf-8'))
+ claims = json.loads(claims.decode('utf-8'))
189
except ValueError as e:
190
raise JWTError('Invalid claims string: %s' % e)
191
192
+ if not isinstance(claims, Mapping):
193
+ raise JWTError('Invalid claims string: must be a json object')
194
+
195
+ return claims
196
197
198
def _validate_iat(claims):
199
"""Validates that the 'iat' claim is valid.
0 commit comments