fix: fail closed on an unwritable audit log, bound the rate limiter and harden startup

The audit logger is opened at startup (exit 2 on failure) and obtained before
every call, which is refused with audit_unavailable otherwise. Audit records only
take validated path and sudo values and use the request id as correlation id. The
rate limiter evicts idle keys, caps tracked keys, audits the first excess per key
and window and uses the settings passed to the app. FORWARDED_ALLOW_IPS is now a
setting, and startup warns about a missing host allow-list and unavailable OAuth.
This commit is contained in:
Latte committed 2026-10-14 16:24:51 +02:00
1 parent a3222d5ebe
commit cf3d2e17d3
16 files changed
+532 -115

No files matched your search

+5
View File
@@ -21,6 +21,11 @@ MCP_BEARER_TOKEN=
PUBLIC_BASE_URL=
# Extra Host header values accepted behind a reverse proxy (comma separated).
ALLOWED_HOSTS=
# Proxy addresses whose X-Forwarded-For is trusted (comma separated IPs or
# networks). The default only trusts a proxy on this host. Behind a Docker proxy
# on another address list that address; use * only if the port is reachable
# solely from the proxy.
FORWARDED_ALLOW_IPS=127.0.0.1
# --- Per-user OAuth (HTTP only) -----------------------------------------------
OAUTH_ENABLED=false