Presently this module is not compatible with private files. Where the response should be "access denied" with this module active it sends the file with with the mime type text/html. This means that the browswer File > Save page as can be used to download the file, which will then have a .html extension padded to the filename. Simply stripping the html extension from the filename will make it accessible to all visitors. I have given this the critical priority because of the privacy problem.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | private_files_become_accessible-2408531-6.patch | 489 bytes | ñull |
| #4 | private_files_become_accessible-2408531-4.patch | 4.21 KB | ñull |
Comments
Comment #1
ñull commentedThe $headers variable is always the same no matter if the file is accessible or not. The test fails and therefore access is never denied:
Comment #2
ñull commentedAttached the patchComment #3
ñull commentedComment #4
ñull commentedAfter some debugging this patch seems to do the job.
Comment #5
sinasalek commentedThanks, there are lots of unnecessary changes in the patch like removing and adding empty lines
Comment #6
ñull commentedSorry, I was just too lazy to find the setting in Netbeans that was stripping trailing spaces. The source code must have had some empty lines with space(s). So basically my previous patch did some useful clean-up as a bonus, but you can have it without it too, as long as this critical privacy bug is fixed.
Comment #7
ñull commentedAfter 10 months of testing in production environment this patch can be considered reviewed and tested at least by my user community. Please proceed to submit this patch at least in a dev version.
Comment #8
toamit commentedThis patch will also fix an issue with headers that get nested due to recursive array merge used in module_invoke_all.
A similar patch is just about to be committed to core https://www.drupal.org/node/1891228
I suggest rolling this in swiftly.
Here is bit more explanation on this
Core and contributed modules use the module_invoke_all method to consolidate headers, however this function uses recursive array merge which ends up nesting arrays instead of keeping it as simple array. For example in list below the Content-Type is being nested instead of being overwritten causing the Notice and botched header
Notice: Array to string conversion in drupal_send_headers() (line 1236 of drupal-7.41/includes/bootstrap.inc)
"Content-Type" : array( 0 => "image/png", 1 => "image/png"),
"Content-Length" : "1021",
"Cache-Control" : "private,
"Content-Disposition" : "inline; filename='villi.png'"
So after calling module_invoke_all method, a flatten routine must be run to get rid of nesting. This is what most discussions and patches do or avoid doing.
A similar change needs to be made at line 58 in resumable_download.inc
But if you can avoid calling module_invoke_all like the patch suggested by null, this problem does not arise and no further changes are needed
Comment #9
toamit commentedSo this patch will fix another reported issue
https://www.drupal.org/node/2295897
Comment #10
sinasalek commentedNOTICE: I only applied the patches, i have not been able to test it, if someone confirm that everything works properly i can create a new release
https://www.drupal.org/project/resumable_download/releases/7.x-1.x-dev