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
{{ message }}
Repository navigation
Feature request: support for custom masking with regx pattern or custom masking chars #5826
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 😃
Activity
anafalcao commentedon Jan 6, 2025
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 😃
leandrodamascena commentedon Jan 20, 2025
We are working on this PR #5837
github-actions commentedon Feb 11, 2025
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
github-actions commentedon Feb 11, 2025
This is now released under 3.6.0 version!