<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: eval(&#8216;foo=a&#8217;, obj.fn); How you aren&#8217;t private in Firefox</title>
	<atom:link href="http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 09 Feb 2012 06:55:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: shadedecho</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265638</link>
		<dc:creator>shadedecho</dc:creator>
		<pubDate>Thu, 03 Jul 2008 03:55:10 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265638</guid>
		<description>FYI: Andrea Giammarchi &quot;solved&quot; this problem here:

http://webreflection.blogspot.com/2008/07/scary-eval-and-futuristic-solution.html

I can&#039;t find any holes in the solution, yet.  But with this topic, I&#039;ve already been burned by speaking too soon, so I&#039;m cautiously optimistic.

Also, apparently FF3.1 is going to disable this &quot;bug&quot; (ie, feature), to the dismay of some, including Andrea.  I agree that it should be kept and has some really interesting benefits for introspection of closures and such.  Again, my original idea is that we could make a &quot;smarter&quot; eval where it would default to allowing access, but objects instances could specifically opt themselves out in some way, and the smart eval would respect that request.

That way, most objects could benefit from it, and those which really need to keep things &quot;private&quot; for some reason could in fact do that.</description>
		<content:encoded><![CDATA[<p>FYI: Andrea Giammarchi &#8220;solved&#8221; this problem here:</p>
<p><a href="http://webreflection.blogspot.com/2008/07/scary-eval-and-futuristic-solution.html" rel="nofollow">http://webreflection.blogspot.com/2008/07/scary-eval-and-futuristic-solution.html</a></p>
<p>I can&#8217;t find any holes in the solution, yet.  But with this topic, I&#8217;ve already been burned by speaking too soon, so I&#8217;m cautiously optimistic.</p>
<p>Also, apparently FF3.1 is going to disable this &#8220;bug&#8221; (ie, feature), to the dismay of some, including Andrea.  I agree that it should be kept and has some really interesting benefits for introspection of closures and such.  Again, my original idea is that we could make a &#8220;smarter&#8221; eval where it would default to allowing access, but objects instances could specifically opt themselves out in some way, and the smart eval would respect that request.</p>
<p>That way, most objects could benefit from it, and those which really need to keep things &#8220;private&#8221; for some reason could in fact do that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TNO</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265567</link>
		<dc:creator>TNO</dc:creator>
		<pubDate>Mon, 30 Jun 2008 23:38:47 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265567</guid>
		<description>Just an FYI from Brendan:

http://groups.google.com/group/google-caja-discuss/msg/ead8d8597a22c013</description>
		<content:encoded><![CDATA[<p>Just an FYI from Brendan:</p>
<p><a href="http://groups.google.com/group/google-caja-discuss/msg/ead8d8597a22c013" rel="nofollow">http://groups.google.com/group/google-caja-discuss/msg/ead8d8597a22c013</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: crock</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265544</link>
		<dc:creator>crock</dc:creator>
		<pubDate>Mon, 30 Jun 2008 17:08:50 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265544</guid>
		<description>I think too big a deal is being made of this. There has never been any safety in this language. That was not one of its goals. But experiments with ADsafe and Caja show that the language can be subsetted to provide safety. A safe subset must block access to the global object. The eval function provides such access, so it is already excluded by all safe subsets. Peter&#039;s report is shocking, but realistically, things are no worse. If you load third party code on your page and that code can use any form of eval, then you and your customers are screwed no matter what browser they are using.</description>
		<content:encoded><![CDATA[<p>I think too big a deal is being made of this. There has never been any safety in this language. That was not one of its goals. But experiments with ADsafe and Caja show that the language can be subsetted to provide safety. A safe subset must block access to the global object. The eval function provides such access, so it is already excluded by all safe subsets. Peter&#8217;s report is shocking, but realistically, things are no worse. If you load third party code on your page and that code can use any form of eval, then you and your customers are screwed no matter what browser they are using.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shadedecho</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265532</link>
		<dc:creator>shadedecho</dc:creator>
		<pubDate>Mon, 30 Jun 2008 00:49:15 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265532</guid>
		<description>@TNO-
This is very interesting, you indeed seem to have shown how this allows controlled read/write access to the internal variable &quot;a&quot;. That&#039;s a good start.

But, two things:  First of all, this syntax is incompatible with IE. So, to use it, all developers would have to browser sniff and return a different patterned public API for IE users (which don&#039;t have the dang eval problem) than for FF and others.  This could work.

But also, and more troubling, would be that the public API for a module could not contain anything other than functions which set or retrieved values, using the pattern you&#039;ve suggested. For instance, general functions which were intended to be able to have several parameters passed to them, and have some kind of operations done on them, would not be possible, as they would automatically open up the eval vulnerability. But, the set prop() functionality could only be used to pass in a single parameter, which means that any function which needed to pass in multiple values would have to do so by wrapping them in an array or object syntax.  This would mean that to keep the calling code from having to have browser-specific functioning, the API calls would all have to be kind of awkward, using the object/array wrap syntax for all parameters.

Both these limitations seem possible to leverage for most &quot;modules&quot;. But it certainly makes things a lot uglier. :(</description>
		<content:encoded><![CDATA[<p>@TNO-<br />
This is very interesting, you indeed seem to have shown how this allows controlled read/write access to the internal variable &#8220;a&#8221;. That&#8217;s a good start.</p>
<p>But, two things:  First of all, this syntax is incompatible with IE. So, to use it, all developers would have to browser sniff and return a different patterned public API for IE users (which don&#8217;t have the dang eval problem) than for FF and others.  This could work.</p>
<p>But also, and more troubling, would be that the public API for a module could not contain anything other than functions which set or retrieved values, using the pattern you&#8217;ve suggested. For instance, general functions which were intended to be able to have several parameters passed to them, and have some kind of operations done on them, would not be possible, as they would automatically open up the eval vulnerability. But, the set prop() functionality could only be used to pass in a single parameter, which means that any function which needed to pass in multiple values would have to do so by wrapping them in an array or object syntax.  This would mean that to keep the calling code from having to have browser-specific functioning, the API calls would all have to be kind of awkward, using the object/array wrap syntax for all parameters.</p>
<p>Both these limitations seem possible to leverage for most &#8220;modules&#8221;. But it certainly makes things a lot uglier. :(</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TNO</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265520</link>
		<dc:creator>TNO</dc:creator>
		<pubDate>Sat, 28 Jun 2008 17:37:19 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265520</guid>
		<description>Another attempt:

			var obj = function(){
				var a = 21;
				return {
					prop : undefined,
					get prop(){return a},
					set prop(x){
						if ((typeof x === &quot;function&quot;) &#124;&#124; (typeof x === object)) {
							return false;
						}
						else {
							a = x;
						}
					}
				}
			}();</description>
		<content:encoded><![CDATA[<p>Another attempt:</p>
<p>			var obj = function(){<br />
				var a = 21;<br />
				return {<br />
					prop : undefined,<br />
					get prop(){return a},<br />
					set prop(x){<br />
						if ((typeof x === &#8220;function&#8221;) || (typeof x === object)) {<br />
							return false;<br />
						}<br />
						else {<br />
							a = x;<br />
						}<br />
					}<br />
				}<br />
			}();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TNO</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265516</link>
		<dc:creator>TNO</dc:creator>
		<pubDate>Sat, 28 Jun 2008 14:02:06 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265516</guid>
		<description>Nevermind, even digging a deeper object hole just involved a few extra steps assigning pointers before assigning the variable.

var obj = function(){
	var Priv = function(){
		var a = 21;

		return {
			getA : function(){
				return a;
			}
		}
	}();

	return {
		fn: function(){
			return Priv.getA()
		}
	}
}();

alert(obj.fn()) //21
var foo;
eval(&quot;foo=Priv&quot;, obj.fn);
alert(foo); //[object Object]
alert(foo.getA()) //21
eval(&quot;foo=a&quot;,foo.getA)
alert(foo) //21</description>
		<content:encoded><![CDATA[<p>Nevermind, even digging a deeper object hole just involved a few extra steps assigning pointers before assigning the variable.</p>
<p>var obj = function(){<br />
	var Priv = function(){<br />
		var a = 21;</p>
<p>		return {<br />
			getA : function(){<br />
				return a;<br />
			}<br />
		}<br />
	}();</p>
<p>	return {<br />
		fn: function(){<br />
			return Priv.getA()<br />
		}<br />
	}<br />
}();</p>
<p>alert(obj.fn()) //21<br />
var foo;<br />
eval(&#8220;foo=Priv&#8221;, obj.fn);<br />
alert(foo); //[object Object]<br />
alert(foo.getA()) //21<br />
eval(&#8220;foo=a&#8221;,foo.getA)<br />
alert(foo) //21</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TNO</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265515</link>
		<dc:creator>TNO</dc:creator>
		<pubDate>Sat, 28 Jun 2008 13:42:57 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265515</guid>
		<description>Well, I guess you could just nest another object within it:

var obj = (function() {
	var Private = function(){
		var a = 21;
		
		return {
			getA : function(){
return a;
}
		}
	}

	return {
		fn: function(){
			return Private.getA();
		}
	}

})();

var foo;
eval(&quot;foo=Private&quot;, obj.fn);
alert(foo);</description>
		<content:encoded><![CDATA[<p>Well, I guess you could just nest another object within it:</p>
<p>var obj = (function() {<br />
	var Private = function(){<br />
		var a = 21;</p>
<p>		return {<br />
			getA : function(){<br />
return a;<br />
}<br />
		}<br />
	}</p>
<p>	return {<br />
		fn: function(){<br />
			return Private.getA();<br />
		}<br />
	}</p>
<p>})();</p>
<p>var foo;<br />
eval(&#8220;foo=Private&#8221;, obj.fn);<br />
alert(foo);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shadedecho</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265513</link>
		<dc:creator>shadedecho</dc:creator>
		<pubDate>Sat, 28 Jun 2008 13:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265513</guid>
		<description>@TNO-
The point is that a malicious or prying person CAN do this with your object (even though you provided them with a getter function, they can end-around you):

eval(&#039;foo=b&#039;,obj.fn) and get directly at your internal, &quot;private&quot; variable b, either gettings it&#039;s value into foo, or eval(&#039;b=500&#039;,obj.fn) and change your internal variable without you being in control.  This is the bad thing.  :(</description>
		<content:encoded><![CDATA[<p>@TNO-<br />
The point is that a malicious or prying person CAN do this with your object (even though you provided them with a getter function, they can end-around you):</p>
<p>eval(&#8216;foo=b&#8217;,obj.fn) and get directly at your internal, &#8220;private&#8221; variable b, either gettings it&#8217;s value into foo, or eval(&#8216;b=500&#8242;,obj.fn) and change your internal variable without you being in control.  This is the bad thing.  :(</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: richtaur</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265507</link>
		<dc:creator>richtaur</dc:creator>
		<pubDate>Sat, 28 Jun 2008 03:47:24 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265507</guid>
		<description>&quot;It just doesn&#039;t provide any security in a major browser.&quot; So the lesson is to never assume you have security in scripts like these, which we already knew.</description>
		<content:encoded><![CDATA[<p>&#8220;It just doesn&#8217;t provide any security in a major browser.&#8221; So the lesson is to never assume you have security in scripts like these, which we already knew.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TNO</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265503</link>
		<dc:creator>TNO</dc:creator>
		<pubDate>Sat, 28 Jun 2008 01:09:05 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265503</guid>
		<description>umm...why not just do this?

var obj = (function() {
  var b = 21;
	function a(){
		return b;
	}
  return {
    fn: a
  };
})();

var foo;
eval(&#039;foo=a&#039;, obj.fn);
alert(foo);</description>
		<content:encoded><![CDATA[<p>umm&#8230;why not just do this?</p>
<p>var obj = (function() {<br />
  var b = 21;<br />
	function a(){<br />
		return b;<br />
	}<br />
  return {<br />
    fn: a<br />
  };<br />
})();</p>
<p>var foo;<br />
eval(&#8216;foo=a&#8217;, obj.fn);<br />
alert(foo);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shadedecho</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265493</link>
		<dc:creator>shadedecho</dc:creator>
		<pubDate>Fri, 27 Jun 2008 18:28:02 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265493</guid>
		<description>nm, AGAIN... i hang my head in shame and retreat. I rang the winner&#039;s bell way too early. 

it now appears from my further testing that in fact this dang parameter gives full access to the entire *private* scope, regardless of the presence of closure or anything. just one publicly exposed function, even an anonymous, empty one without any closure ties to the internals, grants eval() full read/write access to the entire internal scope of your module. ugh. i give up.  :)</description>
		<content:encoded><![CDATA[<p>nm, AGAIN&#8230; i hang my head in shame and retreat. I rang the winner&#8217;s bell way too early. </p>
<p>it now appears from my further testing that in fact this dang parameter gives full access to the entire *private* scope, regardless of the presence of closure or anything. just one publicly exposed function, even an anonymous, empty one without any closure ties to the internals, grants eval() full read/write access to the entire internal scope of your module. ugh. i give up.  :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shadedecho</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265492</link>
		<dc:creator>shadedecho</dc:creator>
		<pubDate>Fri, 27 Jun 2008 17:58:06 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265492</guid>
		<description>so, in other words, they are &quot;protected&quot;, not &quot;private&quot;. sucks, but not as much as &quot;public&quot;.  :)</description>
		<content:encoded><![CDATA[<p>so, in other words, they are &#8220;protected&#8221;, not &#8220;private&#8221;. sucks, but not as much as &#8220;public&#8221;.  :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shadedecho</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265491</link>
		<dc:creator>shadedecho</dc:creator>
		<pubDate>Fri, 27 Jun 2008 17:50:46 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265491</guid>
		<description>IMPORTANT: it should be pointed out that even though it appears that someone can gain access to the VALUES of the modules &quot;private&quot; members, it appears to only give a read-only access, or copy thereof, because it does not appear you can affect the value of either an internal variable (like &quot;a&quot; above) or overwrite a protected function.

This means that the &quot;security&quot; vulnerability is significantly abated in that all a hacker can do is see what the values are (which they can probably do by view-source anyway!) but they cannot change the values, at least from what I&#039;ve tested so far.</description>
		<content:encoded><![CDATA[<p>IMPORTANT: it should be pointed out that even though it appears that someone can gain access to the VALUES of the modules &#8220;private&#8221; members, it appears to only give a read-only access, or copy thereof, because it does not appear you can affect the value of either an internal variable (like &#8220;a&#8221; above) or overwrite a protected function.</p>
<p>This means that the &#8220;security&#8221; vulnerability is significantly abated in that all a hacker can do is see what the values are (which they can probably do by view-source anyway!) but they cannot change the values, at least from what I&#8217;ve tested so far.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shadedecho</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265489</link>
		<dc:creator>shadedecho</dc:creator>
		<pubDate>Fri, 27 Jun 2008 17:40:07 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265489</guid>
		<description>nm... still suffers from the darn &quot;delete&quot;</description>
		<content:encoded><![CDATA[<p>nm&#8230; still suffers from the darn &#8220;delete&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shadedecho</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265486</link>
		<dc:creator>shadedecho</dc:creator>
		<pubDate>Fri, 27 Jun 2008 17:21:58 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265486</guid>
		<description>oops... here&#039;s the rest:

&lt; _root.childNodes.length; i++) {
			try { _root[i].eval = s_eval; _recurseDOM(_root[i]); } catch (err) { }
		}
	}
	catch (err2) { }
})(document.getElementsByTagName(&quot;html&quot;));


})();


var obj = (function() {
var a = 21;
return {
fn: function() {a;}
};
})();</description>
		<content:encoded><![CDATA[<p>oops&#8230; here&#8217;s the rest:</p>
<p>&lt; _root.childNodes.length; i++) {<br />
			try { _root[i].eval = s_eval; _recurseDOM(_root[i]); } catch (err) { }<br />
		}<br />
	}<br />
	catch (err2) { }<br />
})(document.getElementsByTagName(&#8220;html&#8221;));</p>
<p>})();</p>
<p>var obj = (function() {<br />
var a = 21;<br />
return {<br />
fn: function() {a;}<br />
};<br />
})();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shadedecho</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265485</link>
		<dc:creator>shadedecho</dc:creator>
		<pubDate>Fri, 27 Jun 2008 17:20:25 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265485</guid>
		<description>or what about this:

(function(){
var _eval = eval;
var s_eval = eval = function(str) {
	_eval(str);
}
this.__defineGetter__(&quot;eval&quot;, function(){
	return s_eval;
});
window.__defineSetter__(&quot;eval&quot;, function(val){
	alert(&#039;not allowed&#039;);
});
var _oldCE = document.createElement;
document.createElement = function(type) {
	var obj = _oldCE(type);
	obj.contentWindow.eval = s_eval;
}
window.eval = s_eval;
(function recurseDOM(_root) {
	if (typeof _root === undefined &#124;&#124; _root === null) return;

	try {
		for (var i=0; i</description>
		<content:encoded><![CDATA[<p>or what about this:</p>
<p>(function(){<br />
var _eval = eval;<br />
var s_eval = eval = function(str) {<br />
	_eval(str);<br />
}<br />
this.__defineGetter__(&#8220;eval&#8221;, function(){<br />
	return s_eval;<br />
});<br />
window.__defineSetter__(&#8220;eval&#8221;, function(val){<br />
	alert(&#8216;not allowed&#8217;);<br />
});<br />
var _oldCE = document.createElement;<br />
document.createElement = function(type) {<br />
	var obj = _oldCE(type);<br />
	obj.contentWindow.eval = s_eval;<br />
}<br />
window.eval = s_eval;<br />
(function recurseDOM(_root) {<br />
	if (typeof _root === undefined || _root === null) return;</p>
<p>	try {<br />
		for (var i=0; i</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shadedecho</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265484</link>
		<dc:creator>shadedecho</dc:creator>
		<pubDate>Fri, 27 Jun 2008 16:55:22 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265484</guid>
		<description>I wonder if we could somehow overwrite the prototype (maybe Object.prototype) so that even newly created objects don&#039;t have the old eval but rather have the new &quot;secure&quot; eval instead.</description>
		<content:encoded><![CDATA[<p>I wonder if we could somehow overwrite the prototype (maybe Object.prototype) so that even newly created objects don&#8217;t have the old eval but rather have the new &#8220;secure&#8221; eval instead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nuxodin</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265483</link>
		<dc:creator>nuxodin</dc:creator>
		<pubDate>Fri, 27 Jun 2008 16:48:26 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265483</guid>
		<description>@Jordan

You are right, its not possible to make it not work.

I tried this:
(function() {
	var _eval = eval;
	var s_eval = eval = function(str) {
		_eval(str);
	}
	this.__defineGetter__(&quot;eval&quot;, function(){
        return s_eval;
    });
	window.__defineSetter__(&quot;eval&quot;, function(val){
		alert(&#039;not allowed&#039;)
	});
})();


but you can allways:

document.getElementById(&#039;test&#039;).contentWindow.eval(&#039;foo=a&#039;, obj.fn)</description>
		<content:encoded><![CDATA[<p>@Jordan</p>
<p>You are right, its not possible to make it not work.</p>
<p>I tried this:<br />
(function() {<br />
	var _eval = eval;<br />
	var s_eval = eval = function(str) {<br />
		_eval(str);<br />
	}<br />
	this.__defineGetter__(&#8220;eval&#8221;, function(){<br />
        return s_eval;<br />
    });<br />
	window.__defineSetter__(&#8220;eval&#8221;, function(val){<br />
		alert(&#8216;not allowed&#8217;)<br />
	});<br />
})();</p>
<p>but you can allways:</p>
<p>document.getElementById(&#8216;test&#8217;).contentWindow.eval(&#8216;foo=a&#8217;, obj.fn)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PeterMichaux</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265479</link>
		<dc:creator>PeterMichaux</dc:creator>
		<pubDate>Fri, 27 Jun 2008 16:10:03 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265479</guid>
		<description>Jordan,

Yours is tidier and &quot;delete&quot; is a language operator so would be hard or impossible to secure. There are probably many ways to workaround any patch attempting to secure &quot;eval&quot;.</description>
		<content:encoded><![CDATA[<p>Jordan,</p>
<p>Yours is tidier and &#8220;delete&#8221; is a language operator so would be hard or impossible to secure. There are probably many ways to workaround any patch attempting to secure &#8220;eval&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jordan</title>
		<link>http://ajaxian.com/archives/evalfooa-objfn-how-you-arent-private-in-firefox/comment-page-1#comment-265477</link>
		<dc:creator>Jordan</dc:creator>
		<pubDate>Fri, 27 Jun 2008 16:01:50 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3801#comment-265477</guid>
		<description>@PeterMichaux:
How about just:
eval = function() {alert(&quot;eval not allowed!&quot;);};
eval(&quot;alert(&#039;evaled!&#039;);&quot;);  //eval not allowed
delete eval;
eval(&quot;alert(&#039;evaled!&#039;);&quot;);  //evaled</description>
		<content:encoded><![CDATA[<p>@PeterMichaux:<br />
How about just:<br />
eval = function() {alert(&#8220;eval not allowed!&#8221;);};<br />
eval(&#8220;alert(&#8216;evaled!&#8217;);&#8221;);  //eval not allowed<br />
delete eval;<br />
eval(&#8220;alert(&#8216;evaled!&#8217;);&#8221;);  //evaled</p>
]]></content:encoded>
	</item>
</channel>
</rss>

