File protocol filter: log when non-absolute path is rejected
This commit is contained in:
parent
71d873ccfe
commit
7c3325f55e
1 changed files with 2 additions and 1 deletions
|
@ -26,11 +26,12 @@ function _createFileHandler({ userDataPath, installPath, isWindows }) {
|
|||
const target = path.normalize(_urlToPath(request.url, { isWindows }));
|
||||
|
||||
if (!path.isAbsolute(target)) {
|
||||
console.log(`Warning: denying request to non-absolute path '${target}'`);
|
||||
return callback();
|
||||
}
|
||||
|
||||
if (!target.startsWith(userDataPath) && !target.startsWith(installPath)) {
|
||||
console.log(`Warning: denying request to ${target}`);
|
||||
console.log(`Warning: denying request to path '${target}'`);
|
||||
return callback();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue