Security Hardening: Removed unused iframe exceptions (Principle of Least Privilege)
Browse files- webpass/__init__.py +4 -6
webpass/__init__.py
CHANGED
|
@@ -105,18 +105,16 @@ def create_app():
|
|
| 105 |
if not session.get('bio_verified'):
|
| 106 |
return redirect(url_for('bio.lock_screen'))
|
| 107 |
|
|
|
|
| 108 |
# 5. SECURITY HEADERS
|
| 109 |
# 5. SECURITY HEADERS
|
| 110 |
@app.after_request
|
| 111 |
def add_security_headers(response):
|
| 112 |
response.headers['Strict-Transport-Security'] = 'max-age=31536000; includeSubDomains'
|
| 113 |
|
| 114 |
-
#
|
| 115 |
-
#
|
| 116 |
-
response.headers['Content-Security-Policy'] = "frame-ancestors 'self' https://
|
| 117 |
-
|
| 118 |
-
# Note: We remove X-Frame-Options because CSP frame-ancestors replaces it
|
| 119 |
-
# and is fully supported by all modern browsers.
|
| 120 |
|
| 121 |
return response
|
| 122 |
|
|
|
|
| 105 |
if not session.get('bio_verified'):
|
| 106 |
return redirect(url_for('bio.lock_screen'))
|
| 107 |
|
| 108 |
+
# 5. SECURITY HEADERS
|
| 109 |
# 5. SECURITY HEADERS
|
| 110 |
# 5. SECURITY HEADERS
|
| 111 |
@app.after_request
|
| 112 |
def add_security_headers(response):
|
| 113 |
response.headers['Strict-Transport-Security'] = 'max-age=31536000; includeSubDomains'
|
| 114 |
|
| 115 |
+
# SLAMMING THE DOOR: Removed your custom domain since the Vercel Proxy doesn't need it.
|
| 116 |
+
# We only allow Hugging Face so your developer portfolio preview still works!
|
| 117 |
+
response.headers['Content-Security-Policy'] = "frame-ancestors 'self' https://huggingface.co;"
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
return response
|
| 120 |
|