Skip to content

Maintenance: improve the Data Masking utility #8780

Closed

Description

@leandrodamascena

Why is this needed?

I spent some time going through the Data Masking utility, mostly erase(), and found a few edge cases where the result isn't what the docs say, plus some rough spots in error handling and docs. I'd rather fix them together than open ten small issues.

Which area does this relate to?

Other

Solution

Rough list, details in the PRs:

  • fields and masking_rules passed together
  • Pydantic models with SecretStr and other non-JSON field types
  • JSON string input with masking_rules
  • prepare_data with repeated references and __slots__ objects (Bug: data masking prepare_data leaves dataclasses and Pydantic models unconverted #8672)
  • masking_rules pointing at a nested dict or list
  • KMS errors wrapped in our own exceptions
  • small cleanups: warning dedup in lenient mode, regex cache size, dead code in base.py
  • docs for the behaviours above

#8636, #8637 and #8672 fold into this.

Acknowledgment

Activity

  1. added this to the 3.40.0 milestone on Nov 9, 2026
  2. powertools-for-aws-oss-automation commented on Nov 9, 2026

    @powertools-for-aws-oss-automation

    Warning

    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 reopen the issue, or open a new issue referencing this one.
    If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    data-maskingSensitive Data Masking featureinternalMaintenance changestech-debtTechnical Debt tasks

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions