-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
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
Bypass autoescape / XSS #835
Comments
Good catch, PR incoming. |
devoidfury
added a commit
to devoidfury/nunjucks
that referenced
this issue
Sep 7, 2016
devoidfury
added a commit
to devoidfury/nunjucks
that referenced
this issue
Sep 7, 2016
devoidfury
added a commit
to devoidfury/nunjucks
that referenced
this issue
Sep 7, 2016
vecmezoni
added a commit
that referenced
this issue
Sep 7, 2016
fix autoescape for non-string values; fixes #835
vecmezoni
pushed a commit
that referenced
this issue
Sep 7, 2016
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following string works as expected:
If however the variable passed to the template is an array autoescape does nothing:
This looks to be intentional https://github.com/mozilla/nunjucks/blob/master/src/runtime.js#L209
However if a autoescape is on any variable that is rendered in a {{ }} block and appended to the output I would expect it to escaped no matter the type. If the var is just going to be part of a string concat anyway why not toString first then escape?
In express / Koa / (anything else using qs or body-parser) is is trivial to coerce query params types. See the following simple example in express:
http://127.0.0.1:3000/?name[]=<script>alert(1)</script>matt
I created a more detailed writeup and example app at: https://github.com/matt-/nunjucks_test
The text was updated successfully, but these errors were encountered: