Skip to content

Commit e869ff9

Browse files
committed
symlink protection
1 parent de5bb17 commit e869ff9

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

filemanager/filemanager.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,10 @@ def writeFileContents(self):
332332
writeToFile.write(self.data['fileContent'].encode('utf-8'))
333333
writeToFile.close()
334334

335-
if os.path.islink(self.data['fileName']):
335+
command = 'ls -la %s' % (self.data['fileName'])
336+
output = ProcessUtilities.outputExecutioner(command)
337+
338+
if output.find(website.externalApp) == -1:
336339
return self.ajaxPre(0, 'File exists and is symlink.')
337340

338341
if self.data['fileName'].find(self.data['home']) == -1 or self.data['fileName'].find('..') > -1:

0 commit comments

Comments
 (0)