SMT - MaskField

Hello all,
Quick one, is or will it be possible in the future, to choose a function ( either user defined or native ) to mask a field with some desired logic ??
Ex: PhoneNumber field → “+0-000-000-0000”

Instead of masking to that or some fixed value, maybe just randomly change X amount of digits.

“transforms.PhoneMask.type”: “org.apache.kafka.connect.transforms.MaskField$Value”,
“transforms.PhoneMask.fields”: “office,mobile”,
“transforms.PhoneMask.replacementUDF”: digit_scrambler,
“transforms.PhoneMask.replacementUDF.input”: “5”,

This would call the java function to randomly assign 5 digits (or less) to the content of the field.

Thanks in advance.

I’m not seeing any KIPs about this kind of enhancement to the MaskField SMT. KIP-665 is related as it proposes a hashing SMT. You could always adapt an existing SMT to create your own. If you go down the KIP road, I’d suggest proposing something more generic than digit scrambling, e.g., have the SMT accept a regex and generate random strings matching the regex. The regex language would have to be slimmed down to keep the space finite (say only characters, character classes and fixed number quantifiers, no * or + allowed). Generex is an example of this – doesn’t seem to be much action in the repo, though, so there might be other options out there too to implement it. With a regex this gets more broadly applicable (license plates, times of day, etc).

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.