Class: Sentry::Scrubbers::FilterRequestBody

Inherits:
Object
  • Object
show all
Defined in:
lib/sentry/scrubbers/filter_request_body.rb

Constant Summary collapse

FILTERED_CONTROLLERS =
%w[ppiu].freeze

Instance Method Summary collapse

Instance Method Details

#newObject



10
11
12
# File 'lib/sentry/scrubbers/filter_request_body.rb', line 10

def new
  self
end

#process(data) ⇒ Object



14
15
16
# File 'lib/sentry/scrubbers/filter_request_body.rb', line 14

def process(data)
  sanitize(data.deep_stringify_keys)
end

#sanitize(stringified_data) ⇒ Object (private)



20
21
22
23
24
25
26
27
28
# File 'lib/sentry/scrubbers/filter_request_body.rb', line 20

def sanitize(stringified_data)
  if FILTERED_CONTROLLERS.include?(stringified_data.dig('tags', 'controller_name')) &&
     stringified_data.dig('request', 'data').present?

    stringified_data['request']['data'] = PIISanitizer::FILTER_MASK
  end

  stringified_data
end