Skip to content

Commit

Permalink
OIDC: Allow SHA in job_workflow_ref claim, redux. (pypi#14336)
Browse files Browse the repository at this point in the history
* Add missing space

* Add required sha claim to optional claims check
  • Loading branch information
di authored Aug 10, 2023
1 parent 9b446fb commit 0793efd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/unit/oidc/models/test_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def test_github_publisher_missing_optional_claims(self, monkeypatch):
for claim_name in github.GitHubPublisher.__required_verifiable_claims__
}
signed_claims["ref"] = "ref"
signed_claims["sha"] = "sha"
signed_claims["job_workflow_ref"] = publisher.job_workflow_ref + "@ref"
assert publisher.__required_verifiable_claims__
with pytest.raises(errors.InvalidPublisherError) as e:
Expand Down
2 changes: 1 addition & 1 deletion warehouse/oidc/models/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _check_job_workflow_ref(ground_truth, signed_claim, all_signed_claims):
expected = {f"{ground_truth}@{_ref}" for _ref in [ref, sha] if _ref}
if signed_claim not in expected:
raise InvalidPublisherError(
"The job_workflow_ref claim does not match, expecting one of"
"The job_workflow_ref claim does not match, expecting one of "
f"{sorted(expected)!r}, got {signed_claim!r}"
)

Expand Down

0 comments on commit 0793efd

Please sign in to comment.