pub struct RateLimitingSecurityConfig {Show 13 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 requests_per_second_per_user: Option<u32>,
pub redis_url: Option<String>,
pub trust_proxy_headers: bool,
pub trusted_proxy_cidrs: Option<Vec<String>>,
}Expand description
Minimal mirror of the [security.rate_limiting] TOML section, deserialized
from the compiled schema’s security.rate_limiting JSON key.
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.
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 (not yet implemented).
trust_proxy_headers: boolTrust X-Real-IP / X-Forwarded-For headers for the client IP.
Enable only when FraiseQL is deployed behind a trusted reverse proxy (e.g. nginx, Cloudflare, AWS ALB) 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", "172.16.0.0/12"]).
When set and trust_proxy_headers = true, X-Forwarded-For is only honoured
when the direct connection IP falls within one of these CIDR ranges.
Requests arriving from outside these ranges use the connection IP directly,
preventing clients from spoofing their address by setting X-Forwarded-For.
When None and trust_proxy_headers = true, all proxy IPs are trusted
(less secure — a startup warning is emitted).
Trait Implementations§
Source§impl Clone for RateLimitingSecurityConfig
impl Clone for RateLimitingSecurityConfig
Source§fn clone(&self) -> RateLimitingSecurityConfig
fn clone(&self) -> RateLimitingSecurityConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RateLimitingSecurityConfig
impl Debug for RateLimitingSecurityConfig
Source§impl Default for RateLimitingSecurityConfig
impl Default for RateLimitingSecurityConfig
Source§fn default() -> RateLimitingSecurityConfig
fn default() -> 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>,
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,
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