remote-file: prevent saving outside of remote root

This commit is contained in:
jean-emmanuel 2019-04-04 22:51:47 +02:00
parent 03812933c5
commit 3b819996d3

View file

@ -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) {