remote-file: prevent saving outside of remote root
This commit is contained in:
parent
2ab2614853
commit
7f3114d06b
1 changed files with 10 additions and 0 deletions
|
|
@ -146,6 +146,16 @@ module.exports = {
|
|||
|
||||
if (Array.isArray(data.path)) data.path = path.resolve(...data.path)
|
||||
|
||||
var root = settings.read('remoteRoot')
|
||||
if (root && !data.path.includes(root)) {
|
||||
console.error('Could not save: path outside of remote-root')
|
||||
return ipc.send('notify', {
|
||||
class: 'error',
|
||||
locale: 'remotesave_fail',
|
||||
message: ' (Could not save: path outside of remote-root)'
|
||||
}, clientId)
|
||||
}
|
||||
|
||||
try {
|
||||
JSON.parse(data.session)
|
||||
} catch(e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue