Implementation:Puppeteer Puppeteer SecurityDetails
| Property | Value |
|---|---|
| sources | packages/puppeteer-core/src/common/SecurityDetails.ts |
| domains | Network, Security, TLS/SSL |
| last_updated | 2026-02-12 00:00 GMT |
Overview
Description
SecurityDetails is a public class that represents the security details of an HTTP response received over a secure (HTTPS) connection. It wraps the Chrome DevTools Protocol Network.SecurityDetails payload and provides accessor methods for certificate information.
The class exposes the following properties through getter methods:
- issuer -- The name of the certificate authority that issued the certificate.
- validFrom -- A Unix timestamp marking the start of the certificate's validity period.
- validTo -- A Unix timestamp marking the end of the certificate's validity period.
- protocol -- The security protocol being used (e.g., "TLS 1.2", "TLS 1.3").
- subjectName -- The name of the subject to which the certificate was issued.
- subjectAlternativeNames -- The list of Subject Alternative Names (SANs) on the certificate.
All properties are stored as private fields (using the # syntax) and populated from the CDP Protocol.Network.SecurityDetails payload during construction.
Usage
SecurityDetails instances are accessible via the securityDetails() method on Puppeteer HTTPResponse objects when the response was served over HTTPS. This enables users to inspect TLS certificate details for network responses.
Code Reference
Source Location
packages/puppeteer-core/src/common/SecurityDetails.ts
Signature
export class SecurityDetails {
constructor(securityPayload: Protocol.Network.SecurityDetails);
issuer(): string;
validFrom(): number;
validTo(): number;
protocol(): string;
subjectName(): string;
subjectAlternativeNames(): string[];
}
Import
import {SecurityDetails} from 'puppeteer-core/lib/esm/puppeteer/common/SecurityDetails.js';
I/O Contract
| Parameter | Type | Description |
|---|---|---|
| securityPayload | Protocol.Network.SecurityDetails |
The CDP security details payload from a network response |
| Method | Return Type | Description |
|---|---|---|
issuer() |
string |
The certificate issuer name |
validFrom() |
number |
Unix timestamp for start of certificate validity |
validTo() |
number |
Unix timestamp for end of certificate validity |
protocol() |
string |
The security protocol (e.g., "TLS 1.2") |
subjectName() |
string |
The certificate subject name |
subjectAlternativeNames() |
string[] |
The list of SANs on the certificate |
Usage Examples
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
const page = await browser.newPage();
const response = await page.goto('https://example.com');
const securityDetails = response?.securityDetails();
if (securityDetails) {
console.log('Issuer:', securityDetails.issuer());
console.log('Subject:', securityDetails.subjectName());
console.log('Protocol:', securityDetails.protocol());
console.log('Valid from:', new Date(securityDetails.validFrom() * 1000));
console.log('Valid to:', new Date(securityDetails.validTo() * 1000));
console.log('SANs:', securityDetails.subjectAlternativeNames());
}
await browser.close();