Skip to content

Commit a8bf62d

Browse files
committed
Allow partial strings on Rails filter_parameters for meta_data_filters
The Recent Rails template will generate `filter_parameters` with *partial* strings, such as `:passw` and `:_key`. I think this library should also allow such keywords to filter out, following the Rails template. https://github.com/rails/rails/blob/f838a7421228204bbc1e012ff9a3801ed598da80/railties/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt#L6-L8 This patch might be a breaking change because it will filter more parameters than before, but to exclude them would be better than sending probably sensitive parameters as they are.
1 parent e5afde5 commit a8bf62d

File tree

10 files changed

+10
-10
lines changed

10 files changed

+10
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Be sure to restart your server when you modify this file.
22

33
# Configure sensitive parameters which will be filtered from the log file.
4-
Rails.application.config.filter_parameters += [:password]
4+
Rails.application.config.filter_parameters += [:passw]
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Be sure to restart your server when you modify this file.
22

33
# Configure sensitive parameters which will be filtered from the log file.
4-
Rails.application.config.filter_parameters += [:password]
4+
Rails.application.config.filter_parameters += [:passw]
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Be sure to restart your server when you modify this file.
22

33
# Configure sensitive parameters which will be filtered from the log file.
4-
Rails.application.config.filter_parameters += [:password]
4+
Rails.application.config.filter_parameters += [:passw]
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Be sure to restart your server when you modify this file.
22

33
# Configure sensitive parameters which will be filtered from the log file.
4-
Rails.application.config.filter_parameters += [:password]
4+
Rails.application.config.filter_parameters += [:passw]
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Be sure to restart your server when you modify this file.
22

33
# Configure sensitive parameters which will be filtered from the log file.
4-
Rails.application.config.filter_parameters += [:password]
4+
Rails.application.config.filter_parameters += [:passw]
55
Rails.application.config.filter_parameters += [:my_specific_filter]
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Be sure to restart your server when you modify this file.
22

33
# Configure sensitive parameters which will be filtered from the log file.
4-
Rails.application.config.filter_parameters += [:password]
4+
Rails.application.config.filter_parameters += [:passw]
55
Rails.application.config.filter_parameters += [:my_specific_filter]
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Be sure to restart your server when you modify this file.
22

33
# Configure sensitive parameters which will be filtered from the log file.
4-
Rails.application.config.filter_parameters += [:password]
4+
Rails.application.config.filter_parameters += [:passw]
55
Rails.application.config.filter_parameters += [:my_specific_filter]
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Be sure to restart your server when you modify this file.
22

33
# Configure sensitive parameters which will be filtered from the log file.
4-
Rails.application.config.filter_parameters += [:password]
4+
Rails.application.config.filter_parameters += [:passw]
55
Rails.application.config.filter_parameters += [:my_specific_filter]
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Be sure to restart your server when you modify this file.
22

33
# Configure sensitive parameters which will be filtered from the log file.
4-
Rails.application.config.filter_parameters += [:password]
4+
Rails.application.config.filter_parameters += [:passw]

lib/bugsnag/integrations/railtie.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def self.rescue_in_active_record_callbacks?
121121
config.meta_data_filters += ::Rails.configuration.filter_parameters.map do |filter|
122122
case filter
123123
when String, Symbol
124-
/\A#{filter}\z/
124+
/#{filter}/i
125125
else
126126
filter
127127
end

0 commit comments

Comments
 (0)