Skip to content

Commit

Permalink
The _check_sub verifier should check if empty (#15203)
Browse files Browse the repository at this point in the history
  • Loading branch information
di authored Jan 12, 2024
1 parent 1c962a4 commit 5587c72
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/unit/oidc/models/test_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def test_google_publisher_email_verified(self, email_verified, valid):
("fakesubject", "fakesubject", True),
("fakesubject", "wrongsubject", False),
# Publisher configured without subject: any subject is acceptable.
(None, "anysubject", True),
("", "anysubject", True),
# Publisher configured with subject, none provided: must fail.
("fakesubject", None, False),
],
Expand Down
2 changes: 1 addition & 1 deletion warehouse/oidc/models/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def _check_sub(
) -> bool:
# If we haven't set a subject for the publisher, we don't need to check
# this claim.
if ground_truth is None:
if ground_truth == "":
return True

# Defensive: Google should never send us an empty or null subject, but
Expand Down

0 comments on commit 5587c72

Please sign in to comment.