-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
fix: normalize url in ensureServingAccess
#3350
Conversation
I think the problem here is with the approach of using string manipulation to prevent path traversal. The way path are resolved depends on the file system and its mount options, and trying to solve that with a It is already causing a lot of issues:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't fix the issue for e.g. case-insensitive file systems.
Please search the issues for case-insensitive fs, there is no easy way to support them and be generic with other systems in Vite. This is not related to this PR in particular. |
@patak-js What I am saying is that this PR is trying to solve the wrong problem. There is one common cause to all the issues I mentioned above, the problem is the general approach of trying to "normalize" the path, and then testing it with String.startsWith. |
This PR is not intended to correct logic (which requires more time and effort). This PR is a quick hot fix for that can't wait long. You can solve a right problem later. |
Yes, I see where you are coming from. The boggy logic itself was also introduced by a quick hot fix that couldn't wait long. I find vite amazing, but piling hot fixes is dangerous on the long run... |
This is fixing a bug in Windows, we are using |
Description
Fix #3346
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).