-
-
Notifications
You must be signed in to change notification settings - Fork 9k
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
[path] in assetModuleFilename may unexpectedly traverse parent directories #11937
Comments
For maintainers only:
|
Sorry, expected, |
A directory traversal bug is expected? To be clear, I don’t care about reproducing the exact behavior of |
Where you see bug? We just write file above |
When you use |
What I expect is for webpack to convert the If it helps, this affects Zulip even without any explicit
This would also affect a project where
|
For the logs: this was re-reported by someone else as |
@andersk Yeah, we want to reconsider it, make sense to implement something new to solve it |
Bug report
What is the current behavior?
With
output.assetModuleFilename
configured as"[path][name][ext]"
, referencing an asset from outside the project root via..
or a symlink through..
causes a file to be written outside of theoutput.path
directory.If the current behavior is a bug, please provide the steps to reproduce.
webpack has created
dist/../../foo.txt
, i.e.../foo.txt
.What is the expected behavior?
Given a similar configuration using
loader: "file-loader", options: { name: "[path][name].[ext]" }
, webpack instead createsdist/_/_/foo.txt
, which seems like a reasonable way to avoid the unexpected directory traversal.Other relevant information:
webpack version: 5.4.0
Node.js version: 14.15.0
Operating System: Linux
Additional tools:
The text was updated successfully, but these errors were encountered: