forked from open-telemetry/opentelemetry-collector-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[processor/redaction] introduce
allowed_values
parameter in process…
…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]>
- Loading branch information
1 parent
c73e663
commit 1522978
Showing
8 changed files
with
192 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: enhancement | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) | ||
component: processor/redaction | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: "Introduce 'allowed_values' parameter for allowed values of attributes" | ||
|
||
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. | ||
issues: [35840] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: | ||
|
||
# If your change doesn't affect end users or the exported elements of any package, | ||
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. | ||
# Optional: The change log or logs in which this entry should be included. | ||
# e.g. '[user]' or '[user, api]' | ||
# Include 'user' if the change is relevant to end users. | ||
# Include 'api' if there is a change to a library API. | ||
# Default: '[user]' | ||
change_logs: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,10 @@ processors: | |
blocked_values: | ||
- "4[0-9]{12}(?:[0-9]{3})?" ## Visa credit card number | ||
- "(5[1-5][0-9]{14})" ## MasterCard number | ||
# AllowedValues is a list of regular expressions for allowing values of | ||
# blocked span attributes. Values that match are not masked. | ||
allowed_values: | ||
- "[email protected]" | ||
# summary controls the verbosity level of the diagnostic attributes that | ||
# the processor adds to the spans/logs/datapoints when it redacts or masks other | ||
# attributes. In some contexts a list of redacted attributes leaks | ||
|
@@ -101,9 +105,11 @@ If `allowed_keys` is empty, then no attributes are allowed. All | |
attributes are removed in that case. To keep all span attributes, you should | ||
explicitly set `allow_all_keys` to true. | ||
|
||
`blocked_values` applies to the values of the allowed keys. If the value of an | ||
allowed key matches the regular expression for a blocked value, the matching | ||
part of the value is then masked with a fixed length of asterisks. | ||
`blocked_values` and `allowed_values` applies to the values of the allowed keys. | ||
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. | ||
If the value matches the regular expression for a blocked value only, the matching | ||
part of the value is masked with a fixed length of asterisks. | ||
|
||
For example, if `notes` is on the list of allowed keys, then the `notes` | ||
attribute is retained. However, if there is a value such as a credit card | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ func TestLoadConfig(t *testing.T) { | |
AllowedKeys: []string{"description", "group", "id", "name"}, | ||
IgnoredKeys: []string{"safe_attribute"}, | ||
BlockedValues: []string{"4[0-9]{12}(?:[0-9]{3})?", "(5[1-5][0-9]{14})"}, | ||
AllowedValues: []string{"[email protected]"}, | ||
Summary: debug, | ||
}, | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.