use std::path::PathBuf;
#[derive(Debug, thiserror::Error)]
pub enum VerifyError {
#[error("cosign binary not found (searched: {searched:?}). Install via brew/apt/dnf.")]
CosignNotFound {
searched: Vec<PathBuf>,
},
#[error("cosign verify-blob exited non-zero: {stderr}")]
CosignFailed {
stderr: String,
},
#[error("verify io error: {0}")]
Io(String),
#[error(
"trust policy requires signature for `{owner}`, but release has no .sig + .cert assets"
)]
PolicyRequiresSig {
owner: String,
},
#[error("release has `{present}` but missing companion `{missing}`")]
AssetIncomplete {
present: &'static str,
missing: &'static str,
},
#[error("trusted_keys.toml at `{path}` invalid: {reason}")]
TrustedKeysParse {
path: PathBuf,
reason: String,
},
#[error("identity_regexp `{got}` invalid: {reason}")]
IdentityRegexpInvalid {
got: String,
reason: String,
},
#[error("certificate parse failed: {0}")]
CertParseFailed(String),
#[error("certificate public key is not ECDSA-P256: {0}")]
UnsupportedKey(String),
#[error("signature decode failed: {0}")]
SignatureDecodeFailed(String),
#[error("signature does not verify against the certificate")]
SignatureMismatch,
#[error("certificate has no Subject Alternative Name entries")]
IdentityNotFound,
#[error("identity `{found}` does not match policy regex `{expected_regex}`")]
IdentityMismatch {
found: String,
expected_regex: String,
},
#[error("OIDC issuer mismatch: cert claims `{found}`, policy requires `{expected}`")]
IssuerMismatch {
found: String,
expected: String,
},
}