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:
@@ -0,0 +1,6 @@
|
||||
// Serverfehler protokollieren, aber dem Client nur eine generische Meldung
|
||||
// geben — keine DB-/Stack-Interna nach außen (Info-Leak vermeiden).
|
||||
export function serverError(c, where, err, status = 500) {
|
||||
console.error(`[${where}]`, err?.message || err);
|
||||
return c.json({ error: 'Serverfehler' }, status);
|
||||
}
|
||||
Reference in New Issue
Block a user