Answer the question
In order to leave comments, you need to log in
Is the train of thought correct?
There is a field (let's say a comment on the site), it can contain html code and should be displayed as html code. Is it enough to wrap the output of this field in tags <code></code>
or not, to protect against XSS?
Thanks in advance for your reply!
Answer the question
In order to leave comments, you need to log in
Not enough. Check it out for yourself by entering the following code on your website:
use this library - htmlpurifier.org , it's quite simple.
Any normal CMS validates inputs, especially user comments. There are standard functions in PHP that allow you to convert the characters "/<:;{ etc. to unicode.
PS As my teacher said - "Write a program so that a fool does not accidentally break it."
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question