Use config.default_mask_strategy instead of hardcoded values#3820
Use config.default_mask_strategy instead of hardcoded values#3820smrutisahoo10 wants to merge 2 commits intomainfrom
Conversation
d06aa77 to
c1c70fa
Compare
|
Thanks @smrutisahoo10 — good cleanup, replacing hardcoded mask strategy values with config-driven ones. |
Signed-off-by: Smruti Sahoo <talktodaisy19@gmail.com>
Adds regression tests verifying that the Python PIIDetector now respects the configured default_mask_strategy for all built-in PII types. Covers REDACT, PARTIAL, HASH, TOKENIZE, and REMOVE strategies, plus a check that custom patterns keep their explicit strategy. Also adds detect-secrets pragma to pre-existing fake AWS key test fixture. Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
c1c70fa to
3a24966
Compare
|
Thanks @smrutisahoo10 — good cleanup, replacing hardcoded mask strategy values with config-driven ones. Rebased onto main and resolved merge conflicts (the AWS_KEY/API_KEY PII types were removed upstream, so those sections were dropped). Added differential regression tests covering all five masking strategies and a detect-secrets pragma fix for the test fixture. A few notes from the review:
Changes I pushed on top of the original commit:
|
crivetimihai
left a comment
There was a problem hiding this comment.
Looks good — fix is correct, default behavior is more secure, and differential tests are in place. Approving.
|
@lucarlig Can we please check this change against the Rust plugin? Leaving in draft pending resolution. |
|
@jonpspri checked. The Rust-backed detector was still hardcoding built-in mask strategies, so The correct follow-up lives in
I also closed the mistaken
|
🔗 Related Issue
Closes #3724
📝 Summary
Fixes bug where default_mask_strategy configuration was ignored for built-in PII types in PIIFilterPlugin. The plugin was using hardcoded MaskingStrategy.PARTIAL values instead of respecting the configured strategy.
Changes:
Impact:
🏷️ Type of Change
🧪 Verification
make lintmake testmake coverage✅ Checklist
make black isort pre-commit)📓 Notes (optional)
Screenshots, design decisions, or additional context.