Spaces:
Paused
Paused
Referrer-Policy same-origin: an app's own POSTs keep their Origin
Browse files
app.py
CHANGED
|
@@ -70,7 +70,9 @@ def _harden(response: Response, policies: list[str] = ()) -> Response:
|
|
| 70 |
if kept:
|
| 71 |
response.headers.append("content-security-policy", "; ".join(kept))
|
| 72 |
response.headers.append("content-security-policy", "frame-ancestors " + " ".join(FRAME_ANCESTORS))
|
| 73 |
-
|
|
|
|
|
|
|
| 74 |
return response
|
| 75 |
|
| 76 |
|
|
|
|
| 70 |
if kept:
|
| 71 |
response.headers.append("content-security-policy", "; ".join(kept))
|
| 72 |
response.headers.append("content-security-policy", "frame-ancestors " + " ".join(FRAME_ANCESTORS))
|
| 73 |
+
# The app's own requests keep their Origin (no-referrer made a form POST's Origin "null", which
|
| 74 |
+
# CSRF checks refuse); nothing of the preview's URLs reaches other sites.
|
| 75 |
+
response.headers["referrer-policy"] = "same-origin"
|
| 76 |
return response
|
| 77 |
|
| 78 |
|