commit 292b2fd
default
·
2025-02-13 18:44:21 +0000 UTC
parent e237a35
Force the Content-Security-Policy header, instead of just suggesting it in the docs.
2 files changed,
+4,
-3
M
httpd.c
+1,
-3
1@@ -198,9 +198,7 @@ By setting this to true, no inbox collection is done. Inbox collection helps
2 being discovered from remote instances, but also increases network traffic.
3 .It Ic http_headers
4 If you need to add more HTTP response headers for whatever reason, you can
5-fill this object with the required header/value pairs. For example, for enhanced
6-XSS security, you can set the "Content-Security-Policy" header to "script-src ;"
7-to be totally sure that no JavaScript is executed.
8+fill this object with the required header/value pairs.
9 .It Ic show_instance_timeline
10 If this is set to true, the instance base URL will show a timeline with the latest
11 user posts instead of the default greeting static page. If other information
M
httpd.c
+3,
-0
1@@ -553,6 +553,9 @@ void httpd_connection(FILE *f)
2 headers = xs_dict_append(headers, "access-control-allow-origin", "*");
3 headers = xs_dict_append(headers, "access-control-allow-headers", "*");
4
5+ /* disable any form of fucking JavaScript */
6+ headers = xs_dict_append(headers, "Content-Security-Policy", "script-src ;");
7+
8 if (p_state->use_fcgi)
9 xs_fcgi_response(f, status, headers, body, b_size, fcgi_id);
10 else