mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 05:42:43 +00:00
fix(ssrf): centralize host/ip block checks
This commit is contained in:
@@ -49,8 +49,11 @@ describe("ssrf pinning", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects private DNS results", async () => {
|
||||
const lookup = vi.fn(async () => [{ address: "10.0.0.8", family: 4 }]) as unknown as LookupFn;
|
||||
it.each([
|
||||
{ name: "RFC1918 private address", address: "10.0.0.8" },
|
||||
{ name: "RFC2544 benchmarking range", address: "198.18.0.1" },
|
||||
])("rejects blocked DNS results: $name", async ({ address }) => {
|
||||
const lookup = vi.fn(async () => [{ address, family: 4 }]) as unknown as LookupFn;
|
||||
await expect(resolvePinnedHostname("example.com", lookup)).rejects.toThrow(/private|internal/i);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user