You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some of case I would like to custom masking like example Aadhar number or SSN number is 1111-1111-1111 then masking should be done like ****-****-6789 or ****-****-**** or regex pattern.
Solution/User Experience
currently erase, encrypt and decrypt is supported. Similarly can be introduce mask or custom_mask method which accept parameter s like masking_chars
This is just an example to explain how it can worked this can move to prebuild function mask or custom_mask
from aws_lambda_powertools import Logger
import re
# Initialize logger with custom masking
logger = Logger()
def mask_sensitive_data(value):
"""Custom function to mask sensitive data"""
return re.sub(r'\d{4}-\d{4}-\d{4}-(\d{4})', '****-****-****-****', value)
user_data = {
"username": "john_doe",
"card_number": "4111-1111-1111-1111"
}
# Apply custom masking
masked_card_number = mask_sensitive_data(user_data["card_number"])
logger.info("Processing payment", extra={"card_number": masked_card_number})
Hey @AvinashDalvi89 !
Thank you for submitting this feature request. We believe this will be a valuable addition to the Data Masking functionality.
I'll be working on creating this PR soon 😃
Use case
In some of case I would like to custom masking like example Aadhar number or SSN number is 1111-1111-1111 then masking should be done like
****-****-6789
or****-****-****
or regex pattern.Solution/User Experience
currently
erase
,encrypt
anddecrypt
is supported. Similarly can be introducemask
orcustom_mask
method which accept parameter s likemasking_chars
This is just an example to explain how it can worked this can move to prebuild function
mask
orcustom_mask
Alternative solutions
Acknowledgment
The text was updated successfully, but these errors were encountered: