Skip to content

Fix: Error objects bypass redaction#22

Merged
SynthLuvr merged 2 commits into
mainfrom
copilot/fix-redacting-error-logger
Feb 26, 2026
Merged

Fix: Error objects bypass redaction#22
SynthLuvr merged 2 commits into
mainfrom
copilot/fix-redacting-error-logger

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 26, 2026

When an Error is passed to the logger, formatItem returned error.stack || error.message directly without redacting, leaking secrets embedded in error messages/stack traces.

Changes

  • src/format.ts: Wrap the Error stack/message in config.redact() before returning
  • tests/index.test.ts: Add test asserting secrets in Error messages are redacted

Example

// Before fix — secret appears in output
console.error(
  "This will be redacted 78a2fca7a36abb167ecff613ce75cde8b4c04ef4579651f182a8cef9c86b00b5",
  new Error("this will NOT be redacted 78a2fca7a36abb167ecff613ce75cde8b4c04ef4579651f182a8cef9c86b00b5"),
);
// → "This will be redacted [REDACTED] Error: this will NOT be redacted 78a2fca7a36abb167ecff613ce75cde8b4c04ef4579651f182a8cef9c86b00b5"

// After fix
// → "This will be redacted [REDACTED] Error: this will be redacted [REDACTED]"

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: SynthLuvr <131367121+SynthLuvr@users.noreply.github.com>
Comment thread src/format.ts
Comment thread tests/index.test.ts
Copilot AI changed the title [WIP] Fix redacting issue in error logger Fix: Error objects bypass redaction Feb 26, 2026
@SynthLuvr SynthLuvr marked this pull request as ready for review February 26, 2026 15:21
@SynthLuvr SynthLuvr merged commit dadbfb9 into main Feb 26, 2026
3 checks passed
@SynthLuvr SynthLuvr deleted the copilot/fix-redacting-error-logger branch February 26, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants