Skip to content

Commit

Permalink
Merge pull request #1120 from piotr1212/upstream0.9.x
Browse files Browse the repository at this point in the history
0.9.x fix XSS issue in user saved graphs
  • Loading branch information
SEJeff committed Jan 22, 2015
2 parents 7429f9b + a5e09bd commit 094cf54
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 @@ -17,6 +17,7 @@
from django.utils.safestring import mark_safe
from django.http import HttpResponse
from django.conf import settings
from django.utils.html import escape
from graphite.account.models import Profile
from graphite.util import getProfile, getProfileByUsername, defaultUser, json
from graphite.logger import log
Expand Down Expand Up @@ -132,7 +133,7 @@ def myGraphLookup(request):
if name in leaf_inserted: continue
leaf_inserted.add(name)

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

if isBranch:
node.update( { 'id' : str(userpath_prefix + name + '.') } )
Expand Down Expand Up @@ -219,7 +220,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 @@ -228,7 +229,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 094cf54

Please sign in to comment.