M
M
m0ody2014-09-27 20:38:06
Django
m0ody, 2014-09-27 20:38:06

JSON - how to properly protect against XSS?

There is an application on django that gives all the data in json format. On the frontend, this data is rendered. It is necessary to protect against XSS attacks.
To encode to json I use the json library from the python standard library.
1. Will it be enough if I go through the array that needs to be sent to the frontend and process all the string data with the django.utils.html.escape function?
2. Is there a way to hang a hook in the json library that would allow string parameters to be processed during the conversion to json?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2014-09-28
@xmoonlight

only server regexp to check.... fast, simple, understandable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question