pub struct SecurityConfig {Show 20 fields
pub role_definitions: Vec<RoleDefinition>,
pub default_role: Option<String>,
pub multi_tenant: bool,
pub rls: RlsConfig,
pub tenancy: TenancyConfig,
pub cost_budget: Option<CostBudgetConfig>,
pub default_policy: Option<String>,
pub rules: Vec<AuthorizationRule>,
pub policies: Vec<AuthorizationPolicy>,
pub field_auth: Vec<FieldAuthRule>,
pub enterprise: Option<EnterpriseSecurityConfig>,
pub error_sanitization: Option<ErrorSanitizationConfig>,
pub rate_limiting: Option<RateLimitingSecurityConfig>,
pub state_encryption: Option<StateEncryptionConfig>,
pub pkce: Option<PkceSecurityConfig>,
pub api_keys: Option<ApiKeySecurityConfig>,
pub token_revocation: Option<TokenRevocationSecurityConfig>,
pub trusted_documents: Option<TrustedDocumentsConfig>,
pub persisted_queries_only: bool,
pub service_accounts: Option<HashMap<String, ServiceAccountConfig>>,
}Expand description
Security configuration from fraiseql.toml.
Contains role definitions and other security-related settings that are compiled into schema.compiled.json.
deny_unknown_fields: this object is the seam seven security subsystems are
configured through, and it used to carry a #[serde(flatten)] catch-all that
seven string lookups read — so rate_limitting or token_revokation in a
compiled schema landed in the catch-all, the lookup missed, and the subsystem
came up silently unconfigured (#977). A typo’d key must fail the load, not
disable the subsystem it names (the compiled-schema seam rule).
Fields§
§role_definitions: Vec<RoleDefinition>Role definitions mapping role names to their granted scopes.
default_role: Option<String>Default role when none is specified.
multi_tenant: boolWhether this schema serves multiple tenants with data isolation via RLS.
Declared as [security] multi_tenant = true. A non-none
tenancy.mode implies it, so this flag is only needed
by deployments that separate tenants without FraiseQL’s own tenancy
machinery — read CompiledSchema::is_multi_tenant, never this field, when
asking whether a deployment is multi-tenant.
rls: RlsConfigDeclaration that database Row-Level Security isolates this schema’s data.
Compiled from [security.rls]. Consumed by the boot gate: a multi-tenant
schema with caching enabled and no RLS declaration refuses to start, and one
that does declare RLS has the declaration verified against the live
database catalog.
tenancy: TenancyConfigTenancy isolation configuration for multi-tenant deployments.
When present and mode != "none", the runtime enforces tenant isolation
at the database level (row-based or schema-based).
cost_budget: Option<CostBudgetConfig>Operation cost budgets (#379), compiled from [security.cost_budget].
per_request_max is enforced by the executor (every transport that
executes a GraphQL document), not only by the HTTP handler; the
per-tenant default seeds the tenant registry’s rolling windows.
default_policy: Option<String>Default authorization policy applied when an operation names none.
rules: Vec<AuthorizationRule>Custom authorization rules, compiled from [[security.rules]].
policies: Vec<AuthorizationPolicy>Authorization policies (RBAC/ABAC), compiled from [[security.policies]].
field_auth: Vec<FieldAuthRule>Field-level authorization rules, compiled from [[security.field_auth]].
enterprise: Option<EnterpriseSecurityConfig>Enterprise security flags, compiled from [security.enterprise].
error_sanitization: Option<ErrorSanitizationConfig>Error sanitization, compiled from [security.error_sanitization].
rate_limiting: Option<RateLimitingSecurityConfig>Rate limiting, compiled from [security.rate_limiting].
state_encryption: Option<StateEncryptionConfig>OAuth state / PKCE blob encryption, compiled from
[security.state_encryption].
pkce: Option<PkceSecurityConfig>PKCE for OAuth Authorization Code flows, compiled from [security.pkce].
api_keys: Option<ApiKeySecurityConfig>API key authentication, compiled from [security.api_keys].
token_revocation: Option<TokenRevocationSecurityConfig>Token revocation, compiled from [security.token_revocation].
trusted_documents: Option<TrustedDocumentsConfig>Trusted documents / persisted-query allowlist, compiled from
[security.trusted_documents].
persisted_queries_only: boolForce persisted-operations-only enforcement (#379).
When true, the runtime forces the trusted-document store into strict
mode regardless of trusted_documents.mode. Requires a configured
trusted-documents manifest to have any effect.
service_accounts: Option<HashMap<String, ServiceAccountConfig>>Machine service accounts, keyed by account name (security.service_accounts).
Implementations§
Source§impl SecurityConfig
impl SecurityConfig
Sourcepub fn add_role(&mut self, role: RoleDefinition)
pub fn add_role(&mut self, role: RoleDefinition)
Add a role definition.
Sourcepub fn find_role(&self, name: &str) -> Option<&RoleDefinition>
pub fn find_role(&self, name: &str) -> Option<&RoleDefinition>
Find a role definition by name.
Sourcepub fn get_role_scopes(&self, role_name: &str) -> Vec<String>
pub fn get_role_scopes(&self, role_name: &str) -> Vec<String>
Get all scopes granted to a role.
Sourcepub fn role_has_scope(&self, role_name: &str, scope: &str) -> bool
pub fn role_has_scope(&self, role_name: &str, scope: &str) -> bool
Check if a role has a specific scope.
Trait Implementations§
Source§impl Clone for SecurityConfig
impl Clone for SecurityConfig
Source§impl Debug for SecurityConfig
impl Debug for SecurityConfig
Source§impl Default for SecurityConfig
impl Default for SecurityConfig
Source§impl<'de> Deserialize<'de> for SecurityConfig
impl<'de> Deserialize<'de> for SecurityConfig
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 SecurityConfig
Source§impl PartialEq for SecurityConfig
impl PartialEq for SecurityConfig
Source§impl Serialize for SecurityConfig
impl Serialize for SecurityConfig
impl StructuralPartialEq for SecurityConfig
Auto Trait Implementations§
impl Freeze for SecurityConfig
impl RefUnwindSafe for SecurityConfig
impl Send for SecurityConfig
impl Sync for SecurityConfig
impl Unpin for SecurityConfig
impl UnsafeUnpin for SecurityConfig
impl UnwindSafe for SecurityConfig
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.