Encoding full payload and decoding in server in REST

Issue

WAF is showing some errors due to including some HTML tags in my payload responses (mostly field-like messages and user guides). Sometimes, I am also sending R programming language code to the server, which will just be stored in the database.

While doing WAF for security check, it gives a vulnerability issue saying HTML tags and code are detected.

My current Solution

So, our team proposed a solution to encode the entire payload and decode the encoded payload in the Django middleware. But I am wondering if this is the best approach after all?

Validation and Question

Will this approach be efficient in the long run?

If you have faced same issue, can you please suggest the right approach?

Thank You

Вернуться на верх