Open zbalkan opened 1 year ago
Generally PAN is masked excluding the first 6 and last 4 numbers, allowing further investigations. The line below fully replaces the number with as substitute. https://github.com/kanmu/fluent-plugin-pan-anonymizer/blob/0e021c42dabde885d776330586192777a6b16394/lib/fluent/plugin/pan/masker.rb#L38
It would be better to allow the masking to be configurable like this:
<pan> # mastercard formats /(5[1-5][0-9]{2}(?:\ |\-|)[0-9]{2})[0-9]{2}(?:\ |\-|)[0-9]{4}(?:\ |\-|)([0-9]{4})/ checksum_algorithm luhn mask \\1******\\2 </pan>
This can be possible by changing the replacement code:
match = match.gsub(@regexp, @mask)
Generally PAN is masked excluding the first 6 and last 4 numbers, allowing further investigations. The line below fully replaces the number with as substitute. https://github.com/kanmu/fluent-plugin-pan-anonymizer/blob/0e021c42dabde885d776330586192777a6b16394/lib/fluent/plugin/pan/masker.rb#L38
It would be better to allow the masking to be configurable like this:
This can be possible by changing the replacement code: