Skip to main content

BootstrapConfigRaw

Struct BootstrapConfigRaw 

Source
pub struct BootstrapConfigRaw {
Show 52 fields pub application_name: String, pub policy_store_uri: Option<String>, pub log_type: LoggerType, pub log_level: LogLevel, pub log_ttl: Option<u64>, pub log_max_items: Option<usize>, pub log_max_item_size: Option<usize>, pub stdout_mode: StdOutMode, pub stdout_timeout_millis: u64, pub stdout_buffer_limit: usize, pub decision_log_default_jwt_id: String, pub local_jwks: Option<String>, pub local_policy_store: Option<String>, pub policy_store_local_fn: Option<String>, pub max_default_entities: Option<usize>, pub max_base64_size: Option<usize>, pub jwt_sig_validation: FeatureToggle, pub jwt_status_validation: FeatureToggle, pub strict_schema_validation: FeatureToggle, pub jwt_signature_algorithms_supported: HashSet<Algorithm>, pub lock: FeatureToggle, pub lock_server_configuration_uri: Option<String>, pub dynamic_configuration: FeatureToggle, pub lock_ssa_jwt: Option<String>, pub lock_access_token_jwt: Option<String>, pub audit_log_interval: u64, pub audit_health_interval: u64, pub audit_telemetry_interval: u64, pub listen_sse: FeatureToggle, pub accept_invalid_certs: FeatureToggle, pub lock_transport: LockTransport, pub lock_log_channel_capacity: usize, pub lock_log_max_retries: u32, pub token_cache_max_ttl: usize, pub token_cache_capacity: usize, pub token_cache_earliest_expiration_eviction: bool, pub data_store_max_entries: Option<usize>, pub data_store_max_entry_size: Option<usize>, pub data_store_default_ttl: Option<u64>, pub data_store_max_ttl: Option<u64>, pub data_store_enable_metrics: Option<bool>, pub data_store_memory_alert_threshold: Option<f64>, pub trusted_issuer_loader_type: TrustedIssuerLoaderTypeRaw, pub trusted_issuer_loader_workers: WorkersCount, pub http_client_request_timeout: u64, pub http_client_request_max_retries: u32, pub http_client_request_retry_delay: u64, pub http_client_max_response_size_bytes: u64, pub jwks_refresh_interval: Option<u64>, pub jwks_refresh_min_interval: u64, pub status_list_refresh_interval_max: u64, pub policy_store_refresh_interval_secs: u64,
}
Expand description

Struct that represent mapping mapping Bootstrap properties to be JSON and YAML compatible from link

This structure is used to deserialize values from ENV VARS so json keys is same as keys in environment variables

Fields§

§application_name: String

Human friendly identifier for the application

§policy_store_uri: Option<String>

Location of policy store JSON, used if policy store is not local, or retreived from Lock Master.

§log_type: LoggerType

How the Logs will be presented.

§log_level: LogLevel

Log level filter for logging. TRACE is lowest. FATAL is highest.

§log_ttl: Option<u64>

If log_type is set to [LogType::Memory], this is the TTL (time to live) of log entities in seconds.

§log_max_items: Option<usize>

Maximum number of log entities that can be stored using [LogType::Memory]. If value is 0, there is no limit. But if None, default value is applied.

§log_max_item_size: Option<usize>

Maximum size of a single log entity in bytes using [LogType::Memory]. If value is 0, there is no limit. But if None, default value is applied.

§stdout_mode: StdOutMode

Logging mode for stdout logger: “async” or “immediate (default)”. Only applicable for native targets (not WASM).

§stdout_timeout_millis: u64

Flush timeout in milliseconds for async stdout logging. Only applicable for native targets (not WASM).

§stdout_buffer_limit: usize

Buffer size limit in bytes for async stdout logging. Only applicable for native targets (not WASM).

§decision_log_default_jwt_id: String

Token claims that will be used for decision logging. Default is jti, but perhaps some other claim is needed.

§local_jwks: Option<String>

Path to a local file pointing containing a JWKS.

§local_policy_store: Option<String>

JSON object with policy store

§policy_store_local_fn: Option<String>

Path to a Policy Store JSON file

§max_default_entities: Option<usize>

Maximum number of default entities allowed in a policy store. This prevents DoS attacks by limiting the number of entities that can be loaded. If value is 0, there is no limit. But if None, default value is applied.

§max_base64_size: Option<usize>

Maximum size of base64-encoded default entity strings in bytes. This prevents memory exhaustion attacks from extremely large base64 strings. If value is 0, there is no limit. But if None, default value is applied.

§jwt_sig_validation: FeatureToggle

Whether to check the signature of all JWT tokens.

When enabled, this requires the iss (Issuer) claim to be present in all tokens and the issuer URL must use the https scheme.

§jwt_status_validation: FeatureToggle

Whether to check the status of the JWT. On startup.

Cedarling will fetch and retreive the latest Status List JWT from the .well-known/openid-configuration via the status_list_endpoint claim and cache it. See the IETF Draft for more info.

§strict_schema_validation: FeatureToggle

When enabled, Cedar schema is required and all policies and entities are validated against it. When disabled, Cedarling runs without schema-based validation, allowing quick-start and prototyping without a schema.

§jwt_signature_algorithms_supported: HashSet<Algorithm>

Cedarling will only accept tokens signed with these algorithms.

§lock: FeatureToggle

If Enabled, the Cedarling will connect to the Lock Master for policies, and subscribe for SSE events.

§lock_server_configuration_uri: Option<String>

URI where Cedarling can get JSON file with all required metadata about Lock Master, i.e. .well-known/lock-master-configuration.

Required if LOCK == enabled.

§dynamic_configuration: FeatureToggle

Controls whether Cedarling should listen for SSE config updates.

§lock_ssa_jwt: Option<String>

SSA for DCR in a Lock Master deployment. The Cedarling will validate this SSA JWT prior to DCR.

§lock_access_token_jwt: Option<String>

Pre-issued access token to use for Lock Server authentication, bypassing the SSA → DCR → access_token flow entirely.

When this property is set, Cedarling will skip Dynamic Client Registration and use this access token directly to authenticate with Lock Server endpoints (log, health, telemetry). Primarily intended for testing and local development to simplify the bootstrap flow; may also be used in environments where the DCR flow is not available or access tokens are provisioned externally.

If both CEDARLING_LOCK_ACCESS_TOKEN_JWT and CEDARLING_LOCK_SSA_JWT are set, CEDARLING_LOCK_ACCESS_TOKEN_JWT takes precedence and the SSA flow is skipped.

Not available on WASM targets.

§audit_log_interval: u64

How often to send log messages to Lock Master (0 to turn off trasmission).

§audit_health_interval: u64

How often to send health messages to Lock Master (0 to turn off transmission).

§audit_telemetry_interval: u64

How often to send telemetry messages to Lock Master (0 to turn off transmission).

§listen_sse: FeatureToggle

Controls whether Cedarling should listen for updates from the Lock Server.

§accept_invalid_certs: FeatureToggle

Allow interaction with a Lock server with invalid certificates. Used for testing.

§lock_transport: LockTransport

Transport protocol for Lock Server communication (“grpc” or “rest”).

§lock_log_channel_capacity: usize

Channel capacity for buffering log entries before they are sent to the lock server. Higher values allow more logs to be buffered in memory when the lock server is slow, but also increase memory usage. Default value is 100.

§lock_log_max_retries: u32

Maximum number of retry attempts for sending logs to the lock server. Uses exponential backoff strategy for retrying. Default value is 5.

§token_cache_max_ttl: usize

Maximum token cache TTL in seconds.

Caps how long a validated token may stay in the cache. The effective TTL for an entry is min(time-until-exp, max_ttl) when both apply.

  • > 0: cap each entry’s TTL at this value. Also used as the TTL for tokens that do not carry an exp claim.
  • 0: disables the token cache entirely.

Default: 5 seconds — small enough to pick up revocation / status-list changes quickly, large enough to amortise repeated requests for the same token.

§token_cache_capacity: usize

Maximum number of tokens the cache can store. Default value is 100. 0 means no limit.

§token_cache_earliest_expiration_eviction: bool

Enables eviction policy based on the earliest expiration time.

When the cache reaches its capacity, the entry with the nearest expiration timestamp will be removed to make room for a new one.

§data_store_max_entries: Option<usize>

Maximum number of data entries in the data store (0 = unlimited). Default: 10,000

§data_store_max_entry_size: Option<usize>

Maximum size per data entry in bytes (0 = unlimited). Default: 1MB (1,048,576 bytes)

§data_store_default_ttl: Option<u64>

Default TTL for data entries in seconds. If not set, entries do not expire.

§data_store_max_ttl: Option<u64>

Maximum allowed TTL for data entries in seconds. Default: 3600 (1 hour). Entries with TTL exceeding this value will be rejected. Note: 0 means a zero-second max TTL (immediate expiry), not unlimited. Omitting this property uses the default (1 hour).

§data_store_enable_metrics: Option<bool>

Enable metrics tracking (access counts, timestamps) for data entries. Default: true

§data_store_memory_alert_threshold: Option<f64>

Memory usage alert threshold as a percentage (0.0-100.0). When capacity usage exceeds this threshold, a warning is logged. Default: 80.0 (80%)

§trusted_issuer_loader_type: TrustedIssuerLoaderTypeRaw

Type of trusted issuer loader. If not set, synchronous loader is used. Can be SYNC or ASYNC.

Sync loader means that trusted issuers will be loaded on initialization. Async loader means that trusted issuers will be loaded in background.

§trusted_issuer_loader_workers: WorkersCount

Number of concurrent workers to use when loading trusted issuers. Applies to both SYNC (parallel loading during initialization) and ASYNC (parallel background loading) modes. Minimum possible value is 1. Zero will be used as 1.

For WASM maximum value is 6, default is 2. For native maximum value is 1000, default is 10.

§http_client_request_timeout: u64

Per-request timeout in seconds.

§http_client_request_max_retries: u32

Maximum number of retry attempts per request.

§http_client_request_retry_delay: u64

Base delay between retries in seconds.

§http_client_max_response_size_bytes: u64

Maximum HTTP response body size, in bytes. Rejects oversized responses (JWKS, OIDC config, status list, policy store, Lock Server endpoints) before they’re fully buffered into memory. 0 disables the cap. Default: 10 MB (10485760).

§jwks_refresh_interval: Option<u64>

Optional override for JWKS periodic refresh interval in seconds. When set, overrides the Cache-Control: max-age from the JWKS endpoint. If omitted, the server-driven interval or a 1-hour fallback is used. Values below 5 seconds are clamped to 5.

§jwks_refresh_min_interval: u64

Minimum interval in seconds between on-demand JWKS re-fetches per issuer. Prevents abuse from invalid JWT floods triggering excessive re-fetches. Default: 30 seconds. Values below 5 seconds are clamped to 5.

§status_list_refresh_interval_max: u64

Upper bound on the Status List JWT refresh interval, in seconds.

Caps how long Cedarling waits between Status List refreshes. When the Status List JWT carries a ttl claim, the effective refresh interval is min(jwt_ttl, status_list_refresh_interval_max), so the issuer can request a more frequent refresh but never a less frequent one. When the JWT omits ttl, this value is used directly. A value of 0 or an unset variable is treated as “use the default” (300 seconds) so the status list cannot silently go stale forever. Non-zero values below 5 are clamped to 5.

Fail-closed behavior: if any background refresh fails — fetch error, 5xx response, or the status list body is invalid (JWT validation fails, deserialization fails, or bit-string parsing fails) — the cached status list is dropped and all tokens that reference it are rejected until the next successful refresh. This prevents a revoked token from being accepted based on stale data at the cost of temporarily denying valid tokens when the issuer’s status endpoint is unreachable or returns a malformed payload.

§policy_store_refresh_interval_secs: u64

Base refresh interval, in seconds, for periodic background refresh of remote policy stores (CjarUrl / LockServer). 0 disables refresh and preserves the load-once-at-startup behavior. Non-zero values below the MIN_REFRESH_INTERVAL_SECS floor are clamped at service-init time (with a WARN log emitted) so the worker never busy-polls the upstream — see [PolicyStoreConfig::effective_refresh_interval]. A server Cache-Control: max-age / Expires hint can shorten the next interval but never extends it.

Implementations§

Source§

impl BootstrapConfigRaw

Source

pub fn from_raw_config_and_env( raw: Option<BootstrapConfigRaw>, ) -> Result<Self, BootstrapConfigLoadingError>

Construct BootstrapConfig from environment variables and BootstrapConfigRaw config. Environment variables have bigger priority.

Trait Implementations§

Source§

impl Debug for BootstrapConfigRaw

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BootstrapConfigRaw

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for BootstrapConfigRaw

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for BootstrapConfigRaw

Source§

fn eq(&self, other: &BootstrapConfigRaw) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for BootstrapConfigRaw

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for BootstrapConfigRaw

Source§

impl TryFrom<&BootstrapConfigRaw> for LockServiceConfig

Source§

type Error = BootstrapConfigLoadingError

The type returned in the event of a conversion error.
Source§

fn try_from(raw: &BootstrapConfigRaw) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&BootstrapConfigRaw> for LockServiceConfig

Source§

type Error = BootstrapConfigLoadingError

The type returned in the event of a conversion error.
Source§

fn try_from(raw: &BootstrapConfigRaw) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<BootstrapConfigRaw> for BootstrapConfig

Source§

type Error = BootstrapConfigLoadingError

The type returned in the event of a conversion error.
Source§

fn try_from(raw: BootstrapConfigRaw) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more