mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 07:52:44 +00:00
fix(security): enforce strict IPv4 SSRF literal handling
This commit is contained in:
@@ -133,6 +133,17 @@ describe("ssrf pinning", () => {
|
||||
expect(lookup).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("blocks unsupported short-form IPv4 literals before DNS lookup", async () => {
|
||||
const lookup = vi.fn(async () => [
|
||||
{ address: "93.184.216.34", family: 4 },
|
||||
]) as unknown as LookupFn;
|
||||
|
||||
await expect(resolvePinnedHostnameWithPolicy("8.8.2056", { lookupFn: lookup })).rejects.toThrow(
|
||||
SsrFBlockedError,
|
||||
);
|
||||
expect(lookup).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("allows ISATAP embedded private IPv4 when private network is explicitly enabled", async () => {
|
||||
const lookup = vi.fn(async () => [
|
||||
{ address: "2001:db8:1234::5efe:127.0.0.1", family: 6 },
|
||||
|
||||
Reference in New Issue
Block a user