pub struct Finding { /* private fields */ }Expand description
One thing wrong with a scanned subject: a typed, provenance-tagged claim.
Every finding names the DetectionId that produced it, carries two
independent judgements (Severity and Confidence), holds a bounded
Excerpt of the bytes that justify it, and points at zero or more typed
References. Built through Finding::new and the with_* builders, so every
finding passes the same checks whether scanned, rebuilt from a file, or returned by
a module.
Implementations§
Source§impl Finding
impl Finding
Sourcepub fn new(
detection: DetectionId,
title: impl Into<String>,
severity: Severity,
confidence: Confidence,
class: DetectionClass,
) -> Result<Self, FindingError>
pub fn new( detection: DetectionId, title: impl Into<String>, severity: Severity, confidence: Confidence, class: DetectionClass, ) -> Result<Self, FindingError>
A finding from its required parts, or FindingError::EmptyTitle if
title is blank.
The excerpt, references and remediation start empty and are added with the builders below.
Sourcepub fn with_reference(self, reference: Reference) -> Self
pub fn with_reference(self, reference: Reference) -> Self
Adds a reference, keeping the order they arrive in. A duplicate folds away, so two runs that found the same references write the same file.
Sourcepub fn with_excerpt(self, excerpt: Excerpt) -> Self
pub fn with_excerpt(self, excerpt: Excerpt) -> Self
Sets the justifying excerpt. Already bounded by Excerpt::new.
Sourcepub fn with_remediation(self, remediation: impl Into<String>) -> Self
pub fn with_remediation(self, remediation: impl Into<String>) -> Self
Sets the remediation advice.
Sourcepub fn with_cpe(self, cpe: impl Into<String>) -> Self
pub fn with_cpe(self, cpe: impl Into<String>) -> Self
Adds a platform identifier the finding was drawn from.
For a correlation, which draws a finding from a CPE a service carries. Adding one already named changes nothing.
Sourcepub fn with_subject(self, subject: impl Into<String>) -> Self
pub fn with_subject(self, subject: impl Into<String>) -> Self
Names what the claim is about, which claim_id
then keys on in place of the references.
For a detection whose findings summarise a changing set of references, as a correlation’s do, so the claim does not rename itself when the data changes.
Sourcepub fn with_build(self, build: Build) -> Self
pub fn with_build(self, build: Build) -> Self
Records the distribution build a correlation judged.
Sourcepub fn with_advised_by(self, advised_by: DetectionId) -> Self
pub fn with_advised_by(self, advised_by: DetectionId) -> Self
Records the distributor’s advisory data a correlation consulted.
Sourcepub fn with_exploitation(self, exploitation: Exploitation) -> Self
pub fn with_exploitation(self, exploitation: Exploitation) -> Self
Records which of the vulnerabilities it cites are known to be exploited.
Sourcepub fn with_group(self, group: FindingGroup) -> Self
pub fn with_group(self, group: FindingGroup) -> Self
Records which group of findings this one belongs to.
Sourcepub fn group(&self) -> Option<&FindingGroup>
pub fn group(&self) -> Option<&FindingGroup>
What this finding is one of, where its detection declared a group.
Sourcepub fn subject(&self) -> Option<&str>
pub fn subject(&self) -> Option<&str>
What the claim is about, where the detection named it. Untrusted.
Sourcepub fn build(&self) -> Option<&Build>
pub fn build(&self) -> Option<&Build>
The distribution build a correlation judged, if it judged one.
Sourcepub fn advised_by(&self) -> Option<&DetectionId>
pub fn advised_by(&self) -> Option<&DetectionId>
The distributor’s advisory data a correlation consulted, if any.
Sourcepub fn exploitation(&self) -> Option<&Exploitation>
pub fn exploitation(&self) -> Option<&Exploitation>
Which of the vulnerabilities it cites are known to be exploited, if a list consulted names any.
Sourcepub fn detection(&self) -> &DetectionId
pub fn detection(&self) -> &DetectionId
The detection that produced this finding.
Sourcepub fn confidence(&self) -> Confidence
pub fn confidence(&self) -> Confidence
How sure this finding is true.
Sourcepub fn class(&self) -> DetectionClass
pub fn class(&self) -> DetectionClass
The intrusiveness the producing detection ran under.
Sourcepub fn references(&self) -> impl Iterator<Item = &Reference>
pub fn references(&self) -> impl Iterator<Item = &Reference>
The external references, in the order the detection stated them, which is most-relevant-first where it had an order to state.
Sourcepub fn remediation(&self) -> Option<&str>
pub fn remediation(&self) -> Option<&str>
The remediation advice, if any. Untrusted; escape before display.
Sourcepub fn cpes(&self) -> impl Iterator<Item = &str>
pub fn cpes(&self) -> impl Iterator<Item = &str>
The platform identifiers a correlation drew this finding from, ascending, and none for a finding drawn from anything else. Untrusted: a scanned host’s banner chose them, so escape before display.
Each draws the same claim, so it stands while any of them still identifies the endpoint.
Sourcepub fn claim_id(&self) -> ClaimId
pub fn claim_id(&self) -> ClaimId
The key that decides whether this finding and another are the same claim.
The producing detection’s id, paired with the subject it discriminates on:
the subject the detection named where it named one,
otherwise the lowest CVE identifier this finding references, or its
title where it references none.
The lowest, not the first: a correlation states its worst first, which changes when the catalogue does, so keying on the first would rename the claim after a data refresh and a diff of an unchanged host would show one finding gone and another arrived.
Sourcepub fn corroborate(&mut self, other: Finding) -> bool
pub fn corroborate(&mut self, other: Finding) -> bool
Folds another account of the same claim into this one, keeping the stronger reading, and reports whether anything changed.
Called when a detection asserts a claim a subject already carries: the same
producer and claim_id. The caller must have matched the
claims.
The verdict (severity, title, class) follows the version, so it stays in step
with the DetectionId that records who concluded it:
- An account at a lower version supplies only what is missing. Otherwise
folding a
1.0.0reading into a2.0.0one would leave2.0.0stamped on1.0.0’sLow. This is the common direction, since the record folded in is usually the older. - An account at the same version supplies the verdict: one detection
grading a claim differently twice has read different evidence, and the later
reading wins.
mergefolds documents in the order their own clocks give, so a cipherLowin January andCriticalin June isCritical. - A newer version supplies the verdict and its own stamp.
Regardless of version, certainty only rises, since a second agreeing account
is worth something whichever build produced it, and references and platform
identifiers union, as Service::merge
unions CPEs. Keeping one identifier would have a merge drop the claim once a
newer scan backed only the other.
Except for correlations, whose certainty and references are part of the verdict. A correlation is a computation over a service identification and the datasets behind it, and a later one that cites fewer vulnerabilities, or holds them less surely, has usually learned some do not apply to this build. Unioning would carry every vulnerability ever cited into every later report at the surest grade ever given. So an account of a correlation at the same version or newer replaces the certainty, references, build, advisory stamp and exploitation outright, and an older one supplies none of them.
The excerpt and remediation travel with the verdict where one is taken, and otherwise fill a gap.
Trait Implementations§
impl Eq for Finding
Source§impl From<&Finding> for FindingRecord
impl From<&Finding> for FindingRecord
impl StructuralPartialEq for Finding
Auto Trait Implementations§
impl Freeze for Finding
impl RefUnwindSafe for Finding
impl Send for Finding
impl Sync for Finding
impl Unpin for Finding
impl UnsafeUnpin for Finding
impl UnwindSafe for Finding
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more