Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

playwright-core

Package Overview
Dependencies
Maintainers
4
Versions
4636
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

playwright-core - npm Package Compare versions

Comparing version 1.47.0-alpha-2024-08-19 to 1.47.0-alpha-2024-08-20

lib/vite/recorder/assets/codeMirrorModule-D2JFZ4Am.js

2

browsers.json

@@ -30,3 +30,3 @@ {

"name": "webkit",
"revision": "2061",
"revision": "2062",
"installByDefault": true,

@@ -33,0 +33,0 @@ "revisionOverrides": {

@@ -530,11 +530,13 @@ "use strict";

if (!certs) return undefined;
return await Promise.all(certs.map(async cert => {
return {
origin: cert.origin,
cert: cert.certPath ? await _fs.default.promises.readFile(cert.certPath) : undefined,
key: cert.keyPath ? await _fs.default.promises.readFile(cert.keyPath) : undefined,
pfx: cert.pfxPath ? await _fs.default.promises.readFile(cert.pfxPath) : undefined,
passphrase: cert.passphrase
};
}));
const bufferizeContent = async (value, path) => {
if (value) return value;
if (path) return await _fs.default.promises.readFile(path);
};
return await Promise.all(certs.map(async cert => ({
origin: cert.origin,
cert: await bufferizeContent(cert.cert, cert.certPath),
key: await bufferizeContent(cert.key, cert.keyPath),
pfx: await bufferizeContent(cert.pfx, cert.pfxPath),
passphrase: cert.passphrase
})));
}

@@ -131,3 +131,3 @@ "use strict";

deadline,
...(0, _socksClientCertificatesInterceptor.clientCertificatesToTLSOptions)(this._defaultOptions().clientCertificates, requestUrl.origin),
...(0, _socksClientCertificatesInterceptor.getMatchingTLSOptionsForOrigin)(this._defaultOptions().clientCertificates, requestUrl.origin),
__testHookLookup: params.__testHookLookup

@@ -288,3 +288,3 @@ };

deadline: options.deadline,
...(0, _socksClientCertificatesInterceptor.clientCertificatesToTLSOptions)(this._defaultOptions().clientCertificates, url.origin),
...(0, _socksClientCertificatesInterceptor.getMatchingTLSOptionsForOrigin)(this._defaultOptions().clientCertificates, url.origin),
__testHookLookup: options.__testHookLookup

@@ -291,0 +291,0 @@ };

@@ -7,3 +7,3 @@ "use strict";

exports.ClientCertificatesProxy = void 0;
exports.clientCertificatesToTLSOptions = clientCertificatesToTLSOptions;
exports.getMatchingTLSOptionsForOrigin = getMatchingTLSOptionsForOrigin;
exports.rewriteOpenSSLErrorIfNeeded = rewriteOpenSSLErrorIfNeeded;

@@ -169,3 +169,2 @@ var _net = _interopRequireDefault(require("net"));

const handleError = error => {
error = rewriteOpenSSLErrorIfNeeded(error);
_debugLogger.debugLogger.log('client-certificates', `error when connecting to target: ${error.message.replaceAll('\n', ' ')}`);

@@ -203,9 +202,2 @@ const responseBody = (0, _utils.escapeHTML)('Playwright client-certificate error: ' + error.message).replaceAll('\n', ' <br>');

};
let secureContext;
try {
secureContext = _tls.default.createSecureContext(clientCertificatesToTLSOptions(this.socksProxy.clientCertificates, new URL(`https://${this.host}:${this.port}`).origin));
} catch (error) {
handleError(error);
return;
}
if (this._closed) {

@@ -222,3 +214,3 @@ internalTLS.destroy();

servername: !_net.default.isIP(this.host) ? this.host : undefined,
secureContext
secureContext: this.socksProxy.secureContextMap.get(new URL(`https://${this.host}:${this.port}`).origin)
});

@@ -240,7 +232,7 @@ targetTLS.once('secureConnect', () => {

this.ignoreHTTPSErrors = void 0;
this.clientCertificates = void 0;
this.secureContextMap = new Map();
this.alpnCache = void 0;
this.alpnCache = new ALPNCache();
this.ignoreHTTPSErrors = contextOptions.ignoreHTTPSErrors;
this.clientCertificates = contextOptions.clientCertificates;
this._initSecureContexts(contextOptions.clientCertificates);
this._socksProxy = new _socksProxy.SocksProxy();

@@ -271,2 +263,22 @@ this._socksProxy.setPattern('*');

}
_initSecureContexts(clientCertificates) {
// Step 1. Group certificates by origin.
const origin2certs = new Map();
for (const cert of clientCertificates || []) {
const origin = normalizeOrigin(cert.origin);
const certs = origin2certs.get(origin) || [];
certs.push(cert);
origin2certs.set(origin, certs);
}
// Step 2. Create secure contexts for each origin.
for (const [origin, certs] of origin2certs) {
try {
this.secureContextMap.set(origin, _tls.default.createSecureContext(convertClientCertificatesToTLSOptions(certs)));
} catch (error) {
error = rewriteOpenSSLErrorIfNeeded(error);
throw (0, _utils.rewriteErrorMessage)(error, `Failed to load client certificate: ${error.message}`);
}
}
}
async listen() {

@@ -281,11 +293,11 @@ const port = await this._socksProxy.listen(0, '127.0.0.1');

exports.ClientCertificatesProxy = ClientCertificatesProxy;
function clientCertificatesToTLSOptions(clientCertificates, origin) {
const matchingCerts = clientCertificates === null || clientCertificates === void 0 ? void 0 : clientCertificates.filter(c => {
try {
return new URL(c.origin).origin === origin;
} catch (error) {
return c.origin === origin;
}
});
if (!matchingCerts || !matchingCerts.length) return;
function normalizeOrigin(origin) {
try {
return new URL(origin).origin;
} catch (error) {
return origin;
}
}
function convertClientCertificatesToTLSOptions(clientCertificates) {
if (!clientCertificates || !clientCertificates.length) return;
const tlsOptions = {

@@ -296,3 +308,3 @@ pfx: [],

};
for (const cert of matchingCerts) {
for (const cert of clientCertificates) {
if (cert.cert) tlsOptions.cert.push(cert.cert);

@@ -310,2 +322,6 @@ if (cert.key) tlsOptions.key.push({

}
function getMatchingTLSOptionsForOrigin(clientCertificates, origin) {
const matchingCerts = clientCertificates === null || clientCertificates === void 0 ? void 0 : clientCertificates.filter(c => normalizeOrigin(c.origin) === origin);
return convertClientCertificatesToTLSOptions(matchingCerts);
}
function rewriteToLocalhostIfNeeded(host) {

@@ -312,0 +328,0 @@ return host === 'local.playwright' ? 'localhost' : host;

{
"name": "playwright-core",
"version": "1.47.0-alpha-2024-08-19",
"version": "1.47.0-alpha-2024-08-20",
"description": "A high-level API to automate web browsers",

@@ -5,0 +5,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc