• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Form input security

Explorer ,
Nov 13, 2007 Nov 13, 2007

Copy link to clipboard

Copied

I have heard a lot about hackers submitting code through forms to jack with websites and I'm trying to avoid this without pissing off my users. Right now I just reject a post if they use < or >. However I'm finding users are needing to use those symbols.

Question, are using HTMLCodeFormat() or HTMLEditFormat() safe ways of displaying user entered tags and preventing hacker scripts? My assumption is no. Any best practice ideas on this?

Thanks!!
TOPICS
Advanced techniques

Views

224

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Nov 13, 2007 Nov 13, 2007
you can use a rereplace() unction with a regexp to strip out all html
from the user's input prior to inserting it into your db.
there are several udf's over at www.cflib.org that can do that for you.
some are general, others target specific html (like script tags).
a very basic one would be something like:
rereplace(your-var-holding-user-submitted-text, '<[^>]*>', '', 'ALL')

hth

---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate
LEGEND ,
Nov 13, 2007 Nov 13, 2007

Copy link to clipboard

Copied

you can use a rereplace() unction with a regexp to strip out all html
from the user's input prior to inserting it into your db.
there are several udf's over at www.cflib.org that can do that for you.
some are general, others target specific html (like script tags).
a very basic one would be something like:
rereplace(your-var-holding-user-submitted-text, '<[^>]*>', '', 'ALL')

hth

---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 14, 2007 Nov 14, 2007

Copy link to clipboard

Copied

LATEST
Perfect, thanks a lot, thats what I needed. That website looks like a great coldfusion resource

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation