mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
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:
3 files changed
+119
-1
No files matched your search
+16
-1
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user