https: distinguish PFX object-array agent keys

Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
PR-URL: https://github.com/nodejs-private/node-private/pull/930
Refs: https://hackerone.com/reports/3816840
CVE-ID: CVE-2026-56850
This commit is contained in:
RafaelGSS committed 2026-07-27 19:51:49 -03:00
1 parent a77c7f7354
commit fcbdbe47ea
3 files changed
+119 -1

No files matched your search

+16 -1
View File
@@ -22,6 +22,7 @@
'use strict';
const {
ArrayIsArray,
ArrayPrototypeIndexOf,
ArrayPrototypePush,
ArrayPrototypeShift,
@@ -471,6 +472,20 @@ ObjectSetPrototypeOf(Agent.prototype, HttpAgent.prototype);
ObjectSetPrototypeOf(Agent, HttpAgent);
Agent.prototype.createConnection = createConnection;
function getPfxAgentKey(pfx, passphrase) {
if (!ArrayIsArray(pfx))
return pfx;
let key = '';
for (let i = 0; i < pfx.length; i++) {
const value = pfx[i];
const raw = value?.buf || value;
const pass = value?.passphrase || passphrase;
key += `:${raw}:${pass}`;
}
return key;
}
/**
* Gets a unique name for a set of options.
* @param {{
@@ -506,7 +521,7 @@ Agent.prototype.getName = function getName(options = kEmptyObject) {
name += ':';
if (options.pfx)
name += options.pfx;
name += getPfxAgentKey(options.pfx, options.passphrase);
name += ':';
if (options.rejectUnauthorized !== undefined)