用于Javascript和PHP的预制XSS预防库[关闭]

I have gone through many articles of SO and Googled a lot but could not find some good premade libraries to prevent XSS (Cross Side Scripting) with Javascript for Node.js and PHP for Apache. I have found a lot of codes to prevent but isn't there some good libraries already available just include and use it?

php-antixss

htmLawed

HTML Purifier

xss_clean.php filter

XSS Protect

HTML XSS Filter

You can check it out Mod Security (kinda Module)

can be libraries, first go through their docs. But I would suggest you to use your own code for better prevention against such attacks.

It is essentially possible to automatically prevent XSS attacks, since one little line in the code written by the end-user (the developer using such a theoretical library) can open up an attack.

It isn't possible write such a library, you just have to be careful.

If it is a high priority project, the only thing you can really do is be careful and get a third-party security audit from a trusted source (though those usually cost several thousand and the low-end).