Skip to content

Don't allow fs provider to reach above root dir. #207

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

Merged
merged 3 commits into from
Feb 17, 2016
Merged

Conversation

mbleigh
Copy link
Contributor

@mbleigh mbleigh commented Feb 17, 2016

This change makes it so that the fs provider cannot serve files above the specified root. Previously, a string of ../../../ would let you access files outside the specified public directory.

.use(superstatic(opts));

request(app)
.get('/dir/')

Choose a reason for hiding this comment

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

Probably missing something, but how does this test a file with spaces? Isn't it just getting the index.html?

@cbraynor
Copy link

A few nits, back to you

@cbraynor cbraynor assigned mbleigh and unassigned cbraynor Feb 17, 2016
@mbleigh mbleigh assigned cbraynor and unassigned mbleigh Feb 17, 2016
@mbleigh
Copy link
Contributor Author

mbleigh commented Feb 17, 2016

Drastically simplified implementation. I don't think there's any reason to allow parent directory pathing at all.

@cbraynor
Copy link

LGTM, thanks

cbraynor pushed a commit that referenced this pull request Feb 17, 2016
Don't allow fs provider to reach above root dir.
@cbraynor cbraynor merged commit c6ae0b7 into master Feb 17, 2016
@cbraynor cbraynor deleted the mb-fs-root branch February 17, 2016 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants