Gentoo Archives: gentoo-commits

From: "Julian Ospald (hasufell)" <hasufell@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in www-client/torbrowser/files/torbrowser-patches: 0014-Add-DDG-and-StartPage-to-Omnibox.patch 0010-Provide-client-values-only-to-CSS-Media-Queries.patch 0001-Block-Components.interfaces-lookupMethod-from-conten.patch 0017-Randomize-HTTP-request-order-and-pipeline-depth.patch 0018-Add-HTTP-auth-headers-before-the-modify-request-obse.patch 0008-Disable-SSL-Session-ID-tracking.patch 0011-Limit-the-number-of-fonts-per-document.patch 0009-Provide-an-observer-event-to-close-persistent-connec.patch 0003-Make-Intermediate-Cert-Store-memory-only.patch 0006-Make-content-pref-service-memory-only-clearable.patch 0004-Add-a-string-based-cacheKey.patch 0016-Prevent-WebSocket-DNS-leak.patch 0002-Make-Permissions-Manager-memory-only.patch 0007-Make-Tor-Browser-exit-when-not-launched-from-Vidalia.patch 0005-Block-all-plugins-except-flash.patch 0012-Rebrand-Firefox-to-TorBrowser.patch 0013-Make-Download-manager-memory-only.patch 0015-Make-nsICacheSe rvice.EvictEntrie s-synchronous.patch
Date: Wed, 06 Jun 2012 22:21:19
Message-Id: 20120606222108.86CB42004B@flycatcher.gentoo.org
1 hasufell 12/06/06 22:21:08
2
3 Added: 0014-Add-DDG-and-StartPage-to-Omnibox.patch
4 0010-Provide-client-values-only-to-CSS-Media-Queries.patch
5 0001-Block-Components.interfaces-lookupMethod-from-conten.patch
6 0017-Randomize-HTTP-request-order-and-pipeline-depth.patch
7 0018-Add-HTTP-auth-headers-before-the-modify-request-obse.patch
8 0008-Disable-SSL-Session-ID-tracking.patch
9 0011-Limit-the-number-of-fonts-per-document.patch
10 0009-Provide-an-observer-event-to-close-persistent-connec.patch
11 0003-Make-Intermediate-Cert-Store-memory-only.patch
12 0006-Make-content-pref-service-memory-only-clearable.patch
13 0004-Add-a-string-based-cacheKey.patch
14 0016-Prevent-WebSocket-DNS-leak.patch
15 0002-Make-Permissions-Manager-memory-only.patch
16 0007-Make-Tor-Browser-exit-when-not-launched-from-Vidalia.patch
17 0005-Block-all-plugins-except-flash.patch
18 0012-Rebrand-Firefox-to-TorBrowser.patch
19 0013-Make-Download-manager-memory-only.patch
20 0015-Make-nsICacheService.EvictEntries-synchronous.patch
21 Log:
22 version bump/dump... tor upstream switched to ESR
23
24 (Portage version: 2.2.0_alpha110/cvs/Linux x86_64)
25
26 Revision Changes Path
27 1.1 www-client/torbrowser/files/torbrowser-patches/0014-Add-DDG-and-StartPage-to-Omnibox.patch
28
29 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0014-Add-DDG-and-StartPage-to-Omnibox.patch?rev=1.1&view=markup
30 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0014-Add-DDG-and-StartPage-to-Omnibox.patch?rev=1.1&content-type=text/plain
31
32 Index: 0014-Add-DDG-and-StartPage-to-Omnibox.patch
33 ===================================================================
34 From bac6dfa9b86a7389ab5217be629ec2c490dcf193 Mon Sep 17 00:00:00 2001
35 From: Mike Perry <mikeperry-git@××××××××××.org>
36 Date: Wed, 25 Apr 2012 15:03:46 -0700
37 Subject: [PATCH 14/18] Add DDG and StartPage to Omnibox.
38
39 You mean there are search engines that don't require captchas if you don't
40 have a cookie? Holy crap. Get those in there now.
41 ---
42 browser/locales/en-US/searchplugins/duckduckgo.xml | 29 ++++++++++++++++++++
43 browser/locales/en-US/searchplugins/list.txt | 2 +
44 browser/locales/en-US/searchplugins/startpage.xml | 11 +++++++
45 3 files changed, 42 insertions(+), 0 deletions(-)
46 create mode 100644 browser/locales/en-US/searchplugins/duckduckgo.xml
47 create mode 100644 browser/locales/en-US/searchplugins/startpage.xml
48
49 diff --git a/browser/locales/en-US/searchplugins/duckduckgo.xml b/browser/locales/en-US/searchplugins/duckduckgo.xml
50 new file mode 100644
51 index 0000000..4f00b4d
52 --- /dev/null
53 +++ b/browser/locales/en-US/searchplugins/duckduckgo.xml
54 @@ -0,0 +1,29 @@
55 +<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
56 +<ShortName>DuckDuckGo</ShortName>
57 +<Description>Duck Duck Go</Description>
58 +<InputEncoding>UTF-8</InputEncoding>
59 +<Image width="16" height="16">data:image/png;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAANcNAADXDQAAAAAA
60 +AAAAAAAAAAAAAAAAAAAAAAAAAAAAJyDsJmlk8pf6+v3s/v7+++zr/fcnIOyzJyDsgCcg7CYAAAAA
61 +AAAAAAAAAAAAAAAAAAAAAAAAAAAnIOwBJyDscCcg7PZttJ7/7Pfs//////++xO7/S5GA/ycg7P8n
62 +IOz2JyDscCcg7AEAAAAAAAAAAAAAAAAnIOwBJyDstScg7P8nIOz/Y8p5/2fHZf9Yv0z/YcF2/1rB
63 +Uv8nIOz/JyDs/ycg7P8nIOy1JyDsAQAAAAAAAAAAJyDscCcg7P8nIOz/JyDs/4jQoP/p9+n/////
64 +/05X3v9LkYD/JyDs/ycg7P8nIOz/JyDs/ycg7HAAAAAAJyDsJicg7PYnIOz/JyDs/zUu7f/+/v//
65 +//////////89N+7/JyDs/yUo7f8nIOz/JyDs/ycg7P8nIOz2JyDsJicg7IAnIOz/JyDs/ycg7P9h
66 +XPH////////////t/P//GIr2/wfD+/8Gyfz/DKv5/yM57/8nIOz/JyDs/ycg7H8nIOyzJyDs/ycg
67 +7P8nIOz/jov1////////////Otz9/w3G/P8cWfH/JSvt/ycg7P8nIOz/JyDs/ycg7P8nIOyzJyDs
68 +5icg7P8nIOz/JyDs/7u5+f///////////27l/v8E0v3/BNL9/wTQ/f8Oofn/IT7v/ycg7P8nIOz/
69 +JyDs5icg7OYnIOz/JyDs/ycg7P/p6P3/uWsC////////////5fr//6Po/f8Thfb/DKv5/w6f+f8n IOz/JyDs/ycg7OYnIOyzJyDs/ycg7P8nIOz/9/b+/////////////////7lrAv/V1Pv/JyDs/ycg
70 +7P8nIOz/JyDs/ycg7P8nIOyzJyDsgCcg7P8nIOz/JyDs/8/N+///////////////////////iIX1
71 +/ycg7P8nIOz/JyDs/ycg7P8nIOz/JyDsfycg7CYnIOz2JyDs/ycg7P9FP+7/q6n4/+7u/f/n5v3/
72 +fXn0/yoj7P8nIOz/JyDs/ycg7P8nIOz/JyDs9icg7CYAAAAAJyDscCcg7P8nIOz/wsD6/+no/f/Y
73 +1/z/eHTz/ycg7P8nIOz/JyDs/ycg7P8nIOz/JyDs/ycg7HAAAAAAAAAAACcg7AEnIOy1JyDs/ycg
74 +7P8nIOz/JyDs/ycg7P8nIOz/JyDs/ycg7P8nIOz/JyDs/ycg7LUnIOwBAAAAAAAAAAAAAAAAJyDs
75 +AScg7HAnIOz2JyDs/ycg7P8nIOz/JyDs/ycg7P8nIOz/JyDs9icg7HAnIOwBAAAAAAAAAAAAAAAA
76 +AAAAAAAAAAAAAAAAJyDsJicg7IAnIOyzJyDs5icg7OYnIOyzJyDsgCcg7CYAAAAAAAAAAAAAAAAA
77 +AAAA+B8AAPAPAADAAwAAwAMAAIABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAACAAQAAwAMAAMAD
78 +AADwDwAA+B8AAA==</Image>
79 +<Url type="text/html" method="POST" template="https://duckduckgo.com/html/">
80 + <Param name="q" value="{searchTerms}"/>
81 +</Url>
82 +<SearchForm>https://duckduckgo.com/html/</SearchForm>
83 +</SearchPlugin>
84 diff --git a/browser/locales/en-US/searchplugins/list.txt b/browser/locales/en-US/searchplugins/list.txt
85 index 2a1141a..0466f4e 100644
86 --- a/browser/locales/en-US/searchplugins/list.txt
87 +++ b/browser/locales/en-US/searchplugins/list.txt
88 @@ -1,7 +1,9 @@
89 amazondotcom
90 bing
91 +duckduckgo
92 eBay
93 google
94 +startpage
95 twitter
96 wikipedia
97 yahoo
98 diff --git a/browser/locales/en-US/searchplugins/startpage.xml b/browser/locales/en-US/searchplugins/startpage.xml
99 new file mode 100644
100 index 0000000..1a310b1
101 --- /dev/null
102 +++ b/browser/locales/en-US/searchplugins/startpage.xml
103 @@ -0,0 +1,11 @@
104 +<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
105 +<ShortName>Startpage</ShortName>
106 +<Description>Start Page</Description>
107 +<InputEncoding>UTF-8</InputEncoding>
108 +<Image width="16" height="16">data:image/png;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2jkj+9YtD/vWLQ/71i0P+9otD/vaLRP72i0T+9YtE/vWLRP72i0T+9otD/vaNRP72jUT+9otF/vaLRf73kkv+9Yc///WJP//1iT//9Yk///rAmf/94Mz/+sCa//aRTv/1iUH/9ok///aJP//2i0H/9otB//aJQv/2iUL/9otC//aNRP/2jUT/9o1E//aNRP/6wpv////////////96dr/95dQ//aNRP/2kET/9pBG//aQRv/2kEb/9pBG//aRR//3lEz/95BH//mueP/7xJ3/959g//efYf/4p23//vDm//3p2//3kEr/95FJ//aRSf/niFH/95FK//aRSv/2mE//95hS/vq4iP/////////////////81bj/95xZ//q4iP//////+bF+//eZT//njFT/PSqi/2xGjv/2mVD/951V/vedVv783cX///////vQrf/++PP///////748//+8uj///////m3gf/olFr/PSuj/w8Pt/9sSJD/951V//eeWf73oVv++8ul///////5sXf/+KRi//vRsf////////////3r3v/olF//Piyk/w8Pt/9sSJH/+J5Z//ieWv/3oV/++KZf/vihXP/97N7//vn0//zTs//6wJP/+bBy//q6iP/onW//Piyl/w8Pt/8fGbH/m2iB/+icY//4pGD/96hl/viqZf74pmD/+Kxr//3iy/////////n1//ivbP/onGj/Pi2m/w8Pt/8uJKz/fFeQ/x8Zsf8+Lqb/6J9r//ivbP74rm3++Klm//mpZv/5q2f/+bR9//m0e//poW7/Pi6n/w8Pt/9sTZj/+Ktp//ira/+rd4P/Dw+3/4xijv/5snH++
109 LN1/vmvbf/5r23/+a5t//mvb//4r2//TTuk/w8Pt/8fGrL/6ah1//ivcP/4r3P/q3yI/w8Pt/+MZpP/+bN5/vm4ev75t3X/+bV1//m1df/5t3X/+Ld3/8qUhP98XZn/Hxqz/+mse//5t3f/2p+B/x8as/8PD7f/u4qK//m7fv76u4D++bl7//m3fP/5uXz/+bl8//m5fP/5t3z/+bl//x8as/9NPKf/fWCb/x8as/8PD7f/bVOh//q5f//6v4X++sGI/vm9g//5voX/+b6F//m9hf/6vYX/+r6F//nCh/+bepr/Hxu0/w8Pt/8PD7f/fWOh//q+hf/6wof/+saN/vrGjf75xIv/+ceL//nEi//5xIv/+sSL//rHi//6x43/+ceN/+m7kP+7lpj/6ruQ//rHkP/6x43/+seQ//rLlf76ypT++seR//rJkf/6yZH/+seR//rJkf/6yZH/+8mR//vJlP/7yZT/+smU//rJlP/6yZT/+8yV//rJlf/6zpn+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</Image>
110 +
111 +<Url type="text/html" method="POST" template="https://startpage.com/do/search">
112 + <Param name="q" value="{searchTerms}"/>
113 +</Url>
114 +<SearchForm>https://startpage.com/do/search/</SearchForm>
115 +</SearchPlugin>
116 --
117 1.7.5.4
118
119
120
121
122 1.1 www-client/torbrowser/files/torbrowser-patches/0010-Provide-client-values-only-to-CSS-Media-Queries.patch
123
124 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0010-Provide-client-values-only-to-CSS-Media-Queries.patch?rev=1.1&view=markup
125 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0010-Provide-client-values-only-to-CSS-Media-Queries.patch?rev=1.1&content-type=text/plain
126
127 Index: 0010-Provide-client-values-only-to-CSS-Media-Queries.patch
128 ===================================================================
129 From ee455135f0084be04e74952182e4f948643c5347 Mon Sep 17 00:00:00 2001
130 From: Mike Perry <mikeperry-git@××××××.org>
131 Date: Tue, 20 Dec 2011 21:02:49 -0800
132 Subject: [PATCH 10/18] Provide client values only to CSS Media Queries
133
134 Also disable a bunch of Mozilla extensions that smell like they are
135 fingerprintable.
136
137 This is done to address
138 https://www.torproject.org/projects/torbrowser/design/#fingerprinting-linkability
139 ---
140 layout/style/nsMediaFeatures.cpp | 10 ++++++----
141 1 files changed, 6 insertions(+), 4 deletions(-)
142
143 diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp
144 index 6eca06e..c68f191 100644
145 --- a/layout/style/nsMediaFeatures.cpp
146 +++ b/layout/style/nsMediaFeatures.cpp
147 @@ -383,14 +383,14 @@ nsMediaFeatures::features[] = {
148 nsMediaFeature::eMinMaxAllowed,
149 nsMediaFeature::eLength,
150 { nsnull },
151 - GetDeviceWidth
152 + GetWidth
153 },
154 {
155 &nsGkAtoms::deviceHeight,
156 nsMediaFeature::eMinMaxAllowed,
157 nsMediaFeature::eLength,
158 { nsnull },
159 - GetDeviceHeight
160 + GetHeight
161 },
162 {
163 &nsGkAtoms::orientation,
164 @@ -411,7 +411,7 @@ nsMediaFeatures::features[] = {
165 nsMediaFeature::eMinMaxAllowed,
166 nsMediaFeature::eIntRatio,
167 { nsnull },
168 - GetDeviceAspectRatio
169 + GetAspectRatio
170 },
171 {
172 &nsGkAtoms::color,
173 @@ -457,6 +457,7 @@ nsMediaFeatures::features[] = {
174 },
175
176 // Mozilla extensions
177 +/*
178 {
179 &nsGkAtoms::_moz_device_pixel_ratio,
180 nsMediaFeature::eMinMaxAllowed,
181 @@ -469,7 +470,7 @@ nsMediaFeatures::features[] = {
182 nsMediaFeature::eMinMaxNotAllowed,
183 nsMediaFeature::eEnumerated,
184 { kOrientationKeywords },
185 - GetDeviceOrientation
186 + GetOrientation
187 },
188 {
189 &nsGkAtoms::_moz_is_resource_document,
190 @@ -590,6 +591,7 @@ nsMediaFeatures::features[] = {
191 { nsnull },
192 GetWindowsTheme
193 },
194 +*/
195 // Null-mName terminator:
196 {
197 nsnull,
198 --
199 1.7.5.4
200
201
202
203
204 1.1 www-client/torbrowser/files/torbrowser-patches/0001-Block-Components.interfaces-lookupMethod-from-conten.patch
205
206 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0001-Block-Components.interfaces-lookupMethod-from-conten.patch?rev=1.1&view=markup
207 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0001-Block-Components.interfaces-lookupMethod-from-conten.patch?rev=1.1&content-type=text/plain
208
209 Index: 0001-Block-Components.interfaces-lookupMethod-from-conten.patch
210 ===================================================================
211 From 18fea351a9f218893514ccbca82c492ce81d038d Mon Sep 17 00:00:00 2001
212 From: Mike Perry <mikeperry-git@××××××××××.org>
213 Date: Wed, 1 Feb 2012 15:40:40 -0800
214 Subject: [PATCH 01/18] Block Components.interfaces,lookupMethod from content
215
216 This patch removes the ability of content script to access
217 Components.interfaces.* as well as call or access Components.lookupMethod.
218
219 These two interfaces seem to be exposed to content script only to make our
220 lives difficult. Components.lookupMethod can undo our JS hooks, and
221 Components.interfaces is useful for fingerprinting the platform, OS, and
222 Firebox version.
223
224 They appear to have no other legitimate use. See also:
225 https://bugzilla.mozilla.org/show_bug.cgi?id=429070
226 https://trac.torproject.org/projects/tor/ticket/2873
227 https://trac.torproject.org/projects/tor/ticket/2874
228 ---
229 js/xpconnect/src/XPCComponents.cpp | 8 ++++++--
230 1 files changed, 6 insertions(+), 2 deletions(-)
231
232 diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp
233 index 3bcbf91..d5c020a 100644
234 --- a/js/xpconnect/src/XPCComponents.cpp
235 +++ b/js/xpconnect/src/XPCComponents.cpp
236 @@ -4456,7 +4456,9 @@ nsXPCComponents::CanCreateWrapper(const nsIID * iid, char **_retval)
237 NS_IMETHODIMP
238 nsXPCComponents::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
239 {
240 - static const char* allowed[] = { "isSuccessCode", "lookupMethod", nsnull };
241 + // XXX: Pref observer? Also, is this what we want? Seems like a plan
242 + //static const char* allowed[] = { "isSuccessCode", "lookupMethod", nsnull };
243 + static const char* allowed[] = { "isSuccessCode", nsnull };
244 *_retval = xpc_CheckAccessList(methodName, allowed);
245 return NS_OK;
246 }
247 @@ -4465,7 +4467,9 @@ nsXPCComponents::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, c
248 NS_IMETHODIMP
249 nsXPCComponents::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
250 {
251 - static const char* allowed[] = { "interfaces", "interfacesByID", "results", nsnull};
252 + // XXX: Pref observer? Also, is this what we want? Seems like a plan
253 + // static const char* allowed[] = { "interfaces", "interfacesByID", "results", nsnull};
254 + static const char* allowed[] = { "results", nsnull};
255 *_retval = xpc_CheckAccessList(propertyName, allowed);
256 return NS_OK;
257 }
258 --
259 1.7.5.4
260
261
262
263
264 1.1 www-client/torbrowser/files/torbrowser-patches/0017-Randomize-HTTP-request-order-and-pipeline-depth.patch
265
266 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0017-Randomize-HTTP-request-order-and-pipeline-depth.patch?rev=1.1&view=markup
267 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0017-Randomize-HTTP-request-order-and-pipeline-depth.patch?rev=1.1&content-type=text/plain
268
269 Index: 0017-Randomize-HTTP-request-order-and-pipeline-depth.patch
270 ===================================================================
271 From 60d369378ea65b1502ba2ab28a851318e7910a64 Mon Sep 17 00:00:00 2001
272 From: Mike Perry <mikeperry-git@××××××××××.org>
273 Date: Wed, 6 Jun 2012 11:08:56 -0700
274 Subject: [PATCH 17/18] Randomize HTTP request order and pipeline depth.
275
276 This is an experimental defense against
277 http://lorre.uni.lu/~andriy/papers/acmccs-wpes11-fingerprinting.pdf
278
279 See:
280 https://blog.torproject.org/blog/experimental-defense-website-traffic-fingerprinting
281
282 This defense has been improved since that blog post to additionally randomize
283 the order and concurrency of non-pipelined HTTP requests.
284 ---
285 netwerk/protocol/http/nsHttpConnectionMgr.cpp | 136 ++++++++++++++++++++++++-
286 netwerk/protocol/http/nsHttpConnectionMgr.h | 5 +
287 2 files changed, 136 insertions(+), 5 deletions(-)
288
289 diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
290 index 23ef893..788368f 100644
291 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
292 +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
293 @@ -94,6 +94,12 @@ nsHttpConnectionMgr::nsHttpConnectionMgr()
294 {
295 LOG(("Creating nsHttpConnectionMgr @%x\n", this));
296 mCT.Init();
297 +
298 + nsresult rv;
299 + mRandomGenerator = do_GetService("@mozilla.org/security/random-generator;1", &rv);
300 + if (NS_FAILED(rv)) {
301 + mRandomGenerator = nsnull;
302 + }
303 }
304
305 nsHttpConnectionMgr::~nsHttpConnectionMgr()
306 @@ -342,8 +348,12 @@ nsHttpConnectionMgr::AddTransactionToPipeline(nsHttpPipeline *pipeline)
307 nsConnectionEntry *ent = mCT.Get(ci->HashKey());
308 if (ent) {
309 // search for another request to pipeline...
310 - PRInt32 i, count = ent->mPendingQ.Length();
311 - for (i=0; i<count; ++i) {
312 + PRInt32 i, h, count = ent->mPendingQ.Length();
313 + PRInt32* ind = new PRInt32[count];
314 + ShuffleRequestOrder((PRUint32*)ind, (PRUint32)count);
315 +
316 + for (h=0; h<count; ++h) {
317 + i = ind[h]; // random request sequence
318 nsHttpTransaction *trans = ent->mPendingQ[i];
319 if (trans->Caps() & NS_HTTP_ALLOW_PIPELINING) {
320 pipeline->AddTransaction(trans);
321 @@ -354,6 +364,8 @@ nsHttpConnectionMgr::AddTransactionToPipeline(nsHttpPipeline *pipeline)
322 break;
323 }
324 }
325 +
326 + delete [] ind;
327 }
328 }
329 }
330 @@ -585,12 +597,17 @@ nsHttpConnectionMgr::ProcessPendingQForEntry(nsConnectionEntry *ent)
331 LOG(("nsHttpConnectionMgr::ProcessPendingQForEntry [ci=%s]\n",
332 ent->mConnInfo->HashKey().get()));
333
334 - PRInt32 i, count = ent->mPendingQ.Length();
335 + PRUint32 h, i = 0, count = ent->mPendingQ.Length();
336 if (count > 0) {
337 LOG((" pending-count=%u\n", count));
338 nsHttpTransaction *trans = nsnull;
339 nsHttpConnection *conn = nsnull;
340 - for (i=0; i<count; ++i) {
341 +
342 + PRUint32* ind = new PRUint32[count];
343 + ShuffleRequestOrder(ind, count);
344 +
345 + for (h=0; h<count; ++h) {
346 + i = ind[h]; // random request sequence
347 trans = ent->mPendingQ[i];
348
349 // When this transaction has already established a half-open
350 @@ -610,6 +627,7 @@ nsHttpConnectionMgr::ProcessPendingQForEntry(nsConnectionEntry *ent)
351 if (conn)
352 break;
353 }
354 + delete [] ind;
355 if (conn) {
356 LOG((" dispatching pending transaction...\n"));
357
358 @@ -694,6 +712,19 @@ nsHttpConnectionMgr::AtActiveConnectionLimit(nsConnectionEntry *ent, PRUint8 cap
359 maxPersistConns = mMaxPersistConnsPerHost;
360 }
361
362 + // Fuzz maxConns for website fingerprinting attack
363 + // We create a range of maxConns/5 up to 6*maxConns/5
364 + // because this function is called repeatedly, and we'll
365 + // end up converging to the high side of concurrent connections
366 + // after a short while.
367 + PRUint8 *bytes = nsnull;
368 + nsresult rv = mRandomGenerator->GenerateRandomBytes(1, &bytes);
369 + NS_ENSURE_SUCCESS(rv, rv);
370 +
371 + bytes[0] = bytes[0] % (maxConns + 1);
372 + maxConns = (maxConns/5) + bytes[0];
373 + NS_Free(bytes);
374 +
375 // use >= just to be safe
376 return (totalCount >= maxConns) || ( (caps & NS_HTTP_ALLOW_KEEPALIVE) &&
377 (persistCount >= maxPersistConns) );
378 @@ -865,7 +896,7 @@ nsHttpConnectionMgr::DispatchTransaction(nsConnectionEntry *ent,
379 nsHttpPipeline *pipeline = nsnull;
380 if (conn->SupportsPipelining() && (caps & NS_HTTP_ALLOW_PIPELINING)) {
381 LOG((" looking to build pipeline...\n"));
382 - if (BuildPipeline(ent, trans, &pipeline))
383 + if (BuildRandomizedPipeline(ent, trans, &pipeline))
384 trans = pipeline;
385 }
386
387 @@ -938,6 +969,101 @@ nsHttpConnectionMgr::BuildPipeline(nsConnectionEntry *ent,
388 return true;
389 }
390
391 +
392 +// Generate a shuffled request ordering sequence
393 +void
394 +nsHttpConnectionMgr::ShuffleRequestOrder(PRUint32 *ind, PRUint32 count)
395 +{
396 + PRUint32 i;
397 + PRUint32 *rints;
398 +
399 + for (i=0; i<count; ++i) {
400 + ind[i] = i;
401 + }
402 + nsresult rv = mRandomGenerator->GenerateRandomBytes(sizeof(PRUint32)*count,
403 + (PRUint8**)&rints);
404 + if (NS_FAILED(rv))
405 + return; // Leave unshuffled if error
406 +
407 + for (i=0; i < count; ++i) {
408 + PRInt32 temp = ind[i];
409 + ind[i] = ind[rints[i]%count];
410 + ind[rints[i]%count] = temp;
411 + }
412 + NS_Free(rints);
413 +}
414 +
415 +bool
416 +nsHttpConnectionMgr::BuildRandomizedPipeline(nsConnectionEntry *ent,
417 + nsAHttpTransaction *firstTrans,
418 + nsHttpPipeline **result)
419 +{
420 + if (mRandomGenerator == nsnull)
421 + return BuildPipeline(ent, firstTrans, result);
422 + if (mMaxPipelinedRequests < 2)
423 + return PR_FALSE;
424 +
425 + nsresult rv;
426 + PRUint8 *bytes = nsnull;
427 +
428 + nsHttpPipeline *pipeline = nsnull;
429 + nsHttpTransaction *trans;
430 +
431 + PRUint32 i = 0, numAdded = 0, numAllowed = 0;
432 + PRUint32 max = 0;
433 +
434 + while (i < ent->mPendingQ.Length()) {
435 + if (ent->mPendingQ[i]->Caps() & NS_HTTP_ALLOW_PIPELINING)
436 + numAllowed++;
437 + i++;
438 + }
439 +
440 + rv = mRandomGenerator->GenerateRandomBytes(1, &bytes);
441 + NS_ENSURE_SUCCESS(rv, rv);
442 + // 4...12
443 + max = 4 + (bytes[0] % (mMaxPipelinedRequests + 1));
444 + NS_Free(bytes);
445 +
446 + while (numAllowed > 0) {
447 + rv = mRandomGenerator->GenerateRandomBytes(1, &bytes);
448 + NS_ENSURE_SUCCESS(rv, rv);
449 + i = bytes[0] % ent->mPendingQ.Length();
450 + NS_Free(bytes);
451 +
452 + trans = ent->mPendingQ[i];
453 +
454 + if (!(ent->mPendingQ[i]->Caps() & NS_HTTP_ALLOW_PIPELINING))
455 + continue;
456 +
457 + if (numAdded == 0) {
458 + pipeline = new nsHttpPipeline;
459 + if (!pipeline)
460 + return PR_FALSE;
461 + pipeline->AddTransaction(firstTrans);
462 + numAdded = 1;
463 + }
464 + pipeline->AddTransaction(trans);
465 +
466 + // remove transaction from pending queue
467 + ent->mPendingQ.RemoveElementAt(i);
468 + NS_RELEASE(trans);
469 +
470 + numAllowed--;
471 +
472 + if (++numAdded == max)
473 + break;
474 + }
475 +
476 + //fprintf(stderr, "Yay!!! pipelined %u/%u transactions\n", numAdded, max);
477 + LOG((" pipelined %u/%u transactions\n", numAdded, max));
478 +
479 + if (numAdded == 0)
480 + return PR_FALSE;
481 +
482 + NS_ADDREF(*result = pipeline);
483 + return PR_TRUE;
484 +}
485 +
486 nsresult
487 nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans)
488 {
489 diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.h b/netwerk/protocol/http/nsHttpConnectionMgr.h
490 index cdf21a9..81b282a 100644
491 --- a/netwerk/protocol/http/nsHttpConnectionMgr.h
492 +++ b/netwerk/protocol/http/nsHttpConnectionMgr.h
493 @@ -51,6 +51,7 @@
494
495 #include "nsIObserver.h"
496 #include "nsITimer.h"
497 +#include "nsIRandomGenerator.h"
498
499 class nsHttpPipeline;
500
501 @@ -276,6 +277,8 @@ private:
502 nsresult DispatchTransaction(nsConnectionEntry *, nsAHttpTransaction *,
503 PRUint8 caps, nsHttpConnection *);
504 bool BuildPipeline(nsConnectionEntry *, nsAHttpTransaction *, nsHttpPipeline **);
505 + bool BuildRandomizedPipeline(nsConnectionEntry *, nsAHttpTransaction *, nsHttpPipeline **);
506 + void ShuffleRequestOrder(PRUint32 *, PRUint32);
507 nsresult ProcessNewTransaction(nsHttpTransaction *);
508 nsresult EnsureSocketThreadTargetIfOnline();
509 void ClosePersistentConnections(nsConnectionEntry *ent);
510 @@ -353,6 +356,8 @@ private:
511 PRUint64 mTimeOfNextWakeUp;
512 // Timer for next pruning of dead connections.
513 nsCOMPtr<nsITimer> mTimer;
514 + // Random number generator for reordering HTTP pipeline
515 + nsCOMPtr<nsIRandomGenerator> mRandomGenerator;
516
517 //
518 // the connection table
519 --
520 1.7.5.4
521
522
523
524
525 1.1 www-client/torbrowser/files/torbrowser-patches/0018-Add-HTTP-auth-headers-before-the-modify-request-obse.patch
526
527 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0018-Add-HTTP-auth-headers-before-the-modify-request-obse.patch?rev=1.1&view=markup
528 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0018-Add-HTTP-auth-headers-before-the-modify-request-obse.patch?rev=1.1&content-type=text/plain
529
530 Index: 0018-Add-HTTP-auth-headers-before-the-modify-request-obse.patch
531 ===================================================================
532 From 8c741c1ee9b05e23582047df6179bc7344864011 Mon Sep 17 00:00:00 2001
533 From: Mike Perry <mikeperry-git@××××××.org>
534 Date: Fri, 2 Sep 2011 15:33:20 -0700
535 Subject: [PATCH 18/18] Add HTTP auth headers before the modify-request
536 observer.
537
538 Otherwise, how are we supposed to modify them?
539
540 Thanks to Georg Koppen for spotting both the problem and this fix.
541 ---
542 netwerk/protocol/http/nsHttpChannel.cpp | 11 +++++++----
543 1 files changed, 7 insertions(+), 4 deletions(-)
544
545 diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp
546 index 97bd84c..6205d62 100644
547 --- a/netwerk/protocol/http/nsHttpChannel.cpp
548 +++ b/netwerk/protocol/http/nsHttpChannel.cpp
549 @@ -316,9 +316,6 @@ nsHttpChannel::Connect(bool firstTime)
550 return NS_ERROR_DOCUMENT_NOT_CACHED;
551 }
552
553 - // check to see if authorization headers should be included
554 - mAuthProvider->AddAuthorizationHeaders();
555 -
556 if (mLoadFlags & LOAD_NO_NETWORK_IO) {
557 return NS_ERROR_DOCUMENT_NOT_CACHED;
558 }
559 @@ -3707,6 +3704,9 @@ nsHttpChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *context)
560
561 AddCookiesToRequest();
562
563 + // check to see if authorization headers should be included
564 + mAuthProvider->AddAuthorizationHeaders();
565 +
566 // notify "http-on-modify-request" observers
567 gHttpHandler->OnModifyRequest(this);
568
569 @@ -4817,7 +4817,10 @@ nsHttpChannel::DoAuthRetry(nsAHttpConnection *conn)
570 // this authentication attempt (bug 84794).
571 // TODO: save cookies from auth response and send them here (bug 572151).
572 AddCookiesToRequest();
573 -
574 +
575 + // check to see if authorization headers should be included
576 + mAuthProvider->AddAuthorizationHeaders();
577 +
578 // notify "http-on-modify-request" observers
579 gHttpHandler->OnModifyRequest(this);
580
581 --
582 1.7.5.4
583
584
585
586
587 1.1 www-client/torbrowser/files/torbrowser-patches/0008-Disable-SSL-Session-ID-tracking.patch
588
589 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0008-Disable-SSL-Session-ID-tracking.patch?rev=1.1&view=markup
590 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0008-Disable-SSL-Session-ID-tracking.patch?rev=1.1&content-type=text/plain
591
592 Index: 0008-Disable-SSL-Session-ID-tracking.patch
593 ===================================================================
594 From 70161b38e1855ce4b7a61ac1e9572fb07dfbedda Mon Sep 17 00:00:00 2001
595 From: Mike Perry <mikeperry-git@××××××.org>
596 Date: Wed, 7 Dec 2011 19:36:38 -0800
597 Subject: [PATCH 08/18] Disable SSL Session ID tracking.
598
599 We can't easily bind SSL Session ID tracking to url bar domain,
600 so we have to disable them to satisfy
601 https://www.torproject.org/projects/torbrowser/design/#identifier-linkability.
602 ---
603 security/nss/lib/ssl/sslsock.c | 2 +-
604 1 files changed, 1 insertions(+), 1 deletions(-)
605
606 diff --git a/security/nss/lib/ssl/sslsock.c b/security/nss/lib/ssl/sslsock.c
607 index 28e6210..fa48ecd 100644
608 --- a/security/nss/lib/ssl/sslsock.c
609 +++ b/security/nss/lib/ssl/sslsock.c
610 @@ -173,7 +173,7 @@ static sslOptions ssl_defaults = {
611 PR_FALSE, /* enableSSL2 */ /* now defaults to off in NSS 3.13 */
612 PR_TRUE, /* enableSSL3 */
613 PR_TRUE, /* enableTLS */ /* now defaults to on in NSS 3.0 */
614 - PR_FALSE, /* noCache */
615 + PR_TRUE, /* noCache */
616 PR_FALSE, /* fdx */
617 PR_FALSE, /* v2CompatibleHello */ /* now defaults to off in NSS 3.13 */
618 PR_TRUE, /* detectRollBack */
619 --
620 1.7.5.4
621
622
623
624
625 1.1 www-client/torbrowser/files/torbrowser-patches/0011-Limit-the-number-of-fonts-per-document.patch
626
627 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0011-Limit-the-number-of-fonts-per-document.patch?rev=1.1&view=markup
628 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0011-Limit-the-number-of-fonts-per-document.patch?rev=1.1&content-type=text/plain
629
630 Index: 0011-Limit-the-number-of-fonts-per-document.patch
631 ===================================================================
632 From 6eff7de2e19b0970b04b8721be4f46577617894c Mon Sep 17 00:00:00 2001
633 From: Mike Perry <mikeperry-git@××××××××××.org>
634 Date: Wed, 1 Feb 2012 16:01:21 -0800
635 Subject: [PATCH 11/18] Limit the number of fonts per document.
636
637 We create two prefs:
638 browser.display.max_font_count and browser.display.max_font_attempts.
639 max_font_count sets a limit on the number of fonts actually used in the
640 document, and max_font_attempts sets a limit on the total number of CSS
641 queries that a document is allowed to perform.
642
643 Once either limit is reached, the browser behaves as if
644 browser.display.use_document_fonts was set to 0 for subsequent font queries.
645
646 If a pref is not set or is negative, that limit does not apply.
647
648 This is done to address:
649 https://www.torproject.org/projects/torbrowser/design/#fingerprinting-linkability
650 ---
651 layout/base/nsPresContext.cpp | 100 +++++++++++++++++++++++++++++++++++++++++
652 layout/base/nsPresContext.h | 9 ++++
653 layout/style/nsRuleNode.cpp | 13 ++++-
654 3 files changed, 119 insertions(+), 3 deletions(-)
655
656 diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp
657 index e1587db..9690d9c 100644
658 --- a/layout/base/nsPresContext.cpp
659 +++ b/layout/base/nsPresContext.cpp
660 @@ -98,6 +98,8 @@
661 #include "FrameLayerBuilder.h"
662 #include "nsDOMMediaQueryList.h"
663 #include "nsSMILAnimationController.h"
664 +#include "nsString.h"
665 +#include "nsUnicharUtils.h"
666
667 #ifdef IBMBIDI
668 #include "nsBidiPresUtils.h"
669 @@ -706,6 +708,10 @@ nsPresContext::GetUserPreferences()
670 // * use fonts?
671 mUseDocumentFonts =
672 Preferences::GetInt("browser.display.use_document_fonts") != 0;
673 + mMaxFonts =
674 + Preferences::GetInt("browser.display.max_font_count", -1);
675 + mMaxFontAttempts =
676 + Preferences::GetInt("browser.display.max_font_attempts", -1);
677
678 // * replace backslashes with Yen signs? (bug 245770)
679 mEnableJapaneseTransform =
680 @@ -1300,6 +1306,100 @@ nsPresContext::GetDefaultFont(PRUint8 aFontID) const
681 return font;
682 }
683
684 +PRBool
685 +nsPresContext::FontUseCountReached(const nsFont &font) {
686 + if (mMaxFonts < 0) {
687 + return PR_FALSE;
688 + }
689 +
690 + for (PRUint32 i = 0; i < mFontsUsed.Length(); i++) {
691 + if (mFontsUsed[i].name.Equals(font.name,
692 + nsCaseInsensitiveStringComparator())
693 + // XXX: Style is sometimes filled with garbage??
694 + /*&& mFontsUsed[i].style == font.style*/) {
695 + // seen it before: OK
696 + return PR_FALSE;
697 + }
698 + }
699 +
700 + if (mFontsUsed.Length() >= mMaxFonts) {
701 + return PR_TRUE;
702 + }
703 +
704 + return PR_FALSE;
705 +}
706 +
707 +PRBool
708 +nsPresContext::FontAttemptCountReached(const nsFont &font) {
709 + if (mMaxFontAttempts < 0) {
710 + return PR_FALSE;
711 + }
712 +
713 + for (PRUint32 i = 0; i < mFontsTried.Length(); i++) {
714 + if (mFontsTried[i].name.Equals(font.name,
715 + nsCaseInsensitiveStringComparator())
716 + // XXX: Style is sometimes filled with garbage??
717 + /*&& mFontsTried[i].style == font.style*/) {
718 + // seen it before: OK
719 + return PR_FALSE;
720 + }
721 + }
722 +
723 + if (mFontsTried.Length() >= mMaxFontAttempts) {
724 + return PR_TRUE;
725 + }
726 +
727 + return PR_FALSE;
728 +}
729 +
730 +void
731 +nsPresContext::AddFontUse(const nsFont &font) {
732 + if (mMaxFonts < 0) {
733 + return;
734 + }
735 +
736 + for (PRUint32 i = 0; i < mFontsUsed.Length(); i++) {
737 + if (mFontsUsed[i].name.Equals(font.name,
738 + nsCaseInsensitiveStringComparator())
739 + // XXX: Style is sometimes filled with garbage??
740 + /*&& mFontsUsed[i].style == font.style*/) {
741 + // seen it before: OK
742 + return;
743 + }
744 + }
745 +
746 + if (mFontsUsed.Length() >= mMaxFonts) {
747 + return;
748 + }
749 +
750 + mFontsUsed.AppendElement(font);
751 + return;
752 +}
753 +
754 +void
755 +nsPresContext::AddFontAttempt(const nsFont &font) {
756 + if (mMaxFontAttempts < 0) {
757 + return;
758 + }
759 +
760 + for (PRUint32 i = 0; i < mFontsTried.Length(); i++) {
761 + if (mFontsTried[i].name.Equals(font.name,
762 + nsCaseInsensitiveStringComparator())
763 + // XXX: Style is sometimes filled with garbage??
764 + /*&& mFontsTried[i].style == font.style*/) {
765 + // seen it before: OK
766 + return;
767 + }
768 + }
769 +
770 + if (mFontsTried.Length() >= mMaxFontAttempts) {
771 + return;
772 + }
773 +
774 + mFontsTried.AppendElement(font);
775 + return;
776 +}
777 +
778 void
779 nsPresContext::SetFullZoom(float aZoom)
780 {
781 diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h
782 index ecd01d8..552a69a 100644
783 --- a/layout/base/nsPresContext.h
784 +++ b/layout/base/nsPresContext.h
785 @@ -548,6 +548,13 @@ public:
786 }
787 }
788
789 + nsTArray<nsFont> mFontsUsed; // currently for font-count limiting only
790 + nsTArray<nsFont> mFontsTried; // currently for font-count limiting only
791 + void AddFontUse(const nsFont &font);
792 + void AddFontAttempt(const nsFont &font);
793 + PRBool FontUseCountReached(const nsFont &font);
794 + PRBool FontAttemptCountReached(const nsFont &font);
795 +
796 PRInt32 MinFontSize() const {
797 return NS_MAX(mMinFontSize, mMinimumFontSizePref);
798 }
799 @@ -1117,6 +1124,8 @@ protected:
800 PRUint32 mInterruptChecksToSkip;
801
802 mozilla::TimeStamp mReflowStartTime;
803 + PRInt32 mMaxFontAttempts;
804 + PRInt32 mMaxFonts;
805
806 unsigned mHasPendingInterrupt : 1;
807 unsigned mInterruptsEnabled : 1;
808 diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp
809 index 27336bf..827585a 100644
810 --- a/layout/style/nsRuleNode.cpp
811 +++ b/layout/style/nsRuleNode.cpp
812 @@ -3091,6 +3091,7 @@ nsRuleNode::ComputeFontData(void* aStartStruct,
813
814 // See if there is a minimum font-size constraint to honor
815 nscoord minimumFontSize = mPresContext->MinFontSize();
816 + PRBool isXUL = PR_FALSE;
817
818 if (minimumFontSize < 0)
819 minimumFontSize = 0;
820 @@ -3102,10 +3103,10 @@ nsRuleNode::ComputeFontData(void* aStartStruct,
821 // We only need to know this to determine if we have to use the
822 // document fonts (overriding the useDocumentFonts flag), or to
823 // determine if we have to override the minimum font-size constraint.
824 - if ((!useDocumentFonts || minimumFontSize > 0) && mPresContext->IsChrome()) {
825 + if (mPresContext->IsChrome()) {
826 // if we are not using document fonts, but this is a XUL document,
827 // then we use the document fonts anyway
828 - useDocumentFonts = true;
829 + isXUL = PR_TRUE;
830 minimumFontSize = 0;
831 }
832
833 @@ -3120,9 +3121,13 @@ nsRuleNode::ComputeFontData(void* aStartStruct,
834 // generic?
835 nsFont::GetGenericID(font->mFont.name, &generic);
836
837 + mPresContext->AddFontAttempt(font->mFont);
838 +
839 // If we aren't allowed to use document fonts, then we are only entitled
840 // to use the user's default variable-width font and fixed-width font
841 - if (!useDocumentFonts) {
842 + if (!isXUL && (!useDocumentFonts ||
843 + mPresContext->FontAttemptCountReached(font->mFont) ||
844 + mPresContext->FontUseCountReached(font->mFont))) {
845 // Extract the generic from the specified font family...
846 nsAutoString genericName;
847 if (!font->mFont.EnumerateFamilies(ExtractGeneric, &genericName)) {
848 @@ -3158,6 +3163,8 @@ nsRuleNode::ComputeFontData(void* aStartStruct,
849 minimumFontSize, font);
850 }
851
852 + if (font->mGenericID == kGenericFont_NONE)
853 + mPresContext->AddFontUse(font->mFont);
854 COMPUTE_END_INHERITED(Font, font)
855 }
856
857 --
858 1.7.5.4
859
860
861
862
863 1.1 www-client/torbrowser/files/torbrowser-patches/0009-Provide-an-observer-event-to-close-persistent-connec.patch
864
865 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0009-Provide-an-observer-event-to-close-persistent-connec.patch?rev=1.1&view=markup
866 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0009-Provide-an-observer-event-to-close-persistent-connec.patch?rev=1.1&content-type=text/plain
867
868 Index: 0009-Provide-an-observer-event-to-close-persistent-connec.patch
869 ===================================================================
870 From d5ef29d9219a7ff9a78f9523845a2e2966c2a266 Mon Sep 17 00:00:00 2001
871 From: Mike Perry <mikeperry-git@××××××××××.org>
872 Date: Wed, 1 Feb 2012 15:53:28 -0800
873 Subject: [PATCH 09/18] Provide an observer event to close persistent
874 connections
875
876 We need to prevent linkability across "New Identity", which includes closing
877 keep-alive connections.
878 ---
879 netwerk/protocol/http/nsHttpHandler.cpp | 7 +++++++
880 1 files changed, 7 insertions(+), 0 deletions(-)
881
882 diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp
883 index 281d6ff..8125681 100644
884 --- a/netwerk/protocol/http/nsHttpHandler.cpp
885 +++ b/netwerk/protocol/http/nsHttpHandler.cpp
886 @@ -325,6 +325,7 @@ nsHttpHandler::Init()
887 mObserverService->AddObserver(this, "net:clear-active-logins", true);
888 mObserverService->AddObserver(this, NS_PRIVATE_BROWSING_SWITCH_TOPIC, true);
889 mObserverService->AddObserver(this, "net:prune-dead-connections", true);
890 + mObserverService->AddObserver(this, "net:prune-all-connections", PR_TRUE);
891 }
892
893 return NS_OK;
894 @@ -1504,6 +1505,12 @@ nsHttpHandler::Observe(nsISupports *subject,
895 mConnMgr->PruneDeadConnections();
896 }
897 }
898 + else if (strcmp(topic, "net:prune-all-connections") == 0) {
899 + if (mConnMgr) {
900 + mConnMgr->ClosePersistentConnections();
901 + mConnMgr->PruneDeadConnections();
902 + }
903 + }
904
905 return NS_OK;
906 }
907 --
908 1.7.5.4
909
910
911
912
913 1.1 www-client/torbrowser/files/torbrowser-patches/0003-Make-Intermediate-Cert-Store-memory-only.patch
914
915 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0003-Make-Intermediate-Cert-Store-memory-only.patch?rev=1.1&view=markup
916 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0003-Make-Intermediate-Cert-Store-memory-only.patch?rev=1.1&content-type=text/plain
917
918 Index: 0003-Make-Intermediate-Cert-Store-memory-only.patch
919 ===================================================================
920 From e6d127b805461470bff0dad12f5ad89fc3cd3df3 Mon Sep 17 00:00:00 2001
921 From: Mike Perry <mikeperry-git@××××××.org>
922 Date: Fri, 19 Aug 2011 17:58:23 -0700
923 Subject: [PATCH 03/18] Make Intermediate Cert Store memory-only.
924
925 This patch makes the intermediate SSL cert store exist in memory only.
926
927 The pref must be set before startup in prefs.js.
928 https://trac.torproject.org/projects/tor/ticket/2949
929 ---
930 security/manager/ssl/src/nsNSSComponent.cpp | 15 ++++++++++++++-
931 1 files changed, 14 insertions(+), 1 deletions(-)
932
933 diff --git a/security/manager/ssl/src/nsNSSComponent.cpp b/security/manager/ssl/src/nsNSSComponent.cpp
934 index a08c4ef..0ec3713 100644
935 --- a/security/manager/ssl/src/nsNSSComponent.cpp
936 +++ b/security/manager/ssl/src/nsNSSComponent.cpp
937 @@ -1730,8 +1730,21 @@ nsNSSComponent::InitializeNSS(bool showWarningBox)
938 // Ubuntu 8.04, which loads any nonexistent "<configdir>/libnssckbi.so" as
939 // "/usr/lib/nss/libnssckbi.so".
940 PRUint32 init_flags = NSS_INIT_NOROOTINIT | NSS_INIT_OPTIMIZESPACE;
941 - SECStatus init_rv = ::NSS_Initialize(profileStr.get(), "", "",
942 + bool nocertdb = false;
943 + mPrefBranch->GetBoolPref("security.nocertdb", &nocertdb);
944 +
945 + // XXX: We can also do the the following to only disable the certdb.
946 + // Leaving this codepath in as a fallback in case InitNODB fails
947 + if (nocertdb)
948 + init_flags |= NSS_INIT_NOCERTDB;
949 +
950 + SECStatus init_rv;
951 + if (nocertdb) {
952 + init_rv = ::NSS_NoDB_Init(NULL);
953 + } else {
954 + init_rv = ::NSS_Initialize(profileStr.get(), "", "",
955 SECMOD_DB, init_flags);
956 + }
957
958 if (init_rv != SECSuccess) {
959 PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("can not init NSS r/w in %s\n", profileStr.get()));
960 --
961 1.7.5.4
962
963
964
965
966 1.1 www-client/torbrowser/files/torbrowser-patches/0006-Make-content-pref-service-memory-only-clearable.patch
967
968 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0006-Make-content-pref-service-memory-only-clearable.patch?rev=1.1&view=markup
969 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0006-Make-content-pref-service-memory-only-clearable.patch?rev=1.1&content-type=text/plain
970
971 Index: 0006-Make-content-pref-service-memory-only-clearable.patch
972 ===================================================================
973 From 66ff6c30d5b1de5d549181acbba686f792fe4cb4 Mon Sep 17 00:00:00 2001
974 From: Mike Perry <mikeperry-git@××××××.org>
975 Date: Thu, 8 Sep 2011 08:40:17 -0700
976 Subject: [PATCH 06/18] Make content pref service memory-only + clearable
977
978 This prevents random urls from being inserted into content-prefs.sqllite in
979 the profile directory as content prefs change (includes site-zoom and perhaps
980 other site prefs?).
981 ---
982 .../contentprefs/nsContentPrefService.js | 4 ++--
983 1 files changed, 2 insertions(+), 2 deletions(-)
984
985 diff --git a/toolkit/components/contentprefs/nsContentPrefService.js b/toolkit/components/contentprefs/nsContentPrefService.js
986 index adfb650..1619d5f 100644
987 --- a/toolkit/components/contentprefs/nsContentPrefService.js
988 +++ b/toolkit/components/contentprefs/nsContentPrefService.js
989 @@ -1240,7 +1240,7 @@ ContentPrefService.prototype = {
990
991 var dbConnection;
992
993 - if (!dbFile.exists())
994 + if (true || !dbFile.exists())
995 dbConnection = this._dbCreate(dbService, dbFile);
996 else {
997 try {
998 @@ -1288,7 +1288,7 @@ ContentPrefService.prototype = {
999 },
1000
1001 _dbCreate: function ContentPrefService__dbCreate(aDBService, aDBFile) {
1002 - var dbConnection = aDBService.openDatabase(aDBFile);
1003 + var dbConnection = aDBService.openSpecialDatabase("memory");
1004
1005 try {
1006 this._dbCreateSchema(dbConnection);
1007 --
1008 1.7.5.4
1009
1010
1011
1012
1013 1.1 www-client/torbrowser/files/torbrowser-patches/0004-Add-a-string-based-cacheKey.patch
1014
1015 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0004-Add-a-string-based-cacheKey.patch?rev=1.1&view=markup
1016 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0004-Add-a-string-based-cacheKey.patch?rev=1.1&content-type=text/plain
1017
1018 Index: 0004-Add-a-string-based-cacheKey.patch
1019 ===================================================================
1020 From 84668dfe7bdcd35d96ffcaf273ade5a5d8d470f8 Mon Sep 17 00:00:00 2001
1021 From: Mike Perry <mikeperry-git@××××××.org>
1022 Date: Fri, 2 Sep 2011 20:47:02 -0700
1023 Subject: [PATCH 04/18] Add a string-based cacheKey.
1024
1025 Used for isolating cache according to same-origin policy.
1026 ---
1027 netwerk/base/public/nsICachingChannel.idl | 7 +++++++
1028 netwerk/protocol/http/nsHttpChannel.cpp | 22 ++++++++++++++++++++++
1029 netwerk/protocol/http/nsHttpChannel.h | 1 +
1030 3 files changed, 30 insertions(+), 0 deletions(-)
1031
1032 diff --git a/netwerk/base/public/nsICachingChannel.idl b/netwerk/base/public/nsICachingChannel.idl
1033 index 2da46d6..4ee5774 100644
1034 --- a/netwerk/base/public/nsICachingChannel.idl
1035 +++ b/netwerk/base/public/nsICachingChannel.idl
1036 @@ -98,6 +98,13 @@ interface nsICachingChannel : nsICacheInfoChannel
1037 attribute nsISupports cacheKey;
1038
1039 /**
1040 + * Set/get the cache domain... uniquely identifies the data in the cache
1041 + * for this channel. Holding a reference to this key does NOT prevent
1042 + * the cached data from being removed.
1043 + */
1044 + attribute AUTF8String cacheDomain;
1045 +
1046 + /**
1047 * Specifies whether or not the data should be cached to a file. This
1048 * may fail if the disk cache is not present. The value of this attribute
1049 * is usually only settable during the processing of a channel's
1050 diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp
1051 index dec2a83..97bd84c 100644
1052 --- a/netwerk/protocol/http/nsHttpChannel.cpp
1053 +++ b/netwerk/protocol/http/nsHttpChannel.cpp
1054 @@ -2392,6 +2392,12 @@ nsHttpChannel::AssembleCacheKey(const char *spec, PRUint32 postID,
1055 cacheKey.Append(buf);
1056 }
1057
1058 + if (strlen(mCacheDomain.get()) > 0) {
1059 + cacheKey.AppendLiteral("domain=");
1060 + cacheKey.Append(mCacheDomain.get());
1061 + cacheKey.AppendLiteral("&");
1062 + }
1063 +
1064 if (!cacheKey.IsEmpty()) {
1065 cacheKey.AppendLiteral("uri=");
1066 }
1067 @@ -4695,6 +4701,22 @@ nsHttpChannel::SetCacheForOfflineUse(bool value)
1068 }
1069
1070 NS_IMETHODIMP
1071 +nsHttpChannel::GetCacheDomain(nsACString &value)
1072 +{
1073 + value = mCacheDomain;
1074 +
1075 + return NS_OK;
1076 +}
1077 +
1078 +NS_IMETHODIMP
1079 +nsHttpChannel::SetCacheDomain(const nsACString &value)
1080 +{
1081 + mCacheDomain = value;
1082 +
1083 + return NS_OK;
1084 +}
1085 +
1086 +NS_IMETHODIMP
1087 nsHttpChannel::GetOfflineCacheClientID(nsACString &value)
1088 {
1089 value = mOfflineCacheClientID;
1090 diff --git a/netwerk/protocol/http/nsHttpChannel.h b/netwerk/protocol/http/nsHttpChannel.h
1091 index 88ce469..53538cf 100644
1092 --- a/netwerk/protocol/http/nsHttpChannel.h
1093 +++ b/netwerk/protocol/http/nsHttpChannel.h
1094 @@ -303,6 +303,7 @@ private:
1095 nsCOMPtr<nsICacheEntryDescriptor> mOfflineCacheEntry;
1096 nsCacheAccessMode mOfflineCacheAccess;
1097 nsCString mOfflineCacheClientID;
1098 + nsCString mCacheDomain;
1099
1100 // auth specific data
1101 nsCOMPtr<nsIHttpChannelAuthProvider> mAuthProvider;
1102 --
1103 1.7.5.4
1104
1105
1106
1107
1108 1.1 www-client/torbrowser/files/torbrowser-patches/0016-Prevent-WebSocket-DNS-leak.patch
1109
1110 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0016-Prevent-WebSocket-DNS-leak.patch?rev=1.1&view=markup
1111 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0016-Prevent-WebSocket-DNS-leak.patch?rev=1.1&content-type=text/plain
1112
1113 Index: 0016-Prevent-WebSocket-DNS-leak.patch
1114 ===================================================================
1115 From 975bce873ae2d127e6a0681466b21d55e14b1550 Mon Sep 17 00:00:00 2001
1116 From: Mike Perry <mikeperry-git@××××××××××.org>
1117 Date: Wed, 2 May 2012 17:44:39 -0700
1118 Subject: [PATCH 16/18] Prevent WebSocket DNS leak.
1119
1120 This is due to an improper implementation of the WebSocket spec by Mozilla.
1121
1122 "There MUST be no more than one connection in a CONNECTING state. If multiple
1123 connections to the same IP address are attempted simultaneously, the client
1124 MUST serialize them so that there is no more than one connection at a time
1125 running through the following steps.
1126
1127 If the client cannot determine the IP address of the remote host (for
1128 example, because all communication is being done through a proxy server that
1129 performs DNS queries itself), then the client MUST assume for the purposes of
1130 this step that each host name refers to a distinct remote host,"
1131
1132 https://tools.ietf.org/html/rfc6455#page-15
1133
1134 They implmented the first paragraph, but not the second...
1135
1136 While we're at it, we also prevent the DNS service from being used to look up
1137 anything other than IP addresses if socks_remote_dns is set to true, so this
1138 bug can't turn up in other components or due to 3rd party addons.
1139 ---
1140 netwerk/dns/nsDNSService2.cpp | 24 ++++++++++++++++++++++-
1141 netwerk/dns/nsDNSService2.h | 1 +
1142 netwerk/protocol/websocket/WebSocketChannel.cpp | 8 +++++-
1143 3 files changed, 30 insertions(+), 3 deletions(-)
1144
1145 diff --git a/netwerk/dns/nsDNSService2.cpp b/netwerk/dns/nsDNSService2.cpp
1146 index 68ad8a5..1253b2f 100644
1147 --- a/netwerk/dns/nsDNSService2.cpp
1148 +++ b/netwerk/dns/nsDNSService2.cpp
1149 @@ -383,6 +383,7 @@ nsDNSService::Init()
1150 bool enableIDN = true;
1151 bool disableIPv6 = false;
1152 bool disablePrefetch = false;
1153 + bool disableDNS = false;
1154 int proxyType = nsIProtocolProxyService::PROXYCONFIG_DIRECT;
1155
1156 nsAdoptingCString ipv4OnlyDomains;
1157 @@ -404,6 +405,10 @@ nsDNSService::Init()
1158
1159 // If a manual proxy is in use, disable prefetch implicitly
1160 prefs->GetIntPref("network.proxy.type", &proxyType);
1161 +
1162 + // If the user wants remote DNS, we should fail any lookups that still
1163 + // make it here.
1164 + prefs->GetBoolPref("network.proxy.socks_remote_dns", &disableDNS);
1165 }
1166
1167 if (mFirstTime) {
1168 @@ -420,7 +425,7 @@ nsDNSService::Init()
1169
1170 // Monitor these to see if there is a change in proxy configuration
1171 // If a manual proxy is in use, disable prefetch implicitly
1172 - prefs->AddObserver("network.proxy.type", this, false);
1173 + prefs->AddObserver("network.proxy.", this, false);
1174 }
1175 }
1176
1177 @@ -448,6 +453,7 @@ nsDNSService::Init()
1178 mIDN = idn;
1179 mIPv4OnlyDomains = ipv4OnlyDomains; // exchanges buffer ownership
1180 mDisableIPv6 = disableIPv6;
1181 + mDisableDNS = disableDNS;
1182
1183 // Disable prefetching either by explicit preference or if a manual proxy is configured
1184 mDisablePrefetch = disablePrefetch || (proxyType == nsIProtocolProxyService::PROXYCONFIG_MANUAL);
1185 @@ -547,6 +553,14 @@ nsDNSService::AsyncResolve(const nsACString &hostname,
1186 if (mDisablePrefetch && (flags & RESOLVE_SPECULATE))
1187 return NS_ERROR_DNS_LOOKUP_QUEUE_FULL;
1188
1189 + PRNetAddr tempAddr;
1190 + if (mDisableDNS) {
1191 + // Allow IP lookups through, but nothing else.
1192 + if (PR_StringToNetAddr(hostname.BeginReading(), &tempAddr) != PR_SUCCESS) {
1193 + return NS_ERROR_UNKNOWN_PROXY_HOST; // XXX: NS_ERROR_NOT_IMPLEMENTED?
1194 + }
1195 + }
1196 +
1197 res = mResolver;
1198 idn = mIDN;
1199 }
1200 @@ -597,6 +611,14 @@ nsDNSService::Resolve(const nsACString &hostname,
1201 MutexAutoLock lock(mLock);
1202 res = mResolver;
1203 idn = mIDN;
1204 +
1205 + PRNetAddr tempAddr;
1206 + if (mDisableDNS) {
1207 + // Allow IP lookups through, but nothing else.
1208 + if (PR_StringToNetAddr(hostname.BeginReading(), &tempAddr) != PR_SUCCESS) {
1209 + return NS_ERROR_UNKNOWN_PROXY_HOST; // XXX: NS_ERROR_NOT_IMPLEMENTED?
1210 + }
1211 + }
1212 }
1213 NS_ENSURE_TRUE(res, NS_ERROR_OFFLINE);
1214
1215 diff --git a/netwerk/dns/nsDNSService2.h b/netwerk/dns/nsDNSService2.h
1216 index 1749b41..3ec8eba 100644
1217 --- a/netwerk/dns/nsDNSService2.h
1218 +++ b/netwerk/dns/nsDNSService2.h
1219 @@ -70,4 +70,5 @@ private:
1220 bool mDisableIPv6;
1221 bool mDisablePrefetch;
1222 bool mFirstTime;
1223 + bool mDisableDNS;
1224 };
1225 diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp
1226 index 9e446e9..42aa6ca 100644
1227 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp
1228 +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
1229 @@ -1698,8 +1698,12 @@ WebSocketChannel::ApplyForAdmission()
1230 LOG(("WebSocketChannel::ApplyForAdmission: checking for concurrent open\n"));
1231 nsCOMPtr<nsIThread> mainThread;
1232 NS_GetMainThread(getter_AddRefs(mainThread));
1233 - dns->AsyncResolve(hostName, 0, this, mainThread, getter_AddRefs(mDNSRequest));
1234 - NS_ENSURE_SUCCESS(rv, rv);
1235 + rv = dns->AsyncResolve(hostName, 0, this, mainThread, getter_AddRefs(mDNSRequest));
1236 + if (NS_FAILED(rv)) {
1237 + // Fall back to hostname on dispatch failure
1238 + mDNSRequest = nsnull;
1239 + OnLookupComplete(nsnull, nsnull, rv);
1240 + }
1241
1242 return NS_OK;
1243 }
1244 --
1245 1.7.5.4
1246
1247
1248
1249
1250 1.1 www-client/torbrowser/files/torbrowser-patches/0002-Make-Permissions-Manager-memory-only.patch
1251
1252 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0002-Make-Permissions-Manager-memory-only.patch?rev=1.1&view=markup
1253 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0002-Make-Permissions-Manager-memory-only.patch?rev=1.1&content-type=text/plain
1254
1255 Index: 0002-Make-Permissions-Manager-memory-only.patch
1256 ===================================================================
1257 From 336217485d707ff63ef42d2a0bc3705c2c7f7a3c Mon Sep 17 00:00:00 2001
1258 From: Mike Perry <mikeperry-git@××××××××××.org>
1259 Date: Wed, 1 Feb 2012 15:45:16 -0800
1260 Subject: [PATCH 02/18] Make Permissions Manager memory-only
1261
1262 This patch exposes a pref 'permissions.memory_only' that properly isolates the
1263 permissions manager to memory, which is responsible for all user specified
1264 site permissions, as well as stored STS policy.
1265
1266 The pref does successfully clear the permissions manager memory if toggled. It
1267 does not need to be set in prefs.js, and can be handled by Torbutton.
1268
1269 https://trac.torproject.org/projects/tor/ticket/2950
1270 ---
1271 extensions/cookie/nsPermissionManager.cpp | 34 ++++++++++++++++++++++++++--
1272 1 files changed, 31 insertions(+), 3 deletions(-)
1273
1274 diff --git a/extensions/cookie/nsPermissionManager.cpp b/extensions/cookie/nsPermissionManager.cpp
1275 index 67eb216..12cc7cf 100644
1276 --- a/extensions/cookie/nsPermissionManager.cpp
1277 +++ b/extensions/cookie/nsPermissionManager.cpp
1278 @@ -58,6 +58,10 @@
1279 #include "mozStorageHelper.h"
1280 #include "mozStorageCID.h"
1281 #include "nsXULAppAPI.h"
1282 +#include "nsCOMPtr.h"
1283 +#include "nsIPrefService.h"
1284 +#include "nsIPrefBranch.h"
1285 +#include "nsIPrefBranch2.h"
1286
1287 static nsPermissionManager *gPermissionManager = nsnull;
1288
1289 @@ -203,6 +207,11 @@ nsPermissionManager::Init()
1290 mObserverService->AddObserver(this, "profile-do-change", true);
1291 }
1292
1293 + nsCOMPtr<nsIPrefBranch2> pbi = do_GetService(NS_PREFSERVICE_CONTRACTID);
1294 + if (pbi) {
1295 + pbi->AddObserver("permissions.", this, PR_FALSE);
1296 + }
1297 +
1298 if (IsChildProcess()) {
1299 // Get the permissions from the parent process
1300 InfallibleTArray<IPC::Permission> perms;
1301 @@ -251,8 +260,18 @@ nsPermissionManager::InitDB(bool aRemoveFile)
1302 if (!storage)
1303 return NS_ERROR_UNEXPECTED;
1304
1305 + bool memory_db = false;
1306 + nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
1307 + if (prefs) {
1308 + prefs->GetBoolPref("permissions.memory_only", &memory_db);
1309 + }
1310 +
1311 // cache a connection to the hosts database
1312 - rv = storage->OpenDatabase(permissionsFile, getter_AddRefs(mDBConn));
1313 + if (memory_db) {
1314 + rv = storage->OpenSpecialDatabase("memory", getter_AddRefs(mDBConn));
1315 + } else {
1316 + rv = storage->OpenDatabase(permissionsFile, getter_AddRefs(mDBConn));
1317 + }
1318 NS_ENSURE_SUCCESS(rv, rv);
1319
1320 bool ready;
1321 @@ -262,7 +281,11 @@ nsPermissionManager::InitDB(bool aRemoveFile)
1322 rv = permissionsFile->Remove(false);
1323 NS_ENSURE_SUCCESS(rv, rv);
1324
1325 - rv = storage->OpenDatabase(permissionsFile, getter_AddRefs(mDBConn));
1326 + if (memory_db) {
1327 + rv = storage->OpenSpecialDatabase("memory", getter_AddRefs(mDBConn));
1328 + } else {
1329 + rv = storage->OpenDatabase(permissionsFile, getter_AddRefs(mDBConn));
1330 + }
1331 NS_ENSURE_SUCCESS(rv, rv);
1332
1333 mDBConn->GetConnectionReady(&ready);
1334 @@ -783,7 +806,12 @@ NS_IMETHODIMP nsPermissionManager::Observe(nsISupports *aSubject, const char *aT
1335 {
1336 ENSURE_NOT_CHILD_PROCESS;
1337
1338 - if (!nsCRT::strcmp(aTopic, "profile-before-change")) {
1339 + if (nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) == 0) {
1340 + if (!nsCRT::strcmp(someData, NS_LITERAL_STRING("permissions.memory_only").get())) {
1341 + // XXX: Should we remove the file? Probably not..
1342 + InitDB(PR_FALSE);
1343 + }
1344 + } else if (!nsCRT::strcmp(aTopic, "profile-before-change")) {
1345 // The profile is about to change,
1346 // or is going away because the application is shutting down.
1347 if (!nsCRT::strcmp(someData, NS_LITERAL_STRING("shutdown-cleanse").get())) {
1348 --
1349 1.7.5.4
1350
1351
1352
1353
1354 1.1 www-client/torbrowser/files/torbrowser-patches/0007-Make-Tor-Browser-exit-when-not-launched-from-Vidalia.patch
1355
1356 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0007-Make-Tor-Browser-exit-when-not-launched-from-Vidalia.patch?rev=1.1&view=markup
1357 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0007-Make-Tor-Browser-exit-when-not-launched-from-Vidalia.patch?rev=1.1&content-type=text/plain
1358
1359 Index: 0007-Make-Tor-Browser-exit-when-not-launched-from-Vidalia.patch
1360 ===================================================================
1361 From d6956a597662f3d753622377183cb317ef6a3ad4 Mon Sep 17 00:00:00 2001
1362 From: Mike Perry <mikeperry-git@××××××.org>
1363 Date: Sun, 9 Oct 2011 22:50:07 -0700
1364 Subject: [PATCH 07/18] Make Tor Browser exit when not launched from Vidalia
1365
1366 Turns out the Windows 7 UI encourages users to "dock" their Tor Browser app
1367 for easy relaunch. If they manage to do this, we should fail closed rather
1368 than opened. Hopefully they will get the hint and dock Vidalia instead.
1369
1370 This is an emergency fix for
1371 https://trac.torproject.org/projects/tor/ticket/4192. We can do a better
1372 localized fix w/ a translated alert menu later, if it seems like this might
1373 actually be common.
1374 ---
1375 browser/base/content/browser.js | 15 +++++++++++++++
1376 1 files changed, 15 insertions(+), 0 deletions(-)
1377
1378 diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
1379 index b06a17b..fc1d305 100644
1380 --- a/browser/base/content/browser.js
1381 +++ b/browser/base/content/browser.js
1382 @@ -1217,6 +1217,21 @@ function BrowserStartup() {
1383
1384 prepareForStartup();
1385
1386 + // If this is not a TBB profile, exit.
1387 + // Solves https://trac.torproject.org/projects/tor/ticket/4192
1388 + var foundPref = false;
1389 + try {
1390 + foundPref = gPrefService.prefHasUserValue("torbrowser.version");
1391 + } catch(e) {
1392 + //dump("No pref: "+e);
1393 + }
1394 + if(!foundPref) {
1395 + var appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"]
1396 + .getService(Components.interfaces.nsIAppStartup);
1397 + appStartup.quit(3); // Force all windows to close, and then quit.
1398 + }
1399 +
1400 +
1401 if (uriToLoad && !isLoadingBlank) {
1402 if (uriToLoad instanceof Ci.nsISupportsArray) {
1403 let count = uriToLoad.Count();
1404 --
1405 1.7.5.4
1406
1407
1408
1409
1410 1.1 www-client/torbrowser/files/torbrowser-patches/0005-Block-all-plugins-except-flash.patch
1411
1412 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0005-Block-all-plugins-except-flash.patch?rev=1.1&view=markup
1413 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0005-Block-all-plugins-except-flash.patch?rev=1.1&content-type=text/plain
1414
1415 Index: 0005-Block-all-plugins-except-flash.patch
1416 ===================================================================
1417 From 3457f78e346df5962449cbd5aa86624e19fd5f64 Mon Sep 17 00:00:00 2001
1418 From: Mike Perry <mikeperry-git@××××××××××.org>
1419 Date: Wed, 1 Feb 2012 15:50:15 -0800
1420 Subject: [PATCH 05/18] Block all plugins except flash.
1421
1422 We cannot use the @mozilla.org/extensions/blocklist;1 service, because we
1423 actually want to stop plugins from ever entering the browser's process space
1424 and/or executing code (for example, AV plugins that collect statistics/analyse
1425 urls, magical toolbars that phone home or "help" the user, skype buttons that
1426 ruin our day, and censorship filters). Hence we rolled our own.
1427
1428 See https://trac.torproject.org/projects/tor/ticket/3547#comment:6 for musings
1429 on a better way. Until then, it is delta-darwinism for us.
1430 ---
1431 dom/plugins/base/nsPluginHost.cpp | 33 +++++++++++++++++++++++++++++++++
1432 dom/plugins/base/nsPluginHost.h | 2 ++
1433 2 files changed, 35 insertions(+), 0 deletions(-)
1434
1435 diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp
1436 index 992bcd4..f56f231 100644
1437 --- a/dom/plugins/base/nsPluginHost.cpp
1438 +++ b/dom/plugins/base/nsPluginHost.cpp
1439 @@ -1968,6 +1968,35 @@ bool nsPluginHost::IsDuplicatePlugin(nsPluginTag * aPluginTag)
1440 return false;
1441 }
1442
1443 +PRBool nsPluginHost::GhettoBlacklist(nsIFile *pluginFile)
1444 +{
1445 + nsCString leaf;
1446 + const char *leafStr;
1447 + nsresult rv;
1448 +
1449 + rv = pluginFile->GetNativeLeafName(leaf);
1450 + if (NS_FAILED(rv)) {
1451 + return PR_TRUE; // fuck 'em. blacklist.
1452 + }
1453 +
1454 + leafStr = leaf.get();
1455 +
1456 + if (!leafStr) {
1457 + return PR_TRUE; // fuck 'em. blacklist.
1458 + }
1459 +
1460 + // libgnashplugin.so, libflashplayer.so, Flash Player-10.4-10.5.plugin,
1461 + // NPSWF32.dll, NPSWF64.dll
1462 + if (strstr(leafStr, "libgnashplugin") == leafStr ||
1463 + strstr(leafStr, "libflashplayer") == leafStr ||
1464 + strstr(leafStr, "Flash Player") == leafStr ||
1465 + strstr(leafStr, "NPSWF") == leafStr) {
1466 + return PR_FALSE;
1467 + }
1468 +
1469 + return PR_TRUE; // fuck 'em. blacklist.
1470 +}
1471 +
1472 typedef NS_NPAPIPLUGIN_CALLBACK(char *, NP_GETMIMEDESCRIPTION)(void);
1473
1474 nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
1475 @@ -2101,6 +2130,10 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
1476 continue;
1477 }
1478
1479 + if (GhettoBlacklist(localfile)) {
1480 + continue;
1481 + }
1482 +
1483 // if it is not found in cache info list or has been changed, create a new one
1484 if (!pluginTag) {
1485 nsPluginFile pluginFile(localfile);
1486 diff --git a/dom/plugins/base/nsPluginHost.h b/dom/plugins/base/nsPluginHost.h
1487 index 39a8891..c262abf 100644
1488 --- a/dom/plugins/base/nsPluginHost.h
1489 +++ b/dom/plugins/base/nsPluginHost.h
1490 @@ -278,6 +278,8 @@ private:
1491 // Loads all cached plugins info into mCachedPlugins
1492 nsresult ReadPluginInfo();
1493
1494 + PRBool GhettoBlacklist(nsIFile *pluginFile);
1495 +
1496 // Given a file path, returns the plugins info from our cache
1497 // and removes it from the cache.
1498 void RemoveCachedPluginsInfo(const char *filePath,
1499 --
1500 1.7.5.4
1501
1502
1503
1504
1505 1.1 www-client/torbrowser/files/torbrowser-patches/0012-Rebrand-Firefox-to-TorBrowser.patch
1506
1507 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0012-Rebrand-Firefox-to-TorBrowser.patch?rev=1.1&view=markup
1508 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0012-Rebrand-Firefox-to-TorBrowser.patch?rev=1.1&content-type=text/plain
1509
1510 Index: 0012-Rebrand-Firefox-to-TorBrowser.patch
1511 ===================================================================
1512 From a1fcacb6cf3286226552028775aa41c4109546a6 Mon Sep 17 00:00:00 2001
1513 From: Erinn Clark <erinn@××××××××××.org>
1514 Date: Wed, 25 Apr 2012 09:14:00 -0300
1515 Subject: [PATCH 12/18] Rebrand Firefox to TorBrowser
1516
1517 This patch does some basic renaming of Firefox to TorBrowser. The rest of the
1518 branding is done by images and icons.
1519 ---
1520 browser/branding/official/configure.sh | 2 +-
1521 browser/branding/official/locales/en-US/brand.dtd | 6 +++---
1522 .../official/locales/en-US/brand.properties | 6 +++---
1523 3 files changed, 7 insertions(+), 7 deletions(-)
1524
1525 diff --git a/browser/branding/official/configure.sh b/browser/branding/official/configure.sh
1526 index 4d3d297..e9b3738 100644
1527 --- a/browser/branding/official/configure.sh
1528 +++ b/browser/branding/official/configure.sh
1529 @@ -1,2 +1,2 @@
1530 -MOZ_APP_DISPLAYNAME=Firefox
1531 +MOZ_APP_DISPLAYNAME=TorBrowser
1532 MOZ_UA_BUILDID=20100101
1533 diff --git a/browser/branding/official/locales/en-US/brand.dtd b/browser/branding/official/locales/en-US/brand.dtd
1534 index 142d79b..c137e04 100644
1535 --- a/browser/branding/official/locales/en-US/brand.dtd
1536 +++ b/browser/branding/official/locales/en-US/brand.dtd
1537 @@ -1,4 +1,4 @@
1538 -<!ENTITY brandShortName "Firefox">
1539 -<!ENTITY brandFullName "Mozilla Firefox">
1540 -<!ENTITY vendorShortName "Mozilla">
1541 +<!ENTITY brandShortName "TorBrowser">
1542 +<!ENTITY brandFullName "Tor Browser">
1543 +<!ENTITY vendorShortName "Tor Project">
1544 <!ENTITY trademarkInfo.part1 "Firefox and the Firefox logos are trademarks of the Mozilla Foundation.">
1545 diff --git a/browser/branding/official/locales/en-US/brand.properties b/browser/branding/official/locales/en-US/brand.properties
1546 index 5f3ad54..62ac2fd 100644
1547 --- a/browser/branding/official/locales/en-US/brand.properties
1548 +++ b/browser/branding/official/locales/en-US/brand.properties
1549 @@ -1,6 +1,6 @@
1550 -brandShortName=Firefox
1551 -brandFullName=Mozilla Firefox
1552 -vendorShortName=Mozilla
1553 +brandShortName=TorBrowser
1554 +brandFullName=Tor Browser
1555 +vendorShortName=Tor Project
1556
1557 homePageSingleStartMain=Firefox Start, a fast home page with built-in search
1558 homePageImport=Import your home page from %S
1559 --
1560 1.7.5.4
1561
1562
1563
1564
1565 1.1 www-client/torbrowser/files/torbrowser-patches/0013-Make-Download-manager-memory-only.patch
1566
1567 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0013-Make-Download-manager-memory-only.patch?rev=1.1&view=markup
1568 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0013-Make-Download-manager-memory-only.patch?rev=1.1&content-type=text/plain
1569
1570 Index: 0013-Make-Download-manager-memory-only.patch
1571 ===================================================================
1572 From c1ddd87b5cc6e69516c4b465cfa992a5c496e6d0 Mon Sep 17 00:00:00 2001
1573 From: Mike Perry <mikeperry-git@××××××××××.org>
1574 Date: Wed, 25 Apr 2012 13:39:35 -0700
1575 Subject: [PATCH 13/18] Make Download manager memory only.
1576
1577 Solves https://trac.torproject.org/projects/tor/ticket/4017.
1578
1579 Yes, this is an ugly hack. We *could* send the observer notification from
1580 Torbutton to tell the download manager to switch to memory, but then we have
1581 to dance around and tell it again if the user switches in and out of private
1582 browsing mode..
1583
1584 The right way to do this is with a pref. Maybe I'll get to that someday, if
1585 this breaks enough times in conflict.
1586 ---
1587 toolkit/components/downloads/nsDownloadManager.cpp | 4 ++--
1588 toolkit/components/downloads/nsDownloadManager.h | 2 +-
1589 2 files changed, 3 insertions(+), 3 deletions(-)
1590
1591 diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp
1592 index 00a6e7d..2e83f61 100644
1593 --- a/toolkit/components/downloads/nsDownloadManager.cpp
1594 +++ b/toolkit/components/downloads/nsDownloadManager.cpp
1595 @@ -1992,7 +1992,7 @@ nsDownloadManager::Observe(nsISupports *aSubject,
1596 if (NS_LITERAL_STRING("memory").Equals(aData))
1597 return SwitchDatabaseTypeTo(DATABASE_MEMORY);
1598 else if (NS_LITERAL_STRING("disk").Equals(aData))
1599 - return SwitchDatabaseTypeTo(DATABASE_DISK);
1600 + return SwitchDatabaseTypeTo(DATABASE_MEMORY);
1601 }
1602 else if (strcmp(aTopic, "alertclickcallback") == 0) {
1603 nsCOMPtr<nsIDownloadManagerUI> dmui =
1604 @@ -2069,7 +2069,7 @@ nsDownloadManager::OnLeavePrivateBrowsingMode()
1605 (void)ResumeAllDownloads(false);
1606
1607 // Switch back to the on-disk DB again
1608 - (void)SwitchDatabaseTypeTo(DATABASE_DISK);
1609 + //(void)SwitchDatabaseTypeTo(DATABASE_DISK);
1610
1611 mInPrivateBrowsing = false;
1612 }
1613 diff --git a/toolkit/components/downloads/nsDownloadManager.h b/toolkit/components/downloads/nsDownloadManager.h
1614 index 54312e4..cb63b52 100644
1615 --- a/toolkit/components/downloads/nsDownloadManager.h
1616 +++ b/toolkit/components/downloads/nsDownloadManager.h
1617 @@ -90,7 +90,7 @@ public:
1618
1619 virtual ~nsDownloadManager();
1620 nsDownloadManager() :
1621 - mDBType(DATABASE_DISK)
1622 + mDBType(DATABASE_MEMORY)
1623 , mInPrivateBrowsing(false)
1624 #ifdef DOWNLOAD_SCANNER
1625 , mScanner(nsnull)
1626 --
1627 1.7.5.4
1628
1629
1630
1631
1632 1.1 www-client/torbrowser/files/torbrowser-patches/0015-Make-nsICacheService.EvictEntries-synchronous.patch
1633
1634 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0015-Make-nsICacheService.EvictEntries-synchronous.patch?rev=1.1&view=markup
1635 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-client/torbrowser/files/torbrowser-patches/0015-Make-nsICacheService.EvictEntries-synchronous.patch?rev=1.1&content-type=text/plain
1636
1637 Index: 0015-Make-nsICacheService.EvictEntries-synchronous.patch
1638 ===================================================================
1639 From 22fe0ff634913df18d3757d5bdf9faf8527ab395 Mon Sep 17 00:00:00 2001
1640 From: Mike Perry <mikeperry-git@××××××××××.org>
1641 Date: Tue, 1 May 2012 15:02:03 -0700
1642 Subject: [PATCH 15/18] Make nsICacheService.EvictEntries synchronous
1643
1644 This fixes a race condition that allows cache-based EverCookies to persist for
1645 a brief time (on the order of minutes?) after cache clearing/"New Identity".
1646
1647 https://trac.torproject.org/projects/tor/ticket/5715
1648 ---
1649 netwerk/cache/nsCacheService.cpp | 15 +++++++++++++--
1650 1 files changed, 13 insertions(+), 2 deletions(-)
1651
1652 diff --git a/netwerk/cache/nsCacheService.cpp b/netwerk/cache/nsCacheService.cpp
1653 index 8af611f..65686c7 100644
1654 --- a/netwerk/cache/nsCacheService.cpp
1655 +++ b/netwerk/cache/nsCacheService.cpp
1656 @@ -1315,10 +1315,21 @@ NS_IMETHODIMP nsCacheService::VisitEntries(nsICacheVisitor *visitor)
1657 return NS_OK;
1658 }
1659
1660 -
1661 NS_IMETHODIMP nsCacheService::EvictEntries(nsCacheStoragePolicy storagePolicy)
1662 {
1663 - return EvictEntriesForClient(nsnull, storagePolicy);
1664 + NS_IMETHODIMP r;
1665 + r = EvictEntriesForClient(nsnull, storagePolicy);
1666 +
1667 + // XXX: Bloody hack until we get this notifier in FF14.0:
1668 + // https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsICacheListener#onCacheEntryDoomed%28%29
1669 + if (storagePolicy == nsICache::STORE_ANYWHERE &&
1670 + NS_IsMainThread() && gService && gService->mInitialized) {
1671 + nsCacheServiceAutoLock lock;
1672 + gService->DoomActiveEntries();
1673 + gService->ClearDoomList();
1674 + (void) SyncWithCacheIOThread();
1675 + }
1676 + return r;
1677 }
1678
1679 NS_IMETHODIMP nsCacheService::GetCacheIOTarget(nsIEventTarget * *aCacheIOTarget)
1680 --
1681 1.7.5.4