I'd just like to weigh in on this (old) discussion. Ext JS really should escape all input.
The problem
Consider a web app using a JSON api. All serious JSON apis send
raw data. They do not html encode the data over the wire! Examples are the twitter api, amazon api, google api. I'm not talking about CSS, I just mean they send "some tweet by <adam>" not "some tweet by <adam>".
So this means we must htmlescape() on the client side when we recieve the data before we write to the DOM. The only question is who is responsible for the escaping.
Who is responsible?
I believe Ext is responsible. Why?
- The framework should protect beginners from this problem
- Ext has a well defined set of widgets for which to escape. My point being once you've written a big insecure web application its probably more sensible to subclass all the Ext widgets you use and implement escaping anyway. So this should just happen in Ext.
- As mentioned earlier the naming of properties and methods is not consistient. Consider TreeNode::setText which does not escape input. This should be called TreeNode::setHTML
An example of a framework which does autoescape automatically is the django template layer. They went through a painful API transition to do this but the framework comes out much more secure. You can read the rationale for the change:
http://code.djangoproject.com/wiki/AutoEscaping
http://groups.google.com/group/djang...62232b73?pli=1
http://groups.google.com/group/djang...c34ce7cc96e283
The only real rationale I can think of for not doing this is lack of resources which is fair enough. But right now Ext makes it very hard to write a complex secure webapp.