Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+26
@@ -57,4 +57,30 @@ describe("outbound HTTP guard", () => {
|
||||
const response = new Response("abcdef");
|
||||
await expect(readLimitedResponseText(response, 3)).resolves.toEqual({ body: "abc", truncated: true });
|
||||
});
|
||||
|
||||
test("pins the connection to the DNS-validated address to defeat rebinding", async () => {
|
||||
const fetchImpl = vi.fn(async () => 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, pinResolvedAddress: true },
|
||||
);
|
||||
|
||||
// The request must carry a pinned undici dispatcher so undici connects to
|
||||
// the validated IP instead of re-resolving the hostname at connect time.
|
||||
const init = fetchImpl.mock.calls[0]?.[1] as (RequestInit & { dispatcher?: unknown }) | undefined;
|
||||
expect(init?.dispatcher).toBeDefined();
|
||||
});
|
||||
|
||||
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 addressResolver = vi.fn(async () => ["93.184.216.34"]);
|
||||
|
||||
await fetchOutboundHttpWithRedirects("https://hooks.example.com/webhook", { method: "GET" }, { fetchImpl, addressResolver });
|
||||
|
||||
const init = fetchImpl.mock.calls[0]?.[1] as (RequestInit & { dispatcher?: unknown }) | undefined;
|
||||
expect(init?.dispatcher).toBeUndefined();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user