solvvy / redact-pii

Remove personally identifiable information from text.
MIT License
187 stars 56 forks source link

Disabling specific builtin rules does not work for all of them #35

Closed jwill20 closed 4 years ago

jwill20 commented 4 years ago

This example is with a globalReplaceWith, but I get similar results with basic redactor. I show in the comments how some of the false values do not turn off redacting:

async function globalReplaceRedact(inputText, globalReplacementValue) { const globalRedactor = new AsyncRedactor({ globalReplaceWith: globalReplacementValue, builtInRedactors: { names: {enabled: true}, emailAddress: {enabled: true}, creditCardNumber: {enabled: false}, // false does not work phoneNumber: {enabled: false}, // false still redacts the last part of the phone number streetAddress: {enabled: false}, usSocialSecurityNumber: {enabled: false}, // false only works on the first 5 digits and two hyphens zipcode: {enabled: false}, // false does not work } }); redactedText = await globalRedactor.redactAsync(inputText) console.log(""); console.log("Global Replacement Redaction"); console.log(redactedText); };

jwill20 commented 4 years ago

Finally determined that you also have to turn off "digits" to get these others to turn off completely.