tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Content-Security-Policy for man.cgi
@ 2019-11-10  8:59 Anthony J. Bentley
  2019-11-10 10:22 ` Ingo Schwarze
  0 siblings, 1 reply; 6+ messages in thread
From: Anthony J. Bentley @ 2019-11-10  8:59 UTC (permalink / raw)
  To: tech; +Cc: schwarze

Hi,

Modern browsers respect the Content-Security-Policy header, which
restricts where dynamic resources like CSS and JavaScript can be
specified in an HTML document.

Since man.openbsd.org hosts manuals from many sources, and there's
always danger of a bug in mandoc that allows dangerous HTML content
through, a policy of "default-src 'none'; style-src 'self'" would be
appropriate: this allows external stylesheets loaded from a URL on
the same domain, but prohibits external links and inline CSS; scripts
are not allowed at all. (mandoc(1) no longer generates inline styles
at all, right?)

Index: cgi.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/cgi.c,v
retrieving revision 1.106
diff -u -p -r1.106 cgi.c
--- cgi.c	1 Oct 2019 17:54:04 -0000	1.106
+++ cgi.c	10 Nov 2019 08:48:46 -0000
@@ -336,6 +336,7 @@ resp_begin_http(int code, const char *ms
 
 	printf("Content-Type: text/html; charset=utf-8\r\n"
 	     "Cache-Control: no-cache\r\n"
+	     "Content-Security-Policy: default-src 'none'; style-src 'self';\r\n"
 	     "Pragma: no-cache\r\n"
 	     "\r\n");
 
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-11-10 20:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-10  8:59 Content-Security-Policy for man.cgi Anthony J. Bentley
2019-11-10 10:22 ` Ingo Schwarze
2019-11-10 13:02   ` Anthony J. Bentley
2019-11-10 17:47     ` Ingo Schwarze
2019-11-10 20:09       ` Anthony J. Bentley
2019-11-10 20:57         ` Ingo Schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).