Skip to content

fix(exporter): anchor slack webhook regex to prevent false-positive masking#16

Merged
jcouture merged 1 commit into
mainfrom
fix/slack-webhook-masking-regex
Jun 29, 2026
Merged

fix(exporter): anchor slack webhook regex to prevent false-positive masking#16
jcouture merged 1 commit into
mainfrom
fix/slack-webhook-masking-regex

Conversation

@jcouture

Copy link
Copy Markdown
Owner

Problem

The Slack webhook URL regex pattern in defaultValuePatterns used \b word boundaries, which caused it to match webhook URLs embedded inside larger strings. This led to false-positive masking of values that merely contained a webhook URL as a substring (e.g., a redirect URL wrapping a webhook URL).

Solution

Replace the \b word boundaries with ^ and $ anchors so the pattern only matches when the entire value is a Slack webhook URL.

Testing

Added a table-driven test (TestIsSecretValueSlackWebhook) covering:

  • Exact webhook URL value (should be masked)
  • Webhook URL embedded in a larger string (should not be masked)

  - add ^ and $ anchors to slack webhook URL pattern so it only
    matches when the entire value is a webhook URL
  - prevent false-positive masking when a webhook URL appears
    embedded inside a larger unrelated string
  - add table-driven test covering exact match and embedded cases
@jcouture jcouture merged commit 2e4dd04 into main Jun 29, 2026
2 checks passed
@jcouture jcouture deleted the fix/slack-webhook-masking-regex branch June 29, 2026 17:14
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.

1 participant