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 keyCOSIGN_NEW_BUNDLE_FORMAT=falsein the environment. cosign reads aCOSIGN_<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
falseand cosign does not detect the bundle format. Upgrade cosign. Later 2.x releases detect a Sigstore bundle themselves, and before 2.4.0verify-blob-attestationcould 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 Issues
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, andmake gen-docs(regeneratesdocs/source/attestation/verify.mdfor 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).
SIGSTORE:VERIFIEDwith cosign v3.1.1, v3.1.4 andmain(0743bfcff5f8).- 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 withprovided artifact digests do not match digests in statement. LOCAL_CA: glab does not verifyLOCAL_CAyet, and fails as it does onmain(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.COSIGN_NEW_BUNDLE_FORMAT: with the variable unset ortrue, all three builds verify. Withfalse, v3.1.1 and v3.1.4 reject every bundle with the error above, andmainignores 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:
cosign verify-blob-attestation without --new-bundle-format, with the identity and issuer glab passes, verifies a SIGSTORE bundle and a LOCAL_CA bundle:

