status file protection

This commit is contained in:
Usman Nasir 2020-02-05 23:05:07 +05:00
parent b5c0c169fd
commit eb309fc799
1 changed files with 10 additions and 1 deletions

View File

@ -418,10 +418,19 @@ def getBackupStatus(request):
else:
return ACLManager.loadErrorJson('fetchStatus', 0)
if (status[:16] == "/home/cyberpanel" or status[:4] == '/tmp' or status[:18] == '/usr/local/CyberCP') \
and status != '/usr/local/CyberCP/CyberCP/settings.py' and status.find('..') == -1:
pass
else:
data_ret = {'abort': 1, 'installStatus': 0, 'installationProgress': "100",
'currentStatus': 'Invalid status file.'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
## file name read ends
if os.path.exists(status):
command = "sudo cat " + status
command = "cat " + status
result = ProcessUtilities.outputExecutioner(command, 'cyberpanel')
if result.find("Completed") > -1: