Skip to content
Snippets Groups Projects
Verified Commit 5bf35423 authored by Alexander Olofsson's avatar Alexander Olofsson
Browse files

Improve body cleaner for debug output

parent c27aab89
No related branches found
No related tags found
No related merge requests found
Pipeline #17829 failed
...@@ -152,9 +152,17 @@ module Passwordstate ...@@ -152,9 +152,17 @@ module Passwordstate
return if http.body.nil? return if http.body.nil?
body_cleaner = lambda do |obj|
obj.each { |k, v| v.replace('[ REDACTED ]') if k.is_a?(String) && %w[password apikey].include?(k.downcase) } if obj.is_a? Hash
end
clean_body = JSON.parse(http.body) rescue nil clean_body = JSON.parse(http.body) rescue nil
if clean_body if clean_body
clean_body = clean_body.each { |k, v| v.replace('[ REDACTED ]') if k.is_a?(String) && %w[password apikey].include?(k.downcase) }.to_json if http.body if clean_body.is_a? Array
clean_body.each { |val| body_cleaner.call(val) }
else
body_cleaner.call(clean_body)
end
else else
clean_body = http.body clean_body = http.body
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment