Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
other
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Aug 2016 at 20:46 UTC
Updated:
21 Sep 2022 at 21:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
iryston commentedComment #3
iryston commentedComment #4
amar.deokar commentedUpdated patch for drupal-7.59 .
Comment #5
cilefen commentedComment #7
poker10 commentedAs mentioned in the parent D8 issue, there were new tests introduced which needed to be added also to D7.
The patch #4 looks good and does exactly the same fix to FilesMatch as #2508666: Drupal 8 .htaccess rule to prevent php file access can be easily bypassed. I have added the tests from the mentioned issue, so we should have this coverage in D7. The patch itself is unchanged (other changes in D8 issue are not currently in D7, see: #1587270: Forbid execution of PHP files in subfolders by default (except those needed by core)).
Let's check the testbot.
Comment #10
poker10 commentedHm, it seems like there is a problem with the patch or with the testbot with the new created files (probably returning 404 instead of 403). It applies locally and test passes locally. I have to look into it more closely.
Comment #11
poker10 commentedLet's try this with
'external' => TRUE(still passes locally).Comment #13
mcdruid commentedIf we were starting from scratch I might ask whether we need to actually add all of the test files. Could we either generate them on-the-fly or just verify that we get a 403 when apache blocks the requests rather than a 404 when the file is not there?
However, this is how it was done in D8 ... and it's not wrong.
The backport looks good, the additional tests are great - without them it's nasty editing the long condition in the FilesMatch.
Thanks!
Comment #15
poker10 commentedThanks all!
Comment #16
solideogloria commentedThe tests added for this issue include "system/test/fixtures/HtaccessTest/access_test.module" and similarly-named files, such as an info file.
After updating to Drupal 7.92, upon navigating to /admin/modules, I see an errored (unavailable) "access_test" module in the list that says "This version is not compatible with Drupal 7.x and should be replaced."
Comment #17
poker10 commentedThanks for reporting this @solideogloria! It seems like that the packaging script added some metadata to the originally empty .info file, which caused that the module is now displayed. This problem is not present in the 7.x-dev, as there are no metadata added.
I have created a follow-up issue here: #3308466: [D7] HtaccessTest - access_test module displayed in the modules list, where we can fix that (changing the status of this issue back to Fixed).