Documentation
¶
Overview ¶
Package verifier implements offline bundle verification with a four-level trust model.
Trust Levels ¶
Verification produces one of four trust levels (highest to lowest):
- verified: The exact bundle inventory and checksums are valid, the bundle attestation is verified, the binary attestation is verified and identity-pinned to NVIDIA CI, and there is no external data.
- attested: Full chain verified but external data (--data) was used, capping trust because the data's own provenance is unknown.
- unverified: The exact bundle inventory and checksums are valid but no attestation files are present (--attest not used).
- unknown: Missing, malformed, incomplete, or unmanaged bundle inventory; invalid checksums; or failed attestation verification.
Verification Chain ¶
Verify performs a five-step offline verification:
- Read checksums.txt once and verify the exact closed-world bundle inventory
- Check for bundle attestation file
- Verify bundle attestation against trusted root, binding to checksums.txt digest and requiring a valid OIDC-issued certificate
- Check for binary attestation file
- Verify binary attestation with identity pinning to NVIDIA CI and binding to the binary digest recorded in the verified bundle attestation
All verification is fully offline using the locally cached or embedded Sigstore trusted root. No network calls are made during verification.
Identity Pinning ¶
Binary attestation verification pins to NVIDIA's GitHub Actions OIDC issuer and a repository pattern matching NVIDIA/aicr workflows. This ensures the binary was built by NVIDIA CI. The pattern can be overridden via VerifyOptions.CertificateIdentityRegexp but must always contain the github.com/NVIDIA/aicr/ prefix.
Index ¶
Constants ¶
const ( TrustedOIDCIssuer = "https://token.actions.githubusercontent.com" TrustedRepositoryPattern = `^https://github\.com/NVIDIA/aicr/\.github/workflows/on-tag\.yaml@refs/tags/.*` )
Identity pinning constants for NVIDIA CI.
Variables ¶
This section is empty.
Functions ¶
func GetTrustLevels ¶ added in v0.12.0
func GetTrustLevels() []string
GetTrustLevels returns all valid trust level names sorted alphabetically. This excludes "max" which is a meta-value for auto-detection, not a real level.
func ValidateIdentityPattern ¶
ValidateIdentityPattern checks that a certificate identity pattern contains the required NVIDIA/aicr GitHub repository URL path. Accepts both literal and regex-escaped forms (e.g., "github.com" or "github\.com").
func VerifyBinaryAttestation ¶
func VerifyBinaryAttestation(ctx context.Context, bundlePath string, identityPattern string, artifactDigest []byte) (string, error)
VerifyBinaryAttestation verifies the binary attestation with identity pinning to the given OIDC issuer and repository pattern, binding the attestation to the given artifact digest. Returns the signer identity on success.
Types ¶
type Policy ¶
type Policy struct {
// MinTrustLevel is the minimum required trust level ("max" resolves to
// the highest achievable level for the bundle).
MinTrustLevel string
// RequireCreator requires the bundle attestation creator to match.
RequireCreator string
// VersionConstraint is a version constraint expression for the CLI version.
// Supports operators: >=, >, <=, <, ==, !=.
// A bare version (e.g. "0.8.0") is treated as ">= 0.8.0".
VersionConstraint string
}
Policy defines verification requirements to enforce after verification.
type TrustLevel ¶
type TrustLevel string
TrustLevel represents the verification trust level of a bundle.
const ( // TrustUnknown indicates missing checksum files, or an attestation // (bundle or binary) that is present but fails verification. A present // binary attestation whose digest cannot be extracted, or that does not // verify, is a hard failure — unknown, never a degraded attested (#1550). TrustUnknown TrustLevel = "unknown" // TrustUnverified indicates checksums are valid but no attestation files exist // (bundle was created with --attest not used). TrustUnverified TrustLevel = "unverified" // TrustAttested indicates the full chain is cryptographically verified but // external data (--data) was used, capping trust because the data's own // provenance is unknown. TrustAttested TrustLevel = "attested" // TrustVerified indicates checksums valid, bundle attestation verified, // binary attestation verified with identity pinned to NVIDIA CI, and no // external data. TrustVerified TrustLevel = "verified" )
func ParseTrustLevel ¶
func ParseTrustLevel(s string) (TrustLevel, error)
ParseTrustLevel parses a string into a TrustLevel.
func (TrustLevel) MeetsMinimum ¶
func (t TrustLevel) MeetsMinimum(minimum TrustLevel) bool
MeetsMinimum returns true if this trust level is at least the given minimum.
type VerifyOptions ¶
type VerifyOptions struct {
// CertificateIdentityRegexp overrides the default identity pinning pattern
// for binary attestation verification. Must contain "NVIDIA/aicr".
// Defaults to TrustedRepositoryPattern if empty.
CertificateIdentityRegexp string
// Key selects public-key verification of the bundle attestation instead of
// keyless certificate-identity verification. A KMS key URI
// (awskms:// | gcpkms:// | azurekms:// | hashivault://) or a local PEM public-key file.
// Independent of CertificateIdentityRegexp, which pins the (separate) binary
// attestation; the two coexist (see #1152).
Key string
// TrustRoot is a path to a sigstore-go trusted_root.json for verifying the
// bundle attestation against a private Fulcio/Rekor. ADDITIVE: unioned with
// AICR's public-good root, so NVIDIA-signed and privately-signed bundles
// both verify. Counterpart to `bundle --fulcio-url`/`--rekor-url`.
// Composable with Key. Does NOT affect the binary attestation, which is
// always NVIDIA-public-CI-signed and stays pinned to the public-good root.
TrustRoot string
// IgnoreTLog enables offline/air-gapped verification of the key-signed
// bundle attestation: it skips the transparency-log (and observer-timestamp)
// requirement so a bundle produced by `bundle --signing-key ... --tlog-upload=false`
// (#409) verifies with no transparency-log network calls. Full offline
// operation additionally requires a local PEM Key: a KMS Key URI still makes a
// live GetPublicKey call via NewKeyVerificationIdentity to resolve the key.
// ONLY valid with Key set (the air-gapped path is key-based, not keyless);
// Verify rejects it otherwise. INSECURE relative to the default: without a
// tlog/timestamp there is no trusted proof of when the signature was made.
// Does NOT affect the keyless or binary-attestation paths, which always
// require a transparency log.
IgnoreTLog bool
}
VerifyOptions configures verification behavior.
type VerifyResult ¶
type VerifyResult struct {
// TrustLevel is the computed trust level for the bundle.
TrustLevel TrustLevel `json:"trustLevel"`
// ChecksumsPassed indicates whether all content files match checksums.txt.
ChecksumsPassed bool `json:"checksumsPassed"`
// ChecksumFiles is the number of files verified by checksum.
ChecksumFiles int `json:"checksumFiles"`
// BundleAttested indicates whether the bundle attestation was verified.
BundleAttested bool `json:"bundleAttested"`
// BinaryAttested indicates whether the binary attestation was verified.
BinaryAttested bool `json:"binaryAttested"`
// IdentityPinned indicates whether the binary attestation identity was pinned to NVIDIA CI.
IdentityPinned bool `json:"identityPinned"`
// BundleCreator is the OIDC identity from the bundle attestation signing certificate.
BundleCreator string `json:"bundleCreator,omitempty"`
// BinaryBuilder is the certificate subject from the binary attestation.
BinaryBuilder string `json:"binaryBuilder,omitempty"`
// ToolVersion is the aicr version extracted from the attestation predicate.
ToolVersion string `json:"toolVersion,omitempty"`
// HasExternalData indicates the bundle contains external data files (data/ directory).
HasExternalData bool `json:"hasExternalData"`
// TrustReason explains why the trust level was set to its current value.
TrustReason string `json:"trustReason,omitempty"`
// Errors contains verification failure messages.
Errors []string `json:"errors,omitempty"`
}
VerifyResult contains the outcome of bundle verification.
func Verify ¶
func Verify( ctx context.Context, bundleDir string, opts *VerifyOptions, ) (result *VerifyResult, err error)
Verify performs full verification of a bundle directory. Returns a VerifyResult describing the trust level and verification details. Any returned staged-snapshot cleanup failure clears an otherwise successful result and is reported as an internal error.
func (*VerifyResult) CheckPolicy ¶
func (r *VerifyResult) CheckPolicy(p Policy) (string, error)
CheckPolicy validates the verification result against a policy. Returns an empty string if all checks pass, or a failure description.
func (*VerifyResult) MaxAchievableTrustLevel ¶
func (r *VerifyResult) MaxAchievableTrustLevel() TrustLevel
MaxAchievableTrustLevel returns the highest trust level this bundle could achieve based on its contents. Used by --min-trust-level max to enforce that verification reached the expected level:
- verified: standard bundle with both attestations, no external data
- attested: external data present (caps trust regardless of attestation chain)
- unverified: no attestation files (bundle created without --attest)
- unknown: checksums failed or missing
Note the max is computed from what the bundle CONTAINS, not what verified: a bundle whose binary attestation is present but fails verification reports TrustUnknown while its max achievable stays verified, so --min-trust-level max correctly fails it.