Skip to content

Commit

Permalink
Merge pull request #1118 from piotr1212/upstream
Browse files Browse the repository at this point in the history
fix XSS issue in user saved graphs
  • Loading branch information
SEJeff committed Jan 22, 2015
2 parents 77889af + 063a701 commit 59ee9ee
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions webapp/graphite/browser/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from django.conf import settings
from django.shortcuts import render_to_response
from django.utils.safestring import mark_safe
from django.utils.html import escape
from graphite.account.models import Profile
from graphite.compat import HttpResponse
from graphite.util import getProfile, getProfileByUsername, json
Expand Down Expand Up @@ -124,7 +125,7 @@ def myGraphLookup(request):
if name in leaf_inserted: continue
leaf_inserted.add(name)

node = {'text': name}
node = {'text': escape(name)}

if isBranch:
node.update({'id': userpath_prefix + name + '.'})
Expand Down Expand Up @@ -211,7 +212,7 @@ def userGraphLookup(request):

if '.' in relativePath: # branch
node = {
'text' : str(nodeName),
'text' : escape(str(nodeName)),
'id' : str(username + '.' + prefix + nodeName + '.'),
}
node.update(branchNode)
Expand All @@ -220,7 +221,7 @@ def userGraphLookup(request):
m.update(nodeName)

node = {
'text' : str(nodeName ),
'text' : escape(str(nodeName)),
'id' : str(username + '.' + prefix + m.hexdigest()),
'graphUrl' : str(graph.url),
}
Expand Down

0 comments on commit 59ee9ee

Please sign in to comment.