Skip to content

Commit a4afd1e

Browse files
committed
Fix a few more issues, incl bad merge in ssl-observatory.js.
1 parent db99522 commit a4afd1e

File tree

4 files changed

+33
-44
lines changed

4 files changed

+33
-44
lines changed

src/chrome/content/code/ApplicableList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// were applied, and which ones weren't but might have been, to the contents
33
// of a given page (top level nsIDOMWindow)
44

5-
serial_number = 0;
5+
var serial_number = 0;
66

77
function ApplicableList(logger, uri) {
88
this.log = logger;

src/chrome/content/code/HTTPSRules.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const Cc = Components.classes;
21
// Compilation of RegExps is now delayed until they are first used...
32

43
function Rule(from, to) {

src/chrome/content/code/Root-CAs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// These are concatenated md5 and sha1 fingerprints for the Firefox and
22
// Microsoft root CAs as of Aug 2010
33

4-
root_ca_hashes = {
4+
var root_ca_hashes = {
55
'00531D1D7201D423C820D00B6088C5D143DDB1FFF3B49B73831407F6BC8B975023D07C50' : true,
66
'015A99C3D64FA94B3C3BB1A3AB274CBFFC219A76112F76C1C508833C9A2FA2BA84AC087A' : true,
77
'019408DE857F8D806CE602CA89522848750251B2C632536F9D917279543C137CD721C6E0' : true,

src/components/ssl-observatory.js

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,12 @@ function SSLObservatory() {
6767

6868
try {
6969
// Check for torbutton
70-
this.tor_logger = CC["@torproject.org/torbutton-logger;1"]
71-
.getService(CI.nsISupports).wrappedJSObject;
72-
this.torbutton_installed = true;
70+
var tor_logger_component = CC["@torproject.org/torbutton-logger;1"];
71+
if (tor_logger_component) {
72+
this.tor_logger =
73+
tor_logger_component.getService(CI.nsISupports).wrappedJSObject;
74+
this.torbutton_installed = true;
75+
}
7376
} catch(e) {
7477
this.torbutton_installed = false;
7578
}
@@ -380,47 +383,34 @@ SSLObservatory.prototype = {
380383
this.log(INFO, "Could not get server IP address.");
381384
}
382385

383-
if (!this.observatoryActive()) return;
384-
385-
var host_ip = "-1";
386-
var httpchannelinternal = subject.QueryInterface(Ci.nsIHttpChannelInternal);
387-
try {
388-
host_ip = httpchannelinternal.remoteAddress;
389-
} catch(e) {
390-
this.log(INFO, "Could not get server IP address.");
386+
channel.QueryInterface(Ci.nsIHttpChannel);
387+
var chainEnum = certchain.getChain();
388+
var chainArray = [];
389+
var chainArrayFpStr = '';
390+
var fps = [];
391+
for(var i = 0; i < chainEnum.length; i++) {
392+
var cert = chainEnum.queryElementAt(i, Ci.nsIX509Cert);
393+
chainArray.push(cert);
394+
var fp = this.ourFingerprint(cert);
395+
fps.push(fp);
396+
chainArrayFpStr = chainArrayFpStr + fp;
391397
}
392-
subject.QueryInterface(Ci.nsIHttpChannel);
393-
var certchain = this.getSSLCert(subject);
394-
if (certchain) {
395-
var chainEnum = certchain.getChain();
396-
var chainArray = [];
397-
var chainArrayFpStr = '';
398-
var fps = [];
399-
for(var i = 0; i < chainEnum.length; i++) {
400-
var cert = chainEnum.queryElementAt(i, Ci.nsIX509Cert);
401-
chainArray.push(cert);
402-
var fp = this.ourFingerprint(cert);
403-
fps.push(fp);
404-
chainArrayFpStr = chainArrayFpStr + fp;
405-
}
406-
var chain_hash = sha256_digest(chainArrayFpStr).toUpperCase();
407-
this.log(INFO, "SHA-256 hash of cert chain for "+new String(subject.URI.host)+" is "+ chain_hash);
398+
var chain_hash = sha256_digest(chainArrayFpStr).toUpperCase();
399+
this.log(INFO, "SHA-256 hash of cert chain for "+new String(channel.URI.host)+" is "+ chain_hash);
408400

409-
if(!this.myGetBoolPref("use_whitelist")) {
410-
this.log(WARN, "Not using whitelist to filter cert chains.");
411-
}
412-
else if (this.isChainWhitelisted(chain_hash)) {
413-
this.log(INFO, "This cert chain is whitelisted. Not submitting.");
414-
return;
415-
} else {
416-
this.log(INFO, "Cert chain is NOT whitelisted. Proceeding with submission.");
417-
}
401+
if(!this.myGetBoolPref("use_whitelist")) {
402+
this.log(WARN, "Not using whitelist to filter cert chains.");
403+
} else if (this.isChainWhitelisted(chain_hash)) {
404+
this.log(INFO, "This cert chain is whitelisted. Not submitting. ");
405+
return;
406+
} else {
407+
this.log(INFO, "Cert chain is NOT whitelisted. Proceeding with submission");
408+
}
418409

419-
if (channel.URI.port == -1) {
420-
this.submitChainArray(chainArray, fps, new String(channel.URI.host), channel, host_ip, warning, false, chain_hash);
421-
} else {
422-
this.submitChainArray(chainArray, fps, channel.URI.host+":"+channel.URI.port, channel, host_ip, warning, false, chain_hash);
423-
}
410+
if (channel.URI.port == -1) {
411+
this.submitChainArray(chainArray, fps, new String(channel.URI.host), channel, host_ip, warning, false, chain_hash);
412+
} else {
413+
this.submitChainArray(chainArray, fps, channel.URI.host+":"+channel.URI.port, channel, host_ip, warning, false, chain_hash);
424414
}
425415
},
426416

0 commit comments

Comments
 (0)