H-385: add Clark CDP network spike

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
2026-08-20 22:10:00 +08:00
co-authored by multica-agent
parent 1dac5c15f1
commit 8095392f7f
7 changed files with 800 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
import assert from "node:assert/strict";
import { randomUUID } from "node:crypto";
import test from "node:test";
import { boundedBody, redactHeaders, safeUrl } from "../scripts/m0-spike.mjs";
test("export policy redacts credentials and bounds bodies", () => {
const sensitive = randomUUID();
assert.deepEqual(redactHeaders({ Cookie: sensitive, Authorization: sensitive, Referer: "https://example.test/private", "Set-Cookie": sensitive, Accept: "*/*" }), {
accept: "*/*",
authorization: "[REDACTED]",
cookie: "[REDACTED]",
referer: "[REDACTED]",
"set-cookie": "[REDACTED]",
});
assert.equal(safeUrl("https://example.test/path?token=secret"), "https://example.test/path?<redacted>");
assert.deepEqual(boundedBody("hello", false, 5), { state: "stored", bytes: 5, encoding: "utf8", text: "hello" });
assert.deepEqual(boundedBody("hello!", false, 5), { state: "omitted", reason: "size_limit", bytes: 6 });
});