Specify algorithms for webpush jwt verification (#12378)
parent
5995c2f313
commit
f0231c1f29
|
@ -255,12 +255,12 @@ class HTML5PushCallbackView(HomeAssistantView):
|
|||
# 2a. If decode is successful, return the payload.
|
||||
# 2b. If decode is unsuccessful, return a 401.
|
||||
|
||||
target_check = jwt.decode(token, options={'verify_signature': False})
|
||||
target_check = jwt.decode(token, verify=False)
|
||||
if target_check[ATTR_TARGET] in self.registrations:
|
||||
possible_target = self.registrations[target_check[ATTR_TARGET]]
|
||||
key = possible_target[ATTR_SUBSCRIPTION][ATTR_KEYS][ATTR_AUTH]
|
||||
try:
|
||||
return jwt.decode(token, key)
|
||||
return jwt.decode(token, key, algorithms=["ES256", "HS256"])
|
||||
except jwt.exceptions.DecodeError:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in New Issue