Re: How can i deactivate paste in a rich text edit box ?
- From: Lasse Reichstein Nielsen <lrn@xxxxxxxxxx>
- Date: Thu, 22 Sep 2005 00:19:46 +0200
"Seth Russell" <russell.seth@xxxxxxxxx> writes:
> The problem i still have is that i want to send the client a checker
> (probably exactly the one you have given me above) but i don't know
> where to install it in the javascript
Why? Or, more precisely: What problem are you trying to solve by that?
Remember that in non IE/Mozilla browsers, the textarea will be just
that, a plain HTML textarea.
If you really want to do validation of the field, either do it at
submission time, or in an "onchange" handler on the textarea.
Also remember to check all fields, including both title fields,
since they can also contain malicious HTML.
> (http://fastblogit.com/add/richtext.js) that is running the RTE box
> such that it will intervene between the client's paste of their
> clipboard.
Shouldn't be possible. Pasting is just a way of adding a lot of text
without typing it one character at a time, but
> That same routine won't be applied on the output at the
> server because then it would eliminate all the nice rich text editing,
> right ?
The idea was to remove bad HTML from the input, which means that it
never gets any further.
I have now checked the site, and can see that more formatting is
allowed than what my script would let through. The colors are set
using spans with style attributes, so that should be allowed too ...
and then you can't throw away all attributes, or even all style
attributes, so a more precise filtering is needed.
What you need to remove is then, at least:
Scripts:
* all script elements.
* all intrinsic event handlers (any attribute starting with "on" should do)
* all script urls (any url starting with a protocol not http or ftp,
both in links and image elements, and in style attributes)
* any iframe or object element (could embed another page with scripts).
Malicious HTML:
* any opening or closing comment
* any closing tag not matching an opening tag (throw in a </table> and see :).
* any starting tag not closed (especially those with CDATA content,
i.e., script, style and textarea)
With those gone, I'm fairly sure there is no scripting left, and the
HTML can be contained in its div (adding </table> or </div> could otherwise
mess up the layout).
I have done some testing (as anonymous user aaaaej) which messes things
up quite badly (I think I deleted them now, or maybe the Wizzard did :).
/L
--
Lasse Reichstein Nielsen - lrn@xxxxxxxxxx
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
.
- References:
- How can i deactivate paste in a rich text edit box ?
- From: Seth Russell
- Re: How can i deactivate paste in a rich text edit box ?
- From: Lasse Reichstein Nielsen
- Re: How can i deactivate paste in a rich text edit box ?
- From: Seth Russell
- Re: How can i deactivate paste in a rich text edit box ?
- From: Lasse Reichstein Nielsen
- Re: How can i deactivate paste in a rich text edit box ?
- From: Lasse Reichstein Nielsen
- Re: How can i deactivate paste in a rich text edit box ?
- From: Seth Russell
- How can i deactivate paste in a rich text edit box ?
- Prev by Date: Re: xmlhttprequest not working
- Next by Date: Re: xmlhttprequest not working
- Previous by thread: Re: How can i deactivate paste in a rich text edit box ?
- Next by thread: Re: How can i deactivate paste in a rich text edit box ?
- Index(es):
Relevant Pages
|
|