We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tojson filter escapes <, >, & and '. To avoid javascript injection in HTML <script> tags and data-* attributes, Django and other (e.g. Odoo) seems escaping also \u2028 and \u2029 (treated as newlines by some javascript engines, which may allow an attacker to begin a new javascript instruction). More info at https://code.djangoproject.com/ticket/17419#comment:27 See issue and commit in djangoproject.
tojson
<
>
&
'
<script>
data-*
\u2028
\u2029
Nowadays symbols are some more I think https://github.com/jonashaag/django/blob/master/django/utils/html.py#L54:
_js_escapes = { ord('\\'): '\\u005C', ord('\''): '\\u0027', ord('"'): '\\u0022', ord('>'): '\\u003E', ord('<'): '\\u003C', ord('&'): '\\u0026', ord('='): '\\u003D', ord('-'): '\\u002D', ord(';'): '\\u003B', ord('\u2028'): '\\u2028', ord('\u2029'): '\\u2029' }
I saw only htmlsafe_json_dumps without knowing all Jinja codebase, however: sorry if already addressed or evaluated issue.
htmlsafe_json_dumps
Thanks, Pp
The text was updated successfully, but these errors were encountered:
No branches or pull requests
tojson
filter escapes<
,>
,&
and'
. To avoid javascript injection in HTML<script>
tags anddata-*
attributes, Django and other (e.g. Odoo) seems escaping also\u2028
and\u2029
(treated as newlines by some javascript engines, which may allow an attacker to begin a new javascript instruction).More info at https://code.djangoproject.com/ticket/17419#comment:27
See issue and commit in djangoproject.
Nowadays symbols are some more I think https://github.com/jonashaag/django/blob/master/django/utils/html.py#L54:
I saw only
htmlsafe_json_dumps
without knowing all Jinja codebase, however: sorry if already addressed or evaluated issue.Thanks,
Pp
The text was updated successfully, but these errors were encountered: