fix(security): harden browser SSRF defaults and migrate legacy key

This commit is contained in:
Peter Steinberger
2026-02-24 01:51:44 +00:00
parent 8779b523dc
commit 5eb72ab769
24 changed files with 334 additions and 20 deletions

View File

@@ -154,4 +154,19 @@ describe("ssrf pinning", () => {
});
expect(lookup).toHaveBeenCalledTimes(1);
});
it("accepts dangerouslyAllowPrivateNetwork as an allowPrivateNetwork alias", async () => {
const lookup = vi.fn(async () => [{ address: "127.0.0.1", family: 4 }]) as unknown as LookupFn;
await expect(
resolvePinnedHostnameWithPolicy("localhost", {
lookupFn: lookup,
policy: { dangerouslyAllowPrivateNetwork: true },
}),
).resolves.toMatchObject({
hostname: "localhost",
addresses: ["127.0.0.1"],
});
expect(lookup).toHaveBeenCalledTimes(1);
});
});