-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[AssetMapper] Dotfiles exposed due to cache prefix #52697
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
Comments
Or perhaps go with a list of default file extension (.js/.css/.png etc) allowed, this being possible to override ? but indeed having all compiles to public may be risky in case of wrong/accidental commit on assets folders |
It feels like a list of allowed files would be really long and hard to maintain, and it may be confusing for developers to see some files missing when compiling assets after an upgrade. wdyt ? |
What about an option "exclude_dotfiles" (default true) ? |
Yes, I like this option. I'd rather not bother at all - and make it clear that ALL files in your mapped assets/ directory are made publicly accessible (that's actually the whole point of AssetMapper), but it might be better to be on the safe side. But hiding dot files by default (but allowing it to be turned of) seems reasonable to me, and safe by default. Dot files, I think, are a special case. Btw, for comparison, Propshaft from Ruby has the same behavior as AssetMapper and, as far as I know, doesn't exclude anything by default: https://github.com/rails/propshaft#usage So, if we are going to do this, it's at #52712 |
This PR was merged into the 6.4 branch. Discussion ---------- [AssetMapper] Exclude dot files | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes - could possibly be considered a security fix | New feature? | yes | Deprecations? | no | Issues | Fix #52697 | License | MIT See #52697. The biggest question is: should we do this? Is it enough to say "Hey! When you map an assets directory, EVERYTHING is published publicly?". Or should we be on the safe side and exclude dot files by default. Cheers! Commits ------- 85c0ef6 [AssetMapper] Adding an option (true by default) to not publish dot files
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected
6.4,7.0,7.1
Description
Any hidden / dotfile in the assets directory is deployed and publically accessible.
Assets files are versionned via a prefix inserted before the file extension.
The servers standard protection against dotfile access cannot work, as the mapped files are not "dotfiles" anymore.
How to reproduce
Possible Solution
Exclude patterns
This behaviour can be prevented with a specific config directive
As of today this is neither documented or "default behaviour".
That could be a first move, but this is something risky, as the pattern is not self-explanatory
Fix asset collection
Another way would be to modify the assets collection (in the Repository) to ignore dotfiles
..
What do you think ?
The text was updated successfully, but these errors were encountered: