Skip to content

Support SHA hash input for gh attestation verify and gh attestation download command #12462

Open

Description

@suzuki-shunsuke

Describe the feature or problem you’d like to solve

Currently, gh attestation verify and gh attestation download requires the actual artifact (file or OCI image) to be present for verification.
This limitation makes it difficult to verify attestations in offline scenarios or when only the artifact's checksum is known.

Proposed solution

Add support for accepting SHA hashes directly as input to gh attestation verify, similar to how cosign verify-blob works. Users should be able to provide hashes in the format:

  • sha256:4f658c9258ba261019114afcf8cbc155ce1b9a1157d17cb1fc2e0a48d962d1d7
  • sha512:abc123...

Additional context

I've implemented this feature. I'll send a pull request.

Example: Verify pinact_darwin_amd64.tar.gz (sha256:4f658c9258ba261019114afcf8cbc155ce1b9a1157d17cb1fc2e0a48d962d1d7) GitHub Release

Before: Checksums aren't supported.

$ gh version 2.83.2 (2025-12-10)
https://github.com/cli/cli/releases/tag/v2.83.2
$ gh attestation verify sha256:4f658c9258ba261019114afcf8cbc155ce1b9a1157d17cb1fc2e0a48d962d1d7 \
  -R suzuki-shunsuke/pinact \
  --signer-workflow suzuki-shunsuke/go-release-workflow/.github/workflows/release.yaml
✗ Loading digest for sha256:4f658c9258ba261019114afcf8cbc155ce1b9a1157d17cb1fc2e0a48d962d1d7 failed

Error: failed to open local artifact: open sha256:4f658c9258ba261019114afcf8cbc155ce1b9a1157d17cb1fc2e0a48d962d1d7: no such file or directory

After:

$ gh attestation verify sha256:4f658c9258ba261019114afcf8cbc155ce1b9a1157d17cb1fc2e0a48d962d1d7 \
  -R suzuki-shunsuke/pinact \
  --signer-workflow suzuki-shunsuke/go-release-workflow/.github/workflows/release.yaml
Using provided digest sha256:4f658c9258ba261019114afcf8cbc155ce1b9a1157d17cb1fc2e0a48d962d1d7
Loaded 1 attestation from GitHub API

The following policy criteria will be enforced:
- Predicate type must match:................ https://slsa.dev/provenance/v1
- Source Repository Owner URI must match:... https://github.com/suzuki-shunsuke
- Source Repository URI must match:......... https://github.com/suzuki-shunsuke/pinact
- Subject Alternative Name must match regex: ^https://github.com/suzuki-shunsuke/go-release-workflow/.github/workflows/release.yaml
- OIDC Issuer must match:................... https://token.actions.githubusercontent.com

✓ Verification succeeded!

The following 1 attestation matched the policy criteria

- Attestation #1
  - Build repo:..... suzuki-shunsuke/pinact
  - Build workflow:. .github/workflows/release.yaml@refs/tags/v3.8.0
  - Signer repo:.... suzuki-shunsuke/go-release-workflow
  - Signer workflow: .github/workflows/release.yaml@4db55f2aeaca166b2655fa4a80658df1050dc203

Note

Activity

  1. added
    enhancement
    on Jan 11, 2026
  2. github-actions commented on Jan 11, 2026

    @github-actions
    Contributor

    Thank you for your issue! We have categorized it as a feature request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.

    Unless you see the help wanted Contributions welcome label, we are not currently looking for external contributions for this feature.

    If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.

  3. added
    needs-triage
    on Jan 11, 2026
  4. changed the title [-]Support SHA hash input for `gh attestation verify` command[/-] [+]Support SHA hash input for `gh attestation verify` and `gh attestation download` command[/+] on Jan 11, 2026
  5. suzuki-shunsuke commented on Jan 11, 2026

    @suzuki-shunsuke
    Author

    Update: I found not only gh attestation verify but also gh attestation download should also support digest.
    I updated the issue and pull request.

  6. added
    gh-attestation
    on Jan 12, 2026
  7. BagToad commented on Jan 12, 2026

    @BagToad
    Member

    @cli/package-security for visibility.

  8. bdehamer commented on Jan 26, 2026

    @bdehamer
    Contributor

    Hi @suzuki-shunsuke, thank you for taking the time to open this issue and for the thoughtful PR! We really appreciate your contribution to the project.

    We've discussed this feature internally, and while we understand the appeal of offline verification scenarios (and recognize that tools like cosign verify-blob-attestation support this pattern), we've decided not to move forward with this feature at this time.

    Our primary concern is around the security implications of verifying raw digests. When you pass a file path to gh attestation verify, the tool computes the digest and verifies that the attestation matches -- creating a tight binding between "the thing I verified" and "the thing I'm about to use."

    When accepting a raw digest, that binding is broken. It becomes very easy to end up in a situation where you verify one digest but actually use a different artifact. This is especially risky in automated pipelines where the digest might come from one source and the artifact from another, or where there's any opportunity for the values to drift apart.

    This isn't to say we'll never support this. We may revisit it in the future if we can design appropriate guardrails that help users avoid these pitfalls. But for now, we want to err on the side of caution.

    That said, we'd love to hear more about your specific use case! Understanding the real-world scenarios where this would be valuable could help us think about how to approach this more safely in the future.

  9. suzuki-shunsuke commented on Jan 26, 2026

    @suzuki-shunsuke
    Author

    Thank you for the explanation.

    That said, we'd love to hear more about your specific use case!

    Let me explain our use case.

    I'm a maintainer of the CLI Version Manager named aqua.
    aqua supports verifying artifacts by gh attestation verify.

    When verifying downloaded artifacts in CI using gh attestation verify, there are several challenges:

    1. Verification takes some time
    2. Dependency on GitHub CLI (requires installation)
    3. Rekor access occasionally fails
    4. Cannot verify in network-restricted environments where Rekor is inaccessible

    A practical solution to these issues is:

    1. Verify the digest once using provenance and record it in a lock file (aqua has the lock file named aqua-checksums.json)
    2. Subsequently, verify artifacts against the digest recorded in the lock file
    3. Step 1 only needs to be performed when adding or updating artifacts, while step 2 eliminates the issues mentioned above.

    Digests can be obtained from files like checksums.txt or the GitHub Releases API without downloading large artifacts.
    However, since gh attestation verify and gh attestation download currently cannot accept digests as arguments, downloading the artifact is still required.
    Supporting digest arguments would enable efficient verification in step 1.

    aqua’s lock file, aqua-checksums.json, is a file that stores checksums like the following.

    {
      "checksums": [
        {
          "id": "github_release/github.com/aquasecurity/trivy/v0.68.2/trivy_0.68.2_Linux-64bit.tar.gz",
          "checksum": "3D933BBC3685F95EC15280F620583D05D97EE3AFFB66944D14481D5D6D567064",
          "algorithm": "sha256"
        },
        ...
      ]
    ]

    Because lock files are managed independently in the user’s environment, separate from remote artifacts, the risk of both being tampered with at the same time is low.
    Even if assets in GitHub Releases were compromised, such issues can be detected using the lock file.

    Lock files are a common security mechanism supported by many tools, not just aqua.
    As a result, their benefits extend beyond aqua users and can also be enjoyed by users of other tools—or even by those who do not use such specialized tools at all.

    Ultimately, many users will be able to benefit from the security provided by GitHub Artifact Attestations without sacrificing performance, being constrained by their execution environment, or struggling with flaky errors.
    This, in turn, will promote wider adoption of GitHub Artifact Attestations and contribute to improving supply chain security across the ecosystem as a whole.

  10. added and removed
    needs-triage
    on Jan 26, 2026
  11. kommendorkapten commented on Jan 27, 2026

    @kommendorkapten
    Contributor

    Hi @suzuki-shunsuke

    Can you please explain more about the verification step, and how Rekor is a potential source of problems? The Sigstore bundle (the attestation, certificate and other verification materials) do not depend on online access to Rekor. The bundle contains an inclusion proof from Rekor, which is verified offline, without requiring any access to Rekor.

    Using the default flow with GitHub Artifact Attestations, and verifying with gh, there should only be two network transactions (assuming the artifact to verify is already present).

    1. Verify/update the trust root via TUF
    2. Download the attestation (Sigstore bundle) from GitHub's API.

    However, it may be possible to sign the aqua-checksums.json file if it's verified during an action workflow. Not sure if that would help you but it could be something to consider as it would potentially give you the extra layer of inversion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedenhancementgh-attestationstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions