forked from orbit-oss/flask
Fixed XSS problem by escaping all slashes in JSON.
This also probes simplejson first to figure out if it escapes slashes which it did in earlier versions.
This commit is contained in:
parent
268302fc68
commit
9f6bc93e4d
2 changed files with 13 additions and 1 deletions
|
|
@ -245,6 +245,8 @@ class JSONTestCase(unittest.TestCase):
|
|||
with app.test_request_context():
|
||||
rv = flask.render_template_string('{{ "</script>"|tojson|safe }}')
|
||||
assert rv == '"<\\/script>"'
|
||||
rv = flask.render_template_string('{{ "<\0/script>"|tojson|safe }}')
|
||||
assert rv == '"<\\u0000\\/script>"'
|
||||
|
||||
|
||||
class TemplatingTestCase(unittest.TestCase):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue