File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,11 @@ server {
52
52
location ~ \.php$ {
53
53
return 404;
54
54
}
55
+
56
+ # Set Content-Security-Policy for svg files, to block embedded javascript in there
57
+ location ~* \.svg$ {
58
+ add_header Content-Security-Policy "default-src 'self'; script-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; frame-ancestors 'none';";
59
+ }
55
60
56
61
error_log /var/log/nginx/parts.error.log;
57
62
access_log /var/log/nginx/parts.access.log;
Original file line number Diff line number Diff line change @@ -118,3 +118,10 @@ DirectoryIndex index.php
118
118
# RedirectTemp cannot be used instead
119
119
</IfModule >
120
120
</IfModule >
121
+
122
+ # Set Content-Security-Policy for svg files (and compressed variants), to block embedded javascript in there
123
+ <IfModule mod_headers.c >
124
+ <FilesMatch "\.(svg|svg\.gz|svg\.br)$" >
125
+ Header set Content-Security-Policy "default-src 'self'; script-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; frame-ancestors 'none';"
126
+ </FilesMatch >
127
+ </IfModule >
You can’t perform that action at this time.
0 commit comments