Module: LogjamAgent::Obfuscation
- Included in:
- LogjamAgent, Rack::Logger
- Defined in:
- lib/logjam_agent/obfuscation.rb
Constant Summary collapse
Instance Method Summary collapse
- #cookie_obfuscator ⇒ Object
- #filter_pairs(str, filter) ⇒ Object
-
#ip_obfuscator(ip) ⇒ Object
TODO: ipv6 obfuscation.
- #obfuscate_cookie(cookie, filter = cookie_obfuscator) ⇒ Object
Instance Method Details
#cookie_obfuscator ⇒ Object
15 16 17 |
# File 'lib/logjam_agent/obfuscation.rb', line 15 def @cookie_obfuscator ||= ParameterFilter.new() end |
#filter_pairs(str, filter) ⇒ Object
37 38 39 40 41 |
# File 'lib/logjam_agent/obfuscation.rb', line 37 def filter_pairs(str, filter) str.gsub(PAIR_RE) do |_| filter.filter($1 => $2).first.join("=") end end |
#ip_obfuscator(ip) ⇒ Object
TODO: ipv6 obfuscation
8 9 10 |
# File 'lib/logjam_agent/obfuscation.rb', line 8 def ip_obfuscator(ip) obfuscate_ips ? ip.to_s.sub(/\d+\z/, 'XXX') : ip end |
#obfuscate_cookie(cookie, filter = cookie_obfuscator) ⇒ Object
19 20 21 |
# File 'lib/logjam_agent/obfuscation.rb', line 19 def (, filter = ) filter_pairs(, filter) end |