Use "release" sentinel value for release attestation verification #11991
+6
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Per: #11993
What Changed
Updated both
gh release verify
andgh release verify-asset
commands to retrieve attestations using the release predicate sentinel value"release"
instead of the explicit predicate type string"https://in-toto.io/attestation/release/v0.1"
.Why
The GitHub Attestation API supports a sentinel value
"release"
for the predicate type parameter, which allows the API to return attestations with any release predicate version (v0.1, v0.2, etc.) in a single request. This makes the CLI more resilient to future predicate version updates without requiring code changes.Previously, the commands were hardcoded to fetch only v0.1 release predicates, which would miss any attestations created with newer predicate versions.
Changes
PredicateType
fromshared.ReleasePredicateType
to"release"
PredicateType
fromshared.ReleasePredicateType
to"release"
"release"
sentinel value in test mocksTesting
All existing tests pass, including:
pkg/cmd/release/verify
testspkg/cmd/release/verify-asset
testspkg/cmd/attestation/api
testsThe mock client was updated to properly simulate the GitHub API's behavior when receiving the sentinel value.
Fixes the issue described in https://github.com/cli/cli/blob/trunk/pkg/cmd/release/verify/verify.go#L138 and https://github.com/cli/cli/blob/trunk/pkg/cmd/release/verify-asset/verify_asset.go#L150
Original prompt
Fixes github/package-security#3724
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.