fix(ssrf): honor global family policy for pinned dispatcher
This commit is contained in:
@@ -13,7 +13,7 @@ vi.mock("undici", () => ({
|
||||
import { createPinnedDispatcher, type PinnedHostname } from "./ssrf.js";
|
||||
|
||||
describe("createPinnedDispatcher", () => {
|
||||
it("enables network family auto-selection for pinned lookups", () => {
|
||||
it("uses pinned lookup without overriding global family policy", () => {
|
||||
const lookup = vi.fn() as unknown as PinnedHostname["lookup"];
|
||||
const pinned: PinnedHostname = {
|
||||
hostname: "api.telegram.org",
|
||||
@@ -27,9 +27,11 @@ describe("createPinnedDispatcher", () => {
|
||||
expect(agentCtor).toHaveBeenCalledWith({
|
||||
connect: {
|
||||
lookup,
|
||||
autoSelectFamily: true,
|
||||
autoSelectFamilyAttemptTimeout: 300,
|
||||
},
|
||||
});
|
||||
const firstCallArg = agentCtor.mock.calls[0]?.[0] as
|
||||
| { connect?: Record<string, unknown> }
|
||||
| undefined;
|
||||
expect(firstCallArg?.connect?.autoSelectFamily).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -333,8 +333,6 @@ export function createPinnedDispatcher(pinned: PinnedHostname): Dispatcher {
|
||||
return new Agent({
|
||||
connect: {
|
||||
lookup: pinned.lookup,
|
||||
autoSelectFamily: true,
|
||||
autoSelectFamilyAttemptTimeout: 300,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user