feat: add securityDetails.subjectAlternativeNames() #5628 (#5881)

Co-authored-by: Michal TOMA <michaltoma2205@gmail.com>
Co-authored-by: Alex Rudenko <alexrudenko@chromium.org>

Fixes #5625. Closes #5628.
This commit is contained in:
Michal TOMA 2020-05-18 12:58:46 +02:00 committed by Mathias Bynens
parent e8232890a4
commit a17bd89fb9
5 changed files with 60 additions and 78 deletions

View File

@ -311,6 +311,7 @@
- [class: SecurityDetails](#class-securitydetails) - [class: SecurityDetails](#class-securitydetails)
* [securityDetails.issuer()](#securitydetailsissuer) * [securityDetails.issuer()](#securitydetailsissuer)
* [securityDetails.protocol()](#securitydetailsprotocol) * [securityDetails.protocol()](#securitydetailsprotocol)
* [securityDetails.subjectAlternativeNames()](#securitydetailssubjectalternativenames)
* [securityDetails.subjectName()](#securitydetailssubjectname) * [securityDetails.subjectName()](#securitydetailssubjectname)
* [securityDetails.validFrom()](#securitydetailsvalidfrom) * [securityDetails.validFrom()](#securitydetailsvalidfrom)
* [securityDetails.validTo()](#securitydetailsvalidto) * [securityDetails.validTo()](#securitydetailsvalidto)
@ -3729,6 +3730,9 @@ Contains the URL of the response.
#### securityDetails.protocol() #### securityDetails.protocol()
- returns: <[string]> String with the security protocol, eg. "TLS 1.2". - returns: <[string]> String with the security protocol, eg. "TLS 1.2".
#### securityDetails.subjectAlternativeNames()
- returns: <[Array]<[string]>> Returns the list of SANs (subject alternative names) of the certificate.
#### securityDetails.subjectName() #### securityDetails.subjectName()
- returns: <[string]> Name of the subject to which the certificate was issued to. - returns: <[string]> Name of the subject to which the certificate was issued to.

View File

@ -20,6 +20,7 @@ export class SecurityDetails {
private _validFrom: number; private _validFrom: number;
private _validTo: number; private _validTo: number;
private _protocol: string; private _protocol: string;
private _sanList: string[];
constructor(securityPayload: Protocol.Network.SecurityDetails) { constructor(securityPayload: Protocol.Network.SecurityDetails) {
this._subjectName = securityPayload.subjectName; this._subjectName = securityPayload.subjectName;
@ -27,6 +28,7 @@ export class SecurityDetails {
this._validFrom = securityPayload.validFrom; this._validFrom = securityPayload.validFrom;
this._validTo = securityPayload.validTo; this._validTo = securityPayload.validTo;
this._protocol = securityPayload.protocol; this._protocol = securityPayload.protocol;
this._sanList = securityPayload.sanList;
} }
subjectName(): string { subjectName(): string {
@ -48,4 +50,8 @@ export class SecurityDetails {
protocol(): string { protocol(): string {
return this._protocol; return this._protocol;
} }
subjectAlternativeNames(): string[] {
return this._sanList;
}
} }

View File

@ -64,8 +64,12 @@ describeFailsFirefox('ignoreHTTPSErrors', function () {
const protocol = serverRequest.socket.getProtocol().replace('v', ' '); const protocol = serverRequest.socket.getProtocol().replace('v', ' ');
expect(securityDetails.protocol()).toBe(protocol); expect(securityDetails.protocol()).toBe(protocol);
expect(securityDetails.subjectName()).toBe('puppeteer-tests'); expect(securityDetails.subjectName()).toBe('puppeteer-tests');
expect(securityDetails.validFrom()).toBe(1550084863); expect(securityDetails.validFrom()).toBe(1589357069);
expect(securityDetails.validTo()).toBe(33086084863); expect(securityDetails.validTo()).toBe(1904717069);
expect(securityDetails.subjectAlternativeNames()).toEqual([
'www.puppeteer-tests.test',
'www.puppeteer-tests-1.test',
]);
}); });
it('should be |null| for non-secure requests', async () => { it('should be |null| for non-secure requests', async () => {
const { server } = getTestState(); const { server } = getTestState();

View File

@ -1,28 +1,20 @@
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIEsjCCApoCCQCIPLvQDgoZojANBgkqhkiG9w0BAQsFADAaMRgwFgYDVQQDDA9w MIIDWDCCAkCgAwIBAgIUM8Tmw+D1j+eVz9x9So4zRVqFsKowDQYJKoZIhvcNAQEL
dXBwZXRlZXItdGVzdHMwIBcNMTkwMjEzMTkwNzQzWhgPMzAxODA2MTYxOTA3NDNa BQAwGjEYMBYGA1UEAwwPcHVwcGV0ZWVyLXRlc3RzMB4XDTIwMDUxMzA4MDQyOVoX
MBoxGDAWBgNVBAMMD3B1cHBldGVlci10ZXN0czCCAiIwDQYJKoZIhvcNAQEBBQAD DTMwMDUx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MgLFgMD
WLy6yZzJloW7NgpLGAfMA0nMG1O92hfKmQw82Pyf3SVXGTDiXiEOXn0vN6bsPaV/
3Ws2LJQECnVfHj3TsuxdtwcO+VGcFCarMOqlhE6IlQzfK8ykYdP6wCkVgXEtiVCR
T1OWUWCFowoFpwBFLf1lA065qsAymddnkrUEOMiScZ/3OZhmd+FvgQ+O0iYuqpeI
xauiQ68+Jb4KjVWnu5QBVq8n1vUJ5+gAzowNMN9G+1+A282Ox23T48dce22BTS6B
3Taaccm+
-----END CERTIFICATE----- -----END CERTIFICATE-----

View File

@ -1,52 +1,28 @@
-----BEGIN PRIVATE KEY----- -----BEGIN PRIVATE KEY-----
MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQCbntcqgOKp9EiU MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQClZtuGBzoKdbLB
d64E3erAmFRzCqlKLg9DaNPR+6n/uWWiG98hqQuSfQbH/2W7w+caYKmxhGJB4+0I 3zEYRNPWZ8uLfCIohukBQeCEsXiyPSNfPy8uH/iiJylDXZ3puzP4gCLuqt1c2HXU
emf3DwkhwPmabFMw11ayxV63cMIitRayEqwyNkWLIj/nudlzwv2nFgv+3/hOeAut /mcR6Pr8bHh9bMGAZ2skUY+qy9e6Fh3NkCbLrE5pZwsgl5Dnjdte/dh5JPsQZFck
qDI2KI2lWg5/ILtOoMkta1ytiSE0Ogqyp2/j1UpI7TweJLtuObtagiqG5ZDRGUpB Fz+hxOjaMgZMaOqGSwVqJ33XRVCVfcoY4tMMxQKTTRN4RgFNNTHjs9agizFWpuXZ
JsPArJfoMOsnRqjkkAKKPK7A7XucwjJz1+18y+hIUaqYlcezwrkFp14S+4/TdteD HNVdFJYvmGU9aVbb38FC0EaaxfFnJa2qoe52JS6UYFKvgtw/KJxksjyeoKoPSKhL
4re7OxfE3gAOsmUfaLMFvodHVjvl8KHCda8JDg1zp4GwqjvhlMcrmryJdptHdjD/ RMSYaHr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