No, I would not use it. There are many different attacks that depend on the context into which data is inserted. One single function did not cover them all. If you look closely, there are actually only four tests:
// Set the patterns we'll test against
$patterns = array(
// Match any attribute starting with "on" or xmlns
'
// Match javascript:, livescript:, vbscript: and mocha: protocols
'!((java|live|vb)script|mocha):(\w)*!iUu',
'#-moz-binding[\x00-\x20]*:#u',
// Match style attributes
'#(<[^>]+[\x00-\x20\"\'\/])style=[^>]*>?#iUu',
// Match unneeded tags
'#</*(applet|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>?#i'
);
Nothing else has been verified. In addition to attacks that these tests do not detect (false negative), it can also erroneously report some entry as an attack (false positive).
Therefore, instead of detecting XSS attacks, just make sure that you are using the proper sanitization.
Gumbo source
share