Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security] Address vulnerabilities: upgrade cryptography from 42.0.2 to 42.0.4 and specify JWT algorithms to decode. #342

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion api/PclusterApiHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@
JWKS_URL = os.getenv("JWKS_URL",
f"https://cognito-idp.{REGION}.amazonaws.com/{USER_POOL_ID}/" ".well-known/jwks.json")


def jwt_decode(token, audience=None, access_token=None):
return jwt.decode(token, requests.get(JWKS_URL).json(), audience=audience, access_token=access_token)
return jwt.decode(
token, requests.get(JWKS_URL).json(), audience=audience, access_token=access_token, algorithms=["RS256"]
)


def setup_api_credentials(role_arn, credential_external_id=None):
Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ requests==2.31.0
urllib3==1.26.18
# Installing cryptography backend since it is the recommended one: https://pypi.org/project/python-jose/
python-jose[cryptography]==3.3.0
cryptography==42.0.4
PyYAML==6.0
pytest==7.2.2
pytest-mock==3.8.2
Expand Down
6 changes: 4 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ charset-normalizer==2.1.1
# via requests
click==8.1.3
# via flask
cryptography==42.0.2
# via python-jose
cryptography==42.0.4
# via
# -r requirements.in
# python-jose
ecdsa==0.18.0
# via python-jose
exceptiongroup==1.1.1
Expand Down
Loading