pub struct PatternSpec {
pub regex: String,
pub description: Option<String>,
pub group: Option<usize>,
pub client_safe: bool,
}Expand description
A regex pattern with optional capture group and description.
Fields§
§regex: StringRegular expression string (Rust flavor).
description: Option<String>Optional context description.
group: Option<usize>Optional capture group index containing the secret.
client_safe: boolWhen true, a match against THIS pattern downgrades the
finding to Severity::ClientSafe (regardless of the detector’s
nominal severity). Used by services that intentionally ship
public-facing keys in client bundles:
- Sentry DSN (the
https://<key>@URL is meant for the browser) - Stripe
pk_live_/pk_test_(publishable, sk_ is secret) - Mapbox
pk.(public,sk.is secret) - Firebase Web API key, Google Maps browser key
- PostHog / Mixpanel / Algolia search / Datadog browser RUM
Per-pattern (not per-detector) so detectors that fire on both the public and the secret prefix can tag only the public one.
Case sensitivity: keyhog compiles every regex case_insensitive(true),
so to make a single pattern case-SENSITIVE (AWS AKIA is uppercase,
GCP/Snowflake ids are lowercase) prefix its regex with the inline flag
(?-i) in the TOML - no schema field needed.
Trait Implementations§
Source§impl Clone for PatternSpec
impl Clone for PatternSpec
Source§fn clone(&self) -> PatternSpec
fn clone(&self) -> PatternSpec
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 PatternSpec
impl Debug for PatternSpec
Source§impl Default for PatternSpec
impl Default for PatternSpec
Source§fn default() -> PatternSpec
fn default() -> PatternSpec
Source§impl<'de> Deserialize<'de> for PatternSpec
impl<'de> Deserialize<'de> for PatternSpec
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 PartialEq for PatternSpec
impl PartialEq for PatternSpec
Source§fn eq(&self, other: &PatternSpec) -> bool
fn eq(&self, other: &PatternSpec) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for PatternSpec
impl Serialize for PatternSpec
impl StructuralPartialEq for PatternSpec
Auto Trait Implementations§
impl Freeze for PatternSpec
impl RefUnwindSafe for PatternSpec
impl Send for PatternSpec
impl Sync for PatternSpec
impl Unpin for PatternSpec
impl UnsafeUnpin for PatternSpec
impl UnwindSafe for PatternSpec
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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