security: Proxy-Vertrauen nur noch lokal, HSTS in Produktion, Tests ohne echte ntfy-Pushes
Live-Prüfung 08.10.2026: nginx beantwortet die Anfragen direkt (kein CDN, kein vorgeschalteter Proxy), die App vertraute aber jedem Proxy (trustProxies at '*'). Jeder Client konnte per X-Forwarded-For seine IP vorgeben und damit IP-Limits bei Login und Passwort-Reset umgehen sowie IP-Protokolle fälschen. Jetzt steuert config/trustedproxy.php das Vertrauen: lokal (Traefik) weiterhin '*', sonst keinem Proxy; ein späteres CDN kommt über TRUSTED_PROXIES dazu. HSTS fehlte auf Live. SecurityHeaders setzt Strict-Transport-Security auf HTTPS-Antworten, standardmäßig nur in Produktion (max-age 1 Jahr, bewusst ohne includeSubDomains/preload). phpunit.xml leert MONITORING_NTFY_*, damit Testläufe keine echten Push-Nachrichten mehr auslösen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f693226d4a
commit
3def447f51
7 changed files with 121 additions and 3 deletions
|
|
@ -10,6 +10,7 @@ use Symfony\Component\HttpFoundation\Response;
|
|||
* Applikationsseitige Security-Header (R6.2) — bewusst unabhängig vom
|
||||
* Reverse-Proxy gesetzt, damit der Schutz auch bei Proxy-Wechsel bleibt.
|
||||
* Bereits vorhandene Header (z. B. vom Proxy) werden nicht überschrieben.
|
||||
* HSTS nur auf HTTPS-Antworten und laut config/security.php.
|
||||
* CSP fehlt absichtlich: Livewire/Alpine/Vite brauchen eine eigene
|
||||
* Inline-Script-Strategie — separat einführen, nicht nebenbei.
|
||||
*/
|
||||
|
|
@ -30,6 +31,10 @@ class SecurityHeaders
|
|||
}
|
||||
}
|
||||
|
||||
if ($request->isSecure() && config('security.hsts.enabled') && ! $response->headers->has('Strict-Transport-Security')) {
|
||||
$response->headers->set('Strict-Transport-Security', 'max-age='.(int) config('security.hsts.max_age'));
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue