Hey Guys
I have a website where I have created a content type with a file field where I have set the Upload option to Private files. I have also set the private file path to files/private and set the default download method to "Private local files served by Backdrop".
If I create a new node and upload a File, the path to that file is domain.com/system/files/test.pdf
However if I visit that URL in an incognito browser the file is still accessible.
I have checked that the files/private folder has the .htaccess file neccessary generated by Backdrop, and I have also tried to set the private file path to a folder outside Backdrop root with the same result.
I have checked that anonymous users doesn't have the "view private files" permission as well.
I am on an apache server with PHP Version 8.2 and Backdrop version 1.28.1. I have tried this on two different backdrop sites with the same result.
Is this a bug in the CMS or am I missing something?
Thank you.
Hi fjeder.
I agree this is confusing and can be seen as a bug. This case highlights the complexity of permissions when they overlap. You are dealing with two entities: the file entity itself, and the content type that contains a file reference field.
Perhaps this approach should be revised. For the time being, if you wish to disallow Anonymous from accessing a file through a node's file reference field, you'll need to use the contrib Content Access (or something similar) to disallow Anonymous from seeing the node itself.
More to your point, and in addition, accessing a file through the direct download link (e.g
system/files/FILE_NAME
) bypasses the permission check. Using the file entity URI on the other handfile/[FID]
will apply the permission.This is confusing and has been controversial in the past. There are some issues in the issue queue about file Permissions, and Permissions in general, but these are tricky things to change and not be backward compatible breaking changes. So, for the time being, these are "the rules of the game".