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
6eb7c08863
commit
7fa310fa76
7 changed files with 121 additions and 3 deletions
23
config/security.php
Normal file
23
config/security.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTP Strict Transport Security
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Weist Browser an, die Domain für `max_age` Sekunden nur noch per HTTPS
|
||||
| aufzurufen. Wird nur auf HTTPS-Antworten gesetzt und standardmäßig nur
|
||||
| in Produktion. Bewusst ohne includeSubDomains und preload: beides
|
||||
| lässt sich kaum zurücknehmen und betrifft auch fremd betriebene
|
||||
| Subdomains.
|
||||
|
|
||||
*/
|
||||
|
||||
'hsts' => [
|
||||
'enabled' => (bool) env('SECURITY_HSTS', env('APP_ENV') === 'production'),
|
||||
'max_age' => (int) env('SECURITY_HSTS_MAX_AGE', 31536000),
|
||||
],
|
||||
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue