-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC Move protected folder outside of /public directory by default #423
Comments
As much as I'd generally support this idea, there will be hostings and webserver configurations where only one folder will be writable by the webserver itself, generally the document root itself (and the temp folder), which may prevent the use of two separate folders for storing public and private assets without one being a subfolder of the other. |
@michalkleiner Wouldn't that be better off as an opt-in experience rather than the default. Perhaps leaving the Apache/IIS Adapters as classes within this module is still suitable, but making the "combined public/private" asset store as an opt-in experience. E.g. Ability to configure via ConfigManifest / YML. |
Here's the 2017 version of this conversation :) silverstripe/silverstripe-framework#7710 |
Yes @brettt89, you're right that the default can expect more from the hosting while providing better security, with the option to configure it for limited conditions such as a single writable folder. Basically, I forgot this would be configured per environment. |
I think you can already do this bf defining a I tried it locally a while back and it seemed to work well at first glance. Didn't try it on CWP or SCP however and I'm petty sure horrible things would occur if you did. |
@maxime-rainville Yes you can, but this RFC is for changing the default behavior to have PROTECTED assets stored in a different folder entirely. This helps remove the dependency on Apache for running a Silverstripe Website OOTB. |
“Security by default”
Any reason to keep the dot in there? I'd vote move it to a plain, slightly more descriptive name.
Maybe there's no harm in leaving them there anyway as a fallback protection mechanism, eg in case of misconfiguration of the webroot (like the other way around there's also still a fallback .htaccess outside /public to rewrite requests to /public) |
@micschk dot files (and possibly dot folders) are visibly hidden by some file managers, one more way to obscure things. Without the dot, the chance of a folder name collision with something in the codebase is slightly higher imho. |
Only some file managers / systems actually hide dotfiles. While 'using dotfile annotation' is not part of this raised issue (and possibly should be its own Issue). But IMO, dotfiles should not be used as a method of security / hiding files and folders. "Security through Obscurity is not Secure". Dotfiles / Dotfolders is a UNIX convention that is not a standard. (Same as how Windows performs hidden files, uses its own convention). |
That is saying the same thing. I do agree that obscuring shouldn't be used as the main method to secure stuff, but I'd say it can be considered additional if the primary method is secure on its own. |
Apologies I didn't write that party very clear, was just trying to say that IMO we shouldn't default a setting in the application based on something that is not standardized across the industry (E.g. Hidden files/folders). But this is more just a personal opinion on what assumptions a framework should make. Using / Not using dotfiles doesn't have any functionality impact to this issue. |
The default behavior of
silverstripe-assets
appears to have both Public and Protected assets stored within the /public directory (ASSET_DIR). This promotes bad architecture of web servers in that users are encouraged to expose the parent directory of protected assets (/public) to as the Root directory.Currently the default behavior relies on the web servers ability to perform client-directed configuration through static files to protect access to these assets. This architecture is not great as if these configuration files (E.g. .htaccess) go missing / removed / changed in any way, these files could be exposed publicly.
It also restricts the usage of web servers which do not allow client-directed configurations such as Nginx.
Suggestions
/public/.protected
to its own root directory (E.g./.protected
).htaccess
andIIS
configuration filesdev/check
for ensuring protected folder is not publicly accessible via URL?.This helps encourage better security configurations for web servers by having the root directory for static requests set to /public, which is separated from the protected directory. This helps ensure requests to non-public directories can be directed to index.php without making assumptions about the sub-folder structure.
This would also allow the support of many other web server applications that do not support client-driven configurations such as Apache and IIS. (E.g. Nginx)
The text was updated successfully, but these errors were encountered: