#17419: JSON template tag
-----------------------------------+-------------------------------------
     Reporter:  lau                |                    Owner:  aaugustin
         Type:  New feature        |                   Status:  closed
    Component:  Template system    |                  Version:  master
     Severity:  Normal             |               Resolution:  wontfix
     Keywords:  json template tag  |             Triage Stage:  Accepted
    Has patch:  1                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+-------------------------------------

Comment (by abhillman):

 Replying to [comment:18 aaugustin]:
 > I've finally changed my mind on this ticket. There's a good reason why
 it isn't recommended to just include raw JSON data in the HTML: it's
 
[https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet
 extremely hard to prevent XSS] unless you enforce other rules about the
 context, and this isn't under the control of Django.
 >
 > It's obviously possible to solve the problem for particular use cases
 with controlled data. In such cases, the implementation only takes a few
 lines (see the first patch on this ticket). However, it appears very hard
 to provide a general `|json` filter that will be safe in all contexts.
 >
 > If you think you have a working implementation, please submit it on the
 mailing list. I'll expect strong evidence that it's secure :)

 This is a pretty old ticket. But out of curiosity, how would you deal with
 this kind of situation, Aymeric? That is, binding some data to a
 JavaScript variable. Just create an API endpoint to grab data via ajax and
 bind it to a variable there? Create a template tag for your own usage
 given that you are aware of its potential security issues?

--
Ticket URL: <https://code.djangoproject.com/ticket/17419#comment:20>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.ed066679fda0fe90bf249b010769f9a1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to