Module: Contrast::Agent::Reporting::Masker

Extended by:
MaskerUtils, Components::Logger::InstanceMethods, Utils::ObjectShare
Defined in:
lib/contrast/agent/reporting/masker/masker.rb

Overview

This module duty is to mask any activity containing sensitive information - PII masking.

Constant Summary collapse

MASK =
'contrast-redacted-'
BODY_MASK =
'contrast-redacted-body'
BODY_BINARY_MASK =
BODY_MASK.bytes.to_s.cs__freeze

Constants included from Utils::ObjectShare

Utils::ObjectShare::AMPERSAND, Utils::ObjectShare::ASTERISK, Utils::ObjectShare::AT, Utils::ObjectShare::BACK_SLASH, Utils::ObjectShare::BANG, Utils::ObjectShare::CACHE, Utils::ObjectShare::CARROT, Utils::ObjectShare::COLON, Utils::ObjectShare::COLON_SLASH_SLASH, Utils::ObjectShare::COMMA, Utils::ObjectShare::CONTRAST_DOT, Utils::ObjectShare::CONTRAST_PATCHED_METHOD_START, Utils::ObjectShare::DASH, Utils::ObjectShare::DIGIT_REGEXP, Utils::ObjectShare::DOLLAR_SIGN, Utils::ObjectShare::DOUBLE_QUOTE, Utils::ObjectShare::DOUBLE_UNDERSCORE, Utils::ObjectShare::EMPTY_ARRAY, Utils::ObjectShare::EMPTY_HASH, Utils::ObjectShare::EMPTY_STRING, Utils::ObjectShare::EQUALS, Utils::ObjectShare::EXCLAMATION, Utils::ObjectShare::FALSE, Utils::ObjectShare::HTTPS_START, Utils::ObjectShare::HTTP_SCORE, Utils::ObjectShare::HTTP_START, Utils::ObjectShare::INDEX, Utils::ObjectShare::LEFT_ANGLE, Utils::ObjectShare::NEW_LINE, Utils::ObjectShare::NIL_64_STRING, Utils::ObjectShare::NIL_STRING, Utils::ObjectShare::NOT_WHITE_SPACE_REGEXP, Utils::ObjectShare::OBJECT_KEY, Utils::ObjectShare::OVERRIDE_MESSAGE, Utils::ObjectShare::PARENT_PATH, Utils::ObjectShare::PERIOD, Utils::ObjectShare::POUND_SIGN, Utils::ObjectShare::QUESTION_MARK, Utils::ObjectShare::RETURN, Utils::ObjectShare::RETURN_KEY, Utils::ObjectShare::RUBY, Utils::ObjectShare::SEMICOLON, Utils::ObjectShare::SINGLE_QUOTE, Utils::ObjectShare::SLASH, Utils::ObjectShare::SPACE, Utils::ObjectShare::TRUE, Utils::ObjectShare::UNDERSCORE, Utils::ObjectShare::UNKNOWN, Utils::ObjectShare::WHITE_SPACE_REGEXP, Utils::ObjectShare::WRITE_FLAG

Class Method Summary collapse

Methods included from MaskerUtils

mask_raw_query

Methods included from Components::Logger::InstanceMethods

cef_logger, logger

Class Method Details

.dictionaryObject

Keyword dictionary, extracted from the TS response.



27
28
29
# File 'lib/contrast/agent/reporting/masker/masker.rb', line 27

def dictionary
  @_dictionary ||= update_dictionary
end

.mask(activity) ⇒ Object

Mask sensitive data according to the contrast sensitive data rules.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/contrast/agent/reporting/masker/masker.rb', line 34

def mask activity
  return unless activity

  logger.debug('Masker: masking sensitive data', activity: activity.__id__, request: activity.request&.__id__)
  return if activity.request.nil?

  mask_body(activity)
  mask_query_string(activity)
  mask_request_params(activity)
  mask_request_cookies(activity)
  mask_request_headers(activity)
rescue StandardError => _e
  logger.debug('Could not mask activity!', activity: activity.__id__, request: activity.request&.__id__)
end