| Page 1 of 1 | [ 4 posts ] |
|
Heads up everyone, if you use widgets such as autocomplete or datatable, you may be vulnerable to a stored XSS attack if you aren't specifying explicit formatters for textual data. The default formatters YUI supplies render textual data as HTML markup. In particular, if the textual data contains tags (such as script tags), those tags will be added to the page as live HTML. That may not be what you want.
Datatable supplies a formatter (formatText) which renders strings as text, escaping HTML brackets and ampersands. For autocomplete, you are going to have to copy the formatText implementation and override your autocomlete instance's formatResult method with it. As far as I know, autocomplete doesn't supply a proper formatter for textual data, nor is there a general YUI function which takes strings and outputs HTML text with entities. |
|
The same problem happens with the YUI Menu widget as well. In addition, the API documentation is misleading. In the documentation for the addItem method, it says one parameter represents a "String specifying the text of the item to be added to the menu." Actually, the string is interpreted as an HTML fragment, not text. You have to do the HTML escaping yourself.
|
|
Thanks for calling out these problems. If you haven't already, would you mind filing bugs for these and any other potential XSS vectors you find? That'll be the most reliable way to ensure they get in front of a developer immediately and that they're prioritized and fixed for the next release.
|
|
How does cross site affect the formatters?
|
| Page 1 of 1 | [ 4 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group