diff --git a/lib/core/fs.js b/lib/core/fs.js index 7a7e1cf31..5b73f6de7 100644 --- a/lib/core/fs.js +++ b/lib/core/fs.js @@ -7,12 +7,16 @@ require('colors'); function restrictPath(receiver, binding, count, args) { const dapp = dappPath(); - const tmp = os.tmpdir(); + const allowedRoots = [ + dapp, + os.tmpdir() + ]; + let allInsideRestricted = true; for(let i = 0; i < count; i++) { let resolved = path.resolve(dapp, args[i]); - allInsideRestricted = [dapp, tmp].some(p => { return resolved.indexOf(p) === 0; }); + allInsideRestricted = allowedRoots.some(p => { return resolved.indexOf(p) === 0; }); if(!allInsideRestricted) break; }