`gh attestation verify` returns incorrect exit code during verification if no attestations are present
Published 14 Feb 2025 · Updated 10 Sept 2026
Is your project on an affected github.com/cli/cli/v2?
Look after several Go apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected package
- Affected
- >=2.49.0 <2.67.0
- Fixed in
- 2.67.0
go get github.com/cli/cli/v2@v2.67.0Details
Summary
A bug in GitHub's Artifact Attestation CLI tool, gh attestation verify, may return an incorrect zero exit status when no matching attestations are found for the specified --predicate-type <value> or the default https://slsa.dev/provenance/v1 if not specified. This issue only arises if an artifact has an attestation with a predicate type different from the one provided in the command. As a result, users relying solely on these exit codes may mistakenly believe the attestation has been verified, despite the absence of an attestation with the specified predicate type and the tool printing a verification failure.
Users are advised to update gh to version v2.67.0 as soon as possible.
Initial report: https://github.com/cli/cli/issues/10418 Fix: https://github.com/cli/cli/pull/10421
Details
The gh attestation verify command fetches, loads, and attempts to verify attestations associated with a given artifact for a specified predicate type. If an attestation is found, but the predicate type does not match the one specified in the gh attestation verify command, the verification fails, but the program exits early.
Due to a re-used uninitialized error variable, when no matching attestations are found, the relevant function returns nil instead of an error, causing the program to exit with a status code of 0, which incorrectly suggests successful verification.
PoC
Run gh attestation verify with local attestations using the --bundle flag and specify a predicate type with --predicate-type that you know will not match any of the attestations the command will attempt to verify. Confirm that the command exits with a zero status code.
Impact
Users who rely exclusively on the exit status code of gh attestation verify may incorrectly verify an attestation when the attestation's predicate type does not match the specified predicate type in the command.
Is GHSA-fgw4-v983-mgp8 in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected github.com/cli/cli/v2, and gives you the command that fixes it.
More advisories for github.com/cli/cli/v2
- LowCVE-2026-64653GitHub CLI allows path traversal through unescaped request URL components in github.com/cli/cli · 19 Oct 2026
- LowCVE-2026-64652GitHub CLI partially discloses authentication tokens in `gh auth status` output in github.com/cli/cli · 19 Oct 2026
- LowCVE-2026-64655GitHub CLI allows attestation verification bypass through unescaped regex metacharacters in github.com/cli/cli · 19 Oct 2026
- LowCVE-2026-64655GitHub CLI allows attestation verification bypass through unescaped regex metacharacters · 15 Oct 2026
- LowCVE-2026-64653GitHub CLI allows path traversal through unescaped request URL components · 15 Oct 2026
- LowCVE-2026-64652GitHub CLI partially discloses authentication tokens in `gh auth status` output · 15 Oct 2026
References
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.