pub mod acl;
pub mod assignment;
pub mod assignment_seed;
pub mod auth;
pub mod cli_acl;
pub mod cli_identity;
pub mod cli_metrics;
pub mod cli_tsp;
pub mod config;
pub mod didcomm_profile;
pub mod didcomm_unpack;
pub mod domain;
pub mod domain_purge;
pub mod error;
pub mod health;
pub mod identity;
pub mod identity_drain;
pub mod identity_rotate;
pub mod init;
#[cfg(feature = "metrics")]
pub mod metrics;
pub mod migrations;
pub mod mnemonic;
pub mod operator_messages;
#[cfg(feature = "passkey")]
pub mod passkey;
pub mod path_locks;
pub mod pending_purge;
pub mod problem_report;
pub mod rate_limit;
pub mod replay;
pub mod secret_store;
#[cfg(feature = "setup-wizard")]
pub mod setup_prompts;
pub mod setup_recipe;
pub mod stats_collector;
pub mod store;
#[cfg(feature = "server-core")]
pub mod trust_tasks;
#[cfg(feature = "server-core")]
pub mod tsp_binding;
#[cfg(feature = "server-core")]
pub mod tsp_relationship;
#[cfg(feature = "server-core")]
pub mod tsp_relationship_store;
pub mod vta_setup;
pub async fn security_headers(
req: axum::extract::Request,
next: axum::middleware::Next,
) -> axum::response::Response {
let mut resp = next.run(req).await;
let headers = resp.headers_mut();
headers.insert(
axum::http::header::X_CONTENT_TYPE_OPTIONS,
axum::http::HeaderValue::from_static("nosniff"),
);
headers.insert(
axum::http::header::X_FRAME_OPTIONS,
axum::http::HeaderValue::from_static("DENY"),
);
headers.insert(
axum::http::header::CONTENT_SECURITY_POLICY,
axum::http::HeaderValue::from_static(
"default-src 'self'; \
style-src 'self' 'unsafe-inline'; \
img-src 'self' data:; \
connect-src 'self'; \
frame-ancestors 'none'; \
base-uri 'self'; \
form-action 'self'",
),
);
headers.insert(
axum::http::header::REFERRER_POLICY,
axum::http::HeaderValue::from_static("no-referrer"),
);
headers.insert(
axum::http::header::STRICT_TRANSPORT_SECURITY,
axum::http::HeaderValue::from_static("max-age=31536000"),
);
if !headers.contains_key(axum::http::header::CACHE_CONTROL) {
headers.insert(
axum::http::header::CACHE_CONTROL,
axum::http::HeaderValue::from_static("no-store"),
);
}
resp
}
pub fn public_resolution_cors() -> tower_http::cors::CorsLayer {
use axum::http::Method;
tower_http::cors::CorsLayer::new()
.allow_origin(tower_http::cors::Any)
.allow_methods([Method::GET, Method::HEAD, Method::OPTIONS])
.allow_headers(tower_http::cors::Any)
}