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 }));
|
const target = path.normalize(_urlToPath(request.url, { isWindows }));
|
||||||
|
|
||||||
if (!path.isAbsolute(target)) {
|
if (!path.isAbsolute(target)) {
|
||||||
|
console.log(`Warning: denying request to non-absolute path '${target}'`);
|
||||||
return callback();
|
return callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!target.startsWith(userDataPath) && !target.startsWith(installPath)) {
|
if (!target.startsWith(userDataPath) && !target.startsWith(installPath)) {
|
||||||
console.log(`Warning: denying request to ${target}`);
|
console.log(`Warning: denying request to path '${target}'`);
|
||||||
return callback();
|
return callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue