Answer the question
In order to leave comments, you need to log in
Protecting css from XSS?
Good day. How can I protect myself from any vulnerabilities when parsing a css file?
I'm parsing a css file from a file, and submitting from a textarea to an html form with syntax highlighting, where it gets executed. Just pasting <script>alert(1)</script>
it gives 1. I could use htmlspecialchars, but it will corrupt the css structure and make it invalid.
What can be done in such a case?
Answer the question
In order to leave comments, you need to log in
php strip_tags. Strips tags from text along with content. (The tags are not checked for validity. Removes everything enclosed in <> </>
). In theory, CSS shouldn't hurt.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question