Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question