pub struct DeviationStore { /* private fields */ }Expand description
An in-memory collection of Deviations.
The store is currently append-only. Future versions may add update/delete and persistence (file-backed JSON/OSCAL format) — tracked as PKIX-dbhe.
Implementations§
Source§impl DeviationStore
impl DeviationStore
Sourcepub fn add(&mut self, deviation: Deviation) -> Result<(), DeviationAddError>
pub fn add(&mut self, deviation: Deviation) -> Result<(), DeviationAddError>
Add a deviation to the store.
§Errors
DeviationAddError::EmptyFieldifdeviation.justificationordeviation.authorized_byis empty.DeviationAddError::DuplicateIdif a deviation with the sameidalready exists in the store.
Sourcepub fn active_at(&self, now_unix: u64) -> impl Iterator<Item = &Deviation>
pub fn active_at(&self, now_unix: u64) -> impl Iterator<Item = &Deviation>
Return all deviations that are active at now_unix.
Sourcepub fn active_for_lint<'a>(
&'a self,
lint_id: &'a str,
now_unix: u64,
) -> impl Iterator<Item = &'a Deviation>
pub fn active_for_lint<'a>( &'a self, lint_id: &'a str, now_unix: u64, ) -> impl Iterator<Item = &'a Deviation>
Return all deviations targeting lint_id that are active at now_unix.
Sourcepub fn expired_at(&self, now_unix: u64) -> impl Iterator<Item = &Deviation>
pub fn expired_at(&self, now_unix: u64) -> impl Iterator<Item = &Deviation>
Return all deviations that have expired as of now_unix.
Used by corpus-reporting tools to surface deviations that need renewal.
Sourcepub fn find_deviation(
&self,
lint_id: &str,
cert: &Certificate,
now_unix: u64,
) -> Option<&Deviation>
pub fn find_deviation( &self, lint_id: &str, cert: &Certificate, now_unix: u64, ) -> Option<&Deviation>
Check whether a specific finding should be deviated.
Returns the active deviation that matches cert and lint_id
at now_unix, or None if no deviation applies.
§Resolution rule (PKIX-hy2e.10)
Among all matching deviations, the one with the highest
Deviation::priority wins. Ties are broken by
store-insertion order — the first-added deviation at the
winning priority wins.
Operators merging deviation files from multiple authors should
set Deviation::priority explicitly to express specificity:
site-local / lab-scoped waivers get higher priorities than
workspace-wide wildcard waivers. The default priority is 0,
so a single-author store behaves identically to the pre-PKIX-
hy2e.10 “first-match-wins” rule.
Sourcepub fn find_deviation_for_chain(
&self,
lint_id: &str,
chain: &[Certificate],
now_unix: u64,
) -> Option<&Deviation>
pub fn find_deviation_for_chain( &self, lint_id: &str, chain: &[Certificate], now_unix: u64, ) -> Option<&Deviation>
Returns the active deviation that matches lint_id and at
least one certificate in chain at now_unix, or None if no
deviation applies.
Used by DeviationRunner::run_path to apply path-scope
deviations that target an intermediate CA’s properties (rather
than the leaf’s). Per RFC 5280 §6.1, a path-scope finding can
fire because of any cert in the chain, including intermediate
CAs; a deviation scoped to an intermediate must be applicable
even though the path finding has no single “owning” cert.
§Resolution rule (PKIX-hy2e.10 + PKIX-hy2e.11)
- A deviation matches if
Deviation::target_lintequalslint_idAND at least one cert inchainis in scope. - Among all matching deviations, the highest
Deviation::prioritywins. - Priority ties are broken by store-insertion order.
Trait Implementations§
Source§impl Clone for DeviationStore
impl Clone for DeviationStore
Source§fn clone(&self) -> DeviationStore
fn clone(&self) -> DeviationStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DeviationStore
impl Debug for DeviationStore
Source§impl Default for DeviationStore
impl Default for DeviationStore
Source§fn default() -> DeviationStore
fn default() -> DeviationStore
impl Eq for DeviationStore
Source§impl PartialEq for DeviationStore
impl PartialEq for DeviationStore
Source§fn eq(&self, other: &DeviationStore) -> bool
fn eq(&self, other: &DeviationStore) -> bool
self and other values to be equal, and is used by ==.