Skip to content
Permalink
Browse files
symlink protection
  • Loading branch information
usmannasir committed Feb 6, 2020
1 parent de5bb17 commit e869ff9bd103ad27dfc046c4540cd11b121b3829
Showing 1 changed file with 4 additions and 1 deletion.
@@ -332,7 +332,10 @@ def writeFileContents(self):
writeToFile.write(self.data['fileContent'].encode('utf-8'))
writeToFile.close()

if os.path.islink(self.data['fileName']):
command = 'ls -la %s' % (self.data['fileName'])
output = ProcessUtilities.outputExecutioner(command)

if output.find(website.externalApp) == -1:
return self.ajaxPre(0, 'File exists and is symlink.')

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

0 comments on commit e869ff9

Please sign in to comment.