Explorar o código

Fix #168: disallow frames unless ?embed=1

George S. Baugh %!s(int64=4) %!d(string=hai) anos
pai
achega
f7a0375438
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      www/server.psgi

+ 4 - 0
www/server.psgi

@@ -266,6 +266,10 @@ sub _render ($template, $vars, @headers) {
 
     #Compress
     push( @headers, "Content-Encoding" => "deflate" );
+
+    #Disallow framing UNLESS we are in embed mode
+    push( @headers, "Content-Security-Policy" => qq{frame-ancestors 'none'} ) unless $vars->{embed};
+
     my $dfh;
     IO::Compress::Deflate::deflate( \$body => \$dfh );
     print $IO::Compress::Deflate::DeflateError if $IO::Compress::Deflate::DeflateError;