Module: Contrast::Agent::Telemetry::Exception::Obfuscate
- Defined in:
- lib/contrast/agent/telemetry/exception/obfuscate.rb
Overview
Obfuscate sensitive user data before building exception.
Constant Summary collapse
- CHARS =
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.cs__freeze
- CYPHER =
This will generate different chars for each agent startup but will be constant for current run and will make identical obfuscation to be compared if given type is the same.
CHARS.chars.shuffle.join.cs__freeze
- VERSION_MATCH =
'[^0-9].-'
- RUBY_EXT =
/\.(?:rb|gemspec)$/i
- KNOWN_DIRS =
List of known places after witch a user name might appear:
%w[app application lib project projects git github users home user].cs__freeze
Class Method Summary collapse
-
.known_paths ⇒ Array<Regexp>
Returns paths for known gems.
-
.obfuscate_path(path) ⇒ String
Obfuscate a type and replace it with random characters.
Class Method Details
.known_paths ⇒ Array<Regexp>
Returns paths for known gems.
28 29 30 31 32 |
# File 'lib/contrast/agent/telemetry/exception/obfuscate.rb', line 28 def known_paths @_known_paths ||= KNOWN_DIRS.map do |name| to_regexp(name) end end |
.obfuscate_path(path) ⇒ String
Obfuscate a type and replace it with random characters.
38 39 40 41 42 |
# File 'lib/contrast/agent/telemetry/exception/obfuscate.rb', line 38 def obfuscate_path path return path if Contrast::Utils::DuckUtils.empty_duck?(path) cypher(path) end |