Skip to content

fix(security): fix encryption_context handling in data masking operations #6074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions aws_lambda_powertools/utilities/data_masking/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def _apply_action(
custom_mask: str | None = None,
regex_pattern: str | None = None,
mask_format: str | None = None,
**kwargs: Any,
**encryption_context: Any,
) -> Any:
"""
Helper method to determine whether to apply a given action to the entire input data
Expand Down Expand Up @@ -242,19 +242,24 @@ def _apply_action(
custom_mask=custom_mask,
regex_pattern=regex_pattern,
mask_format=mask_format,
**kwargs,
)
else:
logger.debug(f"Running action {action.__name__} with the entire data")
return action(
data=data,
provider_options=provider_options,
dynamic_mask=dynamic_mask,
custom_mask=custom_mask,
regex_pattern=regex_pattern,
mask_format=mask_format,
**kwargs,
)
if action.__name__ == "erase":
return action(
data=data,
provider_options=provider_options,
dynamic_mask=dynamic_mask,
custom_mask=custom_mask,
regex_pattern=regex_pattern,
mask_format=mask_format,
)
else:
return action(
data=data,
provider_options=provider_options,
**encryption_context,
)

def _apply_action_to_fields(
self,
Expand Down
Loading