Skip to content

Commit

Permalink
Merge pull request #23 from maykinmedia/security-fix/jwt-algorithms
Browse files Browse the repository at this point in the history
🔒 Fix JWT verification
  • Loading branch information
CharString authored Feb 9, 2024
2 parents 94008c5 + 20d9345 commit 10dc137
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vng_api_common/middleware.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://pyjwt.readthedocs.io/en/latest/usage.html#reading-headers-without-validation
# -> we can put the organization/service in the headers itself
import logging
from typing import Any, Dict, List, Optional
from typing import Any, Dict, Iterable, List, Optional

from django.conf import settings
from django.db import models, transaction
Expand All @@ -28,7 +28,7 @@ def __init__(self, encoded: str = None):
self.encoded = encoded

@property
def applicaties(self) -> Optional[list]:
def applicaties(self) -> Iterable[Applicatie]:
if self.client_id is None:
return []

Expand Down Expand Up @@ -138,7 +138,7 @@ def payload(self) -> Optional[Dict[str, Any]]:
payload = jwt.decode(
self.encoded,
key,
algorithms="HS256",
algorithms=["HS256"],
leeway=settings.JWT_LEEWAY,
)
except jwt.InvalidSignatureError:
Expand Down

0 comments on commit 10dc137

Please sign in to comment.