Skip to content

Commit 1d91665

Browse files
committed
Security: Prevent access to web.config on Apache servers (also documented in the installation guide for nginx) - refs BT#22085
1 parent b440012 commit 1d91665

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

.htaccess

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,7 @@ RedirectMatch 403 ^/main/inc/lib/javascript/bigupload/files
124124
<IfModule mod_headers.c>
125125
Header always set X-Content-Type-Options nosniff
126126
</IfModule>
127+
128+
<Files "web.config">
129+
Require all denied
130+
</Files>

documentation/installation_guide.html

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -757,11 +757,22 @@ <h3>Apache RewriteRules</h3>
757757
RewriteRule ^(tests|.git) - [F,L,NC]
758758
&lt;/Directory&gt;
759759

760-
AddType application/font-woff .woff .woff2
761-
&lt;IfModule mod_expires.c&gt;
762-
ExpiresActive On
763-
ExpiresByType application/font-woff "access plus 1 month"
764-
&lt;/IfModule&gt;
760+
AddType application/font-woff .woff .woff2
761+
&lt;IfModule mod_expires.c&gt;
762+
ExpiresActive On
763+
ExpiresByType application/font-woff "access plus 1 month"
764+
&lt;/IfModule&gt;
765+
# Disallow direct access to /main/inc/lib/javascript/bigupload/files
766+
RedirectMatch 403 ^/main/inc/lib/javascript/bigupload/files
767+
768+
# Disallow MIME sniffing to prevent XSS from unknown/incorrect file extensions
769+
<IfModule mod_headers.c>
770+
Header always set X-Content-Type-Options nosniff
771+
</IfModule>
772+
773+
<Files "web.config">
774+
Require all denied
775+
</Files>
765776
</pre>
766777

767778
<h4>Special note on sharing questions between courses</h4>
@@ -856,6 +867,10 @@ <h3>Nginx</h3>
856867
}
857868
location ^~ /tests/ {
858869
deny all;
870+
}
871+
location ~* /web.config$ {
872+
deny all;
873+
return 403;
859874
}
860875
</pre>
861876

0 commit comments

Comments
 (0)