pub struct RawMatch {
pub detector_id: String,
pub detector_name: String,
pub service: String,
pub severity: Severity,
pub credential: String,
pub companion: Option<String>,
pub location: MatchLocation,
pub entropy: Option<f64>,
pub confidence: Option<f64>,
}Expand description
A credential match found by the scanner, before verification.
§Examples
use keyhog_core::{MatchLocation, RawMatch, Severity};
let finding = RawMatch {
detector_id: "demo-token".into(),
detector_name: "Demo Token".into(),
service: "demo".into(),
severity: Severity::High,
credential: "demo_ABC12345".into(),
companion: None,
location: MatchLocation {
source: "filesystem".into(),
file_path: Some(".env".into()),
line: Some(1),
offset: 0,
commit: None,
author: None,
date: None,
},
entropy: None,
confidence: Some(0.9),
};
assert_eq!(finding.detector_id, "demo-token");Fields§
§detector_id: StringStable detector identifier.
detector_name: StringHuman-readable detector name.
service: StringService namespace associated with the detector.
severity: SeverityDetector severity level.
credential: StringMatched credential bytes before redaction.
companion: Option<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).
confidence: Option<f64>Confidence score (0.0 - 1.0) combining entropy, keyword proximity, file type, etc.
Implementations§
Source§impl RawMatch
impl RawMatch
Sourcepub fn deduplication_key(&self) -> (String, String)
pub fn deduplication_key(&self) -> (String, String)
Deduplication key: same detector + same credential = same finding. Git history includes commit ID so the same secret in different commits stays distinct.
§Examples
use keyhog_core::{MatchLocation, RawMatch, Severity};
let finding = RawMatch {
detector_id: "demo".into(),
detector_name: "Demo".into(),
service: "demo".into(),
severity: Severity::High,
credential: "demo_ABC12345".into(),
companion: None,
location: MatchLocation {
source: "filesystem".into(),
file_path: Some(".env".into()),
line: Some(1),
offset: 0,
commit: None,
author: None,
date: None,
},
entropy: None,
confidence: None,
};
assert_eq!(finding.deduplication_key().0, "demo");Trait Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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