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

[processor/redaction] Introduce blocked_key_patterns parameter #37664

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

odubajDT
Copy link
Contributor

@odubajDT odubajDT commented Feb 4, 2025

Description

  • added blocked_key_patterns parameter to mask values of attributes, which keys match at least one of the defined patterns
  • refactored tests to make them easier to extend

Link to tracking issue

Fixes #35830

Follow-up

#38161

@github-actions github-actions bot added the processor/redaction Redaction processor label Feb 4, 2025
@odubajDT odubajDT force-pushed the redaction-blocked-patterns branch from 7c82c57 to b3a192a Compare February 4, 2025 12:42
@odubajDT odubajDT marked this pull request as ready for review February 4, 2025 13:01
@odubajDT odubajDT requested a review from a team as a code owner February 4, 2025 13:01
@odubajDT odubajDT force-pushed the redaction-blocked-patterns branch from b3a192a to 71decca Compare February 11, 2025 13:55
…shing instead of masking values via 'hash_function' parameter

Signed-off-by: odubajDT <[email protected]>
@odubajDT odubajDT force-pushed the redaction-blocked-patterns branch from be2df19 to b8eed15 Compare February 25, 2025 06:34
@odubajDT odubajDT changed the title [processor/redaction] Introduce blocked_key_patterns and support hashing instead of masking values via hash_function parameter [processor/redaction] Introduce blocked_key_patterns parameter Feb 25, 2025
component: processor/redaction

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Introduce 'blocked_key_patterns' and support hashing instead of masking values via 'hash_function' parameter"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Release note needs an update after the split

@@ -73,6 +73,11 @@ processors:
# Any keys in this list are allowed so they don't need to be in both lists.
ignored_keys:
- safe_attribute
# blocked_key_patterns is a list of blocked span attribute key patters. Span attributes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# blocked_key_patterns is a list of blocked span attribute key patters. Span attributes
# blocked_key_patterns is a list of blocked span attribute key patterns. Span attributes

Comment on lines +120 to +121
The value is then masked with a fixed length of asterisks or hashed by a function
defined in `hash_function`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit (to make it a bit more future-proof)

Suggested change
The value is then masked with a fixed length of asterisks or hashed by a function
defined in `hash_function`.
The value is then masked according to the configuration.

@@ -43,6 +45,11 @@ func newRedaction(ctx context.Context, config *Config, logger *zap.Logger) (*red
// TODO: Placeholder for an error metric in the next PR
return nil, fmt.Errorf("failed to process block list: %w", err)
}
blockKeysRegexList, err := makeRegexList(ctx, config.BlockedKeyPatterns)
if err != nil {
// TODO: Placeholder for an error metric in the next PR
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have an issue for any TODO in the code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
processor/redaction Redaction processor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[processor/redaction] Add support for keys patterns and ability to specify mask string
3 participants