Problem Statement
You need production-like test data without exposing PII. Describe a safe masking strategy and where to apply it.
Explanation
Mask or anonymize in the database before export or restore. Replace direct identifiers (email, phone, name) with deterministic but fake values so joins and uniqueness still work. Randomize quasi-identifiers and dates within safe bands to preserve distribution while breaking re-identification.
Automate the process as a repeatable pipeline. Store the masking logic in version control, run it as part of backup-to-test jobs, and restrict access to the pre-masked dump only. Validate that constraints and key relationships remain intact after masking.
Code Solution
SolutionRead Only
UPDATE users
SET email = CONCAT('user', id, '@example.test'),
phone = LPAD(id::text, 10, '0');Practice Sets
This question appears in the following practice sets:
