Sanitize injected CSS to prevent XSS

67 views Asked by At

I have a web app that saves user-defined CSS to the DB and injects it into the front end when a user visits a certain page. I need to understand if this can potentially allow XSS injection attacks where the user saves a js code into db that gets injected to the page. Also, what are the ways to filter/prevent these html out? I tried a couple of tools including postcss validators and html-sanitizer plugins. But nothing gives a foolproof solution. My FE is in React and BE is in nestJS.

0

There are 0 answers