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

Don't require the nbf claim #15197

Merged
merged 1 commit into from
Jan 12, 2024
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
4 changes: 2 additions & 2 deletions tests/unit/oidc/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ def test_verify_jwt_signature(self, monkeypatch):
algorithms=["RS256"],
options=dict(
verify_signature=True,
require=["iss", "iat", "nbf", "exp", "aud"],
require=["iss", "iat", "exp", "aud"],
verify_iss=True,
verify_iat=True,
verify_nbf=True,
verify_exp=True,
verify_aud=True,
verify_nbf=True,
strict_aud=True,
),
issuer=service.issuer_url,
Expand Down
2 changes: 1 addition & 1 deletion warehouse/oidc/models/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class OIDCPublisherMixin:
__optional_verifiable_claims__: dict[str, CheckClaimCallable[Any]] = dict()

# Claims that have already been verified during the JWT signature
# verification phase.
# verification phase if present.
__preverified_claims__ = {
"iss",
"iat",
Expand Down
8 changes: 4 additions & 4 deletions warehouse/oidc/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ def verify_jwt_signature(self, unverified_token: str) -> SignedClaims | None:
verify_signature=False,
# We require all of these to be present, but for the
# null publisher we only actually verify the audience.
require=["iss", "iat", "nbf", "exp", "aud"],
require=["iss", "iat", "exp", "aud"],
verify_iss=False,
verify_iat=False,
verify_nbf=False,
verify_exp=False,
verify_aud=True,
# We don't accept JWTs with multiple audiences; we
Expand Down Expand Up @@ -251,12 +250,13 @@ def verify_jwt_signature(self, unverified_token: str) -> SignedClaims | None:
# "require" only checks for the presence of these claims, not
# their validity. Each has a corresponding "verify_" kwarg
# that enforces their actual validity.
require=["iss", "iat", "nbf", "exp", "aud"],
require=["iss", "iat", "exp", "aud"],
verify_iss=True,
verify_iat=True,
verify_nbf=True,
verify_exp=True,
verify_aud=True,
# We don't require the nbf claim, but verify it if present
verify_nbf=True,
# We don't accept JWTs with multiple audiences; we
# want to be the ONLY audience listed.
strict_aud=True,
Expand Down