pkix-lint
Advisory lint engine for X.509 certificate chains. Ships the framework
(Lint trait, LintRunner, Finding, EvaluationReport, deviation
machinery) plus the standards-body (RFC) conformance lint bundle.
Industry-forum lint bundles (CA/B Forum) live in sibling reference
crates such as pkix-lint-cabf.
An optional OSCAL Catalog / Profile / Assessment Results bridge ships
behind the oscal cargo feature for callers who want NIST OSCAL JSON
as their wire format; it is one supported output shape, not a
workspace mandate. See src/oscal/mod.rs for the framing.
What this crate provides
pkix-path::validate_path returns Result<ValidatedPath, Error> — hard pass
or fail. That binary model cannot express "this certificate is RFC 5280 valid
but violates CA/B Forum TLS BR §7.1.4.2" without aborting validation entirely.
pkix-lint adds an advisory layer on top:
Linttrait — the unit of evaluation. Each lint has a stable ID, a normative citation, a severity (Warn,Error,Fatal), a scope (CertificateorPath), and a subject-kind filter (Leaf,IntermediateCa,AnchorIssued, orAny).LintResult—Pass | NotApplicable | Warn | Error | Fatal.Warn,Error, andFatalcarry aCow<'static, str>detail message — zero-allocation for static literals (viaCow::Borrowed) and runtime-formatted strings for dynamic values (viaCow::Owned).Fatalstops further lint evaluation for that item; it does not propagate as a hard failure.Finding— a lint ID paired with a result and the chain index of the offending certificate.LintRunner— evaluates a set ofdyn Lintobjects against a certificate or validated path, returningVec<Finding>.LintProfiletrait — extendspkix_path::Profilewith alints()method so a profile struct bundles its own lint set.deviationmodule — a waiver/exception mechanism that records approved deviations from lint rules for audit purposes.EvaluationReport— an exportable evidence pack. The optionaloscalfeature can serialize it as OSCAL Assessment Results JSON; callers can also consume it directly as Rust data or marshal it into any other format.
Advisory-only contract
pkix-lint findings never cause a certificate to be rejected. All runner
methods return Vec<Finding> — never Result::Err. Whether to act on a
finding is the caller's decision, configured per finding ID at the integration
layer. This is intentional:
- Spec ambiguity (CA/B Forum CPs, FPKI CPs) means some findings require human judgment before enforcement.
pkix-lintdoes not know whether you are in audit, monitoring, or hard-fail enforcement context. The caller does.
Built-in lints (pkix-lint::rfc5280)
pkix-lint ships the framework and standards-body (RFC) conformance lints.
CA/B Forum lint bundles live in the sibling pkix-lint-cabf crate marked
"reference / not authoritative"; project policy (see workspace AGENTS.md)
is that vendor and industry-forum policy interpretations stay out of the
main crate.
| ID | Rule | Scope |
|---|---|---|
rfc5280.cert.serial_number.max_octets |
Certificate serialNumber length cap (RFC 5280 §4.1.2.2) |
Any |
CA/B Forum TLS BR lints (cabf.br.tls.*) — SC-081 phased validity caps,
SHA-1 prohibition, RSA min-key-size, SAN/EKU presence, BasicConstraints
cA-flag — are in pkix-lint-cabf::cabf_tls_br.
Usage
Run CA/B Forum TLS BR lints against a chain (via pkix-profiles-cabf)
use ;
use WebPkiProfile;
let profile = WebPkiProfile;
let runner = profile.lint_runner;
let kinds = vec!;
let findings = runner.run_chain;
for f in findings.iter.filter
Implement a custom lint
use ;
use Certificate;
;
let runner = new;
Record a deviation (waiver)
use ;
let mut store = new;
store.add?;
Export an evidence pack
use EvaluationReport;
let mut report = new;
report.record_findings;
let json = to_string_pretty?; // requires `serde` feature
Finding ID stability
Finding IDs returned by Lint::id() are part of the public API and must not
change between crate versions without a semver-major bump. Format convention:
<regime>.<section>.<noun>, e.g. "cabf.br.tls.validity.max".
Features
| Feature | Enables |
|---|---|
serde |
Serialize/Deserialize on Finding, EvaluationReport, Deviation, and related types |
Standards
- CA/B Forum Baseline Requirements for TLS Server Certificates (SC-081)
- CA/B Forum S/MIME Baseline Requirements
- [RFC 5280] — Internet X.509 PKI Certificate and CRL Profile
License
Apache-2.0 OR MIT