mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 09:41:41 +00:00
fix(security): harden SSRF IPv4 literal parsing
This commit is contained in:
@@ -122,6 +122,17 @@ describe("ssrf pinning", () => {
|
||||
expect(lookup).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("blocks legacy loopback 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("0177.0.0.1", { 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