Developing a project with Django which involves serving JSON data to templates for use in javascript using the D3 framework.
A pattern I am using quite a bit is to return a JsonResponse object from a Django view with an array of data. As I start to link up apps in the project, I am also starting to use this idea to pass data between views in different apps. To get this working, I also need to set a safe flag as False. e.g.
def my_view(request):
data = [{'foo':'bar'}, {'but':'should'}, {'i':'care?'}]
return JsonResponse(data, safe=False)
This works fine and I think I want to be passing arrays because it makes life easier in D3. But it perturbs me a bit to be using this flag. I am somewhat reassured by the description in the Django documentation, but cannot say I have much understanding of the risk.
Any thoughts on how much of a security issue this potentially is, and what might be the best alternative approach if they are significant?