pub struct DedupedMatch {
pub detector_id: String,
pub detector_name: String,
pub service: String,
pub severity: Severity,
pub credential: String,
pub companion: Option<String>,
pub primary_location: MatchLocation,
pub additional_locations: Vec<MatchLocation>,
pub confidence: Option<f64>,
}Expand description
A group of raw matches with the same (detector_id, credential), collapsed into a single finding with one primary location and zero or more additional locations.
§Examples
use keyhog_core::{DedupScope, DedupedMatch, MatchLocation, RawMatch, Severity, dedup_matches};
let matches = vec![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),
}];
let groups = dedup_matches(matches, &DedupScope::Credential);
assert_eq!(groups.len(), 1);
assert_eq!(groups[0].detector_id, "demo-token");Fields§
§detector_id: StringStable detector identifier.
detector_name: StringHuman-readable detector name.
service: StringService namespace associated with the detector.
severity: SeveritySeverity preserved from the original match.
credential: StringUnredacted credential for verification.
companion: Option<String>Optional companion credential or nearby value.
primary_location: MatchLocationPrimary source location.
additional_locations: Vec<MatchLocation>Additional duplicate locations.
confidence: Option<f64>Confidence score (0.0 - 1.0) combining entropy, keyword proximity, file type, etc.
Trait Implementations§
Source§impl Clone for DedupedMatch
impl Clone for DedupedMatch
Source§fn clone(&self) -> DedupedMatch
fn clone(&self) -> DedupedMatch
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DedupedMatch
impl RefUnwindSafe for DedupedMatch
impl Send for DedupedMatch
impl Sync for DedupedMatch
impl Unpin for DedupedMatch
impl UnsafeUnpin for DedupedMatch
impl UnwindSafe for DedupedMatch
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