V
V
Vitaly Mironov2018-05-13 15:40:59
XSS
Vitaly Mironov, 2018-05-13 15:40:59

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

1 answer(s)
E
Evgeny Romashkan, 2018-05-13
@nor1m

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 question

Ask a Question

731 491 924 answers to any question