| 123456789 |
- import { describe, expect, it } from "vitest";
- import { pretty, redact } from "@/lib/redact";
- describe("redaction", () => {
- it("redacts credential-like fields and bearer values", () => {
- expect(redact({ apiKey: "secret", nested: { authorization: "Bearer abc.def" }, safe: "ok" })).toEqual({ apiKey: "[REDACTED]", nested: { authorization: "[REDACTED]" }, safe: "ok" });
- expect(pretty("Authorization: Bearer abc.def")).toContain("Bearer [REDACTED]");
- });
- });
|