After upgrading the Web File Manager module from 6.x-2.16-rc1 to 6.x-2.16 I discovered a critical problem: I have attached some files to a node on which a certain role has view access. The same role has the permission "view webfm attachments" allowed. They can view the attachments, but not actually download them! They receive an Access denied error!

I reverted back to 6.x-2.16-rc1 and the problem is gone, so the problem was definitely introduced in the final 2.16 version.

Comments

cabralje’s picture

I am having the same "Access denied" issue with WebFM 6.x-2.16 with 2 different Drupal sites. Reverting to 6.x-2.15 solved it.

roball’s picture

I would suggest to revert to 6.x-2.16-rc1 (instead of 2.15) since it contains a critical bugfix for PHP 5.3. I have used that version for months without any problem.

Are you observing these errors on sites using I18N (i.e. with enabled Locale module)?

stephaneheller’s picture

I had the same problem "Access denied" . Reverting to 6.x-2.16-rc1 solved it.
It seems it has to do with
"File Information Extensions" desactivated
that appears in admin/reports/status when WebFM 6.x-2.16 final is installed.

opanga’s picture

Reverting to 6.x-2.16-rc1 also solved the issue for our site. We're not running the Locale module, so cannot comment on that.

nhck’s picture

Status: Active » Postponed (maintainer needs more info)

Hej,
as far as I understand the use case is like this?
You have a certain role that user B belongs to. B is allowed to access the content and allowed to "view webfm attachments".
You now access a node that has been created by a user A that is allowed to attach files (23.png) to certain content that B is allowed to read, eg. at http://example.com/node/42

Now B reads node/42 sees the attachment 23.png, but once B clicks access is denied.

I would say: This is the default behavior - you should check the file permissions of 23.png by right clicking and choosing File permissions. You also have to make sure that the file is actually in a folder B can access.

roball’s picture

Status: Postponed (maintainer needs more info) » Active

The use case is exactly as you have described.

However, WebFM always (until 6.x-2.16-rc1) behaved in the way that once a user can see a file attached to a node, then this user also can download it. The attachment has been treated just as part of the node, having the permissions inherited by the node permission - no matter what permissions the file itself has.

This behaviour has been explained for example here: #783052: Protected files can be publicly downloaded when "view webfm attachments" is granted:
"WebFM attachments are designed to be a replacement for the normal file attachments. As such, it is designed to follow the same rules that normal node/comment attachments do. "

higherform’s picture

Downgrade to 6.x-2.16-rc1 solved the access denied issue for us as well.

Changing the functioning of the module in such a drastic way is a serious bug. Please return the module to its original logic of "user can access node = user can access files attached to node".

Thanks.

nhck’s picture

Status: Active » Needs review

Sorry about that,
I've pushed a change to the master - it should be in the dev version in a second.

dan3h’s picture

We just had the same problem. "Upgraded" to the latest (2.16) version yesterday, because the update notifier told us updates were available. Our client emailed us in a panic later the same day asking why suddenly she couldn't open the files in webfm. We assumed that using the production, non-dev version of the module would provide some assurance that there are no show-stopper bugs in it. But not the case. We had to downgrade to the 2.16rc1 version, as suggested in this thread, which did fix the problem.

Would be awesome to get a 2.17 version of this module posted, incorporating @nhck's bug fix from comment #8. Thanks!

nhck’s picture

Well did anyone actually test my patch?

dan3h’s picture

Must admit we didn't. :-/ It's a production site without a parallel test version -- wanted something that was known to work right away.

nhck’s picture

Status: Needs review » Fixed

Issue #1361200 by roball: Fixed Roles with permission 'view webfm attachments" can view attached files, but no longer actually download them.

nhck’s picture

Version: 6.x-2.16 » 6.x-2.17
roball’s picture

I can confirm the problem has actually been fixed with 6.x-2.18. Thanks!

dan3h’s picture

Wow, that was fast. You guys are amazing! Thanks a lot!

nhck’s picture

Status: Fixed » Closed (fixed)
webservant316’s picture

Status: Closed (fixed) » Active

reopening. upgraded to 2.18 and now I cannot view any webfm file in any location with any user, even user 1.

I thought the problem was #3 above also and just spent half a day getting 'fileinfo' loaded on my server and another half a day trying to figure out why the 'mime_content_type' function wasn't available after loading 'fileinfo'. I think I figured out that 'mime_content_type' is not a function defined by 'fileinfo' extension but instead an alternative to the functions in 'fileinfo' so that webfm 1st prefers to use 'fileinfo', 2nd prefers to use 'mime_content_type', and third will default to a reasonable effort to confirm the file type. Is this correct? That is all to say I don't think webfm will cease to function if the warning described in #3 is active. Is that correct?

However, I do think the warning code should be changed as proposed here - http://drupal.org/node/1491350#comment-5768068, line 168 of webfm.module should be revised to be

- if (!extension_loaded('fileinfo') OR !function_exists('mime_content_type')) {
+ if (!extension_loaded('fileinfo') AND !function_exists('mime_content_type')) {

NOW back to my critical issue, I have upgraded to webfm 2.18 and now suddenly I cannot view any webfm files. I need to find a solution ASAP or revert. Can I drop back to 6.x-2.16-rc1? Or have database changes stopped a backward path. I was at version 2.14 when I upgraded to 2.18.

webservant316’s picture

Couldn't figure out why files couldn't be viewed. Had to regress to previous installed version 2.15 (listed as 2.14 in webfm.info). If an answer can be found I would love to upgrade to the current release.

nhck’s picture

Status: Active » Closed (fixed)

webservant316, thank you for helping and reporting this. However your bug report is quite short. You should elaborate more. Also I would like to ask you to open a new bugreport if the problem persits because it does not seem related at all.

Thank you very much.

webservant316’s picture

will do, though it seems related to me. I cannot view webfm files with 2.18. the people above also said they could not view webfm files when upgrading past 2.15. see #1 above. I see you posted a fix that solved the problem for some. perhaps the fix was not comprehensive.

though point well taken I will elaborate more as soon as I get back into this. unfortunately there was not much to say. I upgraded from 2.15 to 2.18. the upgrade reported success. there were no php errors or drupal errors logged. I simply could not view any webfm files as any user... period. Instead I was redirected to my no access / file not found page. I now remember that in the past I attempted an upgrade from 2.15 to 2.16 or 2.17 (I forget which) and had the same problem and just regressed at that time also.

there is a definite problem here, just trying to figure out how to get enough information to expose the reason for the problem.

webservant316’s picture

sorry I see this post is specifically about downloading files and not viewing them. sigh...
anyway thanks for the module and hope my problem can be fixed eventually.

nhck’s picture

Look webservant, please open a new bug report and describe detailed (as if I was blind) what you do what happens and what you expect to happen. Every step. Provide detail about the software you use and so on. I can try to fix the bug, but I need to kind of duplicate your setup.

webservant316’s picture

ok - new ticket opened, thanks.