pub struct DlpConfig {
pub enabled: bool,
pub max_scan_size: usize,
pub max_matches: usize,
pub scan_text_only: bool,
pub max_body_inspection_bytes: usize,
pub fast_mode: bool,
pub custom_keywords: Option<Vec<String>>,
pub redaction: HashMap<SensitiveDataType, RedactionMode>,
pub hash_salt: Option<String>,
}Expand description
DLP configuration
Fields§
§enabled: bool§max_scan_size: usizeMaximum body size to accept for scanning (reject if larger)
max_matches: usizeMaximum matches before stopping scan
scan_text_only: boolOnly scan text-based content types
max_body_inspection_bytes: usizeMaximum bytes to inspect for DLP patterns (truncate if larger). This bounds scan time for large payloads. Default 8KB. Content beyond this limit is not scanned but the request continues.
fast_mode: boolFast mode: Skip low-priority patterns (email, phone, IPv4) for better performance. Only scans critical patterns: credit cards, SSN, AWS keys, API keys, passwords, private keys, JWT, IBAN, medical records. Reduces scan time by ~30-40% for typical payloads.
custom_keywords: Option<Vec<String>>List of custom keywords to detect (e.g., project codenames)
redaction: HashMap<SensitiveDataType, RedactionMode>Redaction settings per data type
hash_salt: Option<String>Salt for hash-based redaction (REQUIRED if any type uses RedactionMode::Hash) Should be a cryptographically random string, at least 32 bytes
Implementations§
Source§impl DlpConfig
impl DlpConfig
Sourcepub fn validate(&self) -> Result<(), DlpConfigError>
pub fn validate(&self) -> Result<(), DlpConfigError>
Validate the configuration Returns error if:
- Any data type uses Hash mode but no salt is configured
- Custom keywords contain empty strings or exceed length limits
Sourcepub fn max_pattern_length(&self) -> usize
pub fn max_pattern_length(&self) -> usize
Get the maximum pattern length for overlap calculation Returns the longest pattern that could span chunk boundaries
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DlpConfig
impl<'de> Deserialize<'de> for DlpConfig
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>,
Auto Trait Implementations§
impl Freeze for DlpConfig
impl RefUnwindSafe for DlpConfig
impl Send for DlpConfig
impl Sync for DlpConfig
impl Unpin for DlpConfig
impl UnsafeUnpin for DlpConfig
impl UnwindSafe for DlpConfig
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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