Safeguard
Developer Tools•

How do you verify an attestation with gh attestation verify?

Three forms of gh attestation verify cover a binary, a container image and an SBOM predicate. See the commands and what a pass does and does not tell you.

Safeguard Security Team
3 min read

Use gh attestation verify with the artifact path and the source repository for a binary, add an oci:// prefix for a container image, and add --predicate-type to check an SBOM attestation. A pass means the attestation matches that artifact and repository. It does not mean the software is safe.

GitHub's documentation shows all three forms. This post lays them out and adds a short routine for using them in a release check.

The three forms

A binary. Pass the file and the organization and repository you expect:

gh attestation verify PATH/TO/YOUR/BUILD/ARTIFACT-BINARY -R ORGANIZATION_NAME/REPOSITORY_NAME

A container image. Log in to the registry first, then prefix the reference with oci://:

gh attestation verify oci://ghcr.io/ORGANIZATION_NAME/IMAGE_NAME:test

The documentation example for images does not show a repository flag. Check the current command reference for flags that state the expected repository before you script it.

An SBOM attestation. Add --predicate-type, such as https://spdx.dev/Document/v2.3 for SPDX. You can add --format json with --jq to inspect the predicate content.

What each check is saying

Command formYou are confirming
Binary with repositoryThis file has an attestation tied to that repository
Image with oci prefixThis image reference has an attestation
Predicate type givenAn attestation of that specific kind exists, such as SBOM

The repository flag is the expectation. If you leave it out, you are checking less, because you are not stating where the artifact should have come from. That echoes the SLSA advice that verification needs expectations, not just a valid signature.

What a pass does not cover

GitHub's page says attestations establish where and how software was built. It does not state any claim about vulnerabilities or code safety, and neither should you.

A pass also does not say the build used reviewed code, only that it happened in the place named. Pair verification with branch protection and review rules in the source repository.

A release check routine

  1. Download the artifact from the place customers get it.
  2. Run the verify command with the repository you expect.
  3. For images, verify by the digest you plan to deploy, not a moving tag. Tags can be repointed.
  4. Run the SBOM form if you ship SBOM attestations, and read the content.
  5. Save the output with the release record.
  6. Make a deploy job fail when verification fails.

Step three is a general good habit rather than something the page requires, since digests name exact content and tags can move.

Handling failures

When verification fails, resist the urge to rerun until it passes. Read the message, confirm the repository name, and check whether you are verifying the artifact that was actually attested. A rebuilt or re-tagged artifact has a different digest and will not match an older attestation.

Where scanning fits

Verification tells you about origin. Scanning tells you about contents. Safeguard's dependency scanning and SBOM tools cover the second part, and you can try the free scan at https://gold.safeguard.sh/scan.

Quick check

Do I need the repository flag?

The documentation examples include it. Without it you are not stating where the artifact should have been built.

Does verification confirm the image has no vulnerabilities?

No. It confirms origin information. Scan separately.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.