Bug 1470516 - remove or fix localized values in securityInfo, r?rpl draft
authorShane Caraveo <scaraveo@mozilla.com>
Mon, 02 Jul 2018 15:45:18 -0300
changeset 813216 20800434ca904ea5134401f40a32a1d182e978ed
parent 813062 9c02d2ecf22050bfee5d70c04a359d8aaff6eb91
push id114823
push usermixedpuppy@gmail.com
push dateMon, 02 Jul 2018 18:49:22 +0000
reviewersrpl
bugs1470516
milestone63.0a1
Bug 1470516 - remove or fix localized values in securityInfo, r?rpl MozReview-Commit-ID: 3xURSfbPTmS
toolkit/components/extensions/schemas/web_request.json
toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html
toolkit/modules/addons/SecurityInfo.jsm
--- a/toolkit/components/extensions/schemas/web_request.json
+++ b/toolkit/components/extensions/schemas/web_request.json
@@ -184,20 +184,20 @@
           "subject": {
             "type": "string"
           },
           "issuer": {
             "type": "string"
           },
           "validity": {
             "type": "object",
-            "description": "Contains start and end dates in GMT.",
+            "description": "Contains start and end timestamps.",
             "properties": {
-              "startGMT": { "type": "string" },
-              "endGMT": { "type": "string" }
+              "start": { "type": "integer" },
+              "end": { "type": "integer" }
             }
           },
           "fingerprint": {
             "type": "object",
             "properties": {
               "sha1": { "type": "string" },
               "sha256": { "type": "string" }
             }
@@ -209,19 +209,16 @@
             "type": "boolean"
           },
           "subjectPublicKeyInfoDigest": {
             "type": "object",
             "properties": {
               "sha256": { "type": "string" }
             }
           },
-          "keyUsages": {
-            "type": "string"
-          },
           "rawDER": {
             "optional": true,
             "type": "array",
             "items": {
               "type": "integer"
             }
           }
         }
--- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_hsts.html
@@ -32,16 +32,18 @@ function getExtension() {
                               "security info reflects https");
 
       if (options.certificateChain) {
         // Some of the tests here only produce a single cert in the chain.
         browser.test.assertTrue(securityInfo.certificates.length >= 1, "have certificate chain");
       } else {
         browser.test.assertTrue(securityInfo.certificates.length == 1, "no certificate chain");
       }
+      let cert = securityInfo.certificates[0];
+      browser.test.assertTrue(cert.validity.start < Date.now() < cert.validity.end, "cert validity is correct");
       if (options.rawDER) {
         for (let cert of securityInfo.certificates) {
           browser.test.assertTrue(cert.rawDER.length > 0, "have rawDER");
         }
       }
     }
 
     browser.webRequest.onHeadersReceived.addListener(async (details) => {
--- a/toolkit/modules/addons/SecurityInfo.jsm
+++ b/toolkit/modules/addons/SecurityInfo.jsm
@@ -205,29 +205,28 @@ const SecurityInfo = {
     if (!cert) {
       return {};
     }
 
     let certData = {
       subject: cert.subjectName,
       issuer: cert.issuerName,
       validity: {
-        startGMT: cert.validity.notBeforeGMT,
-        endGMT: cert.validity.notAfterGMT,
+        start: cert.validity.notBefore,
+        end: cert.validity.notAfter,
       },
       fingerprint: {
         sha1: cert.sha1Fingerprint,
         sha256: cert.sha256Fingerprint,
       },
       serialNumber: cert.serialNumber,
       isBuiltInRoot: cert.isBuiltInRoot,
       subjectPublicKeyInfoDigest: {
         sha256: cert.sha256SubjectPublicKeyInfoDigest,
       },
-      keyUsages: cert.keyUsages,
     };
     if (options.rawDER) {
       certData.rawDER = cert.getRawDER({});
     }
     return certData;
   },
 
   // Bug 1355903 Transparency is currently disabled using security.pki.certificate_transparency.mode