hashicorp/packer · error

sigstore bundle signature does not match any attestation sig

Error message

sigstore bundle signature does not match any attestation signature

What it means

ensureBundleMatchesEnvelope verifies that the Sigstore bundle being checked actually signs the same DSSE attestation that is being verified. It extracts the bundle's envelope, checks payload type/payload equality, then compares the bundle's signature bytes against each decoded signature in the attestation envelope. If no signature byte-matches, it means the bundle and envelope come from different (or re-signed) attestations, so verification cannot proceed.

Source

Thrown at internal/attestation/verify.go:380

	}

	if len(envelope.Signatures) == 0 {
		return fmt.Errorf("attestation envelope has no signatures")
	}

	bundleSignature := bundleEnvelope.Signature()
	for i, envelopeSignature := range envelope.Signatures {
		signature, err := DecodeEnvelopeSignature(envelopeSignature)
		if err != nil {
			return fmt.Errorf("decode attestation envelope signature %d: %w", i, err)
		}

		if bytes.Equal(bundleSignature, signature) {
			return nil
		}
	}

	return fmt.Errorf("sigstore bundle signature does not match any attestation signature")
}

func verifyArtifactSubject(subjects []internalprovenance.Subject, artifactPath string) error {
	digest, err := sha256File(artifactPath)
	if err != nil {
		return fmt.Errorf("hash artifact %q: %w", artifactPath, err)
	}

	artifactName := filepath.Base(artifactPath)
	for _, subject := range subjects {
		if subject.Name == artifactName && strings.EqualFold(subject.Digest["sha256"], digest) {
			return nil
		}
	}

	return fmt.Errorf("attestation subject does not match artifact %q", artifactPath)
}

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Regenerate the Sigstore bundle from the exact attestation envelope being verified (re-run the sign/attest step) so signatures match
  2. Confirm the bundle file and attestation envelope come from the same CI run / build ID
  3. Verify the envelope's signatures were not re-encoded (whitespace/base64 canonicalization differences will break bytes.Equal; use consistent encoding)
  4. Check for key rotation: if the signing key changed, re-sign the attestation and rebuild the bundle

Example fix

// before: verifying a stale bundle against a re-signed attestation
bundle, _ := loadBundle("old-bundle.jsonl")
envelope, _ := loadEnvelope("new-attestation.intoto.jsonl")
ensureBundleMatchesEnvelope(bundle, envelope) // fails
// after: regenerate both from the same signing run
bundle, envelope := signAndBundle(payload) // single sign step
ensureBundleMatchesEnvelope(bundle, envelope)
Defensive patterns

Strategy: validation

Validate before calling

// Verify bundle/envelope pairing before calling the verifier
env, err := bundle.Envelope()
if err != nil { return err }
if env.RawEnvelope().Payload != envelope.Payload { return errors.New("payload mismatch") }
sig := env.Signature()
for _, s := range envelope.Signatures {
    dec, err := DecodeEnvelopeSignature(s)
    if err == nil && bytes.Equal(sig, dec) { return nil }
}
return errors.New("bundle does not sign this attestation")

Try / catch

if err := ensureBundleMatchesEnvelope(bundle, envelope); err != nil {
    return fmt.Errorf("stale or mismatched sigstore bundle: %w", err)
}

Prevention

When it happens

Trigger: verifySigstoreBundleEvidenceImpl passes a bundle whose envelope payload matches the attestation but whose signature bytes differ from every signature entry in the envelope — e.g. the attestation was re-signed after the bundle was produced, or the bundle belongs to a different (but identically-payloaded) attestation.

Common situations: Mixing artifacts from different CI runs: downloading a bundle from one `cosign attest` run and the in-toto statement/envelope from another; regenerating an attestation with an updated signer key while reusing an old bundle; manually editing envelope signatures; key rotation between bundle creation and verification.

Related errors


AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05). Data as JSON: /api/errors/44615bc5b6a7568b. Report an issue: GitHub.