security: Härtung der CMS-API + Deployment

App-Level:
- Security-Header (secureHeaders) global; /images/* mit strikter CSP+sandbox
  → bösartiges SVG kann kein JS im Origin ausführen
- Body-Limit 256 KB auf /api/*; Login-Rate-Limit (10/5min) gegen Brute-Force
- Upload: 8-MB-Limit + Format-Verifikation (sharp-Metadaten, SVG/GIF-Signatur)
- Comment-Längenlimit (10k) gegen DB-Bloat
- DB-Fehler nicht mehr roh ausliefern (serverError-Helper)
- Profil-PUT koalesziert Hugo-Builds (kein Build-Sturm)

Infra:
- Container läuft non-root (USER node, uid 1000) + Proxmox-Repo-chown
- Ports binden per Default auf 127.0.0.1 (BIND_ADDR-Escape-Hatch)
- Kong-CORS auf SITE_URL beschränkt statt "*"
- README: Härtungs- + Migrationshinweise

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-01 22:05:57 +02:00
parent 6d20be036a
commit 2650913050
13 changed files with 222 additions and 22 deletions
+7 -1
View File
@@ -20,7 +20,13 @@ API_EXTERNAL_URL=http://localhost:8000
# unter `authors` steht.
ADMIN_EMAILS=karim@gabrielevarano.ch
# ═══ Optional: Ports ═══
# ═══ Optional: Ports & Binding ═══
# Auf welcher Host-Adresse lauschen die veröffentlichten Ports?
# 127.0.0.1 (Standard) = nur lokal / hinter Reverse-Proxy mit TLS (empfohlen).
# 0.0.0.0 = direkt im LAN erreichbar (ohne Proxy).
# Bei 127.0.0.1 muss SITE_URL/API_EXTERNAL_URL über den Proxy laufen, sonst
# erreicht der Browser :8000/:8080 nicht.
BIND_ADDR=127.0.0.1
APP_PORT=8080 # CMS: Site + /admin + /_preview + /api
KONG_HTTP_PORT=8000 # Supabase-API-Gateway
KONG_HTTPS_PORT=8443