I want to enhance the security of my API by removing HTML and JavaScript from user-provided input data to prevent XSS attacks

41 views Asked by At

enter image description here

I'm developing a Node.js API using Express.js, TypeScript, and MongoDB (Mongoose), and I'm concerned about security vulnerabilities such as XSS attacks. Specifically, I aim to ensure that user-provided input data containing HTML tags is sanitized before persisting it in my database.currently all html tags safely presist in database.

What are the recommended approaches or best practices for implementing input sanitization within this tech stack to effectively mitigate XSS risks?

0

There are 0 answers