How to prevent XSS attacks ?
Author: manutheblackerCreated Apr 29, 2026Updated Aug 28, 2026
Please describe what you are trying to achieve.
I'm running tests on my OpenAPI Django-Ninja with Cats Tools (https://github.com/Endava/cats/) and it has really helped me identify flaws in my API designs so far.
After fixing some code issues, I logged in to my account and noticed that the app had triggered an 'XSS' alert. After examining various tables, I discovered that Django-cacheops was storing outdated data in the Redis cache.
Would it be possible to sanitise all POST, PUT and PATCH paths at the Ninja controller level to prevent this from happening again?
Source: vitalik/django-ninja