TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-22-2008, 12:39 PM   #1 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default editor bug ! click here

hi
i have a texteditor so my visitors can make text bold center......
the name of this editor is tinymc
but the problem if someone stop javascript from running in his browser , he can add tags
and thats a problem :s:s
and if i add htmlentities and her brothers for security
the result is not what i want bcz its like that for exemple
PHP Code:
<b>morocco</b
and i want it to be actually bold instead
is there a solution ???
__________________
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 01-22-2008, 02:45 PM   #2 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

Using TinyMCE for public web applications is cool, but do not use them on the front side of the site since it's all hackable. You can exist divs, tables, bolds, links and much more. That's why it's only smart to entrust it to the administrator since he obviously doesn't want to mess up his site.

Second, stopping Javascript is pretty stupid to be honest. Proxies do it all the time, but that's why most of them also don't accept cookies and sessions. If you want give the public the opportunity to make their text bold, you should use BBCode from the "What You See Is What You Get" (WYSIWYG Editor). You can also create your own BBCode but that's a little bit harder to do.

Hope this helped. If not, I can help you out on it but using TinyMCE on the front side of the site, is not smart.

Good luck!
__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
The Following User Says Thank You to ReSpawN For This Useful Post:
webtuto (01-22-2008)
Old 01-22-2008, 02:59 PM   #3 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

thanks man
so WYSIWYG Editor is safer than tinymc
and i can use it ?
__________________
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 01-22-2008, 03:55 PM   #4 (permalink)
The Frequenter
 
xenon's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
xenon is on a distinguished road
Default

TinyMCE IS itself a WYSIWYG editor. lol. He ment you should use the simple textareas which are based on a simple set of tags, and don't render HTML (like this forum's post editor - although this editor has a rich text editing option. for a cheaper implementation see phpBB2 - post editor).
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
xenon is offline  
Reply With Quote
Old 01-22-2008, 04:06 PM   #5 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

thanks
but what should i do ?
i cant code it by myself :s
__________________
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 01-22-2008, 08:51 PM   #6 (permalink)
The Acquainted
Upcoming Programmer 
 
CMellor's Avatar
 
Join Date: Sep 2007
Location: Leeds, UK
Posts: 141
Thanks: 6
CMellor is on a distinguished road
Default

I use TinyMCE and when submitting that data into the database, I turn all that HTML code into RAW code, then when I output it again, I use html_entity_decode.
__________________
Not quite a n00b...
CMellor is offline  
Reply With Quote
Old 01-22-2008, 09:57 PM   #7 (permalink)
The Acquainted
 
wGEric's Avatar
 
Join Date: Nov 2007
Posts: 166
Thanks: 0
wGEric is on a distinguished road
Default

Quote:
Originally Posted by ReSpawN View Post
Using TinyMCE for public web applications is cool, but do not use them on the front side of the site since it's all hackable. You can exist divs, tables, bolds, links and much more. That's why it's only smart to entrust it to the administrator since he obviously doesn't want to mess up his site.
If you provide the proper checks on the server side to make sure only the HTML you want is getting through then it is fine to have a WYSIWYG editor that everyone can use. The only problem is that you can't rely on the client side to validate submitted data because like his user, you can always get by it. Server side validation is the only safe validation.

Quote:
If you want give the public the opportunity to make their text bold, you should use BBCode from the "What You See Is What You Get" (WYSIWYG Editor). You can also create your own BBCode but that's a little bit harder to do.
TinyMCE has a BBCode editor in it so you can still have the WYSIWYG and use bbcode instead. Only thing you'd have to do is alter how the submitted data is displayed. Also add your htmlspecialchars() so no HTML is allowed.

Quote:
Originally Posted by CMellor
I use TinyMCE and when submitting that data into the database, I turn all that HTML code into RAW code, then when I output it again, I use html_entity_decode.
The XSS issue is still there. HTML is being displayed which was submitted by users.
__________________
Eric
wGEric is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 07:26 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design