Skip to main content

DeviationStore

Struct DeviationStore 

Source
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

Source

pub const fn new() -> Self

Create an empty store.

Source

pub fn add(&mut self, deviation: Deviation) -> Result<(), DeviationAddError>

Add a deviation to the store.

§Errors
Source

pub fn all(&self) -> &[Deviation]

Return all deviations in the store.

Source

pub fn active_at(&self, now_unix: u64) -> impl Iterator<Item = &Deviation>

Return all deviations that are active at now_unix.

Source

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.

Source

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.

Source

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.

Source

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)
  1. A deviation matches if Deviation::target_lint equals lint_id AND at least one cert in chain is in scope.
  2. Among all matching deviations, the highest Deviation::priority wins.
  3. Priority ties are broken by store-insertion order.

Trait Implementations§

Source§

impl Clone for DeviationStore

Source§

fn clone(&self) -> DeviationStore

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DeviationStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DeviationStore

Source§

fn default() -> DeviationStore

Returns the “default value” for a type. Read more
Source§

impl Eq for DeviationStore

Source§

impl PartialEq for DeviationStore

Source§

fn eq(&self, other: &DeviationStore) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for DeviationStore

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for DeviationStore

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V