From 85f04f5475f8c6531e1d0af5bb758bab534e6b54 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Feb 2026 15:13:10 +0000 Subject: [PATCH 1/2] Initial plan From 54b9e6e07feddb779f540a063fbf3010010a1316 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Feb 2026 15:16:42 +0000 Subject: [PATCH 2/2] Fix: redact Error message/stack contents in format.ts, add test Co-authored-by: SynthLuvr <131367121+SynthLuvr@users.noreply.github.com> --- src/format.ts | 3 ++- tests/index.test.ts | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/format.ts b/src/format.ts index 741e8c7..3a46888 100644 --- a/src/format.ts +++ b/src/format.ts @@ -25,7 +25,8 @@ const formatItem = (item: unknown): string => { // Check if this is an Error const error = ErrorType(item); - if (!(error instanceof type.errors)) return error.stack || error.message; + if (!(error instanceof type.errors)) + return config.redact(error.stack || error.message); const stringified = (() => { try { diff --git a/tests/index.test.ts b/tests/index.test.ts index aecbb9c..07d04d9 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -1,4 +1,5 @@ import { beforeAll, describe, expect, it } from "vitest"; +import { format } from "../src/format.js"; import { setupLogging } from "../src/index.js"; beforeAll(() => { @@ -25,4 +26,12 @@ describe("logging", () => { ); expect(true).toBe(true); }); + + it("redacts secret inside Error message and stack", () => { + const secret = + "78a2fca7a36abb167ecff613ce75cde8b4c04ef4579651f182a8cef9c86b00b5"; + const result = format([new Error(`this will be redacted ${secret}`)]); + expect(result).not.toContain(secret); + expect(result).toContain("[REDACTED]"); + }); });