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
+20
View File
@@ -15,6 +15,16 @@ services:
- /auth/v1/
plugins:
- name: cors
config:
# Nur die eigene Browser-Origin erlauben (nicht „*"). __CORS_ORIGIN__
# wird beim Provisionieren auf SITE_URL gesetzt (siehe Proxmox-Script);
# bei Domain/HTTPS-Wechsel hier bzw. in .env mitziehen.
origins:
- __CORS_ORIGIN__
methods: [GET, POST, PUT, PATCH, DELETE, OPTIONS]
headers: [Accept, Authorization, Content-Type, apikey, x-client-info, x-supabase-api-version]
credentials: false
max_age: 3600
- name: rest-v1
url: http://rest:3000/
@@ -25,3 +35,13 @@ services:
- /rest/v1/
plugins:
- name: cors
config:
# Nur die eigene Browser-Origin erlauben (nicht „*"). __CORS_ORIGIN__
# wird beim Provisionieren auf SITE_URL gesetzt (siehe Proxmox-Script);
# bei Domain/HTTPS-Wechsel hier bzw. in .env mitziehen.
origins:
- __CORS_ORIGIN__
methods: [GET, POST, PUT, PATCH, DELETE, OPTIONS]
headers: [Accept, Authorization, Content-Type, apikey, x-client-info, x-supabase-api-version]
credentials: false
max_age: 3600