pub struct DetectionId { /* private fields */ }Expand description
Which detection produced a Finding, to which version, from which bytes.
The provenance stamp the report records: an author-chosen id, an ordered
Version, and the content hash of the detection body. The hash is an opaque
string computed by the detection subsystem.
The id is untrusted input that reaches exported reports, so escape it like a
scanned host’s banner. The zond: prefix is reserved for built-in detections,
enforced where detections are authored: by build.rs for those this project ships
and by detect::flow::validate for an operator’s. It is not
enforced here, since the built-in correlator’s id lives in that namespace, nor on a
report read back, where everything is the document’s own claim.
Implementations§
Source§impl DetectionId
impl DetectionId
Sourcepub fn new(
id: impl Into<String>,
version: Version,
content_hash: impl Into<String>,
) -> Result<Self, FindingError>
pub fn new( id: impl Into<String>, version: Version, content_hash: impl Into<String>, ) -> Result<Self, FindingError>
A detection identity, or FindingError::EmptyId if id is blank.
The content hash is opaque and may be empty (a detection under development need not have one); the id may not.
Sourcepub fn content_hash(&self) -> &str
pub fn content_hash(&self) -> &str
The content hash of the detection body, or an empty string if none was recorded.
Trait Implementations§
Source§impl Clone for DetectionId
impl Clone for DetectionId
Source§impl Debug for DetectionId
impl Debug for DetectionId
impl Eq for DetectionId
Source§impl From<&DetectionId> for DetectionIdRecord
impl From<&DetectionId> for DetectionIdRecord
Source§fn from(detection: &DetectionId) -> Self
fn from(detection: &DetectionId) -> Self
Source§impl Hash for DetectionId
impl Hash for DetectionId
Source§impl Ord for DetectionId
impl Ord for DetectionId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for DetectionId
impl PartialEq for DetectionId
Source§impl PartialOrd for DetectionId
impl PartialOrd for DetectionId
impl StructuralPartialEq for DetectionId
Auto Trait Implementations§
impl Freeze for DetectionId
impl RefUnwindSafe for DetectionId
impl Send for DetectionId
impl Sync for DetectionId
impl Unpin for DetectionId
impl UnsafeUnpin for DetectionId
impl UnwindSafe for DetectionId
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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