File tree 5 files changed +7
-2
lines changed
tests/fixtures/HtaccessTest
5 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 3
3
#
4
4
5
5
# Protect files and directories from prying eyes.
6
- <FilesMatch "\.(engine|inc|install|make|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$" >
6
+ <FilesMatch "\.(engine|inc|install|make|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock) )$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$" >
7
7
<IfModule mod_authz_core.c >
8
8
Require all denied
9
9
</IfModule >
Original file line number Diff line number Diff line change @@ -86,6 +86,11 @@ protected function getProtectedFiles() {
86
86
foreach ($ file_exts_to_allow as $ file_ext ) {
87
87
$ file_paths ["$ path/access_test. $ file_ext " ] = 200 ;
88
88
}
89
+
90
+ // Ensure composer.json and composer.lock cannot be accessed.
91
+ $ file_paths ["$ path/composer.json " ] = 403 ;
92
+ $ file_paths ["$ path/composer.lock " ] = 403 ;
93
+
89
94
return $ file_paths ;
90
95
}
91
96
Original file line number Diff line number Diff line change 22
22
<rewrite >
23
23
<rules >
24
24
<rule name =" Protect files and directories from prying eyes" stopProcessing =" true" >
25
- <match url =" \.(engine|inc|install|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl|yml|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$" />
25
+ <match url =" \.(engine|inc|install|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl|yml|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format|composer\.(json|lock) )$" />
26
26
<action type =" CustomResponse" statusCode =" 403" subStatusCode =" 0" statusReason =" Forbidden" statusDescription =" Access is forbidden." />
27
27
</rule >
28
28
You can’t perform that action at this time.
0 commit comments