Skip to content
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

Redaction process only works for string attributes #37590

Open
kyle-watershed opened this issue Jan 30, 2025 · 3 comments
Open

Redaction process only works for string attributes #37590

kyle-watershed opened this issue Jan 30, 2025 · 3 comments
Labels
bug Something isn't working needs triage New item requiring triage processor/redaction Redaction processor

Comments

@kyle-watershed
Copy link

Component(s)

processor/redaction

What happened?

Description

The redaction processor seems to use https://pkg.go.dev/go.opentelemetry.io/collector/pdata/pcommon#Value.Str to convert the value to a string when evaluating blocked_values here: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/redactionprocessor/processor.go#L190. This creates some unexpected behavior because of how Value.Str works:

If the Type() is not ValueTypeStr then returns empty string.
means that for all other types (array, boolean, integer) the regex will never match.

I was hoping that the redaction process would be able to redact array values - do you have any advice on how to achieve that? The desired behavior is to either redact the entire array if any element matches a regex or apply redaction to individual elements within the array (masking only the matching values).

Steps to Reproduce

Attempt to use blocked_values to redact attributes with type other than string

Expected Result

Redacts the values

Actual Result

Does not redact the values

Collector version

0.89

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

Log output

Additional context

No response

@kyle-watershed kyle-watershed added bug Something isn't working needs triage New item requiring triage labels Jan 30, 2025
@github-actions github-actions bot added the processor/redaction Redaction processor label Jan 30, 2025
Copy link
Contributor

Pinging code owners:

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

@mx-psi
Copy link
Member

mx-psi commented Jan 30, 2025

Hey, thanks for filing this! Is this a duplicate of #36684 ?

@kyle-watershed
Copy link
Author

@mx-psi Yep, this is a similar issue, just calling out that the problem isn't just limited to numeric types - it affects all non-string types, such as arrays as well. I was also hoping to get some advice on the best way to handle redaction for arrays

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage New item requiring triage processor/redaction Redaction processor
Projects
None yet
Development

No branches or pull requests

2 participants