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

  1. Check the wrapped inner error and fix per its cause (usually key mismatch)
  2. Load the public key corresponding to the actual signing key of this file
  3. Re-verify the envelope's integrity or re-generate the attestation
  4. 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

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


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