-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Security vulnerability with serveStatic #123
Comments
Hi @MaSchwarz Thank you for raising the issue. It is strange because we are taking action on that issue. If it is a bug, it is a vulnerability and needs to be fixed. Can you create a project that can reproduce it? Also, is it running on macOS, Windows, or Linux? |
Thanks for your quick response. I'm running on an M1 Mac with the latest OS version. I created an example project here. You can run the server with Edit: I did some further tinkering and added a simple // serve-static.ts
...
export const serveStatic = (options: ServeStaticOptions = { root: '' }): MiddlewareHandler => {
return async (c, next) => {
console.log("I was here") // <-----------------------------
// Do nothing if Response is already set
if (c.finalized) return next()
... |
Thank you so much! I understoond what happened and will fix it. |
This was caused by the new Request object introduced in Since this is a major vulnerability, we have issued an advisory. Thank you for the report. We appreciate it. |
I upgraded the dependency to |
Hello,
i recently discovered this library and I'm loving it so far. Thanks for the great work. ❤️
While working with the
serveStatic
method I noticed a behavior that I would describe as a security vulnerability.Here's a simplified version of my project structure:
Here's a simplified version of my
src/index.ts
file. It's basically just copied from the docs.After booting up the server I was able to get my CSS file by sending a GET request to
http://localhost:3000/static/global.css
, nice 👍.To my surprise I was also able to get the content of my
.env
file by sending a GET request tohttp://localhost:3000/static/../.env
. That seems like a security vulnerability to me. I would expect that the scope is restricted to thestatic
folder. Am I missing something?I'm happy to provide further information and create a pull request.
The text was updated successfully, but these errors were encountered: