Module: Sentry::Rails::LogSubscribers::ParameterFilter
- Included in:
- ActionControllerSubscriber, ActionMailerSubscriber, ActiveJobSubscriber, ActiveRecordSubscriber
- Defined in:
- lib/sentry/rails/log_subscribers/parameter_filter.rb
Overview
Shared utility module for filtering sensitive parameters in log subscribers.
This module provides consistent parameter filtering across all Sentry Rails log subscribers, leveraging Rails’ built-in parameter filtering when available. It automatically detects the correct Rails parameter filtering API based on the Rails version and includes the appropriate implementation module.
Constant Summary collapse
- EMPTY_HASH =
{}.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#filter_sensitive_params(params) ⇒ Hash
Filter sensitive parameters from a hash, respecting Rails configuration.
Class Method Details
.backend ⇒ Object
28 29 30 |
# File 'lib/sentry/rails/log_subscribers/parameter_filter.rb', line 28 def self.backend ActiveSupport::ParameterFilter end |
Instance Method Details
#filter_sensitive_params(params) ⇒ Hash
Filter sensitive parameters from a hash, respecting Rails configuration.
41 42 43 44 45 46 47 48 |
# File 'lib/sentry/rails/log_subscribers/parameter_filter.rb', line 41 def filter_sensitive_params(params) return EMPTY_HASH unless params.is_a?(Hash) filter_parameters = ::Rails.application.config.filter_parameters parameter_filter = ParameterFilter.backend.new(filter_parameters) parameter_filter.filter(params) end |