The Artima Developer Community
Sponsored Link

Web Buzz Forum
Sanitising HTML

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Stuart Langridge

Posts: 2006
Nickname: aquarius
Registered: Sep, 2003

Stuart Langridge is a web, JavaScript, and Python hacker, and sometimes all three at once.
Sanitising HTML Posted: Jan 10, 2010 3:28 PM
Reply to this message Reply

This post originated from an RSS feed registered with Web Buzz by Stuart Langridge.
Original Post: Sanitising HTML
Feed Title: as days pass by
Feed URL: http://feeds.feedburner.com/kryogenix
Feed Description: scratched tallies on the prison wall
Latest Web Buzz Posts
Latest Web Buzz Posts by Stuart Langridge
Latest Posts From as days pass by

Advertisement

It was pointed out to me that comments on my old posts were showing as raw HTML (you know, a sort of <p>this is a comment</p> sort of thing). I knew this. However, the reason it was like that is because it occurred to me about five minutes after releasing thort, the engine that now runs this place, that comment HTML was just displayed. Unsanitised.

Cross-site scripting, anyone? Oops.

So I just threw an "escape" filter into my comment template (which uses the great Trimpath JavaScript templating engine) so that I couldn't be brutally pwnt by anyone posting a comment.

Finally this evening I thought: I'd better do something about that. Two minutes of Googling brought me to Caja's HTML sanitizer, written in JavaScript. It was the work of but a moment to throw that into the CouchDB view that generates comments so that outputted comment HTML was sanitized. It was the work of but one more moment to also throw that into the client-side JavaScript that displays a posted comment. It's really nice being able to use exactly the same code on client and server.

Read: Sanitising HTML

Topic: Experience Secure Surfing With Comodo Firewall Previous Topic   Next Topic Topic: Is DZone Web Builder dying?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use