JsonResponse and list values

343 views
Skip to first unread message

Curtis Maloney

unread,
Feb 16, 2015, 6:30:25 PM2/16/15
to django-d...@googlegroups.com
Ran into this bug this morning... what's the rationale behind JsonResponse only accepting dict types unless you set safe=False to allow _any_ type?

Surely list/tuple should also be permitted?

There's a test explicitly ensuring lists fail.

I'm not comfortable turning off ALL type safe-guards just so I can send lists as JSON results.

--
Curtis

Florian Apolloner

unread,
Feb 16, 2015, 6:41:21 PM2/16/15
to django-d...@googlegroups.com


On Tuesday, February 17, 2015 at 12:30:25 AM UTC+1, Curtis Maloney wrote:
Ran into this bug this morning... what's the rationale behind JsonResponse only accepting dict types unless you set safe=False to allow _any_ type?

Cause dict maps to object which is somewhat safe.
 
Surely list/tuple should also be permitted?

Curtis Maloney

unread,
Feb 16, 2015, 6:49:00 PM2/16/15
to django-d...@googlegroups.com
Cheers for the quick reply... well, you learn more about how shit JS is every day :P

--
C

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/c31944e1-a4f5-4ed9-91e0-aee9f2d7fb9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tom Christie

unread,
Feb 16, 2015, 7:00:20 PM2/16/15
to django-d...@googlegroups.com
I haven't dug out sources on this, but I think that vulnerability had been dealt with a long time ago, and isn't an issue on browsers with any real market share today.

Would need to double check though - don't remember where I came across it previously.

schinckel

unread,
Feb 16, 2015, 11:03:28 PM2/16/15
to django-d...@googlegroups.com
My attempts to reproduce it (I have quite a lot of code that returns JSON arrays) on the smattering of browsers I had handy resulted in no apparent vulnerabilities.
Reply all
Reply to author
Forward
0 new messages