Security notes
View Source- Who may do what is
Wraith.Policy(owner, admin, editor, author, contributor), checked inside every door: admin LiveViews, the Admin API (@policyper action, per-post checks,status/author_iddropped for roles that may not set them) and every MCP tool (Wraith.Tools, which refuses calls with no resolved actor). An Admin API key acts as the owner; a signed-in session on the Admin API is read-only (that pipeline has no CSRF token). A Content API key reaches only the public read tools. - The paywall is one function,
Content.readable_markdown/2; the post page, feeds, search index, Content API and MCP all go through it. Locked posts answer with"access": falseand the public preview only. - Secrets at rest (the Kiro key, Stripe secret and webhook secret) are
encrypted with
Wraith.VaultunderWRAITH_VAULT_KEY(notSECRET_KEY_BASE, so cookies can rotate without losing them); only hints are shown or exported. Transcripts shown in the studio are scrubbed of key-shaped strings. - Tokens: sign-in, confirmation and reset links are single-use; a reset link is bound to the password it replaces, and a password change ends every session that predates it.
- Client IP for rate limits:
TRUSTED_PROXIESsays how many proxies sit in front (1 behind an ALB); the client is that many hops from the end ofX-Forwarded-For. With 0 (the default) only the socket address counts. - Rate limits (
Wraith.RateLimit, per IP / visitor / address): 5 logins a minute, 3 magic links and 3 password resets per 15 min, 5 sign-ups an hour, 10 comments a minute, 60 searches and 60 widget events a minute, 300 API/MCP calls a minute and 20 failed key attempts a minute. - Outbound fetches (widget
wraith.fetch, bookmark cards, upload-from-URL) go throughWraith.SafeHTTP: http(s) only, private/loopback/link-local/CGNAT addresses refused on every redirect hop, size and time capped. - Uploads are sniffed by magic bytes, not trusted by extension; SVGs with
scripts, handlers or
javascript:links are refused, and/uploadsis served withnosniffand a sandboxing CSP. - Widgets: Lua runs in a supervised task with a heap cap, a time limit and
capped output; widget HTML goes through an allowlist sanitiser
(
Wraith.Widgets.sanitize/1) and may only sendphx-click="widget"events. - Caching: public pages are cacheable only when nothing is personalised and
no cookie is set (
Vary: Cookie); otherwiseprivate, no-store. - Subscriptions are double opt-in. Stripe webhooks are signature-checked and applied once per event id.
- Sessions expire (60 days authors, 180 members);
Wraith.Janitordeletes expired sessions and used-token markers hourly, and DynamoDB tables get a TTL onttl. - Code injection (Settings) is raw HTML by design — only the owner edits it.
- HTTP/2 is disabled in prod (
http_2_options: [enabled: false]) while bandit 1.12.5's HTTP/2 advisory (EEF-CVE-2026-105659) has no fixed release. /health(readiness) and/health/liveanswer{"status": …}only; details go to the log. Both are exempt from the HTTPS redirect for load balancers.