This week we're recreating a PHP function that is extremely important for sanitizing user input. All HTML/ASP/PHP tags are stripped outright; there is no support for a whitelist of allowed tags. A whitelist can be very dangerous without much more rigorous testing to check for script-related exploits. A safer solution would be to force the user to use something like UBB code or Markdown and convert to HTML on the backend.
ASP
function strip_tags(unsafeString)
dim regEx
set regEx = new RegExp
with regEx
.Global = true
.IgnoreCase = true
.Pattern = "(\<(/?[^\>]+)\>)"
end with
strip_tags = regEx.Replace(unsafeString, "")
set regEx = nothing
end function
No comments:
Post a Comment