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
View File
@@ -40,5 +40,12 @@ COPY --from=admin /admin/dist ./admin-dist
ENV NODE_ENV=production
ENV ADMIN_DIR=/app/admin-dist
# Als non-root laufen (das node-Image bringt den User `node`, uid/gid 1000 mit).
# /app gehört dem Build (root, read-only zur Laufzeit — reicht zum Servieren).
# Das gemountete Repo unter /site muss uid 1000 gehören (siehe Proxmox-Script:
# chown -R 1000:1000), damit Hugo dort public/ bauen und content/ schreiben kann.
USER node
EXPOSE 3000
CMD ["sh", "/app/entrypoint.sh"]