Skip to content

[processor/redaction] Add support for allowed values that are never redacted #35840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
janslow opened this issue Oct 16, 2024 · 4 comments · Fixed by #37638
Closed

[processor/redaction] Add support for allowed values that are never redacted #35840

janslow opened this issue Oct 16, 2024 · 4 comments · Fixed by #37638
Labels
enhancement New feature or request priority:p2 Medium processor/redaction Redaction processor

Comments

@janslow
Copy link

janslow commented Oct 16, 2024

Component(s)

processor/redaction

Is your feature request related to a problem? Please describe.

I want the processor to never redact specific values, such as email addresses from specific domains. For example, we need [email protected] to be redacted for compliance purposes, but not [email protected]

Describe the solution you'd like

Add an allowed_values configuration option that is a list of regexes (same as blocked_values), then never redact values that match at least one allowed_values regex (even if it also matches a blocked_values regex).

For example, with the given config:

processors:
  redaction:
    # ...
    blocked_values:
      - '.+@.+'
    allowed_values:
      - '[email protected]'

then [email protected] would be redacted in the relevant attributes, but [email protected] wouldn't.

Describe alternatives you've considered

The blocked_values uses Go's regexp package, which doesn't support negative lookahead, which could have been another alternative. There may be workarounds by incrementally excluding matches, but they result in very complex and hard to maintain patterns (especially if multiple patterns need to be allowed, e.g., multiple email domains)

Additional context

I'm happy to contribute a PR if my proposed solution is acceptable

@janslow janslow added enhancement New feature or request needs triage New item requiring triage labels Oct 16, 2024
@github-actions github-actions bot added the processor/redaction Redaction processor label Oct 16, 2024
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@TylerHelmuth TylerHelmuth added priority:p2 Medium and removed needs triage New item requiring triage labels Oct 22, 2024
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@odubajDT
Copy link
Contributor

odubajDT commented Jan 31, 2025

Hi, I would like to take this ticket, if it's still free to grab

@mx-psi
Copy link
Member

mx-psi commented Jan 31, 2025

I support this and you can go ahead @odubajDT !

mx-psi pushed a commit that referenced this issue Feb 11, 2025
…or config (#37638)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Introduce `allowed_values` parameter to the processor config.

If the value of an allowed key matches the regular expression for an
allowed value, the matching
part of the value is not masked even if it matches the regular
expression for a blocked value.

<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes #35840

---------

Signed-off-by: odubajDT <[email protected]>
khushijain21 pushed a commit to khushijain21/opentelemetry-collector-contrib that referenced this issue Feb 14, 2025
…or config (open-telemetry#37638)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Introduce `allowed_values` parameter to the processor config.

If the value of an allowed key matches the regular expression for an
allowed value, the matching
part of the value is not masked even if it matches the regular
expression for a blocked value.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#35840

---------

Signed-off-by: odubajDT <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority:p2 Medium processor/redaction Redaction processor
Projects
None yet
4 participants