Skip to content

[processor/redaction] Apply blocked_values patterns in configuration order - #49876

Merged
songy23 merged 3 commits into
open-telemetry:mainfrom
yamoyamoto:fix/redaction-blocked-values-order
Jul 27, 2026
Merged

[processor/redaction] Apply blocked_values patterns in configuration order#49876
songy23 merged 3 commits into
open-telemetry:mainfrom
yamoyamoto:fix/redaction-blocked-values-order

Conversation

@yamoyamoto

Copy link
Copy Markdown
Contributor

Description

Apply blocked_values patterns in the order they are listed in the configuration.

Previously the compiled patterns were stored in a map and applied in Go's unspecified map iteration order, so when two patterns matched overlapping regions of the same value, the result changed from run to run. See the tracking issue for details.

makeRegexList now returns an order-preserving slice instead of a map. The other lists built by the same helper (allowed_values, blocked_key_patterns, ignored_key_patterns) are only used with any-match semantics, so this has no behavioral effect on them. No config schema change.

Note: the map implicitly deduplicated identical pattern strings; with the slice, a duplicated pattern is now applied twice. This is only observable with hash_function configured. I kept the code simple rather than deduplicating, but can add it if preferred.

Link to tracking issue

Fixes #49858

Testing

Added TestBlockedValuesAppliedInConfigOrder: two overlapping patterns against 777-7777@example.com, asserting the expected output for both orderings, on both the attribute and log body paths, repeated 10 times so a regression to nondeterministic ordering fails reliably.

Documentation

Documented the ordering behavior in the README and added a bug_fix changelog entry.

Authorship

  • I, a human, wrote this pull request description myself.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jul 26, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: yamoyamoto / name: Tomoya Kawaguchi (bd01336)

@github-actions github-actions Bot added the first-time contributor PRs made by new contributors label Jul 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib.

Important reminders:

  • Read our Contributing Guidelines.
  • Sign the CLA if you haven't already.
  • Follow the OpenTelemetry Generative AI policy: disclose any AI use in your contribution, and communicate (PR descriptions, review replies) in your own words rather than AI-generated text.
  • Give reviewers at least a few days before pinging them for feedback.
  • If you need help with general setup, development process, or contributor etiquette, ask in #opentelemetry-new-contributors.
  • First-time contributors should have at most one PR not marked as draft until their first PR is merged.
  • If your change isn't one of our priority components, reviews may take more time.
  • Raise technical or Collector-specific questions in #otel-collector-dev or a Collector SIG meeting.

@github-actions github-actions Bot added the processor/redaction Redaction processor label Jul 26, 2026
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Jul 26, 2026

Copy link
Copy Markdown

Pull request dashboard status

Status last refreshed: 2026-07-27 16:17:10 UTC.

  • Status: Merged.

This automated status or its linked feedback items may be incorrect. If something looks wrong, please report it with the result you expected.

@singhvibhanshu

Copy link
Copy Markdown
Member

/workflow-approve

@singhvibhanshu

Copy link
Copy Markdown
Member

/workflow-approve

@paulojmdias paulojmdias added ready to merge Code review completed; ready to merge by maintainers and removed waiting-for-code-owners labels Jul 27, 2026
@paulojmdias

Copy link
Copy Markdown
Member

/workflow-approve

@singhvibhanshu

Copy link
Copy Markdown
Member

/workflow-approve

@songy23
songy23 merged commit 446ac57 into open-telemetry:main Jul 27, 2026
133 checks passed
@otelbot

otelbot Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution @yamoyamoto! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first-time contributor PRs made by new contributors processor/redaction Redaction processor ready to merge Code review completed; ready to merge by maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[processor/redaction] blocked_values patterns are applied in non-deterministic order, causing partial redaction when patterns overlap

6 participants