Hi there,
After updating from FE 2.2 to 2.3 I noticed that the default upload scheme is ignored when 'skip scheme selection' is selected in the module configuration.
This means that when the default scheme is set to private:// files get uploaded to the public file directory without notifying the user in any way. This seems like a pretty serious security issue to me!
*I think this issue may have to do with https://www.drupal.org/node/2264145 that was committed to FE 2.3, but I am not sure.
Steps to reproduce:
1. make sure you have set the default upload scheme to private:// at 'admin/config/media/file-system'.
2. upload a file at 'file/add'
3. check the file destination at 'file/xxx/edit' , the destination is now set to 'Public files' while it should be set to 'Private files'.
I added screenshots that should clarify the steps to reproduce above.
It should be noted that the behaviour described above does not occur when 'skip scheme selection' is not selected at the module configuration page. When acceptable this could serve as a workaround for the problem, but in cases where this is simply not acceptable from a UI perspective this remains a problem to be solved.
Especially the silent nature of this behaviour creates a security threat in my view. Users expect files to be uploaded to the private destination while files are uploaded to the public destination without any notification...
Cheers,
Marco
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | file_entity-scheme-selection-2905317-5.patch | 430 bytes | cboyden |
| Screen Shot 2017-07-10 at 17.32.42.png | 71.89 KB | frontmobe | |
| Screen Shot 2017-07-10 at 16.57.38.png | 98.95 KB | frontmobe | |
| Screen Shot 2017-07-10 at 16.55.40.png | 152.16 KB | frontmobe |
Comments
Comment #2
joseph.olstadComment #3
cboyden commentedLooks like this was caused by http://cgit.drupalcode.org/file_entity/commit/?id=fe30d62d6e64749cccb291..., which was a fix for #1901566: Resolve the 'allowed file types' field widget setting with the file_entity forms.
Comment #4
cboyden commentedSee comment 18 in that issue - that's where code was added to set the form data to have uri_scheme = "public," to avoid PHP notices in cases various settings options weren't available. But obviously this means that in any case where the choose-destination step is skipped, file uploads will be public. It might work to instead grab the default scheme and use that. Or, if the approach of initializing the form options array is problematic in other ways too, it would require more checks in the code.
Comment #5
cboyden commentedThe attached patch fixes the immediate problem. But, it's possible that the other generic form options being set will cause other problems. Perhaps the approach needs to be different.
Which other options in this array could cause problems? Does the code overwrite options that have already been set in the $options array?
Comment #8
joseph.olstadCommitted cboyden patch as it looks good. If necessary, please open a new issue for related work, linking this to the new issue.