Skip to content

Commit ec0b1aa

Browse files
committed
Merge branch 'master' of https://github.com/EFForg/https-everywhere into switchplanner
Conflicts: chromium/background.js
2 parents 5c46851 + 21f1bf4 commit ec0b1aa

6 files changed

Lines changed: 88 additions & 20 deletions

File tree

‎chromium/background.js‎

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ function onBeforeRequest(details) {
8484
if (canonical_host.charAt(canonical_host.length - 1) == ".") {
8585
while (canonical_host.charAt(canonical_host.length - 1) == ".")
8686
canonical_host = canonical_host.slice(0,-1);
87+
uri.hostname(canonical_host);
8788
}
88-
uri.hostname(canonical_host);
8989

9090
// If there is a username / password, put them aside during the ruleset
9191
// analysis process
92-
var tmpuserinfo = tmpuri.userinfo();
92+
var tmpuserinfo = uri.userinfo();
9393
if (tmpuserinfo) {
94-
tmpuri.userinfo('');
94+
uri.userinfo('');
9595
}
9696

9797
var canonical_url = uri.toString();
@@ -107,7 +107,7 @@ function onBeforeRequest(details) {
107107
activeRulesets.removeTab(details.tabId);
108108
}
109109

110-
var rs = all_rules.potentiallyApplicableRulesets(a.hostname);
110+
var rs = all_rules.potentiallyApplicableRulesets(uri.hostname());
111111
// If no rulesets could apply, let's get out of here!
112112
if (rs.length === 0) { return; }
113113

@@ -119,7 +119,7 @@ function onBeforeRequest(details) {
119119
if (redirectCounter[details.requestId] > 9) {
120120
log(NOTE, "Redirect counter hit for "+canonical_url);
121121
urlBlacklist[canonical_url] = true;
122-
var hostname = tmpuri.hostname();
122+
var hostname = uri.hostname();
123123
domainBlacklist[hostname] = true;
124124
log(WARN, "Domain blacklisted " + hostname);
125125
return;
@@ -137,7 +137,7 @@ function onBeforeRequest(details) {
137137
}
138138
}
139139

140-
if (newuristr && tmpuserinfo != "") {
140+
if (newuristr && tmpuserinfo !== "") {
141141
// re-insert userpass info which was stripped temporarily
142142
// while rules were applied
143143
var finaluri = new URI(newuristr);
@@ -330,25 +330,17 @@ function onCookieChanged(changeInfo) {
330330
}
331331

332332
// This event is needed due to the potential race between cookie permissions
333-
// update and cookie transmission, because the cookie API is non-blocking.
334-
// It would be less perf impact to have a blocking version of the cookie API
335-
// available instead.
333+
// update and cookie transmission (because the cookie API is non-blocking).
334+
// Without this function, an aggressive attacker could race to steal a not-yet-secured
335+
// cookie if they controlled & could redirect the user to a non-SSL subdomain.
336336
// WARNING: This is a very hot function.
337337
function onBeforeSendHeaders(details) {
338-
// XXX this function appears to enforce something equivalent to the secure
339-
// cookie flag by independent means. Is that really what it's supposed to
340-
// do?
341-
// @@@ Agreed, this function is really weird. I'm not sure it's even useful
342-
// since we block WebRequests to HTTP sites (and maybe rewrite them to SSL)
343-
// we force cookies to be sent over HTTPS even if they don't have the flag
344-
// "Secure" set. (Unless I'm reading this wrong?)
345338
// TODO: Verify this with wireshark
346339
for (var h in details.requestHeaders) {
347340
if (details.requestHeaders[h].name == "Cookie") {
348341
// Per RFC 6265, Chrome sends only ONE cookie header, period.
349-
var a = document.createElement("a");
350-
a.href = details.url;
351-
var host = a.hostname;
342+
var uri = new URI(details.url);
343+
var host = uri.hostname();
352344

353345
var newCookies = [];
354346
var cookies = details.requestHeaders[h].value.split(";");

‎src/chrome/content/rules/Huffington-Post.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
** Unsecurable
7474
7575
-->
76-
<ruleset name="Huffington Post">
76+
<ruleset name="Huffington Post" platform="mixedcontent">
7777

7878
<target host="huffingtonpost.com" />
7979
<target host="*.huffingtonpost.com" />
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ruleset name="Jesse Ruderma">
2+
<target host="www.squarefree.com"/>
3+
<target host="*.squarefree.com"/>
4+
<rule from="^http://([^/:@]*)\.squarefree\.com/" to="https://$1.squarefree.com/"/>
5+
</ruleset>

‎src/chrome/content/rules/PPS.xml‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<ruleset name="PPS">
2+
<target host="www.piratenpartei.ch"/>
3+
<target host="*.piratenpartei.ch"/>
4+
<target host="www.pirateparty.ch"/>
5+
<target host="*.pirateparty.ch"/>
6+
<target host="www.partipirate.ch"/>
7+
<target host="*.partipirate.ch"/>
8+
<target host="www.partitopirata.ch"/>
9+
<target host="*.partitopirata.ch"/>
10+
<exclusion pattern="^http://bl\.piratenpartei\.ch/"/>
11+
<exclusion pattern="^http://bl\.partipirate\.ch/"/>
12+
<exclusion pattern="^http://bl\.partitopirata\.ch/"/>
13+
<exclusion pattern="^http://bl\.pirateparty\.ch/"/>
14+
<exclusion pattern="^http://bs\.piratenpartei\.ch/"/>
15+
<exclusion pattern="^http://bs\.partipirate\.ch/"/>
16+
<exclusion pattern="^http://bs\.partitopirata\.ch/"/>
17+
<exclusion pattern="^http://bs\.pirateparty\.ch/"/>
18+
<exclusion pattern="^http://ag\.piratenpartei\.ch/"/>
19+
<exclusion pattern="^http://ag\.partipirate\.ch/"/>
20+
<exclusion pattern="^http://ag\.partitopirata\.ch/"/>
21+
<exclusion pattern="^http://ag\.pirateparty\.ch/"/>
22+
<exclusion pattern="^http://zh\.piratenpartei\.ch/"/>
23+
<exclusion pattern="^http://zh\.partipirate\.ch/"/>
24+
<exclusion pattern="^http://zh\.partitopirata\.ch/"/>
25+
<exclusion pattern="^http://zh\.pirateparty\.ch/"/>
26+
<exclusion pattern="^http://projects\.partipirate\.ch/"/>
27+
<exclusion pattern="^http://projects\.pirateparty\.ch/"/>
28+
<exclusion pattern="^http://projects\.partitopirata\.ch/"/>
29+
<exclusion pattern="^http://info\.piratenpartei\.ch/"/>
30+
<exclusion pattern="^http://info\.partipirate\.ch/"/>
31+
<exclusion pattern="^http://info\.partitopirata\.ch/"/>
32+
<exclusion pattern="^http://info\.pirateparty\.ch/"/>
33+
<exclusion pattern="^http://lists\.piratenpartei\.ch/"/>
34+
<exclusion pattern="^http://lists\.partipirate\.ch/"/>
35+
<exclusion pattern="^http://lists\.partitopirata\.ch/"/>
36+
<exclusion pattern="^http://lists\.pirateparty\.ch/"/>
37+
<rule from="^http://([^/:@]*)\.piratenpartei\.ch/"
38+
to="https://$1.piratenpartei.ch/"/>
39+
<rule from="^http://([^/:@]*)\.pirateparty\.ch/"
40+
to="https://$1.pirateparty.ch/"/>
41+
<rule from="^http://([^/:@]*)\.partipirate\.ch/"
42+
to="https://$1.partipirate.ch/"/>
43+
<rule from="^http://([^/:@]*)\.partitopirata\.ch/"
44+
to="https://$1.partitopirata.ch/"/>
45+
<rule from="^https://([^/:@]*)\.piraten-partei\.ch/"
46+
to="https://$1.piratenpartei.ch/"/>
47+
<rule from="^http://([^/:@]*)\.piraten-partei\.ch/"
48+
to="https://$1.piratenpartei.ch/"/>
49+
<rule from="^https://([^/:@]*)\.parti-pirate\.ch/"
50+
to="https://$1.partipirate.ch/"/>
51+
<rule from="^http://([^/:@]*)\.parti-pirate\.ch/"
52+
to="https://$1.partipirate.ch/"/>
53+
<rule from="^https://([^/:@]*)\.partito-pirata\.ch/"
54+
to="https://$1.partitopirata.ch/"/>
55+
<rule from="^http://([^/:@]*)\.partito-pirata\.ch/"
56+
to="https://$1.partitopirata.ch/"/>
57+
<rule from="^https://([^/:@]*)\.pirate-party\.ch/"
58+
to="https://$1.pirateparty.ch/"/>
59+
<rule from="^http://([^/:@]*)\.pirate-party\.ch/"
60+
to="https://$1.pirateparty.ch/"/>
61+
</ruleset>

‎src/chrome/content/rules/STEG.xml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ruleset name="STEG">
2+
<target host="www.steg-electronics.ch"/>
3+
<target host="*.steg-electronics.ch"/>
4+
<rule from="^http://([^/:@]*)\.steg-electronics\.ch/" to="https://$1.steg-electronics.ch/"/>
5+
</ruleset>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ruleset name="TagesWoche">
2+
<target host="www.tageswoche.ch"/>
3+
<target host="*.tageswoche.ch"/>
4+
<rule from="^http://([^/:@]*)\.tageswoche\.ch/" to="https://$1.tageswoche.ch/"/>
5+
</ruleset>

0 commit comments

Comments
 (0)