Class: Elastic::Transport::OpenTelemetry::Sanitizer Private

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic/transport/opentelemetry.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Replaces values in a hash with ‘REDACTED’, given a set of keys to match on.

Constant Summary collapse

FILTERED =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'REDACTED'
DEFAULT_KEY_PATTERNS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%w[password passwd pwd secret *key *token* *session* *credit* *card* *auth* set-cookie].map! do |p|
  Regexp.new(p.gsub('*', '.*'))
end

Class Method Summary collapse

Class Method Details

.sanitize(body, key_patterns = []) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



89
90
91
92
93
# File 'lib/elastic/transport/opentelemetry.rb', line 89

def sanitize(body, key_patterns = [])
  patterns = DEFAULT_KEY_PATTERNS
  patterns += key_patterns if key_patterns
  sanitize!(DeepDup.dup(body), patterns)
end