{"maintainers":[{"email":"shtylman@gmail.com","name":"defunctzombie"},{"email":"jonathanrichardong@gmail.com","name":"jongleberry"},{"email":"doug@somethingdoug.com","name":"dougwilson"},{"email":"mscdex@mscdex.net","name":"mscdex"},{"email":"fishrock123@rocketmail.com","name":"fishrock123"}],"keywords":["resolve","path","safe"],"dist-tags":{"latest":"1.3.3"},"author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"description":"Resolve a relative path against a root path with validation","readme":"# resolve-path\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Node.js Version][node-image]][node-url]\n[![Linux Build][travis-image]][travis-url]\n[![Windows Build][appveyor-image]][appveyor-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\nResolve a relative path against a root path with validation.\n\nThis module would protect against commons attacks like `GET /../file.js`\nwhich reaches outside the root folder.\n\n## Installation\n\nThis is a [Node.js](https://nodejs.org/en/) module available through the\n[npm registry](https://www.npmjs.com/). Installation is done using the\n[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):\n\n```sh\n$ npm install resolve-path\n```\n\n## API\n\n```\nvar resolvePath = require('resolve-path')\n```\n\n### resolvePath(relativePath)\n\nResolve a relative path against `process.cwd()` (the process's current working\ndirectory) and return an absolute path. *This will throw* if the resulting resolution\nseems malicious. The following are malicious:\n\n  - The relative path is an absolute path\n  - The relative path contains a NULL byte\n  - The relative path resolves to a path outside of `process.cwd()`\n  - The relative path traverses above `process.cwd()` and back down\n\n### resolvePath(rootPath, relativePath)\n\nResolve a relative path against the provided root path and return an absolute path.\n*This will throw* if the resulting resolution seems malicious. The following are\nmalicious:\n\n  - The relative path is an absolute path\n  - The relative path contains a NULL byte\n  - The relative path resolves to a path outside of the root path\n  - The relative path traverses above the root and back down\n\n## Example\n\n### Safely resolve paths in a public directory\n\n```js\nvar http = require('http')\nvar parseUrl = require('parseurl')\nvar path = require('path')\nvar resolvePath = require('resolve-path')\n\n// the public directory\nvar publicDir = path.join(__dirname, 'public')\n\n// the server\nvar server = http.createServer(function onRequest (req, res) {\n  try {\n    // get the pathname from the URL (decoded)\n    var pathname = decodeURIComponent(parseUrl(req).pathname)\n\n    if (!pathname) {\n      res.statusCode = 400\n      res.end('path required')\n      return\n    }\n\n    // remove leading slash\n    var filename = pathname.substr(1)\n\n    // resolve the full path\n    var fullpath = resolvePath(publicDir, filename)\n\n    // echo the resolved path\n    res.statusCode = 200\n    res.end('resolved to ' + fullpath)\n  } catch (err) {\n    res.statusCode = err.status || 500\n    res.end(err.message)\n  }\n})\n\nserver.listen(3000)\n```\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/resolve-path.svg\n[npm-url]: https://npmjs.org/package/resolve-path\n[node-image]: https://img.shields.io/node/v/resolve-path.svg\n[node-url]: http://nodejs.org/download/\n[travis-image]: https://img.shields.io/travis/pillarjs/resolve-path/master.svg?label=linux\n[travis-url]: https://travis-ci.org/pillarjs/resolve-path\n[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/resolve-path/master.svg?label=windows\n[appveyor-url]: https://ci.appveyor.com/project/dougwilson/resolve-path\n[coveralls-image]: https://img.shields.io/coveralls/pillarjs/resolve-path/master.svg\n[coveralls-url]: https://coveralls.io/r/pillarjs/resolve-path?branch=master\n[downloads-image]: https://img.shields.io/npm/dm/resolve-path.svg\n[downloads-url]: https://npmjs.org/package/resolve-path\n","repository":{"type":"git","url":"https://github.com/pillarjs/resolve-path"},"bugs":{"url":"https://github.com/pillarjs/resolve-path/issues"},"license":"MIT","versions":{"1.0.0":{"name":"resolve-path","description":"resolve a relative path from a root path with validation","version":"1.0.0","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"repository":{"type":"git","url":"https://github.com/expressjs/resolve-path.git"},"bugs":{"url":"https://github.com/expressjs/resolve-path/issues","email":"me@jongleberry.com"},"devDependencies":{"should":"^3.0","mocha":"^1.13"},"scripts":{"test":"NODE_ENV=test mocha --require should --reporter spec --bail"},"license":"MIT","homepage":"https://github.com/expressjs/resolve-path","_id":"resolve-path@1.0.0","dist":{"shasum":"b88baf7f3b8ddc90b21b75b18ac322ee072e9f84","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/resolve-path/-/resolve-path-1.0.0.tgz"},"_from":".","_npmVersion":"1.4.4","_npmUser":{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},"maintainers":[{"name":"jongleberry","email":"jonathanrichardong@gmail.com"}],"directories":{}},"1.1.0":{"name":"resolve-path","description":"resolve a relative path from a root path with validation","version":"1.1.0","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"repository":{"type":"git","url":"https://github.com/pillarjs/resolve-path"},"devDependencies":{"istanbul":"0","mocha":"2"},"scripts":{"test":"mocha","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"},"keywords":["resolve","path","safe"],"license":"MIT","dependencies":{"http-assert":"1"},"gitHead":"7f4dd97f81f23cc41de0947e4ef452a2c87b74eb","bugs":{"url":"https://github.com/pillarjs/resolve-path/issues"},"homepage":"https://github.com/pillarjs/resolve-path","_id":"resolve-path@1.1.0","_shasum":"a991d427ba2985a27cb2608db8f2186861dd0223","_from":".","_npmVersion":"2.1.12","_nodeVersion":"0.11.14","_npmUser":{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},"maintainers":[{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"dougwilson","email":"doug@somethingdoug.com"},{"name":"shtylman","email":"shtylman@gmail.com"},{"name":"mscdex","email":"mscdex@mscdex.net"},{"name":"fishrock123","email":"fishrock123@rocketmail.com"}],"dist":{"shasum":"a991d427ba2985a27cb2608db8f2186861dd0223","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/resolve-path/-/resolve-path-1.1.0.tgz"},"directories":{}},"1.2.0":{"name":"resolve-path","description":"Resolve a relative path against a root path with validation","version":"1.2.0","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"license":"MIT","repository":{"type":"git","url":"https://github.com/pillarjs/resolve-path"},"dependencies":{"http-errors":"~1.2.8"},"devDependencies":{"istanbul":"0.3.5","mocha":"~2.1.0"},"files":["HISTORY.md","LICENSE","README.md","index.js"],"engines":{"node":">= 0.8"},"scripts":{"test":"mocha --reporter spec --bail --check-leaks test/","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"},"keywords":["resolve","path","safe"],"gitHead":"54784b03a15164e75b65592c4b24b7c0d50367af","bugs":{"url":"https://github.com/pillarjs/resolve-path/issues"},"homepage":"https://github.com/pillarjs/resolve-path","_id":"resolve-path@1.2.0","_shasum":"576fabd822afb5b07a50254daa564cf59f22d950","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"maintainers":[{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"dougwilson","email":"doug@somethingdoug.com"},{"name":"shtylman","email":"shtylman@gmail.com"},{"name":"mscdex","email":"mscdex@mscdex.net"},{"name":"fishrock123","email":"fishrock123@rocketmail.com"}],"dist":{"shasum":"576fabd822afb5b07a50254daa564cf59f22d950","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/resolve-path/-/resolve-path-1.2.0.tgz"},"directories":{}},"1.2.1":{"name":"resolve-path","description":"Resolve a relative path against a root path with validation","version":"1.2.1","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"license":"MIT","repository":{"type":"git","url":"https://github.com/pillarjs/resolve-path"},"dependencies":{"http-errors":"~1.2.8"},"devDependencies":{"istanbul":"0.3.5","mocha":"~2.1.0"},"files":["HISTORY.md","LICENSE","README.md","index.js"],"engines":{"node":">= 0.8"},"scripts":{"test":"mocha --reporter spec --bail --check-leaks test/","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"},"keywords":["resolve","path","safe"],"gitHead":"8b0b690ad4a8444621b11731d05f4ee12d7e5508","bugs":{"url":"https://github.com/pillarjs/resolve-path/issues"},"homepage":"https://github.com/pillarjs/resolve-path","_id":"resolve-path@1.2.1","_shasum":"cb1fcb7fa909fe33807b4213d7c222c8734f18a5","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"maintainers":[{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"dougwilson","email":"doug@somethingdoug.com"},{"name":"shtylman","email":"shtylman@gmail.com"},{"name":"mscdex","email":"mscdex@mscdex.net"},{"name":"fishrock123","email":"fishrock123@rocketmail.com"}],"dist":{"shasum":"cb1fcb7fa909fe33807b4213d7c222c8734f18a5","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/resolve-path/-/resolve-path-1.2.1.tgz"},"directories":{}},"1.2.2":{"name":"resolve-path","description":"Resolve a relative path against a root path with validation","version":"1.2.2","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"license":"MIT","repository":{"type":"git","url":"https://github.com/pillarjs/resolve-path"},"dependencies":{"http-errors":"~1.3.1"},"devDependencies":{"istanbul":"0.3.5","mocha":"~2.1.0"},"files":["HISTORY.md","LICENSE","README.md","index.js"],"engines":{"node":">= 0.8"},"scripts":{"test":"mocha --reporter spec --bail --check-leaks test/","test-ci":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/"},"keywords":["resolve","path","safe"],"gitHead":"d4c3d78a633b96d42d814d759799e171be0e9589","bugs":{"url":"https://github.com/pillarjs/resolve-path/issues"},"homepage":"https://github.com/pillarjs/resolve-path","_id":"resolve-path@1.2.2","_shasum":"5a8fa192d4684d35ab4aaa096852fd7a06b730fb","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"maintainers":[{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"dougwilson","email":"doug@somethingdoug.com"},{"name":"shtylman","email":"shtylman@gmail.com"},{"name":"mscdex","email":"mscdex@mscdex.net"},{"name":"fishrock123","email":"fishrock123@rocketmail.com"}],"dist":{"shasum":"5a8fa192d4684d35ab4aaa096852fd7a06b730fb","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/resolve-path/-/resolve-path-1.2.2.tgz"},"directories":{}},"1.3.0":{"name":"resolve-path","description":"Resolve a relative path against a root path with validation","version":"1.3.0","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"license":"MIT","repository":{"type":"git","url":"https://github.com/pillarjs/resolve-path"},"dependencies":{"http-errors":"~1.3.1","path-is-absolute":"1.0.0"},"devDependencies":{"istanbul":"0.3.9","mocha":"2.2.5"},"files":["HISTORY.md","LICENSE","README.md","index.js"],"engines":{"node":">= 0.8"},"scripts":{"test":"mocha --reporter spec --bail --check-leaks test/","test-ci":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/"},"keywords":["resolve","path","safe"],"gitHead":"9a0445d8f5e55965c202909ce523927a9ab07c9e","bugs":{"url":"https://github.com/pillarjs/resolve-path/issues"},"homepage":"https://github.com/pillarjs/resolve-path","_id":"resolve-path@1.3.0","_shasum":"6c76d9b23bf037eca79a470fcbb97cb7b60ee34c","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"maintainers":[{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"dougwilson","email":"doug@somethingdoug.com"},{"name":"mscdex","email":"mscdex@mscdex.net"},{"name":"fishrock123","email":"fishrock123@rocketmail.com"},{"name":"defunctzombie","email":"shtylman@gmail.com"}],"dist":{"shasum":"6c76d9b23bf037eca79a470fcbb97cb7b60ee34c","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/resolve-path/-/resolve-path-1.3.0.tgz"},"directories":{}},"1.3.1":{"name":"resolve-path","description":"Resolve a relative path against a root path with validation","version":"1.3.1","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/pillarjs/resolve-path.git"},"dependencies":{"http-errors":"~1.4.0","path-is-absolute":"1.0.0"},"devDependencies":{"istanbul":"0.4.2","mocha":"2.4.5"},"files":["HISTORY.md","LICENSE","README.md","index.js"],"engines":{"node":">= 0.8"},"scripts":{"test":"mocha --reporter spec --bail --check-leaks test/","test-ci":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/"},"keywords":["resolve","path","safe"],"gitHead":"07ff4410f213aebd0ce6b37a8efd0323ece52c27","bugs":{"url":"https://github.com/pillarjs/resolve-path/issues"},"homepage":"https://github.com/pillarjs/resolve-path#readme","_id":"resolve-path@1.3.1","_shasum":"4850b43948a91343aea69d1294c0fd0ae568f56b","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.7.0","_npmUser":{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},"dist":{"shasum":"4850b43948a91343aea69d1294c0fd0ae568f56b","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/resolve-path/-/resolve-path-1.3.1.tgz"},"maintainers":[{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"dougwilson","email":"doug@somethingdoug.com"},{"name":"mscdex","email":"mscdex@mscdex.net"},{"name":"fishrock123","email":"fishrock123@rocketmail.com"},{"name":"defunctzombie","email":"shtylman@gmail.com"}],"_npmOperationalInternal":{"host":"packages-9-west.internal.npmjs.com","tmp":"tmp/resolve-path-1.3.1.tgz_1456698560934_0.25436124857515097"},"directories":{}},"1.3.2":{"name":"resolve-path","description":"Resolve a relative path against a root path with validation","version":"1.3.2","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"license":"MIT","repository":{"type":"git","url":"https://github.com/pillarjs/resolve-path"},"dependencies":{"http-errors":"~1.5.0","path-is-absolute":"1.0.0"},"devDependencies":{"eslint":"2.12.0","eslint-config-standard":"5.3.1","eslint-plugin-promise":"1.3.2","eslint-plugin-standard":"1.3.2","istanbul":"0.4.3","mocha":"2.5.3"},"files":["HISTORY.md","LICENSE","README.md","index.js"],"engines":{"node":">= 0.8"},"scripts":{"lint":"eslint **/*.js","test":"mocha --reporter spec --bail --check-leaks test/","test-ci":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/"},"keywords":["resolve","path","safe"],"gitHead":"5d2fb011f164922a633b965091aa6603272b9e40","bugs":{"url":"https://github.com/pillarjs/resolve-path/issues"},"homepage":"https://github.com/pillarjs/resolve-path","_id":"resolve-path@1.3.2","_shasum":"c20924408aff77466e819da548d7ce40a81d561f","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"maintainers":[{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"dougwilson","email":"doug@somethingdoug.com"},{"name":"mscdex","email":"mscdex@mscdex.net"},{"name":"fishrock123","email":"fishrock123@rocketmail.com"},{"name":"defunctzombie","email":"shtylman@gmail.com"}],"dist":{"shasum":"c20924408aff77466e819da548d7ce40a81d561f","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/resolve-path/-/resolve-path-1.3.2.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/resolve-path-1.3.2.tgz_1466178860146_0.997490526875481"},"directories":{}},"1.3.3":{"name":"resolve-path","description":"Resolve a relative path against a root path with validation","version":"1.3.3","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"license":"MIT","repository":{"type":"git","url":"https://github.com/pillarjs/resolve-path"},"dependencies":{"http-errors":"~1.5.0","path-is-absolute":"1.0.1"},"devDependencies":{"eslint":"3.10.1","eslint-config-standard":"6.2.1","eslint-plugin-markdown":"1.0.0-beta.3","eslint-plugin-promise":"3.3.2","eslint-plugin-standard":"2.0.1","istanbul":"0.4.5","mocha":"2.5.3"},"files":["HISTORY.md","LICENSE","README.md","index.js"],"engines":{"node":">= 0.8"},"scripts":{"lint":"eslint --plugin markdown --ext js,md .","test":"mocha --reporter spec --bail --check-leaks test/","test-ci":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/"},"keywords":["resolve","path","safe"],"gitHead":"5741e74db208c51578e158cbc747198ff2a1f65f","bugs":{"url":"https://github.com/pillarjs/resolve-path/issues"},"homepage":"https://github.com/pillarjs/resolve-path","_id":"resolve-path@1.3.3","_shasum":"4d83aba6468c2b8e632a575e3f52b0fa0dbe1a5c","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"maintainers":[{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"dougwilson","email":"doug@somethingdoug.com"},{"name":"mscdex","email":"mscdex@mscdex.net"},{"name":"fishrock123","email":"fishrock123@rocketmail.com"},{"name":"defunctzombie","email":"shtylman@gmail.com"}],"dist":{"shasum":"4d83aba6468c2b8e632a575e3f52b0fa0dbe1a5c","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/resolve-path/-/resolve-path-1.3.3.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/resolve-path-1.3.3.tgz_1479179525843_0.11867789761163294"},"directories":{}}},"name":"resolve-path","contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"time":{"modified":"2017-05-10T12:55:09.970Z","created":"2014-03-23T11:48:30.582Z","1.0.0":"2014-03-23T11:48:30.582Z","1.1.0":"2014-12-27T22:06:02.372Z","1.2.0":"2015-01-05T21:03:05.902Z","1.2.1":"2015-01-20T05:03:09.961Z","1.2.2":"2015-02-17T03:56:35.588Z","1.3.0":"2015-06-16T04:22:23.730Z","1.3.1":"2016-02-28T22:29:22.074Z","1.3.2":"2016-06-17T15:54:22.654Z","1.3.3":"2016-11-15T03:12:07.718Z"},"readmeFilename":"README.md","homepage":"https://github.com/pillarjs/resolve-path"}