New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Filter Attributes to perform exact matches instead of Fuzzy matches #51488
base: main
Are you sure you want to change the base?
Update Filter Attributes to perform exact matches instead of Fuzzy matches #51488
Conversation
I don't think an extra argument is needed when you already can pass a regex to precisely filter: rails/activesupport/lib/active_support/parameter_filter.rb Lines 25 to 28 in f613ba8
IMO better would be for |
6d7820d
to
ffefaf3
Compare
You're right. adding this line does fix the problem: klass.filter_attributes += [ /^#{attribute}$/ ] My concern was if we ever need to do the same then it would make sense to have a seperate approach for it altogether. |
+1 to this Maybe we can add a config value to switch between fuzzy and exact match with the default being what we have currently (fuzzy)? I don't think we should have one or the other, not sure that's a consistent experience with how Filtering is currently used. |
ffefaf3
to
1e021bb
Compare
I don't think for encryption we need fuzzy matches. If i'm encrypting |
1e021bb
to
e8fd465
Compare
Agreed 👍 Can you update the pull request title and add a CHANGELOG entry? Hopefully it'll be merged soon :) |
e8fd465
to
bdb003e
Compare
Updated the CHANGELOG and the description. |
bdb003e
to
6b0724f
Compare
Motivation / Background
This Pull Request has been created because of a bug mentioned in #51254 wherein encrypting one attribute in a model filters out other similar matching attributes in inspect.
Detail
This PR makes the following changes:
filter_attributes
to exact regex matches instead of fuzzy matchingChecklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]