Skip to content

Commit 2b69473

Browse files
committed
Added content-security policy for SVG files in webserver config
1 parent 7e34535 commit 2b69473

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

docs/installation/nginx.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ server {
5252
location ~ \.php$ {
5353
return 404;
5454
}
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+
}
5560
5661
error_log /var/log/nginx/parts.error.log;
5762
access_log /var/log/nginx/parts.access.log;

public/.htaccess

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,10 @@ DirectoryIndex index.php
118118
# RedirectTemp cannot be used instead
119119
</IfModule>
120120
</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>

0 commit comments

Comments
 (0)