Allow partial strings on Rails filter_parameters
for meta_data_filters
#776
+10
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goal
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.
Design
I just removed
\A
and\z
from theRegexp
construction on a railtie as well as addingi
to allow any cases to be matched.Changeset
\A
and\z
, and addi
toRegexp
initialization on railtieTesting
I updated
Rails.application.config.filter_parameters
insidefeatures
to be:passw
from:password
. It would be good if the End to end tests pass.