1
0
mirror of synced 2026-10-29 01:59:38 +03:00

373 Commits

Author SHA1 Message Date
Aaron Lew
ef56e6999c Unify attach signature and attestation under new bundle format (#5141)
* Unify attach signature and attestation under new bundle format

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* fix(attach): honor --allow-http-registry when writing referrers

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

---------

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-10-25 20:07:11 -07:00
Aaron Lew
7757e8b3e3 fix(e2e): enable UseSignedTimestamps in *TSAMTLSWithSigningConfig
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-10-01 10:49:26 -07:00
Aaron Lew
907c3d899c fix(sign): propagate BundlePath from SignOptions to KeyOpts
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-09-24 12:59:42 -07:00
Aaron Lew
67a1216d73 fix: write referrers when image index has attestations (#5111)
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-09-18 16:24:31 -04:00
Geoffrey Hichborn
1dbbc36ca4 fix(load): upload bundle layer blobs before manifest PUT
cosign load was putting v3 Sigstore bundle manifests before their layer
blobs, causing BLOB_UPLOAD_UNKNOWN on registries that enforce blob-first
ordering (e.g. AWS ECR). Reorder to match WriteReferrer.

Add a unit test for upload ordering and a cross-registry e2e whose
destination rejects manifests that reference missing blobs, so the
regression is not masked by the permissive fake registry.

Fixes #5030

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Geoffrey Hichborn <geoff@yourparadigm.net>
2026-09-14 16:14:40 -07:00
Aaron Lew
d39ab7c812 Align privacy statement prompt behavior (#5076)
* fix: evaluate tlog upload for all signers

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* refactor: extract privacy statement logic from ShouldUploadToTlog

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* refactor: generalize public good URL detection for Rekor and Fulcio

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* fix: only show privacy statement for public Sigstore services

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* refactor: rename shouldUpload to uploadToTlog

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

---------

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-09-08 15:25:10 -04:00
Aaron Lew
81fa4e9817 fix(verify): propagate CommonVerifyOptions to VerifyCommand (#5094)
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-09-03 10:04:21 -04:00
Hayden
98ff280b19 Bump golanglint-ci, dynamically fetch version (#5055)
This moves the version into a Dockerfile so that it'll get auto-updated.
Also bumps to the latest linter version as it's needed for Go 1.26.

Signed-off-by: Hayden <8418760+Hayden-IO@users.noreply.github.com>
2026-08-13 14:25:41 -04:00
Guy Avigdor
4b28ba793d Bump sigstore-go to v1.3.0 (#5045)
* Update sigstore-go to v1.3.0

Fixes a nil-pointer panic on malformed bundles: validateBundle now
runs before TlogEntries. cosign loads user-supplied bundles from disk
in verify-blob, verify-blob-attestation, and checkNewBundle, though
cosign always validates first so the panic was not reachable through
its own paths.

Also picked up: Rekor v1 CreateLogEntry recovers from a 409 Conflict
by fetching the existing entry, and DSSE parsing no longer
materializes in-toto predicates on paths that only read subjects.

The other module changes come from sigstore-go's own go.mod via MVS;
go get sigstore-go@v1.3.0 && go mod tidy reproduces this diff.

Signed-off-by: Guy Avigdor <guy.avigdor@zota.com>

* test: pass explicit params to TSA client calls

timestamp-authority v2.1.3 reads params before its nil check, so passing
nil panics. Use NewGetTimestampCertChainParams() instead.

Signed-off-by: Guy Avigdor <guy.avigdor@zota.com>

---------

Signed-off-by: Guy Avigdor <guy.avigdor@zota.com>
2026-08-07 18:03:47 +00:00
Kenneth
d6d86c224e Supporting OCI Signing with X.509 Certificate Chain (#4614)
* Adding BYOCA Certificate Chain Option for Signing and Verification

Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>

* Temporary Reference to Uncommited sigstore-go Updates

Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>

* Update sigstore-go v1.2.2

Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>

* Update Copyright Date

Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>

* Certificate Chain Support for Verify Blob and E2E Tests

Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>

* Update Unit Tests for sigstore-go v1.2.2 Changes

Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>

* Update localCertChainProvider to Skip Self-Signed Certificate

Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>

* Fix Unit Test for Legacy Signing to Include Self-Signed Root

Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>

---------

Signed-off-by: Kenneth Yang <kenneth.yang@coinbase.com>
2026-07-24 11:31:58 -07:00
Aaron Lew
193d215343 Remove unused policy evaluation code (#4936)
* Remove unused policy evaluation package and associated fuzz tests

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* Remove unused ValidateJSONWithModuleInput helper from rego package

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

---------

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-07-17 10:32:20 -04:00
Aaron Lew
089731c31f fix(download): Validate predicate type for new bundle format
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-07-16 11:26:50 -07:00
Zach Steindler
c0edaac063 Allow attestation download to handle both bundle types (#4996)
* Allow attestation download to handle both bundle types.

As suggested on https://github.com/sigstore/cosign/issues/4573

Signed-off-by: Zach Steindler <steiza@github.com>

* Do not error out if no old attestations are found to download

Signed-off-by: Zach Steindler <steiza@github.com>

* Update e2e test to actually check download attestation output

Signed-off-by: Zach Steindler <steiza@github.com>

---------

Signed-off-by: Zach Steindler <steiza@github.com>
2026-07-09 16:05:29 -04:00
Aaron Lew
0fc9811059 Remove unused signing code (#4918)
* Remove unused signcommon code

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* Remove unused Rekor code

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* Remove unused Fulcio code

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* Remove unused tlog code

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* Remove unused attestation code

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* Remove unused bundle code

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* Remove unused TSA code

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* Replace legacy signers with static.NewSignature in verify test

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* Replace tsa.GetTimestampedSignature with new helpers in verify tests

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* Remove unused signer wrapper implementations

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* Replace tsa.SplitPEMCertificateChain with existing helper in verify test

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* Remove unused exported SplitPEMCertificateChain TSA util

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* Replace bundle.MakeProtobufBundle with proto in verify_blob_* tests

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* Move BundleV03MediaType constant to new constants file

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* Remove unused protobundle code

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

* Update go.mod and go.sum

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>

---------

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-06-12 07:57:20 -04:00
Cody Soyland
c7b62530dc test(e2e): cover Rekor v2 hashedrekord behavior (#4916)
Add TestSignAttestVerifyRekorV2 to round-trip sign + attest + verify
against rekor-tiles (Rekor v2) and assert each bundle's tlog entry is
hashedrekord/0.0.2 — confirming sigstore-go v1.2.0's behavior of
encoding DSSE attestations as hashedrekord on Rekor v2 (rather than
dsse, which v1 emitted).

Adds a rekorV2URL test constant and fixes TestSignRekorV2NoTSA which
was building its signing config with the v1 URL but api-version=2.
It never reached rekor-tiles, so it only happened to pass by failing
early on the missing-TSA check.

Signed-off-by: Cody Soyland <cody.soyland@chainguard.dev>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-05 21:05:38 +00:00
Cody Soyland
6115844a09 Update sigstore-go to v1.2.0 (#4914)
* Update sigstore-go to v1.2.0

sigstore-go v1.2.0 encodes DSSE envelopes as hashedrekord entries
on Rekor v2. Bump conformance action to v0.0.29 and remove the
message-digest-mismatch xfail, which now passes. Fix e2e and unit
tests for updated transitive dependencies (timestamp-authority
v2.1.2 requires default-policy-oid config; tlog entry body parsing
now requires a valid Rekor v1 or v2 body).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Cody Soyland <cody.soyland@chainguard.dev>

* fix(ci): plug DSSE bundle reader leak and use --allow-http-registry

Two fixes for the Rekor v2 / sigstore-go v1.2.0 attestation path:

- oci/remote.Bundle never closed the reader returned by Uncompressed(),
  leaking a slot in go-containerregistry's pull limiter. Repeated calls
  (e.g. GetBundles walking multiple attestations) exhaust the limiter and
  block forever, hanging TestSignVerifyBundle and the vuln
  verify-attestation e2e step.

- go-containerregistry v0.21.6 narrowed the local registry regex from
  `.local` to `.localhost`, so `registry.local:5000` is no longer
  auto-detected as HTTP. Use the correct `--allow-http-registry` flag.

Signed-off-by: Cody Soyland <cody.soyland@chainguard.dev>

---------

Signed-off-by: Cody Soyland <cody.soyland@chainguard.dev>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-06-05 13:56:34 -04:00
Aaron Lew
5e053b312e fix(verify): Attach provided certificate and chain to loaded signature (#4737)
This change updates loadSignatureFromFile to properly bind the provided --certificate and --certificate-chain to the constructed signature object. Previously, verification using detached materials ignored these flags during object initialization, which caused transparency log lookups to incorrectly fall back to querying with a raw public key instead of the full certificate PEM, preventing the signature from being found in the log.

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-06-02 19:58:30 -07:00
Andrew Womeldorf
a01e484b73 Use the configured Target Repository more consistently. (#4836)
---------

Signed-off-by: Andrew Womeldorf <andrew.womeldorf@gmail.com>
Signed-off-by: Andrew Womeldorf <git@andrew.wom.icu>
2026-05-21 10:22:30 -04:00
Aaron Lew
1d5c7a6d34 Sign exclusively via sigstore-go (#4618)
This change refactors the signing path in all signing and attestation commands such that all signing events occur via sigstore-go, not just those in which a signing config is used.

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-04-13 16:50:12 -07:00
Hayden
f1ad3ee952 Fix DSSE predicate check (GHSA-w6c6-c85g-mmv6) (#4801)
AttestationToPayloadJSON parses the attestation and checks that the
predicate type matches the expected type provided by the user.
Previously, when this function was called for old-format bundles and
detached signatures, any error returned was silently ignored, so
malformed attestations would be accepted and cosign would report a
successful verification. For new-format bundles, this check was never
performed at all, so the attestaion would be accepted even if it did not
match the type given by the user. This change ensures that errors are
handled correctly and that the check is performed for both paths.

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>
2026-04-06 14:39:58 -07:00
Aaron Lew
952a0ac409 Update e2e tests to use scaffolding containers (#4548)
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-03-03 12:46:11 -08:00
Eric Pickard
9b259ff6b6 disallow key and cert identity being used together during verification (#4636)
---------

Signed-off-by: Eric Pickard <piceri@github.com>
2026-02-26 11:09:41 -05:00
Hayden
e64dc88677 Enforce TSA requirement for Rekor v2, Fuclio signing (#4683)
When using Rekor v2, the log entry does not provide a Signed Entry Timestamp
that validates the time of inclusion. For keyless signing with short-lived certificates,
a trusted timestamp is required to verify the certificate was valid at the time of signing.

This change updates the new sign path to enforce that a timestamp authority is configured when
Rekor v2 is to be used with Fulcio and no TSA URL is provided.

This should not affect users signing using the public instance, since
the signing configuration includes a public TSA.

Signed-off-by: Hayden <8418760+Hayden-IO@users.noreply.github.com>
2026-02-03 13:13:10 -08:00
Aaron Lew
934afc49e4 Add mTLS support for TSA client connections when signing with a signing config (#4620)
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-01-26 15:13:04 -08:00
Tuomo Tanskanen
c5717cb886 Allow --local-image with --new-bundle-format for v2 and v3 signatures (#4626)
* Allow --local-image with --new-bundle-format for v2 signatures

Remove the mutual exclusivity constraint between --local-image and
--new-bundle-format flags in verify and verify-attestation commands.
This enables verification of v2-signed images saved as local OCI layouts
when using cosign v3.

Add HasLocalBundles() function that auto-detects the signature format
by checking for dev.sigstore.cosign/bundle annotations in the local
OCI layout. If no bundles are found (v2 attached signatures), the
verification falls back to v2 mode automatically.

This mirrors the existing auto-detection pattern used for registry-based
verification via GetBundles().

Signed-off-by: Tuomo Tanskanen <tuomo.tanskanen@est.tech>

* Add tests for local image format auto-detection

Add unit tests for HasLocalBundles() and HasLocalAttestationBundles()
functions covering v2 signatures, v3 bundles, and edge cases.

Add e2e test TestSaveLoadAutoDetectFormat to verify the auto-detection
works correctly for both v2 attached signatures and v3 bundles.

Signed-off-by: Tuomo Tanskanen <tuomo.tanskanen@est.tech>

* Enable full local verification of v3 sigstore bundles

Add GetLocalBundles() and verifyLocalImageAttestationsSigstoreBundle()
to support verifying v3 bundles directly from local OCI layouts.

Refactors hasLocalSigstoreBundles() to getLocalBundleDescriptors() for
reuse, and updates VerifyLocalImageAttestations() to use the new v3
verification path when NewBundleFormat is true.

Signed-off-by: Tuomo Tanskanen <tuomo.tanskanen@est.tech>

* Add tests for local v3 bundle verification

Add unit tests for GetLocalBundles() covering valid layouts, missing
blobs, and error cases. Update e2e test to verify v3 bundles directly
from local OCI layout without registry round-trip.

Signed-off-by: Tuomo Tanskanen <tuomo.tanskanen@est.tech>

---------

Signed-off-by: Tuomo Tanskanen <tuomo.tanskanen@est.tech>
2026-01-23 15:53:20 -05:00
Hayden
d8f7d86aea Don't require a trusted root to verify offline with a key (#4613)
When signing offline using a key and opting out of Rekor, contents from
the TUF repo are not fetched because they aren't needed. Similarly with
verification, TUF shouldn't be required when no service roots are
needed, which is true when a) a public key is provided, b) Rekor is
skipped via flag, and c) timestamp verification is skipped via a flag.

Note that this affects the old bundle format verification path,
which allows for services to be skipped via flags. When a new bundle
format is provided, users will not be required to include a trusted root
if the above 3 conditions are satisfied.

Fixes #4550

Signed-off-by: Hayden B <8418760+haydentherapper@users.noreply.github.com>
2026-01-06 08:58:56 -05:00
Hayden
246945e6cb Support default services for trusted-root and signing-config creation (#4592)
When a client doesn't want to use a default service like Rekor while
still using the public instance, a client would need to retrieve the
signing configuration or trusted root, remove the tlog sections, and
provide that to the sign/verify command. This first step can now be
skipped by using --with-default-services and --no-<service> to omit it
from the configuration file. This will provide a better user experience
while maintaining the unified configuration interface between clients.

Ref: https://github.com/docker/actions-toolkit/issues/901

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>
2026-01-05 08:55:11 -08:00
Zach Steindler
dc8ad5e825 Protobuf bundle support for subcommand clean (#4539)
---------

Signed-off-by: Zach Steindler <steiza@github.com>
2025-12-05 16:13:01 -05:00
Zach Steindler
1e49088b9a Updating sign-blob to also support signing with a certificate (#4547)
---------

Signed-off-by: Zach Steindler <steiza@github.com>
2025-12-03 09:38:24 -05:00
Hayden
38bf9e6a99 Bump sigstore library dependencies (#4532)
Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>
2025-12-02 08:39:21 +01:00
Zach Steindler
4e3042ceba Protobuf bundle support for subcommands save and load (#4538)
* Adding support for new bundles stored with OCI referrers to save and load

---------

Signed-off-by: Zach Steindler <steiza@github.com>
2025-11-25 07:16:59 -05:00
Colleen Murphy
7981e233cc Fix cert attachment for new bundle with signing config
Without this change, if an image is signed with `--certificate` and also
using signing config and the new bundle format (the defaults), the logic
routes to sigstore-go signing which does not natively understand signing
with a cert that is not issued by Fulcio. This means that only the
public key is uploaded to the bundle, so the image cannot be verified
using the certificate. This change ensures the certificate is passed
through to the bundle if it is provided with `sign`, `attest`, and
`attest-blob` . The `sign-blob` command does not support
`--certificate`.

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>
2025-11-24 09:17:34 -08:00
dependabot[bot]
8eba87c9fe chore(deps): bump golang.org/x/crypto in /test/fakeoidc (#4535)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.35.0 to 0.45.0.
- [Commits](https://github.com/golang/crypto/compare/v0.35.0...v0.45.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-version: 0.45.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-20 14:03:05 +01:00
Hayden
b51a7c2a25 Deprecate tlog-upload flag (#4458)
* Deprecate tlog-upload flag

Clients that don't want to use a transparency log should provide a
signing config without tlog service instances rather than use this flag.
This will also throw an error when a client uses this flag when a
signing config will be used, since Cosign/sigstore-go ignores this flag
and we don't want a user to unexpectedly upload to the public instance.

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>

* Refactor TR and SC initialization into common method

The one difference between sign/attest and sign/attest-blob is whether a
bundle output flag is present, so the error message has been adjusted.

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>

* Fix e2e test, better error message

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>

---------

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>
2025-11-14 11:50:40 -08:00
Noel Georgi
6eecec74d2 fix: Use signal context for sign cli package.
Use proper context passing for `sign` cli package.

Fixes: #4506

Signed-off-by: Noel Georgi <git@frezbo.dev>
2025-11-12 13:09:04 -08:00
Colleen Murphy
ee3d9fe1c5 Fix signing/verifying annotations for new bundle
Without this change, when the new bundle format is used, annotations
were not being added to the payload, nor were they being checked during
verification, but were still being reported as verified. This also had a
side effect of the annotations not appearing in the verification output.
This change fixes the issue by passing through the annotations to the
statement builder during signing, and using a different in-toto
`Statement` type to parse annotations from the statement during
verification, as well as actually calling the claims verifier.

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>
2025-11-04 09:54:07 -08:00
Zach Steindler
0f1bf8394c Add support to download and attach for protobuf bundles (#4477)
---------

Signed-off-by: Zach Steindler <steiza@github.com>
2025-11-04 10:48:11 -05:00
Colleen Murphy
4a2caf9f74 Add --bundle and fix --upload for new bundle
Without this change, --upload=false was not respected with the new
bundle format. It also would not have made sense because there was no
way to output the bundle locally. This change adds a flag
--bundle so that the bundle can be created on disk without
attaching it to the image, and also passes through the Upload parameter
to bypass uploading it if desired.

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>
2025-10-29 16:58:55 -07:00
Colleen Murphy
d470294ce6 Pass insecure registry flags through to referrers
Also updates the registry tests to use TUF so that they can be re-used
for both the legacy format and protobuf bundle format.

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>
2025-10-27 14:05:20 -07:00
Zach Steindler
3c5b34b615 Add protobuf bundle support for tree subcommand (#4491)
* Add protobuf bundle support for tree subcommand

---------

Signed-off-by: Zach Steindler <steiza@github.com>
2025-10-24 15:40:13 -04:00
Emily Zheng
f9a9a0b805 Support multiple container identities
With this change, cosign sign can be run only once when an image
has multiple pull references.

Closes #4330

Signed-off-by: Emily Zheng <yuzheng@redhat.com>
2025-10-22 13:14:02 -07:00
AdamKorcz
6826722cb0 upgrade OSS-Fuzz build tooling (#4487)
Signed-off-by: Adam Korczynski <adam@adalogics.com>
2025-10-21 17:56:00 +02:00
Colleen Murphy
5ae3d57365 Use overridden repository for new bundle format (#4473)
Ensure COSIGN_REPOSITORY environment variable is respected both for the
legacy attachment format and the new bundle format.

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>
2025-10-18 06:04:37 -04:00
Hayden
8e3a787545 Bump module version to v3 for Cosign v3.0 (#4427)
Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>
Co-authored-by: Hayden <8418760+haydentherapper@users.noreply.github.com>
2025-09-26 13:31:26 -07:00
Zach Steindler
b952363fb2 Default to using the new protobuf format (#4318)
* Default to using the new protobuf format

---------

Signed-off-by: Zach Steindler <steiza@github.com>
2025-09-16 13:31:06 -04:00
Hayden
11163ae7d8 Bump sigstore-go, support alternative hash algorithms with keys (#4386)
* Bump sigstore-go, support alternative hash algorithms with keys

sigstore-go now handles non-ECDSA-P-256 signatures with Rekor v2. To
support verification, we also need a way to provide alternative hash
algorithms to the default SHA-256. cosign verify already had a flag for
this, so I added the flag to all verify commands. In the future, when we
are only processing bundles, we can lookup the default hash algorithm
given the key.

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>

* lint fmt

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>

* Drop support for Fulcio with ed25519ph key

We've chosen to not support this in sigstore-go, so we'll also remove
this from Cosign. This is a niche edge case where a user provides an
ed25519 key or algorithm and requests a cert and logs it to Rekor. We'll
revisit this if there's demand or when we support the prehash variant in
Fulcio.

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>

---------

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>
Co-authored-by: Hayden <8418760+haydentherapper@users.noreply.github.com>
2025-09-11 08:32:25 -07:00
Hayden
a2cbedabcc Add support for SigningConfig in sign/attest (#4371)
* Add support for SigningConfig in sign/attest

This will indirectly add support for signing with Rekor v2, since
signing will be handled by sigstore-go rather than Cosign.

This also brings sign/attest up to par with sign-blob/attest-blob with
respect to signing with a key and providing a trusted root when
providing a signing config.

This feature is gated behind one of two signing config flags, which in a
later version of Cosign will be flipped to on by default.

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>

* Address review comments

--signing-config and --use-signing-config are now mutually exclusive.

TrustedMaterial and SigningConfig are set in the same line as fetching
the trusted root and signing config.

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>

---------

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>
2025-09-04 13:32:50 -07:00
Hayden
59b9930775 Support self-managed keys when signing with sigstore-go (#4368)
* Support self-managed keys when signing with sigstore-go

This creates a wrapper around the Keypair interface when a
SignerVerifier is provided for signing with KMS or any other provided
keys. This also retains support for --issue-certificate to request a
certificate for a managed key.

Fixes #4327

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>

* Add issue-certificate flags to attest and attest-blob

This is for uniformity with sign/sign-blob.

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>

* Refactor SignerFromKeyOpts to split Fulcio signer into its own method

Now, we can generate a SignerVerifier from a provided key without
mandating that we also request a Fulcio certificate when
"issue-certificate" is provided.

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>

* Use default options to load key material

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>

---------

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>
2025-09-03 12:21:29 -07:00
Riccardo Schirone
b36644f793 Remove SHA256 assumption in sign-blob/verify-blob (#4050)
Use sigstore/sigstore signature.LoadSignerVerifierFromPrivateKey to load default verifiers given a private key.

Signed-off-by: Riccardo Schirone <riccardo.schirone@trailofbits.com>
2025-09-02 15:00:46 -07:00
Hayden
fd5fcfbf07 Break import cycle with e2e build tag (#4370)
When developing locally, with the e2e build tag set, there's an import
cycle. test/helpers.go imports "cmd/cosign/cli/verify", which imports
"test" in test files in the verify package. This change breaks the
import cycle by moving certificate utilities to an internal test
directory.

Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>
2025-08-28 11:42:30 -07:00