874
edits
(added code examples) |
(Removed section on untrusted HTML since it's no longer relevant) |
||
Line 4: | Line 4: | ||
If at all possible, see if you can implement your command using a [[Labs/Ubiquity/Locked-Down_Feed_Tutorial|Locked-Down Feed]]. Not only does it make it harder for any coding mistakes to accidentally harm the user, but it also makes it easier for the end-user to subscribe to, since they're not presented with a big [[Media:Warning.PNG|warning of doom]]. | If at all possible, see if you can implement your command using a [[Labs/Ubiquity/Locked-Down_Feed_Tutorial|Locked-Down Feed]]. Not only does it make it harder for any coding mistakes to accidentally harm the user, but it also makes it easier for the end-user to subscribe to, since they're not presented with a big [[Media:Warning.PNG|warning of doom]]. | ||
=== Escaping Text === | === Escaping Text === | ||
Line 76: | Line 35: | ||
Another alternative is to set an element's text contents using jQuery's <tt>text()</tt> method. | Another alternative is to set an element's text contents using jQuery's <tt>text()</tt> method. | ||
Even though preview areas are now contained in their own content-space IFRAME element, this is still useful (and it also allows users to use symbols like '<' and '>' in their selections!). | |||
== For Core Developers == | == For Core Developers == | ||
Check out the [https://www.owasp.org/index.php?title=XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet#You_Need_a_Security_Encoding_Library Cross-Site Scripting Prevention Cheat Sheet Cross-Site Scripting Prevention Cheat Sheet]. Ubiquity's <tt>chrome://</tt> pages—even the ones that just look like web pages—run in a trusted context, but they sometimes display untrusted content, such as text metadata for a Locked-Down feed; therefore we need to make sure that we're escaping the data properly. The stakes here are higher than they are for XSS attacks because rather than the attacker gaining control of a user's web experience on a single domain, they gain control of the user's entire computing experience. | Check out the [https://www.owasp.org/index.php?title=XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet#You_Need_a_Security_Encoding_Library Cross-Site Scripting Prevention Cheat Sheet Cross-Site Scripting Prevention Cheat Sheet]. Ubiquity's <tt>chrome://</tt> pages—even the ones that just look like web pages—run in a trusted context, but they sometimes display untrusted content, such as text metadata for a Locked-Down feed; therefore we need to make sure that we're escaping the data properly. The stakes here are higher than they are for XSS attacks because rather than the attacker gaining control of a user's web experience on a single domain, they gain control of the user's entire computing experience. |
edits