Skip to content
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(vite): avoid serving arbitrary file in vite-node middleware #20345

Merged
merged 2 commits into from
Apr 18, 2023

Conversation

antfu
Copy link
Member

@antfu antfu commented Apr 18, 2023

πŸ”— Linked issue

Code ported from Vite, await vitejs/vite#12894 to refactor.

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@codesandbox
Copy link

codesandbox bot commented Apr 18, 2023

CodeSandbox logoCodeSandbox logoΒ  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

return false
}

function isParentDirectory (dir: string, file: string): boolean {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be happy to see such utils going to pathe/utils would be much easier to share and also test...

Comment on lines +187 to +190
/**
* The following code is ported from vite
* Awaits https://github.com/vitejs/vite/pull/12894
*/
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pi0 I'd suggest we do nothing about the code below and wait for the Vite PR to be shipped (so we could remove them). Unless you are saying it could be a nice addition to pathe but not related to this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not specific for this PR of course. And only if finally vite can leverage from same util. Otherwise closest impl is best.

@danielroe danielroe merged commit 886350a into main Apr 18, 2023
@danielroe danielroe deleted the fix/vite-node-serve branch April 18, 2023 11:30
This was referenced Apr 19, 2023
@github-actions github-actions bot mentioned this pull request Apr 20, 2023
@github-actions github-actions bot mentioned this pull request Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants