diff --git a/processor/redactionprocessor/README.md b/processor/redactionprocessor/README.md index 799536143e9f..e6ad1ab4de84 100644 --- a/processor/redactionprocessor/README.md +++ b/processor/redactionprocessor/README.md @@ -73,6 +73,8 @@ processors: # Any keys in this list are allowed so they don't need to be in both lists. ignored_keys: - safe_attribute + # redact_all_types will check incoming fields for sensitive data based on their AsString() representation. This allows the processor to redact sensitive data from ints. This is useful for redacting credit card numbers + redact_all_types: true # blocked_values is a list of regular expressions for blocking values of # allowed span attributes. Values that match are masked blocked_values: diff --git a/processor/redactionprocessor/config.go b/processor/redactionprocessor/config.go index 7faaa9ef8ec9..a9469b6dd71e 100644 --- a/processor/redactionprocessor/config.go +++ b/processor/redactionprocessor/config.go @@ -19,6 +19,11 @@ type Config struct { // without being changed or removed. IgnoredKeys []string `mapstructure:"ignored_keys"` + // RedactAllTypes is a flag to allow the processor to redact all span + // attribute values including those that are not strings. By default + // it is false and only string values are redacted. + RedactAllTypes bool `mapstructure:"redact_all_types"` + // BlockedValues is a list of regular expressions for blocking values of // allowed span attributes. Values that match are masked BlockedValues []string `mapstructure:"blocked_values"` diff --git a/processor/redactionprocessor/processor.go b/processor/redactionprocessor/processor.go index f2aecf84b286..64885b7c80d2 100644 --- a/processor/redactionprocessor/processor.go +++ b/processor/redactionprocessor/processor.go @@ -188,6 +188,9 @@ func (s *redaction) processAttrs(_ context.Context, attributes pcommon.Map) { // Mask any blocked values for the other attributes strVal := value.Str() + if s.config.RedactAllTypes { + strVal = value.AsString() + } var matched bool for _, compiledRE := range s.blockRegexList { match := compiledRE.MatchString(strVal)