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

[security] Use node path builtin for path resolution #9

Closed
katanacrimson opened this issue Jun 19, 2013 · 2 comments
Closed

[security] Use node path builtin for path resolution #9

katanacrimson opened this issue Jun 19, 2013 · 2 comments
Assignees

Comments

@katanacrimson
Copy link
Contributor

https://github.com/designcreateplay/NodeBB/blob/master/src/routes/user.js#L115

I smell security issues with this, probably directory traversal; probably in that you're only working with / and not \ too. Let path do the job it is made to do.

http://nodejs.org/api/path.html

Use path.normalize to prevent directory traversal, path.relative to change the path we're aimed towards...etc.

@ghost ghost assigned barisusakli Jun 19, 2013
@barisusakli
Copy link
Member

@katanacrimson
Copy link
Contributor Author

considering how filename is only used in one line in that scope, why not wrap the entire thing using path.join (for OS-relative paths)

e.g.

        var absolutePath = path.join([global.configuration['ROOT_DIRECTORY'], config.upload_path, path.basename(oldpicture)]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants