pub struct RawMatch {
pub detector_id: Arc<str>,
pub detector_name: Arc<str>,
pub service: Arc<str>,
pub severity: Severity,
pub credential: Arc<str>,
pub credential_hash: String,
pub companions: HashMap<String, String>,
pub location: MatchLocation,
pub entropy: Option<f64>,
pub confidence: Option<f64>,
}Expand description
A raw pattern match before verification or deduplication.
entropy and confidence are stored as f64 but are guaranteed never to
be NaN (sanitized at construction time). This keeps the manual Eq impl
reflexive, which downstream code relies on for HashMap/BTreeMap keys.
Manual Debug impl redacts the credential field — the previous
derive-Debug was a CRITICAL leak vector (any {:?} print, panic
handler, or tracing::error!(?match) would expose plaintext). See
audit kimi-wave1 finding 1.1.
Fields§
§detector_id: Arc<str>Stable detector identifier.
detector_name: Arc<str>Human-readable detector name.
service: Arc<str>Service namespace associated with the detector.
severity: SeverityDetector severity level.
credential: Arc<str>Matched credential bytes before redaction.
credential_hash: StringSHA-256 hash of the credential for allowlisting and deduplication.
companions: HashMap<String, String>Companion credential or context value extracted nearby.
location: MatchLocationSource location for the match.
entropy: Option<f64>Shannon entropy of the matched credential (0.0 - 8.0). NaN-sanitized.
confidence: Option<f64>Confidence score (0.0 - 1.0). NaN-sanitized at construction.
Implementations§
Source§impl RawMatch
impl RawMatch
Sourcepub fn sanitize_floats(self) -> Self
pub fn sanitize_floats(self) -> Self
Replace NaN floats with None so the manual Eq impl stays reflexive
and HashMap/BTreeMap lookups don’t trap. Call this on any externally
constructed RawMatch (deserialized findings, scanner outputs).
Source§impl RawMatch
impl RawMatch
Sourcepub fn deduplication_key(&self) -> (&str, &str)
pub fn deduplication_key(&self) -> (&str, &str)
Get unique key for deduplication.
Sourcepub fn to_redacted(&self) -> RedactedFinding
pub fn to_redacted(&self) -> RedactedFinding
Convert into a serialization-safe DTO that never carries the plaintext
credential. Use this anywhere a RawMatch would otherwise be written
to disk, sent over the network, or rendered into a user-visible
report. See kimi-wave1 audit finding 2.1 (scan_system.rs JSON exfil).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RawMatch
impl<'de> Deserialize<'de> for RawMatch
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Ord for RawMatch
impl Ord for RawMatch
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for RawMatch
impl PartialOrd for RawMatch
impl Eq for RawMatch
Auto Trait Implementations§
impl Freeze for RawMatch
impl RefUnwindSafe for RawMatch
impl Send for RawMatch
impl Sync for RawMatch
impl Unpin for RawMatch
impl UnsafeUnpin for RawMatch
impl UnwindSafe for RawMatch
Blanket Implementations§
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§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<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