Skip to content

fix(#582): redact sensitive webhook headers from error logs#613

Merged
OneStepAt4time merged 1 commit intomainfrom
fix/582-webhook-header-leak
Mar 31, 2026
Merged

fix(#582): redact sensitive webhook headers from error logs#613
OneStepAt4time merged 1 commit intomainfrom
fix/582-webhook-header-leak

Conversation

@OneStepAt4time
Copy link
Copy Markdown
Owner

Summary

Redacts sensitive header values (Authorization, Cookie, X-API-Key, etc.) from webhook error logs to prevent secret leakage.

Changes

  • src/utils/redact-headers.ts (new) β€” redactHeaders() and redactSecretsFromText() utilities
  • src/channels/webhook.ts β€” applies header redaction in error catch blocks
  • src/__tests__/webhook-header-redaction.test.ts β€” 113 lines of tests covering all sensitive patterns

Scope

Minimal: 3 files, +170 -1 lines. No unrelated changes.

Fixes #582

Quality Gate

  • tsc --noEmit β€” zero errors
  • npm run build β€” success
  • npm test β€” 77 files, 1776 tests passed

Add redact-headers utility that masks Authorization, Cookie, X-Api-Key
and other sensitive header values before they can appear in error output.
Applied to webhook delivery error messages to prevent secret leakage.

Generated by Hephaestus (Aegis dev agent)
@gitguardian
Copy link
Copy Markdown

gitguardian bot commented Mar 31, 2026

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

πŸ”Ž Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
29378933 Triggered X-API-Key Secret 78be71c src/tests/webhook-header-redaction.test.ts View secret
πŸ›  Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


πŸ¦‰ GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@OneStepAt4time OneStepAt4time merged commit 9f9f614 into main Mar 31, 2026
3 of 4 checks passed
@OneStepAt4time OneStepAt4time deleted the fix/582-webhook-header-leak branch March 31, 2026 02:19
@OneStepAt4time
Copy link
Copy Markdown
Owner Author

🚨 Bug audit verified: STILL PRESENT

webhook.ts:119-127 still leaks session metadata (id, name, workDir) in payload. No redaction applied.

New tracking issue: #827 (P2)

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.

[Security][Warning] Webhook custom headers may leak secrets in error logs

1 participant