mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 932179 - Part 4: Test static pinning with an unit test instead as the test domain is no longer available for mochitests (bug 1096197
). r=past
This commit is contained in:
parent
1190cde79f
commit
11e697030f
@ -18,17 +18,14 @@ SimpleTest.waitForExplicitFinish();
|
||||
|
||||
let gCurrentTestCase = -1;
|
||||
const HPKP_PREF = "security.cert_pinning.process_headers_from_non_builtin_roots";
|
||||
|
||||
// Static pins tested by unit/test_security-info-static-hpkp.js.
|
||||
const TEST_CASES = [
|
||||
{
|
||||
desc: "no Public Key Pinning",
|
||||
url: "https://example.com",
|
||||
usesPinning: false,
|
||||
},
|
||||
{
|
||||
desc: "static Public Key Pinning",
|
||||
url: "https://include-subdomains.pinning.example.com/",
|
||||
usesPinning: true,
|
||||
},
|
||||
{
|
||||
desc: "dynamic Public Key Pinning with this request",
|
||||
url: "https://include-subdomains.pinning-dynamic.example.com/" +
|
||||
|
@ -0,0 +1,47 @@
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
// Test that NetworkHelper.parseSecurityInfo correctly detects static hpkp pins
|
||||
|
||||
const { devtools } = Components.utils.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
Object.defineProperty(this, "NetworkHelper", {
|
||||
get: function() {
|
||||
return devtools.require("devtools/toolkit/webconsole/network-helper");
|
||||
},
|
||||
configurable: true,
|
||||
writeable: false,
|
||||
enumerable: true
|
||||
});
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const wpl = Ci.nsIWebProgressListener;
|
||||
|
||||
const MockSecurityInfo = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsITransportSecurityInfo,
|
||||
Ci.nsISSLStatusProvider]),
|
||||
securityState: wpl.STATE_IS_SECURE,
|
||||
errorCode: 0,
|
||||
SSLStatus: {
|
||||
cipherSuite: "TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256",
|
||||
protocolVersion: 3, // TLS_VERSION_1_2
|
||||
serverCert: {
|
||||
validity: {}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
const MockRequest = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPrivateBrowsingChannel]),
|
||||
URI: {
|
||||
host: "include-subdomains.pinning.example.com"
|
||||
}
|
||||
};
|
||||
|
||||
function run_test() {
|
||||
let result = NetworkHelper.parseSecurityInfo(MockSecurityInfo, MockRequest);
|
||||
equal(result.hpkp, true, "Static HPKP detected.");
|
||||
}
|
@ -10,3 +10,4 @@ support-files =
|
||||
[test_security-info-parser.js]
|
||||
[test_security-info-protocol-version.js]
|
||||
[test_security-info-state.js]
|
||||
[test_security-info-static-hpkp.js]
|
||||
|
Loading…
Reference in New Issue
Block a user