hashicorp/packer · error
verify attestation envelope %q: %w
Error message
verify attestation envelope %q: %w
What it means
verifyEnvelopeSignature wraps any VerifyEnvelope failure with `verify attestation envelope %q: %w` so the failing file path is included. The underlying cause is almost always error 150: no signature in the envelope validated against the chosen verifier. The wrapped error chain preserves the root reason.
Source
Thrown at internal/attestation/verify.go:98
// Keyless attestations are signed with a short-lived Fulcio certificate that
// appears expired against wall-clock time moments after signing. When a
// Sigstore bundle carrying transparency-log or timestamp evidence is
// available, prefer it so the certificate is validated as of the signing
// time recorded in that evidence rather than the current time.
if envelopeHasCertificate(envelope) {
if bundlePath := resolveSigstoreBundlePath(policy, path); bundlePath != "" && bundleAnchorsSigningTime(bundlePath) {
policy.SigstoreBundlePath = bundlePath
return verifySigstoreBundleEvidence(envelope, cfg, policy)
}
}
verifier, err := verifierForEnvelope(ctx, cfg, envelope)
if err != nil {
return err
}
if err := VerifyEnvelope(ctx, envelope, verifier); err != nil {
return fmt.Errorf("verify attestation envelope %q: %w", path, err)
}
return nil
}
// resolveSigstoreBundlePath returns an explicitly configured bundle path, or the
// conventional "<attestation>.sigstore.json" sidecar written alongside signed
// attestations when it exists on disk.
func resolveSigstoreBundlePath(policy VerificationPolicy, attestationPath string) string {
if trimmed := strings.TrimSpace(policy.SigstoreBundlePath); trimmed != "" {
return trimmed
}
candidate := defaultSigstoreBundlePath(attestationPath)
if info, err := os.Stat(candidate); err == nil && !info.IsDir() {
return candidate
}
View on GitHub (pinned to eb36e3c3e4)
Solutions
- Check the wrapped inner error and fix per its cause (usually key mismatch)
- Load the public key corresponding to the actual signing key of this file
- Re-verify the envelope's integrity or re-generate the attestation
- For keyless files, supply keyless_identity/keyless_oidc_issuer and the Sigstore bundle
Example fix
// before
// key.pub from an older signing key
attestation.VerifyAttestationFile(ctx, path, cfgWith("key.pub"), policy) // verify attestation envelope "a.json": signature verification failed
// after
// current signer's public key
attestation.VerifyAttestationFile(ctx, path, cfgWith("current-key.pub"), policy) Defensive patterns
Strategy: try-catch
Validate before calling
// confirm config matches signing mode before verification
if cfg.Mode == attestation.SigningModeKey && cfg.SignerRef == "" && cfg.VerifierRef == "" {
return errors.New"key mode needs a key or verifier reference")
} Try / catch
if err := attestation.VerifyAttestationFile(ctx, path, cfg, policy); err != nil {
if strings.Contains(err.Error(), "verify attestation envelope") {
return fmt.Errorf"could not verify %s with configured verifier: %w", path, err)
}
return err
} Prevention
- Track which key signed each artifact and load the matching verifier
- Use errors.As/Is on the wrapped chain to reach the root cause
- Keep envelopes immutable after signing
- Run a sign-then-verify smoke test in the same pipeline
When it happens
Trigger: VerifyAttestationFile proceeds past payloadType validation, builds a verifier via verifierForEnvelope, and VerifyEnvelope rejects all signatures — wrong key, tampered payload, or an envelope with undecodable signatures.
Common situations: Verifying with a public key from a different signer; envelope edited or corrupted after signing; a KMS key reference that does not match the original signing key after rotation; mismatch between keyless and key-mode configuration.
Related errors
- decode envelope signature: %w
- signature verification failed
- signing_mode %q does not support Sigstore bundle emission
- decode envelope payload: %w
- attestation %q has unexpected payloadType %q (want %q)
AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05).
Data as JSON: /api/errors/58da44a7431ce12d.
Report an issue: GitHub.