Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Disabling Dangerous HTML Tags
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

proxysource
Starting Member

USA
19 Posts

Posted - 25 September 2000 :  02:22:46  Show Profile  Visit proxysource's Homepage
I've added some code to FormatStr function in inc_functions.asp to disable some of the more potentially dangerous HTML/ASP tags. This might be useful if you want to turn HTML on without allowing folks to post harmful scripts, etc. to your forum.

I've listed the code below. Can anyone think of anything that ought to be added?

fString = replace(fString, "&","&", 1, -1, 1)
fString = replace(fString, ">",">", 1, -1, 1)
fString = replace(fString, "&lt;","<", 1, -1, 1)
fString = replace(fString, "<script","&lt;script", 1, -1, 1)
fString = replace(fString, "</script","&lt;/script", 1, -1, 1)
fString = replace(fString, "<!--#INCLUDE","&lt;!--#INCLUDE", 1, -1, 1)
fString = replace(fString, "<object","&lt;object", 1, -1, 1)
fString = replace(fString, "</object","&lt;/object", 1, -1, 1)
fString = replace(fString, "<iframe","&lt;iframe", 1, -1, 1)
fString = replace(fString, "</iframe","&lt;/iframe", 1, -1, 1)
fString = replace(fString, "<applet","&lt;applet", 1, -1, 1)
fString = replace(fString, "</applet","&lt;/applet", 1, -1, 1)
fString = replace(fString, "<embed","&lt;embed", 1, -1, 1)
fString = replace(fString, "</embed","&lt;/embed", 1, -1, 1)
fString = replace(fString, " on"," &#111;n", 1, -1, 1)
fString = replace(fString, " On"," &#79;n", 1, -1, 1)
fString = replace(fString, " oN"," &#111;N", 1, -1, 1)
fString = replace(fString, " ON"," &#79;N", 1, -1, 1)
fString = replace(fString, "%","&#37", 1, -1, 1)
fString = replace(fString, """javascript","&quot;javascript", 1, -1, 1)
fString = replace(fString, """Javascript","&quot;Javascript", 1, -1, 1)
fString = replace(fString, """JAVASCRIPT","&quot;JAVASCRIPT", 1, -1, 1)

_______________________
Dave Rosen
ProxySource.com
www.proxysource.com

Edited by - proxysource on 25 September 2000 02:24:12

gor
Retired Admin

Netherlands
5511 Posts

Posted - 25 September 2000 :  02:53:51  Show Profile  Visit gor's Homepage
Hmm, this was something to be looked at anyhow, I've been reading reports about HTMLEncode not handling different charactersets the right way and replacing it with this is sometimes said to be an option.

As to what needs to be added, ofcourse you also should put the reverse code in CleanCode() so the user sees the original code again when editing.
He/she might just be supplying a harmless listing of some HTML/ASP code as a response to a question and shouldn't have to care about how it is the application makes sure it is harmless code.

<b>Pierre Gorissen</b>

<font color=blue><font size=1>Sometimes it is more important to discover what one cannot do, than what one can do.</font id=blue></font id=size1>
<font size=1><font color=black><b>Lin Yutang</b></font id=size1></font id=black>
Go to Top of Page

proxysource
Starting Member

USA
19 Posts

Posted - 25 September 2000 :  17:44:42  Show Profile  Visit proxysource's Homepage
Good point about the CleanCode().

Of course, when HTML is on, there is a problem with folks that want to post HTML code as part of a response, rather than something to interpreted by the browser. I've added a feature to my forum where members can add a plain text box (using the <textarea></textarea> tags) in which code can be written without being interpreted.

_______________________
Dave Rosen
ProxySource.com
www.proxysource.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.12 seconds. Powered By: Snitz Forums 2000 Version 3.4.07