Skip to content

Commit afe2bf6

Browse files
author
istiak101
authored
Security: Prevent leaking load average data
Prevent leaking load average data to non-logged in users.
1 parent 9df424a commit afe2bf6

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

baseTemplate/views.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,19 @@ def getSystemStatus(request):
7575
return HttpResponse("Can not get admin Status")
7676

7777
def getLoadAverage(request):
78-
loadAverage = SystemInformation.cpuLoad()
79-
loadAverage = list(loadAverage)
80-
one = loadAverage[0]
81-
two = loadAverage[1]
82-
three = loadAverage[2]
83-
loadAvg = {"one": one, "two": two,"three": three}
84-
json_data = json.dumps(loadAvg)
85-
return HttpResponse(json_data)
78+
try:
79+
val = request.session['userID']
80+
currentACL = ACLManager.loadedACL(val)
81+
loadAverage = SystemInformation.cpuLoad()
82+
loadAverage = list(loadAverage)
83+
one = loadAverage[0]
84+
two = loadAverage[1]
85+
three = loadAverage[2]
86+
loadAvg = {"one": one, "two": two,"three": three}
87+
json_data = json.dumps(loadAvg)
88+
return HttpResponse(json_data)
89+
except KeyError:
90+
return HttpResponse("Not allowed.")
8691

8792
@ensure_csrf_cookie
8893
def versionManagment(request):

0 commit comments

Comments
 (0)