F-15/F-16/F-17 Security-Header & Logout
- F-15 CSRF-Logout: /logout nur noch via POST mit CSRF-Token; Sidebar-Link ist jetzt ein POST-Formular. Schuetzt vor Cross-Site-Logout (SameSite=Lax greift bei Top-Level-GET nicht). - F-16 SRI: Subresource-Integrity-Hashes (sha384) + crossorigin fuer alle CDN-Ressourcen (Bootstrap CSS/JS, Bootstrap-Icons). - F-17: Permissions-Policy-Header (deaktiviert ungenutzte Browser-Features). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+5
-1
@@ -56,6 +56,10 @@ def _security_headers(resp):
|
||||
resp.headers['X-Frame-Options'] = 'DENY'
|
||||
resp.headers['X-Content-Type-Options'] = 'nosniff'
|
||||
resp.headers['Referrer-Policy'] = 'no-referrer'
|
||||
resp.headers['Permissions-Policy'] = (
|
||||
'geolocation=(), camera=(), microphone=(), payment=(), usb=(), '
|
||||
'accelerometer=(), gyroscope=(), magnetometer=()'
|
||||
)
|
||||
resp.headers.setdefault('Content-Security-Policy', CSP)
|
||||
# HTML-Seiten (Formulare/Session-Daten) nicht cachen lassen.
|
||||
if resp.mimetype == 'text/html':
|
||||
@@ -262,7 +266,7 @@ def login():
|
||||
return render_template('login.html')
|
||||
|
||||
|
||||
@app.route('/logout')
|
||||
@app.route('/logout', methods=['POST'])
|
||||
def logout():
|
||||
session.clear()
|
||||
return redirect(url_for('login'))
|
||||
|
||||
Reference in New Issue
Block a user