mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-13 22:37:29 +00:00
Block IPv6 unspecified feed URLs (#15)
This commit is contained in:
parent
9942ef8dc6
commit
73e2464b30
2 changed files with 2 additions and 0 deletions
|
|
@ -50,6 +50,7 @@ describe("site probing helpers", () => {
|
||||||
|
|
||||||
it("blocks private SSRF targets", async () => {
|
it("blocks private SSRF targets", async () => {
|
||||||
await expect(assertSafeHttpUrl("http://127.0.0.1/feed")).rejects.toThrow(/Blocked internal/);
|
await expect(assertSafeHttpUrl("http://127.0.0.1/feed")).rejects.toThrow(/Blocked internal/);
|
||||||
|
await expect(assertSafeHttpUrl("http://[::]/feed")).rejects.toThrow(/Blocked internal/);
|
||||||
await expect(assertSafeHttpUrl("http://[::ffff:192.168.1.10]/feed")).rejects.toThrow(/Blocked internal/);
|
await expect(assertSafeHttpUrl("http://[::ffff:192.168.1.10]/feed")).rejects.toThrow(/Blocked internal/);
|
||||||
await expect(assertSafeHttpUrl("file:///etc/passwd")).rejects.toThrow(/Unsupported URL protocol/);
|
await expect(assertSafeHttpUrl("file:///etc/passwd")).rejects.toThrow(/Unsupported URL protocol/);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ function isBlockedIp(value: string) {
|
||||||
return isBlockedIp(`${high >> 8}.${high & 255}.${low >> 8}.${low & 255}`);
|
return isBlockedIp(`${high >> 8}.${high & 255}.${low >> 8}.${low & 255}`);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
normalized === "::" ||
|
||||||
normalized === "::1" ||
|
normalized === "::1" ||
|
||||||
normalized.startsWith("fc") ||
|
normalized.startsWith("fc") ||
|
||||||
normalized.startsWith("fd") ||
|
normalized.startsWith("fd") ||
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue