fix(attestation): stop passing deprecated --new-bundle-format to cosign

Description

glab attestation verify passes --new-bundle-format to cosign verify-blob-attestation. cosign v3.0.0 made the Sigstore bundle format the default, and v3.1.0 deprecated the flag. On cosign main (sigstore/cosign PR 5089), verify-blob-attestation always reads a Sigstore bundle and ignores the flag. A later release is expected to remove the flag, and cosign will then reject the command. This MR stops passing it.

The identity, issuer, --type and bundle arguments are unchanged.

Two cases now depend on cosign's default instead of the flag. Both fail closed, with a misleading error:

Error: bundle does not contain cert for verification, please provide public key
  • COSIGN_NEW_BUNDLE_FORMAT=false in the environment. cosign reads a COSIGN_<FLAG> variable when the flag is not on the command line, so this makes cosign 3.x read the bundle in the legacy format. Unset the variable.
  • cosign 2.4.0 and 2.4.1, where the flag defaults to false and cosign does not detect the bundle format. Upgrade cosign. Later 2.x releases detect a Sigstore bundle themselves, and before 2.4.0 verify-blob-attestation could not read one.

The help text now says the command requires Cosign 3.0.6 or later. Earlier 3.x releases, and 2.x releases before 2.6.3, can report a false positive in verify-blob-attestation when payload parsing fails (GHSA-w6c6-c85g-mmv6).

Related to https://gitlab.com/gitlab-org/gitlab/-/work_items/640703 (confidential)

How has this been tested?

Automated:

  • Unit tests drop the flag from the expected cosign arguments.
  • make test-changed, golangci-lint, and make gen-docs (regenerates docs/source/attestation/verify.md for the new requirement).

Manual, on a local GDK (http://gdk.test:3000) with a local Sigstore stack, against existing attestations of the public project root/slsa-test (no new pipeline, no re-signing): one SIGSTORE bundle and two LOCAL_CA bundles, all application/vnd.dev.sigstore.bundle.v0.3+json. Each cosign build was first on PATH, and a wrapper logged the arguments glab passed (no --new-bundle-format).

  1. SIGSTORE: VERIFIED with cosign v3.1.1, v3.1.4 and main (0743bfcff5f8).
  2. Changed artifact: glab fails with unable to find a provenance statement (the digest no longer matches). Passing the changed file to cosign directly, with the arguments glab uses and the original bundle, fails on all three builds with provided artifact digests do not match digests in statement.
  3. LOCAL_CA: glab does not verify LOCAL_CA yet, and fails as it does on main (not enough verified log entries from transparency log: 0 < 1). Both bundles verify with cosign directly on all three builds, without the flag, with a trusted root built from the project CA and --insecure-ignore-tlog --insecure-ignore-sct. A changed artifact fails.
  4. COSIGN_NEW_BUNDLE_FORMAT: with the variable unset or true, all three builds verify. With false, v3.1.1 and v3.1.4 reject every bundle with the error above, and main ignores the variable. Nothing that should fail passes.

Screenshots of two of these checks are below.

Screenshots (if appropriate):

glab attestation verify from this branch verifies a SIGSTORE attestation on the local GDK:

terminal-glab-sigstore

cosign verify-blob-attestation without --new-bundle-format, with the identity and issuer glab passes, verifies a SIGSTORE bundle and a LOCAL_CA bundle:

terminal-cosign-sigstore-and-local_ca

Edited by Saahil Sabu Hameed

Merge request reports

Loading
Loading