Class: PlatformSdk::Sentry::PiiScrubber
- Inherits:
-
Object
- Object
- PlatformSdk::Sentry::PiiScrubber
- Defined in:
- lib/platform_sdk/sentry/pii_scrubber.rb
Overview
Scrubs PII from Sentry events
Constant Summary collapse
- DEFAULT_PII_FIELDS =
Pii::DEFAULT_FIELDS
- FILTERED =
Pii::FILTERED
- EMAIL_REGEX =
Pii::EMAIL_REGEX
Instance Attribute Summary collapse
-
#filter ⇒ Object
readonly
Returns the value of attribute filter.
Instance Method Summary collapse
-
#initialize(additional_fields: []) ⇒ PiiScrubber
constructor
A new instance of PiiScrubber.
- #scrub_breadcrumb(breadcrumb) ⇒ Object
- #scrub_event(event) ⇒ Object
- #scrub_hash(hash) ⇒ Object
Constructor Details
#initialize(additional_fields: []) ⇒ PiiScrubber
Returns a new instance of PiiScrubber.
15 16 17 18 |
# File 'lib/platform_sdk/sentry/pii_scrubber.rb', line 15 def initialize(additional_fields: []) fields = DEFAULT_PII_FIELDS + additional_fields @filter = ActiveSupport::ParameterFilter.new(fields, mask: FILTERED) end |
Instance Attribute Details
#filter ⇒ Object (readonly)
Returns the value of attribute filter.
13 14 15 |
# File 'lib/platform_sdk/sentry/pii_scrubber.rb', line 13 def filter @filter end |
Instance Method Details
#scrub_breadcrumb(breadcrumb) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/platform_sdk/sentry/pii_scrubber.rb', line 34 def () .data = scrub_hash(.data) if .data.is_a?(Hash) . = (.) if . end |
#scrub_event(event) ⇒ Object
26 27 28 29 30 |
# File 'lib/platform_sdk/sentry/pii_scrubber.rb', line 26 def scrub_event(event) scrub_event_data(event) scrub_request(event.request) if event.request event end |
#scrub_hash(hash) ⇒ Object
20 21 22 23 24 |
# File 'lib/platform_sdk/sentry/pii_scrubber.rb', line 20 def scrub_hash(hash) return {} unless hash.is_a?(Hash) filter.filter(hash) end |