1
0
mirror of synced 2026-10-24 12:59:22 +03:00

895 Commits

Author SHA1 Message Date
Carlos Tadeu Panato Junior
f8e6ea940d Add cosign-specific user-agent to all HTTP requests (#4705)
* Add cosign-specific user-agent to all HTTP requests

This change addresses issue #4692 by ensuring that all HTTP requests
made by cosign identify with a proper user-agent that includes both
the cosign version and sigstore-go version.

Signed-off-by: Carlos Panato <ctadeu@gmail.com>

* Scope sigstore-go user-agent to sigstore-go code paths

Keep the global user-agent as cosign/<version> (os; arch) and only
send cosign/<version> sigstore-go/<version> (os; arch) on requests
made through sigstore-go. Fulcio and TSA clients built in SignData
now use a transport that overrides sigstore-go's default user-agent.

Rekor requests made via sigstore-go still use sigstore-go's
user-agent until sigstore-go exposes a way to set it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Carlos Panato <ctadeu@gmail.com>

* Set cosign user-agent on sigstore-go Fulcio, TSA and Rekor clients

Bump sigstore-go to main to pick up sigstore/sigstore-go#686, which
adds a UserAgent option and always appends sigstore-go/<version>.
Pass cosign's user-agent through it and drop the transport wrapper
and the sigstore-go version lookup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Carlos Panato <ctadeu@gmail.com>

---------

Signed-off-by: Carlos Panato <ctadeu@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 11:37:45 -07:00
Zach Steindler
cfeaa4a435 Implement cosign bundle create-from-container (#5144)
For #5138

To help people transition old container signatures and attestations to
the protobuf bundle format that supports offline verification, rotating
verification material via trusted roots, etc.

Also do not try to convert container signatures, since the signature
over the container won't match the signature over the new DSSE that
containers use with the protobuf bundle format.

---------

Signed-off-by: Zach Steindler <steiza@github.com>
2026-10-16 15:30:00 -04:00
Aaron Lew
0ea1cec1aa refactor: remove uploadToRekor parameter from ConfirmPrivacyStatement
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-10-01 11:08:07 -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
swivelmargarita
0c66ecdff3 clean: update inaccurate warning (#4909)
* clean: update inaccurate warning

The warning message is incorrect, as `cosign clean` subcommand does not have
`--referrer` option

Closes #4908

Signed-off-by: Takha Polat <takha.polat@bell-sw.com>

* Empty commit to run tests

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

---------

Signed-off-by: Takha Polat <takha.polat@bell-sw.com>
Signed-off-by: Zach Steindler <steiza@github.com>
Co-authored-by: Takha Polat <takha.polat@bell-sw.com>
Co-authored-by: Zach Steindler <steiza@github.com>
2026-09-18 20:34:09 +00:00
Aaron Lew
ac3a927375 fix(verify): enforce mutually exclusive key and security key (#5124)
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-09-18 16:23:55 -04:00
Aaron Lew
048eff5895 Reorder events in LoadTrustedMaterialAndSigningConfig
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-09-18 12:56:55 -07:00
Pujitha Paladugu
81b61e249c fix: strip trailing whitespace from attached signature files/stdin (#5058)
* fix: strip trailing whitespace from attached signature files/stdin

Motivation:
The linked report below describes a failure after detaching a
signature with `cosign download signature ... | jq -r
'.Base64Signature' > signature.sig` and later re-attaching it on
another registry with `cosign attach signature --signature
signature.sig ...`. The reporter's own --verbose debug output shows
the OCI manifest annotation dev.cosignproject.cosign/signature on the
re-attached image literally contains the base64 signature value with
a trailing newline embedded in it, unlike the original signing
machine's copy. That newline comes from shell redirection after
`jq -r`; cosign's attach signature command stores whatever bytes it
reads from the --signature file or stdin verbatim, with no trimming.

Storing extraneous whitespace inside a signature annotation is a
real, demonstrated defect regardless of whether it fully explains the
"invalid signature when validating ASN.1 encoded signature" error the
reporter hit: Go's own base64 decoder tolerates embedded \r/\n and
decodes to the same bytes, so this alone would not necessarily
reproduce that exact failure, and the report's repro also mixed up
`cosign download signature`'s JSON envelope for --payload, a separate
issue. This change fixes the annotation-pollution defect on its own
merits; it is not a claim that it resolves the full reported scenario
end-to-end.

Approach:
Trim leading and trailing whitespace from bytes read from a signature
file or stdin in signatureBytes() (cmd/cosign/cli/attach/sig.go)
before they are stored as the signature annotation. Base64 has no
whitespace in its alphabet, so trimming cannot remove meaningful
signature bytes. The literal-argument path is untouched.

Validation:
- go test ./cmd/cosign/cli/attach/... — added
  TestSignatureBytesTrimsTrailingWhitespace, which fails before this
  change (returned bytes include the trailing "\n") and passes after;
  verified this directly by stashing the fix and re-running the test.
  Also added TestSignatureBytesFileWithoutTrailingWhitespaceUnaffected
  confirming clean input is unaffected.
- go build ./... and go vet ./cmd/cosign/cli/attach/... pass.
- go test ./cmd/cosign/... passes (all subpackages).
- golangci-lint run ./cmd/cosign/cli/attach/... (v2.12.2, matching
  this repo's Dockerfile.golangci-lint) reports 0 issues.

Report: https://github.com/sigstore/cosign/issues/4207
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>

* fix: update copyright year in sig_test.go to 2026

Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>

---------

Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Co-authored-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
2026-09-14 15:58:32 -07:00
Pujitha Paladugu
3532c1d092 fix: include annotations in implied payload for offline verify
Motivation:
When signing with `cosign sign --upload=false -a key=value
--output-signature=sig.file`, cosign builds the signed payload from
payload.Cosign{Image, ClaimedIdentity, Annotations} including the
annotations (cmd/cosign/cli/sign/sign.go). When later verifying
offline with `cosign verify -a key=value --signature sig.file` and no
explicit `--payload`, cosign reconstructs an "implied" payload via
ObsoletePayload to compare against the signature, but that
reconstruction dropped annotations entirely. The reconstructed payload
therefore never matched the payload that was actually signed, so
verification always failed with "crypto/rsa: verification error" (or
equivalent) any time annotations were used with offline signing.

Approach:
Thread the caller-supplied annotations through ObsoletePayload so the
implied payload it builds matches what was used at signing time. The
verify call site (pkg/cosign/verify.go) now passes co.Annotations,
which is populated from the `-a` flag. The attach-signature call site
(cmd/cosign/cli/attach/sig.go) has no annotations flag, so it passes
nil, preserving its existing behavior exactly.

This is a pure payload-construction/serialization fix with no
dependency on registry, network, or transparency-log state: the
default (no-annotations) case is byte-for-byte unchanged.

Validation:
- go build ./...
- go test ./pkg/cosign/... ./cmd/cosign/cli/attach/... ./cmd/cosign/cli/verify/...
- go test $(go list ./... | grep -v third_party/)
  All pass. Added TestObsoletePayloadWithAnnotations in
  pkg/cosign/obsolete_test.go, which fails to compile against the
  pre-fix ObsoletePayload signature and asserts the annotation now
  appears in the marshaled payload's "optional" field once the fix is
  applied; confirmed by temporarily reverting the source changes and
  observing the test target fail to build.

Report: https://github.com/sigstore/cosign/issues/4024
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
2026-09-14 15:14:58 -07:00
dependabot[bot]
633e8f4303 chore(deps): bump the gomod group across 1 directory with 17 updates (#5104)
* chore(deps): bump the gomod group across 1 directory with 17 updates

Bumps the gomod group with 7 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [cuelang.org/go](https://github.com/cue-lang/cue) | `0.17.0` | `0.17.1` |
| [github.com/go-jose/go-jose/v4](https://github.com/go-jose/go-jose) | `4.1.4` | `4.1.5` |
| [github.com/go-openapi/runtime](https://github.com/go-openapi/runtime) | `0.33.0` | `0.33.2` |
| [github.com/open-policy-agent/opa](https://github.com/open-policy-agent/opa) | `1.20.1` | `1.20.2` |
| [github.com/secure-systems-lab/go-securesystemslib](https://github.com/secure-systems-lab/go-securesystemslib) | `0.11.0` | `0.11.1` |
| [github.com/sigstore/protobuf-specs](https://github.com/sigstore/protobuf-specs) | `0.5.1` | `0.5.2` |
| [github.com/sigstore/rekor](https://github.com/sigstore/rekor) | `1.5.3` | `1.5.4` |



Updates `cuelang.org/go` from 0.17.0 to 0.17.1
- [Release notes](https://github.com/cue-lang/cue/releases)
- [Commits](https://github.com/cue-lang/cue/compare/v0.17.0...v0.17.1)

Updates `github.com/go-jose/go-jose/v4` from 4.1.4 to 4.1.5
- [Release notes](https://github.com/go-jose/go-jose/releases)
- [Commits](https://github.com/go-jose/go-jose/compare/v4.1.4...v4.1.5)

Updates `github.com/go-openapi/runtime` from 0.33.0 to 0.33.2
- [Release notes](https://github.com/go-openapi/runtime/releases)
- [Commits](https://github.com/go-openapi/runtime/compare/v0.33.0...v0.33.2)

Updates `github.com/go-openapi/strfmt` from 0.27.0 to 0.27.1
- [Release notes](https://github.com/go-openapi/strfmt/releases)
- [Commits](https://github.com/go-openapi/strfmt/compare/v0.27.0...v0.27.1)

Updates `github.com/go-openapi/swag/conv` from 0.27.3 to 0.29.1
- [Release notes](https://github.com/go-openapi/swag/releases)
- [Commits](https://github.com/go-openapi/swag/compare/v0.27.3...v0.29.1)

Updates `github.com/open-policy-agent/opa` from 1.20.1 to 1.20.2
- [Release notes](https://github.com/open-policy-agent/opa/releases)
- [Changelog](https://github.com/open-policy-agent/opa/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-policy-agent/opa/compare/v1.20.1...v1.20.2)

Updates `github.com/secure-systems-lab/go-securesystemslib` from 0.11.0 to 0.11.1
- [Release notes](https://github.com/secure-systems-lab/go-securesystemslib/releases)
- [Commits](https://github.com/secure-systems-lab/go-securesystemslib/compare/v0.11.0...v0.11.1)

Updates `github.com/sigstore/protobuf-specs` from 0.5.1 to 0.5.2
- [Changelog](https://github.com/sigstore/protobuf-specs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sigstore/protobuf-specs/compare/v0.5.1...v0.5.2)

Updates `github.com/sigstore/rekor` from 1.5.3 to 1.5.4
- [Release notes](https://github.com/sigstore/rekor/releases)
- [Changelog](https://github.com/sigstore/rekor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sigstore/rekor/compare/v1.5.3...v1.5.4)

Updates `github.com/sigstore/sigstore` from 1.10.8 to 1.10.9
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.10.8...v1.10.9)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/aws` from 1.10.8 to 1.10.9
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.10.8...v1.10.9)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/azure` from 1.10.8 to 1.10.9
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.10.8...v1.10.9)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/gcp` from 1.10.8 to 1.10.9
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.10.8...v1.10.9)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/hashivault` from 1.10.8 to 1.10.9
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.10.8...v1.10.9)

Updates `github.com/stretchr/testify` from 1.11.1 to 1.12.1
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.11.1...v1.12.1)

Updates `google.golang.org/api` from 0.284.0 to 0.290.0
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.284.0...v0.290.0)

Updates `google.golang.org/protobuf` from 1.36.12-0.20260120151049-f2248ac996af to 1.36.12

---
updated-dependencies:
- dependency-name: cuelang.org/go
  dependency-version: 0.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/go-jose/go-jose/v4
  dependency-version: 4.1.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/go-openapi/runtime
  dependency-version: 0.33.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/go-openapi/strfmt
  dependency-version: 0.27.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/go-openapi/swag/conv
  dependency-version: 0.29.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
- dependency-name: github.com/open-policy-agent/opa
  dependency-version: 1.20.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/secure-systems-lab/go-securesystemslib
  dependency-version: 0.11.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/protobuf-specs
  dependency-version: 0.5.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/rekor
  dependency-version: 1.5.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore
  dependency-version: 1.10.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/aws
  dependency-version: 1.10.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/azure
  dependency-version: 1.10.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/gcp
  dependency-version: 1.10.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/hashivault
  dependency-version: 1.10.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/stretchr/testify
  dependency-version: 1.12.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
- dependency-name: google.golang.org/api
  dependency-version: 0.290.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
- dependency-name: google.golang.org/protobuf
  dependency-version: 1.36.12
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>

* update mock interface

Signed-off-by: Bob Callaway <bcallaway@google.com>

* fix linter errors

Signed-off-by: Bob Callaway <bcallaway@google.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Bob Callaway <bcallaway@google.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bob Callaway <bcallaway@google.com>
2026-09-08 15:36:42 -04: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
dependabot[bot]
b918f9d67c chore(deps): bump the all group across 1 directory with 2 updates (#5067)
* chore(deps): bump the all group across 1 directory with 2 updates

Bumps the all group with 2 updates in the / directory: golang and golangci/golangci-lint.


Updates `golang` from 1.26.5 to 1.27.0

Updates `golangci/golangci-lint` from v2.12.2 to v2.13.1

---
updated-dependencies:
- dependency-name: golang
  dependency-version: 1.27.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: golangci/golangci-lint
  dependency-version: v2.13.1
  dependency-type: direct:production
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>

* address lints

Signed-off-by: Bob Callaway <bcallaway@google.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Bob Callaway <bcallaway@google.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bob Callaway <bcallaway@google.com>
2026-09-08 13:33:49 +00:00
Aaron Lew
00c17724d9 refactor: extract signing flag validation (#5070)
* refactor: extract signing flag validation

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

* fix: pass bundle path to flag validation in sign and attest

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

---------

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-09-03 14:26:21 -04:00
Aaron Lew
39037f1c76 fix: restrict bundle signing and attestation to one artifact (#5081)
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-09-03 10:49:31 -04:00
Aaron Lew
5b6e93010c fix: pass missing OIDC flags to KeyOpts (#5079)
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-09-03 10:30:12 -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
Pujitha Paladugu
84effabfc9 fix: verify-blob should not force SHA256 for non-default key hash algorithms (#5064)
* fix: verify-blob should not force SHA256 for non-default key hash algorithms

Motivation:
cosign verify-blob fails to verify legacy-bundle blob signatures made
with keys whose conventional digest algorithm is not SHA256 (e.g. an
ECDSA P-521 key, which pairs with SHA-512), unless the user explicitly
passes the deprecated --signature-digest-algorithm flag. Without it,
verification fails with "invalid signature when validating ASN.1
encoded signature".

Approach:
The --signature-digest-algorithm flag had a hardcoded default value of
"sha256", so its value was indistinguishable from an explicit
--signature-digest-algorithm sha256. SignatureDigestOptions.HashAlgorithm()
compounded this by also returning SHA256 for an empty/unset value.
VerifyBlobCmd.Exec then forced any zero HashAlgorithm to SHA256 before
loading the verifier, discarding the zero-value sentinel that
LoadPublicKeyRaw (pkg/signature/keys.go) relies on to fall back to
signature.LoadDefaultVerifier, which selects the correct digest
algorithm for the given key type (SHA256 for P-256/RSA, SHA384 for
P-384, SHA512 for P-521).

This change makes the flag default to an empty string, has
HashAlgorithm() return 0 (unset) when the flag isn't provided, and
removes the forced-SHA256 default in VerifyBlobCmd.Exec, letting the
key-loading path pick the digest algorithm that matches the key. The
same forced-default pattern still exists, unchanged, in the image
verify, verify-attestation, and verify-blob-attestation commands,
which are out of scope for this fix.

Validation:
Added TestVerifyBlobWithUnsetHashAlgorithmMatchesKeyDefault
(cmd/cosign/cli/verify/verify_blob_test.go), which signs a blob with a
generated P-521 key using SHA-512 and verifies it via VerifyBlobCmd.Exec
with HashAlgorithm left unset. Confirmed this test fails with the
exact reported error before this change (verified by reverting only
the implementation files) and passes after. Also added
TestSignatureDigestOptionsHashAlgorithm
(cmd/cosign/cli/options/signature_digest_test.go) covering the
unset/explicit/invalid cases for HashAlgorithm().

Ran:
  go build ./...
  go vet ./cmd/... ./pkg/...
  go test ./cmd/... ./pkg/...
  golangci-lint run ./cmd/cosign/cli/options/... ./cmd/cosign/cli/verify/...
All passed with no regressions.

Report: https://github.com/sigstore/cosign/issues/5063
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>

* fix: verify, verify-attestation, verify-blob-attestation should not force SHA256 for non-default key hash algorithms

Applies the same fix as verify-blob to the sibling verify commands, per
review feedback on #5064: stop forcing HashAlgorithm to SHA256 when
unset, and let LoadVerifierFromKeyOrCert pick the digest algorithm
that matches the provided key (e.g. SHA-512 for P-521 ECDSA keys).

Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>

---------

Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Co-authored-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
2026-08-18 20:09:31 +00:00
Ville Skyttä
8b8c87b68a feat: --slot option argument shell completion (#5057)
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2026-08-14 15:09:45 -07:00
Aaron Lew
0a5f602ff3 Deprecate --use-signing-config (#5056)
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-08-14 10:12:19 -07:00
Aaron Lew
990e273c00 fix: use correct Rekor URLs to activate privacy warning (#5054)
* Extract tlogUpload check from NewSigningConfigFromKeyOpts

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

* Switch signingConfig and shouldUpload initialization in sign*

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

* Update privacy statement logic to check Rekor URLs from SigningConfig instead of KeyOpts

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

---------

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-08-14 09:52:07 -07:00
Pujitha Paladugu
151d838c15 fix: only show public-instance privacy statement for the default Rekor URL (#5042)
* fix: only show public-instance privacy statement for the default Rekor URL

Motivation:
When uploading to a transparency log, cosign always printed the
"hosted by sigstore a Series of LF Projects, LLC" privacy statement
and confirmation prompt, even when the user pointed --rekor-url at
their own local or self-hosted Rekor instance. The upload itself
correctly went to the custom instance, but the displayed text
described the public sigstore.dev data-retention/Terms of Use policy,
which is misleading and confusing for anyone running their own Rekor
server (e.g. via the rekor docker-compose setup).

This is a UX/cosmetic issue only: no upload destination or signing
behavior changes, only the confirmation text shown to the user.

Approach:
In ShouldUploadToTlog (cmd/cosign/cli/signcommon/common.go), only show
the public-instance privacy statement when the configured Rekor URL is
empty (unset) or equal to options.DefaultRekorURL
(https://rekor.sigstore.dev). A custom --rekor-url no longer triggers
the public-instance notice.

Validation:
- go build ./...
- go test $(go list ./... | grep -v third_party/) (equivalent to `make test`) — all packages pass
- make lint — 0 issues
- Added TestShouldUploadToTlog_CustomRekorURLSkipsPublicInstanceStatement
  in cmd/cosign/cli/signcommon/common_test.go, which calls
  ShouldUploadToTlog with a custom RekorURL and asserts the public-instance
  statement is not printed. Manually reverted the guard and reran the test
  to confirm it fails without the fix and passes with it restored.

Report: https://github.com/sigstore/cosign/issues/4400
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>

* fix: match public-good Rekor URLs by *.sigstore.dev/*.sigstage.dev suffix

Per review feedback, an exact-string match against the default Rekor
URL doesn't account for region- and year-specific public-good
hostnames. Only suppress/show the privacy statement based on whether
the configured Rekor URL's hostname is sigstore.dev/sigstage.dev or a
subdomain of either.

Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>

* test: consolidate ShouldUploadToTlog tests into a table-driven test

Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>

* fix: treat empty Rekor URL as not public-good in isPublicGoodRekorURL

An empty ko.RekorURL means NewSigningConfigFromKeyOpts configures no
Rekor service at all, so nothing is uploaded to the public-good
instance in that case; the privacy statement should not be shown.

Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>

---------

Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Co-authored-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
2026-08-07 18:57:08 +00:00
Hayden
11926fa5bb Verification bypass via public key in legacy bundle (GHSA-fx35-mq7g-6g98) (#5040)
Remove the fallback that loaded a raw public key from a legacy bundle's
cert field when X.509 certificate parsing failed. Previously, an attacker
could supply a bare public key in b.Cert to populate co.SigVerifier,
skipping X.509 certificate chain validation and CheckCertificatePolicy
enforcement during keyless verification. This would use the key without
any additional checks. The key-as-certificate in the bundle would take
priority over a key being provided via --key as well.

This updates the sign-blob and attest-blob code paths to never set a key
in the certificate field in the legacy bundle. Before a refactor a few
months ago, attest-blob did this. After the refactor, sign-blob did as
well. Now, neither code path will persist a key in the bundle.

For verification, verify-blob and verify-blob-attestation have been
updated to not fallback to parsing a certificate as a key. If a bundle
is supplied that contains a key, it fails with a parsing error.

Note that no change is needed for sign/attest and
verify/verify-attestation, as the container signing path never stored a
public key in the certificate field and the container verification path
would only load a certificate as a certificate.

Signed-off-by: Hayden <8418760+Hayden-IO@users.noreply.github.com>
2026-08-05 19:43:27 -04:00
Ville Skyttä
83d9ec8f4b fix: prevent shell completions for various options not taking filenames (#5032)
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2026-07-31 08:14:31 -07:00
Aaron Lew
0238975414 test(inspect): replace mock TSA client usage with local timestamp response generator (#5021)
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-07-25 19:20:01 -07: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
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
Aaron Lew
df78bf6798 fix(verify): skip identity validation for security keys (#5012)
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-07-13 11:25:58 -07:00
Aaron Lew
816f2b6634 Deprecate --payload for sign and verify commands (#4991)
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-07-09 18:45:44 -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
Nikhil J
a8642c7b86 Fix panic in dockerfile verify on malformed FROM lines (#4979)
* Return an error instead of panicking on malformed FROM lines in dockerfile verify

getImageFromLine panicked with an index-out-of-range on two malformed but
parseable FROM lines: an unresolvable build arg ("FROM ${BASE_IMAGE}" with
BASE_IMAGE unset) expands to an empty string and indexes fields[-1], and a
trailing "AS" ("FROM image AS") reads fields[i+1] past the slice. Return an
actionable error in both cases and propagate it from the caller. Adds a
regression test.

Signed-off-by: Nikhil Jathar <22786232+mailnike@users.noreply.github.com>


---------

Signed-off-by: Nikhil Jathar <22786232+mailnike@users.noreply.github.com>
Signed-off-by: Zach Steindler <steiza@github.com>
2026-07-08 17:21:40 -04:00
Firas Ghanmi
16ddbcf904 feat(signing-config): add --base-config flag to override services from base config (#4977)
* feat(signing-config): add --base-config flag to override services from base config

Signed-off-by: Firas Ghanmi <fghanmi@redhat.com>

* update doc

Signed-off-by: Firas Ghanmi <fghanmi@redhat.com>

---------

Signed-off-by: Firas Ghanmi <fghanmi@redhat.com>
2026-07-04 16:57:05 -07:00
Jason Power
f17f812494 fix: pass NewBundleFormat to KeyOpts in sign command (#4981)
Signed-off-by: JasonPowr <japower@redhat.com>
2026-07-04 16:45:07 -07:00
Aaron Lew
9e69e9ea0c Remove new bundle format flag from conformance
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-07-01 01:11:49 +02:00
Ville Skyttä
8184126082 feat: improve verify flag shell completions (#4965)
* feat: shell complete bundles with .sigstore.json too

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>

* feat: verify shell completion improvements

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>

---------

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2026-06-30 10:23:05 -07:00
Ricard Bejarano
6ef8d9d040 fix: ignore build stage references in dockerfile verify (#4961)
`cosign dockerfile verify` extracted the target of a `FROM` instruction even
when it referenced a previously declared build stage (e.g. `FROM base_image`),
then tried to pull that stage name as an image and failed with an
authentication/not-found error.

Skip `FROM` references that resolve to a known stage name, mirroring the
existing handling for `COPY --from=<stage>`.

Fixes #3880

Signed-off-by: bejaratommy <tommy@bejara.net>
Co-authored-by: bejaratommy <tommy@bejara.net>
2026-06-23 09:47:17 +02:00
SEONGHYUN HONG
8dbdef5616 fix: allow '=' in annotation values (#4957)
AnnotationsMap parsed --annotations with strings.Split(a, "="), so any value
containing '=' (base64 padding, URLs with query strings, chained key=value)
yielded len>2 and was rejected with "unable to parse annotation". Use
strings.SplitN(a, "=", 2), matching the repo's canonical parser in
pkg/signature/annotations.go. The no-'=' case is still rejected.

Signed-off-by: Seonghyun Hong <s3onghyun.hong@gmail.com>
2026-06-18 11:14:56 -07:00
Aaron Lew
2e0749ac11 Deprecate --output-attestation (#4958)
This change deprecates the --output-attestation flag for attest-blob in favor of --bundle.

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-06-18 11:02:55 -07:00
Ogulcan Aydogan
ed0efe8cb4 docs: fix Short style and add Example fields to piv-tool subcommands (#4942)
Capitalize Short descriptions and remove command-name self-references
("generate-key generates...", "reset resets..."). Add Example: fields
to all seven piv-tool subcommands. Regenerate doc/ via cmd/help/main.go.

Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@hotmail.com>
2026-06-15 10:35:59 -07:00
Aaron Lew
a633e3a327 fix(inspect test): Replace non-existent tsa.GetTimestampedSignature with new helper (#4946)
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-06-12 14:12:47 -07:00
Ogulcan Aydogan
6d39eb9e98 docs: drop trailing periods from cobra Short descriptions (#4944)
The Short command descriptions were inconsistent: most followed the cobra
convention of a short phrase with no trailing period, but sixteen ended in
a period. Standardize the outliers to match the period-free majority and
regenerate the Markdown docs.

piv-tool and pkcs11-tool Short fields are addressed in separate changes.

Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@hotmail.com>
2026-06-12 11:01:58 -07: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
Ogulcan Aydogan
d41b86c63c docs: add Example fields to env and bundle create commands (#4941)
* docs: add Example fields to env and bundle create commands

Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@hotmail.com>

* docs: regenerate doc/ after adding Example fields

Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@hotmail.com>

---------

Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@hotmail.com>
2026-06-11 13:51:11 -07:00
Ogulcan Aydogan
8a7174a1d4 docs: fix Short style and add Example fields to pkcs11-tool subcommands
Capitalize Short descriptions and remove command-name self-references
("list-tokens lists..." -> "List all..."). Add Example: fields to
both subcommands. Regenerate doc/ via cmd/help/main.go.

Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@hotmail.com>
2026-06-11 13:46:12 -07:00
Aaron Lew
2233166935 Add bundle inspect command (#4842)
This change adds a bundle inspect command which provides a diagnostic display of a bundle's contents.

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-06-09 16:34:33 -07: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
Zach Steindler
0add3b539d Remove docstring references to deprecated flags (#4910)
Since they will not show up in the command help.

I suggested doing this on
https://github.com/sigstore/cosign/issues/4696#issuecomment-4407649465,
and then I closed the issue without actually doing this.

Signed-off-by: Zach Steindler <steiza@github.com>
2026-06-02 15:07:41 -04:00
Aaron Lew
ceeb6f4e4e Add staging support to conformance testing
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-06-02 11:13:21 -07:00
Eric Pickard
8cedfdeddb Deprecate subcommands (#4894)
---------

Signed-off-by: Eric Pickard <piceri@github.com>
2026-06-01 15:34:50 -04:00
CrazyMax
8f34218544 verify: return TUF errors for new bundle trusted roots
New bundle verification cannot fall back to legacy TUF targets when the live trusted root cannot be loaded. Return the wrapped TUF error from SetTrustedMaterial in that mode so callers see the underlying trusted root failure instead of the later nil TrustedMaterial invariant.

Legacy verification still warns and falls back to individual targets, and the new tests cover both paths.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-05-28 13:16:48 -07:00
Aaron Lew
55f4d9e208 Enable initialize command output in conformance (#4892)
Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
2026-05-26 15:11:19 +00:00