Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
111d424d
authored
Jan 07, 2015
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix xss in notifications
Closes #374
parent
dedaf53a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
circle/dashboard/models.py
+11
-2
No files found.
circle/dashboard/models.py
View file @
111d424d
...
...
@@ -31,6 +31,7 @@ from django.db.models import (
)
from
django.db.models.signals
import
post_save
,
pre_delete
,
post_delete
from
django.templatetags.static
import
static
from
django.utils.html
import
escape
from
django.utils.translation
import
ugettext_lazy
as
_
from
django_sshkey.models
import
UserKey
from
django.core.exceptions
import
ObjectDoesNotExist
...
...
@@ -87,7 +88,8 @@ class Notification(TimeStampedModel):
@property
def
subject
(
self
):
return
HumanReadableObject
.
from_dict
(
self
.
subject_data
)
return
HumanReadableObject
.
from_dict
(
self
.
escape_dict
(
self
.
subject_data
))
@subject.setter
def
subject
(
self
,
value
):
...
...
@@ -95,7 +97,14 @@ class Notification(TimeStampedModel):
@property
def
message
(
self
):
return
HumanReadableObject
.
from_dict
(
self
.
message_data
)
return
HumanReadableObject
.
from_dict
(
self
.
escape_dict
(
self
.
message_data
))
def
escape_dict
(
self
,
data
):
for
k
,
v
in
data
[
'params'
]
.
items
():
if
isinstance
(
v
,
basestring
):
data
[
'params'
][
k
]
=
escape
(
v
)
return
data
@message.setter
def
message
(
self
,
value
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment