﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Matt Shannon commented on Resolving cross site scripting issues.</title><description>To further elaborate on Steve Gentile's comment, it is better to build a string up and update the DOM a single time rather than updating it per row.
  
  
See 
[http://jqfundamentals.com/book/book.html](http://jqfundamentals.com/book/book.html) and 
[blog.rebeccamurphey.com/in-search-of-javascript...](http://blog.rebeccamurphey.com/in-search-of-javascript-developers-a-gist)</description><link>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment16</link><guid>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment16</guid><pubDate>Tue, 21 Sep 2010 06:26:02 GMT</pubDate></item><item><title>Michael Fever commented on Resolving cross site scripting issues.</title><description>Not all browsers show it the same way, but they will direct you to the line # of the problem.  Chrome has the best devtools .. worth checking out.
</description><link>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment15</link><guid>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment15</guid><pubDate>Tue, 21 Sep 2010 02:06:31 GMT</pubDate></item><item><title>Miranda commented on Resolving cross site scripting issues.</title><description>Or... you could just encode everything? I'm not sure what this is all about.
</description><link>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment14</link><guid>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment14</guid><pubDate>Sun, 19 Sep 2010 20:16:40 GMT</pubDate></item><item><title>Jonas commented on Resolving cross site scripting issues.</title><description>Fixing just one instance of a problem is a sin You definitely have more problems like that and one alone is enough to hijack another user's credentials.
</description><link>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment13</link><guid>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment13</guid><pubDate>Sun, 19 Sep 2010 19:58:26 GMT</pubDate></item><item><title>Steve Gentile commented on Resolving cross site scripting issues.</title><description>As above that JsonDiv is getting wrapped twice
  
  
It was recommended to me to use $jsonDiv as a variable name to make it clear that it was already a wrapped jQuery object
</description><link>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment12</link><guid>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment12</guid><pubDate>Sat, 18 Sep 2010 20:55:49 GMT</pubDate></item><item><title>Luke commented on Resolving cross site scripting issues.</title><description>Oops...my bad Oren. 
</description><link>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment11</link><guid>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment11</guid><pubDate>Sat, 18 Sep 2010 19:25:22 GMT</pubDate></item><item><title>Felipe Fujiy commented on Resolving cross site scripting issues.</title><description>I didn´t understand why that string is show in UI and executing too.
</description><link>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment10</link><guid>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment10</guid><pubDate>Sat, 18 Sep 2010 18:54:15 GMT</pubDate></item><item><title>Ayende Rahien commented on Resolving cross site scripting issues.</title><description>Marcus,
  
That is the same behavior in all browsers.
</description><link>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment9</link><guid>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment9</guid><pubDate>Sat, 18 Sep 2010 12:47:40 GMT</pubDate></item><item><title>Marcus commented on Resolving cross site scripting issues.</title><description>@Andrew: thanks thats explains it
  
  
He seems to be using Chrome though, according to the first image,
  
maybe Chrome has that functionality too.
</description><link>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment8</link><guid>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment8</guid><pubDate>Sat, 18 Sep 2010 12:24:22 GMT</pubDate></item><item><title>Andrew commented on Resolving cross site scripting issues.</title><description>@Marcus: At least in Firebug when the javascript  'debugger;' statement is encountered; this simulates a breakpoint.
</description><link>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment7</link><guid>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment7</guid><pubDate>Sat, 18 Sep 2010 12:21:06 GMT</pubDate></item><item><title>tobi commented on Resolving cross site scripting issues.</title><description>Nice technique. Are 100% percent sure that the "key" is already encoded as well? At the very least it can contain umlauts which have to be html encoded (or you might find yourself debugging a much harder problem a year in the future).
</description><link>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment6</link><guid>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment6</guid><pubDate>Sat, 18 Sep 2010 12:14:46 GMT</pubDate></item><item><title>Marcus commented on Resolving cross site scripting issues.</title><description>@Mike: no thats not what I mean,
  
  
I mean the other yellow-marked word 'debugger', how does that bring him to the line of javascript code?
</description><link>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment5</link><guid>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment5</guid><pubDate>Sat, 18 Sep 2010 11:56:47 GMT</pubDate></item><item><title>Ken Egozi commented on Resolving cross site scripting issues.</title><description>you should look into some kind of string templating instead of the concatenations
  
  
EJS is a great pick. it gives you a syntax similar to php/asp/ERB that is extremely familiar.
  
  
so you'd be creating the markup in using a view, then transferring the markup built to jQuery to be inserted to the DOM
</description><link>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment4</link><guid>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment4</guid><pubDate>Sat, 18 Sep 2010 11:49:31 GMT</pubDate></item><item><title>Mike Scott commented on Resolving cross site scripting issues.</title><description>Oren, sweet use of the debugger breakpoint!
  
  
I also wanted to suggest chaining the calls to append() in your jquery to prevent doing the $(childDiv) lookup multiple times, for example.
</description><link>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment3</link><guid>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment3</guid><pubDate>Sat, 18 Sep 2010 11:49:13 GMT</pubDate></item><item><title>Mike Scott commented on Resolving cross site scripting issues.</title><description>Marcus
  
  
Do you mean the tooltip that displays the value of the children variable? Because the value isn't HTML encoded, any javascript will be inserted straight into that 
&lt;span as is and thus will be executed on the browser - in this case a debugger breakpoint and then a call to the alert() function.
&gt;</description><link>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment2</link><guid>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment2</guid><pubDate>Sat, 18 Sep 2010 11:44:24 GMT</pubDate></item><item><title>Marcus commented on Resolving cross site scripting issues.</title><description>Excuse my incompetence but can you elaborate the connection between the yellowish debbuger variable and the javascript line of code?
</description><link>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment1</link><guid>http://ayende.com/4633/resolving-cross-site-scripting-issues#comment1</guid><pubDate>Sat, 18 Sep 2010 10:49:14 GMT</pubDate></item></channel></rss>