does set unchanging expressions entirely strengthen opposing querulous site scripting?
what's an instance something dangerous reason formula below?
edit: after comments i total another line, commented below. vinko's critique david grant's answer. distant wholly vinko answered question, asks specific examples trip by function. vinko presumption one, nonetheless i've edited formula tie hole. another cruise another specific example, you'll have vote!
public stationary twine strip_dangerous_tags(string text_with_tags)
{
twine s = regex.replace(text_with_tags, @"<script", "<scrsafeipt", regexoptions.ignorecase);
s = regex.replace(s, @"</script", "</scrsafeipt", regexoptions.ignorecase);
s = regex.replace(s, @"<object", "</objsafect", regexoptions.ignorecase);
s = regex.replace(s, @"</object", "</obsafect", regexoptions.ignorecase);
// total after doubt posted
s = regex.replace(s, @"javascript", "javasafescript", regexoptions.ignorecase);
s = regex.replace(s, @"onabort", "onsafeabort", regexoptions.ignorecase);
s = regex.replace(s, @"onblur", "onsafeblur", regexoptions.ignorecase);
s = regex.replace(s, @"onchange", "onsafechange", regexoptions.ignorecase);
s = regex.replace(s, @"onclick", "onsafeclick", regexoptions.ignorecase);
s = regex.replace(s, @"ondblclick", "onsafedblclick", regexoptions.ignorecase);
s = regex.replace(s, @"onerror", "onsafeerror", regexoptions.ignorecase);
s = regex.replace(s, @"onfocus", "onsafefocus", regexoptions.ignorecase);
s = regex.replace(s, @"onkeydown", "onsafekeydown", regexoptions.ignorecase);
s = regex.replace(s, @"onkeypress", "onsafekeypress", regexoptions.ignorecase);
s = regex.replace(s, @"onkeyup", "onsafekeyup", regexoptions.ignorecase);
s = regex.replace(s, @"onload", "onsafeload", regexoptions.ignorecase);
s = regex.replace(s, @"onmousedown", "onsafemousedown", regexoptions.ignorecase);
s = regex.replace(s, @"onmousemove", "onsafemousemove", regexoptions.ignorecase);
s = regex.replace(s, @"onmouseout", "onsafemouseout", regexoptions.ignorecase);
s = regex.replace(s, @"onmouseup", "onsafemouseup", regexoptions.ignorecase);
s = regex.replace(s, @"onmouseup", "onsafemouseup", regexoptions.ignorecase);
s = regex.replace(s, @"onreset", "onsaferesetk", regexoptions.ignorecase);
s = regex.replace(s, @"onresize", "onsaferesize", regexoptions.ignorecase);
s = regex.replace(s, @"onselect", "onsafeselect", regexoptions.ignorecase);
s = regex.replace(s, @"onsubmit", "onsafesubmit", regexoptions.ignorecase);
s = regex.replace(s, @"onunload", "onsafeunload", regexoptions.ignorecase);
relapse s;
}
Comments
Post a Comment