Skip to content

Commit 135ecf5

Browse files
committed
Add a submission parameter to say whether there was a cert warning
1 parent e9a1c82 commit 135ecf5

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

src/components/ssl-observatory.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ SSLObservatory.prototype = {
327327
if (certchain) {
328328
this.log(INFO, "Got state cert chain for "
329329
+ chan.originalURI.spec + "->" + chan.URI.spec + ", state: " + aState);
330-
this.submitCertChainForChannel(certchain, chan);
330+
var warning = true;
331+
this.submitCertChainForChannel(certchain, chan, warning);
331332
}
332333
}
333334
},
@@ -364,11 +365,12 @@ SSLObservatory.prototype = {
364365
if (!this.observatoryActive(channel)) return;
365366

366367
var certchain = this.getSSLCertChain(subject);
367-
this.submitCertChainForChannel(certchain, channel);
368+
var warning = false;
369+
this.submitCertChainForChannel(certchain, channel, warning);
368370
}
369371
},
370372

371-
submitCertChainForChannel: function(certchain, channel) {
373+
submitCertChainForChannel: function(certchain, channel, warning) {
372374
if (!certchain) {
373375
return;
374376
}
@@ -407,9 +409,9 @@ SSLObservatory.prototype = {
407409
}
408410

409411
if (channel.URI.port == -1) {
410-
this.submitChainArray(chainArray, fps, new String(channel.URI.host), channel, host_ip, false);
412+
this.submitChainArray(chainArray, fps, new String(channel.URI.host), channel, host_ip, warning, false);
411413
} else {
412-
this.submitChainArray(chainArray, fps, channel.URI.host+":"+channel.URI.port, channel, host_ip, false);
414+
this.submitChainArray(chainArray, fps, channel.URI.host+":"+channel.URI.port, channel, host_ip, warning, false);
413415
}
414416
},
415417

@@ -614,7 +616,7 @@ SSLObservatory.prototype = {
614616
return true;
615617
},
616618

617-
submitChainArray: function(certArray, fps, domain, channel, host_ip, resubmitting) {
619+
submitChainArray: function(certArray, fps, domain, channel, host_ip, warning, resubmitting) {
618620
var base64Certs = [];
619621
// Put all this chain data in one object so that it can be modified by
620622
// subroutines if required
@@ -631,7 +633,7 @@ SSLObservatory.prototype = {
631633
if (Object.keys(this.delayed_submissions).length < MAX_DELAYED)
632634
if (!(c.fps[0] in this.delayed_submissions)) {
633635
this.log(WARN, "Planning to retry submission...");
634-
let retry = function() { this.submitChainArray(certArray, fps, domain, channel, host_ip, true); };
636+
let retry = function() { this.submitChainArray(certArray, fps, domain, channel, host_ip, warning, true); };
635637
this.delayed_submissions[c.fps[0]] = retry;
636638
}
637639
return;
@@ -658,18 +660,22 @@ SSLObservatory.prototype = {
658660

659661
if (resubmitting) {
660662
reqParams.push("client_asn="+ASN_UNKNOWABLE);
661-
}
662-
else {
663+
} else {
663664
reqParams.push("client_asn="+this.client_asn);
664665
}
665666

666667
if (this.myGetBoolPref("priv_dns")) {
667668
reqParams.push("private_opt_in=1");
668-
}
669-
else {
669+
} else {
670670
reqParams.push("private_opt_in=0");
671671
}
672672

673+
if (warning) {
674+
reqParams.push("browser_warning=1");
675+
} else {
676+
reqParams.push("browser_warning=0");
677+
}
678+
673679
var params = reqParams.join("&") + "&padding=0";
674680
var tot_len = BASE_REQ_SIZE;
675681

@@ -733,7 +739,7 @@ SSLObservatory.prototype = {
733739
if (Object.keys(that.delayed_submissions).length < MAX_DELAYED)
734740
if (!(c.fps[0] in that.delayed_submissions)) {
735741
that.log(WARN, "Planning to retry submission...");
736-
let retry = function() { that.submitChainArray(certArray, fps, domain, channel, host_ip, true); };
742+
let retry = function() { that.submitChainArray(certArray, fps, domain, channel, host_ip, warning, true); };
737743
that.delayed_submissions[c.fps[0]] = retry;
738744
}
739745

0 commit comments

Comments
 (0)