Class: Instana::Secrets
- Inherits:
-
Object
- Object
- Instana::Secrets
- Defined in:
- lib/instana/secrets.rb
Instance Method Summary collapse
-
#initialize(logger: ::Instana.logger) ⇒ Secrets
constructor
A new instance of Secrets.
- #remove_from_query(str, secret_values = Instana.agent.secret_values) ⇒ Object
Constructor Details
Instance Method Details
#remove_from_query(str, secret_values = Instana.agent.secret_values) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/instana/secrets.rb', line 13 def remove_from_query(str, secret_values = Instana.agent.secret_values) return str unless secret_values && str begin url = URI(str) params = url.scheme ? CGI.parse(url.query || '') : CGI.parse(url.to_s) redacted = redact(params, secret_values) url.query = URI.encode_www_form(redacted) url.scheme ? CGI.unescape(url.to_s) : CGI.unescape(url.query) rescue URI::InvalidURIError => _e params = CGI.parse(str || '') redacted = redact(params, secret_values) CGI.unescape(URI.encode_www_form(redacted)) end end |