1 | ;
|
2 |
|
3 | const path = require('path');
|
4 | const startsWith = require('mout/string/startsWith');
|
5 |
|
6 | module.exports = function(base, file) {
|
7 | var rest = path.join.apply(path, arguments);
|
8 | if(!startsWith(rest, base))
|
9 | throw `path.jail escape attempt in ${base}/${file}`;
|
10 | return rest;
|
11 | };
|