pub struct EntityConfig {
pub max_entities: usize,
pub max_entities_per_site: usize,
pub risk_half_life_minutes: f64,
pub repeat_offender_max_factor: f64,
pub block_threshold: f64,
pub max_rules_per_entity: usize,
pub enabled: bool,
pub max_risk: f64,
pub max_anomalies_per_entity: usize,
}Expand description
Configuration for entity tracking.
Fields§
§max_entities: usizeMaximum number of entities to track (LRU eviction when exceeded).
max_entities_per_site: usizeMaximum entities per site/tenant (prevents single tenant from filling global pool).
SECURITY: This limit ensures fair-share allocation across tenants. A single tenant generating many unique actors (intentional attack or misconfigured client) cannot fill the global pool and degrade security for other tenants.
Default: 10% of max_entities (10,000 for default 100,000 max) Set to 0 to disable per-site limits.
risk_half_life_minutes: f64Risk half-life in minutes (time for risk to decay to 50% of current value).
SECURITY: Using exponential decay prevents attackers from predicting when their risk score will drop below threshold. With linear decay (deprecated), attackers could time attacks to occur right after score drops below threshold.
Formula: new_risk = old_risk * 0.5^(elapsed_minutes / half_life_minutes)
Default: 5 minutes (score decays to 50% every 5 minutes)
- After 5 min: 50% of original
- After 10 min: 25% of original
- After 20 min: 6.25% of original
repeat_offender_max_factor: f64Minimum half-life for repeat offenders (multiplied from base).
Entities with many rule matches decay slower as punishment. Applied as: effective_half_life = base_half_life * repeat_offender_factor
Default factor range: 1.0 (first offense) to 3.0 (heavy offender)
block_threshold: f64Risk threshold for automatic blocking.
max_rules_per_entity: usizeMaximum number of rule matches to track per entity.
enabled: boolWhether entity tracking is enabled.
max_risk: f64Maximum risk score (default: 100.0, extended: 1000.0).
max_anomalies_per_entity: usizeMaximum number of anomaly entries to track per entity.
Trait Implementations§
Source§impl Clone for EntityConfig
impl Clone for EntityConfig
Source§fn clone(&self) -> EntityConfig
fn clone(&self) -> EntityConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EntityConfig
impl Debug for EntityConfig
Auto Trait Implementations§
impl Freeze for EntityConfig
impl RefUnwindSafe for EntityConfig
impl Send for EntityConfig
impl Sync for EntityConfig
impl Unpin for EntityConfig
impl UnsafeUnpin for EntityConfig
impl UnwindSafe for EntityConfig
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