pub struct ScannerConfig {Show 17 fields
pub max_decode_depth: usize,
pub validate_decode: bool,
pub entropy_enabled: bool,
pub entropy_threshold: f64,
pub entropy_in_source_files: bool,
pub ml_enabled: bool,
pub ml_weight: f64,
pub min_confidence: f64,
pub unicode_normalization: bool,
pub max_decode_bytes: usize,
pub max_matches_per_chunk: usize,
pub scan_comments: bool,
pub multiline: MultilineConfig,
pub known_prefixes: Vec<String>,
pub secret_keywords: Vec<String>,
pub test_keywords: Vec<String>,
pub placeholder_keywords: Vec<String>,
}Expand description
Configuration for the scanner’s decoding and processing heuristics.
Fields§
§max_decode_depth: usizeMaximum recursion depth for decode-through (base64, hex, etc.)
validate_decode: boolValidate decoded strings (e.g. check if decoded base64 is UTF-8)
entropy_enabled: boolEnable entropy-based detection
entropy_threshold: f64Threshold for entropy-based detection
entropy_in_source_files: boolEnable entropy-based detection in source code files
ml_enabled: boolEnable ML-based confidence scoring
ml_weight: f64ML weight for confidence scoring, 0.0-1.0
min_confidence: f64Minimum confidence threshold for matches
unicode_normalization: boolEnable Unicode normalization
max_decode_bytes: usizeMaximum bytes for decode-through processing
max_matches_per_chunk: usizeMaximum matches to collect per chunk before stopping. Prevents OOM on extremely noisy files.
scan_comments: boolWhen true, credentials inside source-code comments are
treated as first-class findings (no confidence downgrade,
no comment-context multiplier). Mirrors
keyhog_core::config::ScanConfig::scan_comments and the
CLI’s --scan-comments flag. See that field’s doc for why
the default is off.
multiline: MultilineConfigConfiguration for multiline concatenation
known_prefixes: Vec<String>Known secret prefixes used to boost confidence.
secret_keywords: Vec<String>Keywords indicating a secret context (e.g. “api_key”, “token”).
test_keywords: Vec<String>Keywords indicating a test/mock context (e.g. “test”, “fake”).
placeholder_keywords: Vec<String>Keywords indicating a placeholder value (e.g. “change_me”, “todo”).
Implementations§
Source§impl ScannerConfig
impl ScannerConfig
pub fn fast() -> Self
pub fn thorough() -> Self
pub fn min_confidence(self, min_confidence: f64) -> Self
Sourcepub fn sanitise(&mut self)
pub fn sanitise(&mut self)
Clamp every float field into its valid range and replace any
NaN with a safe default. A user-supplied
--min-confidence=-5.0 or a corrupt config TOML feeding
min_confidence = nan would otherwise NaN-infect the
confidence-comparison path and silently drop every finding
(NaN comparisons are always false, so conf < min_confidence
is false, but conf >= min_confidence is also false,
behaviour-dependent on the call site).
Idempotent - sanitising an already-sane config is a no-op.
Called inside From<ScanConfig> so any path that constructs
a ScannerConfig from a user-influenced source pays this
once at config-build time.
Trait Implementations§
Source§impl Clone for ScannerConfig
impl Clone for ScannerConfig
Source§fn clone(&self) -> ScannerConfig
fn clone(&self) -> ScannerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScannerConfig
impl Debug for ScannerConfig
Source§impl Default for ScannerConfig
impl Default for ScannerConfig
Source§impl From<ScanConfig> for ScannerConfig
impl From<ScanConfig> for ScannerConfig
Source§fn from(config: ScanConfig) -> Self
fn from(config: ScanConfig) -> Self
Auto Trait Implementations§
impl Freeze for ScannerConfig
impl RefUnwindSafe for ScannerConfig
impl Send for ScannerConfig
impl Sync for ScannerConfig
impl Unpin for ScannerConfig
impl UnsafeUnpin for ScannerConfig
impl UnwindSafe for ScannerConfig
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<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