mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 05:31:23 +00:00
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";
|
import { createPinnedDispatcher, type PinnedHostname } from "./ssrf.js";
|
||||||
|
|
||||||
describe("createPinnedDispatcher", () => {
|
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 lookup = vi.fn() as unknown as PinnedHostname["lookup"];
|
||||||
const pinned: PinnedHostname = {
|
const pinned: PinnedHostname = {
|
||||||
hostname: "api.telegram.org",
|
hostname: "api.telegram.org",
|
||||||
@@ -27,9 +27,11 @@ describe("createPinnedDispatcher", () => {
|
|||||||
expect(agentCtor).toHaveBeenCalledWith({
|
expect(agentCtor).toHaveBeenCalledWith({
|
||||||
connect: {
|
connect: {
|
||||||
lookup,
|
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({
|
return new Agent({
|
||||||
connect: {
|
connect: {
|
||||||
lookup: pinned.lookup,
|
lookup: pinned.lookup,
|
||||||
autoSelectFamily: true,
|
|
||||||
autoSelectFamilyAttemptTimeout: 300,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user