@zhijiewang/openharness 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-fetch.test.d.ts","sourceRoot":"","sources":["../../src/tools/web-fetch.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import test from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { WebFetchTool } from "./WebFetchTool/index.js";
|
|
4
|
+
const ctx = { workingDir: process.cwd() };
|
|
5
|
+
test("blocks localhost", async () => {
|
|
6
|
+
const r = await WebFetchTool.call({ url: "http://localhost:8080/secret" }, ctx);
|
|
7
|
+
assert.equal(r.isError, true);
|
|
8
|
+
assert.ok(r.output.includes("blocked"));
|
|
9
|
+
});
|
|
10
|
+
test("blocks 192.168.x.x", async () => {
|
|
11
|
+
const r = await WebFetchTool.call({ url: "http://192.168.1.1/" }, ctx);
|
|
12
|
+
assert.equal(r.isError, true);
|
|
13
|
+
assert.ok(r.output.includes("blocked"));
|
|
14
|
+
});
|
|
15
|
+
test("blocks .internal hostnames", async () => {
|
|
16
|
+
const r = await WebFetchTool.call({ url: "http://app.internal/api" }, ctx);
|
|
17
|
+
assert.equal(r.isError, true);
|
|
18
|
+
assert.ok(r.output.includes("blocked"));
|
|
19
|
+
});
|
|
20
|
+
test("allows normal https URLs (will fail to connect but not blocked)", async () => {
|
|
21
|
+
// Use a URL that won't actually resolve to avoid network calls,
|
|
22
|
+
// but the SSRF check itself should pass (error will be a fetch error, not "blocked")
|
|
23
|
+
const r = await WebFetchTool.call({ url: "https://example.invalid/page" }, ctx);
|
|
24
|
+
// Should NOT be the SSRF block message
|
|
25
|
+
assert.ok(!r.output.includes("private/internal hosts is blocked"));
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=web-fetch.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1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