News for hackers. Stuff that matters.
Re:Is your Rails application safe? by simonw on Monday September 22, 2008 @03:26PM (#311528)
I'm very skeptical about the value of stripping HTML from user input - what if your site is a forum where people discuss HTML? Or a site where people might want to talk about the <head> conference? http://www.headconference.com/

Stripping HTML on input also means you lose the ability to audit attempted attacks against your site.

A much smarter strategy in my opinion is to escape everything on output. That way it doesn't matter what people submit to your site - unless you explicitly say "this is safe to display unescaped" in your templates harmful characters will be neutralised.

Re:Is your Rails application safe? by 100k on Monday September 22, 2008 @04:31PM (#311594)
Yup. I am suggesting escaping HTML on output (of user input) by default -- making h() the default, essentially.

(Incidentally, the reason why this will probably never happen is that it would break all of Rails' HTML helpers.)

There are several frameworks that do this already. Django even broke existing apps to make such a change.

Re:Is your Rails application safe? by tptacek on Monday September 22, 2008 @04:39PM (#311611)
This only stops the "hello world" attacks. Be careful not to give the impression that Django "solved" cross-site scripting; they clearly haven't.
Re:Is your Rails application safe? by simonw on Monday September 22, 2008 @05:18PM (#311656)
Any suggestions for other things we could be doing?
Re:Is your Rails application safe? by mtw on Monday September 22, 2008 @04:17PM (#311580)
white_list is a better option, imho