Merge aa54fa9a7b9262adffa59fd338e4daaf72d3611b into 5e417b44e1540f528d2ae63e3e20229a902d1db2
This commit is contained in:
commit
b8fac7f128
@ -210,9 +210,29 @@ describe("createPinnedDispatcher", () => {
|
||||
|
||||
expect(proxyAgentCtor).toHaveBeenCalledWith({
|
||||
uri: "http://127.0.0.1:7890",
|
||||
requestTls: { lookup },
|
||||
proxyTls: {
|
||||
autoSelectFamily: false,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("passes pinned lookup via requestTls when proxyTls is absent", () => {
|
||||
const lookup = vi.fn() as unknown as PinnedHostname["lookup"];
|
||||
const pinned: PinnedHostname = {
|
||||
hostname: "api.telegram.org",
|
||||
addresses: ["149.154.167.220"],
|
||||
lookup,
|
||||
};
|
||||
|
||||
createPinnedDispatcher(pinned, {
|
||||
mode: "explicit-proxy",
|
||||
proxyUrl: "http://127.0.0.1:7890",
|
||||
});
|
||||
|
||||
expect(proxyAgentCtor).toHaveBeenCalledWith({
|
||||
uri: "http://127.0.0.1:7890",
|
||||
requestTls: { lookup },
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -416,11 +416,16 @@ export function createPinnedDispatcher(
|
||||
}
|
||||
|
||||
const proxyUrl = policy.proxyUrl.trim();
|
||||
// Always pass the pinned lookup via requestTls so DNS resolution for the
|
||||
// origin server goes through the SSRF-safe pinned lookup, not the default
|
||||
// resolver. Without this, ProxyAgent bypasses DNS pinning (#46685).
|
||||
const requestTls = withPinnedLookup(pinned.lookup);
|
||||
if (!policy.proxyTls) {
|
||||
return new ProxyAgent(proxyUrl);
|
||||
return new ProxyAgent({ uri: proxyUrl, requestTls });
|
||||
}
|
||||
return new ProxyAgent({
|
||||
uri: proxyUrl,
|
||||
requestTls,
|
||||
proxyTls: { ...policy.proxyTls },
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user