pub struct RateLimitingSecurityConfig {Show 18 fields
pub enabled: bool,
pub requests_per_second: u32,
pub burst_size: u32,
pub auth_start_max_requests: u32,
pub auth_start_window_secs: u64,
pub auth_callback_max_requests: u32,
pub auth_callback_window_secs: u64,
pub auth_refresh_max_requests: u32,
pub auth_refresh_window_secs: u64,
pub auth_logout_max_requests: u32,
pub auth_logout_window_secs: u64,
pub failed_login_max_attempts: u32,
pub failed_login_lockout_secs: u64,
pub requests_per_second_per_user: Option<u32>,
pub redis_url: Option<String>,
pub trust_proxy_headers: bool,
pub trusted_proxy_cidrs: Option<Vec<String>>,
pub max_buckets: usize,
}Expand description
Per-endpoint and global rate limiting configuration for [security.rate_limiting].
The single shape for this section: the CLI authors it from TOML and the server consumes it from the compiled schema, so the two cannot drift (before #977 each side kept its own copy — with different defaults).
Fields§
§enabled: boolEnable rate limiting.
requests_per_second: u32Global request rate cap (requests per second, per IP).
burst_size: u32Burst allowance above the steady-state rate.
auth_start_max_requests: u32Auth initiation endpoint — max requests per window.
auth_start_window_secs: u64Auth initiation window in seconds.
auth_callback_max_requests: u32OAuth callback endpoint — max requests per window.
auth_callback_window_secs: u64OAuth callback window in seconds.
auth_refresh_max_requests: u32Token refresh endpoint — max requests per window.
auth_refresh_window_secs: u64Token refresh window in seconds.
auth_logout_max_requests: u32Logout endpoint — max requests per window (#893).
auth_logout_window_secs: u64Logout window in seconds.
failed_login_max_attempts: u32Maximum failed first-factor login attempts before lockout.
The off-the-shelf binary performs no first-factor login of its own, so it
cannot enforce this; a value tuned away from the default is rejected at
startup in production (#356) — see the server’s failed_login_lockout_check.
failed_login_lockout_secs: u64Lockout window in seconds after failed_login_max_attempts is exceeded.
requests_per_second_per_user: Option<u32>Per-authenticated-user request rate in requests/second.
Defaults to 10× requests_per_second if not set.
redis_url: Option<String>Redis URL for distributed rate limiting.
Optional: when unset, budgets are tracked in-memory, per process. When set, an unreachable Redis is a boot error in production (#770/#777 class) — the server does not silently downgrade to per-process limits.
trust_proxy_headers: boolTrust X-Real-IP / X-Forwarded-For headers for client IP extraction.
Set to true only when FraiseQL is deployed behind a trusted reverse
proxy that sets these headers. Enabling without a trusted proxy allows
clients to spoof their IP address.
trusted_proxy_cidrs: Option<Vec<String>>CIDR ranges trusted as proxy IPs (e.g. ["10.0.0.0/8"]).
When set and trust_proxy_headers = true, X-Forwarded-For is only
honoured when the direct connection IP falls within one of these ranges.
When omitted with trust_proxy_headers = true, all proxy IPs are trusted
(less secure — the server emits a startup warning).
max_buckets: usizeMaximum tracked buckets per map — a memory ceiling, not a security control.
The limiter keeps one token bucket per key in each of its maps (per-IP,
per-user, per-path-and-IP, per-tenant). This caps how many it holds at once,
at roughly 200 bytes each: the default 100 000 is about 20 MiB per map.
Reaching the cap evicts the least-recently-used of a sample rather than refusing the newcomer (#1080/#1143), so setting it low degrades accuracy — a client whose bucket was evicted starts again with a full one — and never availability. It is a knob to size to the host, not to tune for protection.
Trait Implementations§
Source§impl Clone for RateLimitingSecurityConfig
impl Clone for RateLimitingSecurityConfig
Source§impl Debug for RateLimitingSecurityConfig
impl Debug for RateLimitingSecurityConfig
Source§impl Default for RateLimitingSecurityConfig
impl Default for RateLimitingSecurityConfig
Source§impl<'de> Deserialize<'de> for RateLimitingSecurityConfigwhere
RateLimitingSecurityConfig: Default,
impl<'de> Deserialize<'de> for RateLimitingSecurityConfigwhere
RateLimitingSecurityConfig: Default,
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>,
impl Eq for RateLimitingSecurityConfig
impl StructuralPartialEq for RateLimitingSecurityConfig
Auto Trait Implementations§
impl Freeze for RateLimitingSecurityConfig
impl RefUnwindSafe for RateLimitingSecurityConfig
impl Send for RateLimitingSecurityConfig
impl Sync for RateLimitingSecurityConfig
impl Unpin for RateLimitingSecurityConfig
impl UnsafeUnpin for RateLimitingSecurityConfig
impl UnwindSafe for RateLimitingSecurityConfig
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.