Skip to content
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
2 changes: 2 additions & 0 deletions tests/unit/oidc/models/test_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@ def test_github_publisher_job_workflow_ref(self, claim, ref, sha, valid, expecte
[
("repo:foo/bar", "repo:foo/bar:someotherstuff", True),
("repo:foo/bar", "repo:foo/bar:", True),
("repo:fOo/BaR", "repo:foo/bar", True),
("repo:foo/bar", "repo:fOo/BaR:", True),
("repo:foo/bar:someotherstuff", "repo:foo/bar", False),
("repo:foo/bar-baz", "repo:foo/bar", False),
("repo:foo/bar", "repo:foo/bar-baz", False),
Expand Down
7 changes: 6 additions & 1 deletion warehouse/oidc/models/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ def _check_sub(ground_truth, signed_claim, _all_signed_claims):
if len(components) < 2:
return False

return f"{components[0]}:{components[1]}" == ground_truth
org, repo, *_ = components
if not org or not repo:
return False

# The sub claim is case-insensitive
return f"{org}:{repo}".lower() == ground_truth.lower()


class GitHubPublisherMixin:
Expand Down