Agent Wranglers

DAT-32Required

Keep personal data out of test copies

Never copy personal data into development, test or staging databases. Mask or replace it while copying. A throwaway restore inside the production account is the one exception.

How to do it

Run a masking step as part of the copy, such as replacing names and emails with fake values and shifting dates. Keep IDs and relations intact, so tests still work. Tools such as PostgreSQL Anonymizer do this, or a script with a fake data library. One exception is allowed. A throwaway restore inside the production account, with production's access controls and deleted after the run, may hold unmasked data, as test migrations uses it.

How to check

Compare the email column of a staging copy with production's. No address appears in both, and every staging address is on a test domain such as example.com. No unmasked restore exists outside the production account, and none inside it is older than 24 hours.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/data/personal-data/masked-copies">Agent Wranglers data and databases playbook</a>. In code you write, add a comment next to it with the same link.