Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -7,6 +7,8 @@ describe("outbound HTTP guard", () => {
test("blocks private and internal targets", () => {
expect(() => validateOutboundHttpUrl("http://127.0.0.1/metadata")).toThrow("Outbound HTTP endpoint host is not allowed.");
expect(() => validateOutboundHttpUrl("http://[fec0::1]/internal")).toThrow("Outbound HTTP endpoint host is not allowed.");
expect(() => validateOutboundHttpUrl("http://[ff02::1]/multicast")).toThrow("Outbound HTTP endpoint host is not allowed.");
expect(() => validateOutboundHttpUrl("https://service.internal/hook")).toThrow("Outbound HTTP endpoint host is not allowed.");
expect(validateOutboundHttpUrl("https://hooks.example.com/workflow")).toBe("https://hooks.example.com/workflow");
});
@@ -59,7 +61,11 @@ describe("outbound HTTP guard", () => {
});
test("pins the connection to the DNS-validated address to defeat rebinding", async () => {
const fetchImpl = vi.fn(async () => new Response("ok", { status: 200 }));
const fetchImpl = vi.fn(async (input: Parameters<typeof fetch>[0], init?: Parameters<typeof fetch>[1]) => {
void input;
void init;
return new Response("ok", { status: 200 });
});
const addressResolver = vi.fn(async () => ["93.184.216.34"]);
await fetchOutboundHttpWithRedirects(
@@ -74,8 +80,38 @@ describe("outbound HTTP guard", () => {
expect(init?.dispatcher).toBeDefined();
});
test("closes every pinned dispatcher after redirect and final-response hops", async () => {
const { Agent } = await import("undici");
const closeSpy = vi.spyOn(Agent.prototype, "close");
const fetchImpl = vi
.fn()
.mockResolvedValueOnce(new Response(null, { status: 307, headers: { location: "https://hooks.example.com/final" } }))
.mockResolvedValueOnce(new Response("ok", { status: 200 }));
try {
const response = await fetchOutboundHttpWithRedirects(
"https://hooks.example.com/start",
{ method: "POST", body: "payload" },
{ fetchImpl, addressResolver: publicResolver, pinResolvedAddress: true }
);
await response.text();
expect(fetchImpl).toHaveBeenCalledTimes(2);
const hopDispatchers = fetchImpl.mock.calls.map((call) => (call[1] as RequestInit & { dispatcher?: unknown }).dispatcher);
expect(new Set(hopDispatchers).size).toBe(2);
const closedDispatchers = new Set<unknown>(closeSpy.mock.instances);
expect(hopDispatchers.every((dispatcher) => closedDispatchers.has(dispatcher))).toBe(true);
} finally {
closeSpy.mockRestore();
}
});
test("does not pin when a custom fetchImpl is used without opting in", async () => {
const fetchImpl = vi.fn(async () => new Response("ok", { status: 200 }));
const fetchImpl = vi.fn(async (input: Parameters<typeof fetch>[0], init?: Parameters<typeof fetch>[1]) => {
void input;
void init;
return new Response("ok", { status: 200 });
});
const addressResolver = vi.fn(async () => ["93.184.216.34"]);
await fetchOutboundHttpWithRedirects("https://hooks.example.com/webhook", { method: "GET" }, { fetchImpl, addressResolver });