]> Pileus Git - ~andy/sunrise/blob - www-client/torbrowser/files/0001-Block-Components.interfaces-lookupMethod-from-conten.patch
ba0da286aebc1d517bb9e0abdac420ef92b11c11
[~andy/sunrise] / www-client / torbrowser / files / 0001-Block-Components.interfaces-lookupMethod-from-conten.patch
1 From 67b86f0c22070cbf86112174ae1e2ce6d6a36dee Mon Sep 17 00:00:00 2001
2 From: Mike Perry <mikeperry-git@torproject.org>
3 Date: Wed, 1 Feb 2012 15:40:40 -0800
4 Subject: [PATCH 01/13] Block Components.interfaces,lookupMethod from content
5
6 This patch removes the ability of content script to access
7 Components.interfaces.* as well as call or access Components.lookupMethod.
8
9 These two interfaces seem to be exposed to content script only to make our
10 lives difficult. Components.lookupMethod can undo our JS hooks, and
11 Components.interfaces is useful for fingerprinting the platform, OS, and
12 Firebox version.
13
14 They appear to have no other legitimate use. See also:
15 https://bugzilla.mozilla.org/show_bug.cgi?id=429070
16 https://trac.torproject.org/projects/tor/ticket/2873
17 https://trac.torproject.org/projects/tor/ticket/2874
18 ---
19  js/xpconnect/src/XPCComponents.cpp |    8 ++++++--
20  1 files changed, 6 insertions(+), 2 deletions(-)
21
22 diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp
23 index 3bcbf91..d5c020a 100644
24 --- a/js/xpconnect/src/XPCComponents.cpp
25 +++ b/js/xpconnect/src/XPCComponents.cpp
26 @@ -4456,7 +4456,9 @@ nsXPCComponents::CanCreateWrapper(const nsIID * iid, char **_retval)
27  NS_IMETHODIMP
28  nsXPCComponents::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
29  {
30 -    static const char* allowed[] = { "isSuccessCode", "lookupMethod", nsnull };
31 +    // XXX: Pref observer? Also, is this what we want? Seems like a plan
32 +    //static const char* allowed[] = { "isSuccessCode", "lookupMethod", nsnull };
33 +    static const char* allowed[] = { "isSuccessCode", nsnull };
34      *_retval = xpc_CheckAccessList(methodName, allowed);
35      return NS_OK;
36  }
37 @@ -4465,7 +4467,9 @@ nsXPCComponents::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, c
38  NS_IMETHODIMP
39  nsXPCComponents::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
40  {
41 -    static const char* allowed[] = { "interfaces", "interfacesByID", "results", nsnull};
42 +    // XXX: Pref observer? Also, is this what we want? Seems like a plan
43 +    //    static const char* allowed[] = { "interfaces", "interfacesByID", "results", nsnull};
44 +    static const char* allowed[] = { "results", nsnull};
45      *_retval = xpc_CheckAccessList(propertyName, allowed);
46      return NS_OK;
47  }
48 -- 
49 1.7.5.4
50