Skip to content

Commit

Permalink
Allow partial strings on Rails filter_parameters for `meta_data_fil…
Browse files Browse the repository at this point in the history
…ters`

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.
  • Loading branch information
yykamei committed May 29, 2024
1 parent 5175335 commit 342ad07
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Be sure to restart your server when you modify this file.

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

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

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

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

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

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

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

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

# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
Rails.application.config.filter_parameters += [:passw]
2 changes: 1 addition & 1 deletion lib/bugsnag/integrations/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def self.rescue_in_active_record_callbacks?
config.meta_data_filters += ::Rails.configuration.filter_parameters.map do |filter|
case filter
when String, Symbol
/\A#{filter}\z/
/#{filter}/i
else
filter
end
Expand Down

0 comments on commit 342ad07

Please sign in to comment.