Table of contents
- Quick read
- Readiness check
- Classify data before it enters the environment
- Set a maximum age for every copy
- Automate deletion and prove it ran
- Mask or synthesize before the first load
- Control who can extend retention
- Audit the environment against the rule
- Put the rule in the onboarding pack
- Role brief
- Frequently asked questions
- Sources
Is the handoff ready?
Use these checks before access expands or the first ticket begins.
Classification
Ready: Each dataset has a class, source, and owner.
Needs work: A folder called test-data with no provenance.
Expiry
Ready: Creation and expiry times are stored with the data.
Needs work: A spreadsheet that nobody updates.
Deletion
Ready: The job logs dataset id, rows, and completion time.
Needs work: A manual cleanup remembered at release time.
Masking
Ready: Personal fields are replaced before the first load.
Needs work: Production records copied raw into staging.
Classify data before it enters the environment
Start by classifying the data that can enter the test environment. Separate public configuration, internal test records, customer personal data, and regulated data such as health or payment information. Each class needs a different handling rule and a different approval path. A single label called test data hides the cases that carry the most risk. Write the class on the dataset record.
Name the source of each dataset and the person who approved its use. A copy of production data is not automatically safe because it sits in a staging database. Record whether the data was masked, synthesized, or taken from a controlled sample. If the source cannot be named, the dataset should not be loaded. An unnamed source is an automatic rejection.
Set a maximum age for every copy
Every test dataset needs a maximum age measured from the time it was created, not the time it was last opened. A short default, such as thirty days for masked data and seven days for a refreshable snapshot, keeps stale records from becoming permanent. The rule should be short enough to limit exposure and long enough for a normal test cycle. The clock does not reset when someone opens the data.
Store the creation time and the expiry time with the dataset, not only in a spreadsheet. Make the expiry visible in the environment so an engineer knows when the data will disappear. When a test needs an older dataset, require a new request rather than an extension of the old copy. Age is a property of the data, not a setting someone remembers to change.
Automate deletion and prove it ran
Manual cleanup will fail during a busy release. Schedule a job that deletes expired datasets and their backups, then write a log entry with the dataset id, row count, and completion time. Send the result to the team that owns the environment. A deletion job that silently stops is worse than no job because it creates false confidence. Send the log to the environment owner.
Test the deletion on a copy before trusting it in the shared environment. Check that related files, caches, and exports are removed as well as the primary database rows. Some systems keep soft-deleted records or snapshots that the job does not touch. Record the scope of the deletion and the person who verified it. Repeat the test after any change to the job.
Mask or synthesize before the first load
Masking should happen before data reaches the test environment, not after it is already visible. Replace names, email addresses, phone numbers, account identifiers, and free-text fields that can contain personal details. Keep the relationships needed for testing so the masked data still behaves like production. A masked dataset that breaks every join is not useful. Record the masking rule version with the load.
Use synthetic data when the test does not need production distributions. For tests that depend on realistic volume or edge cases, use a controlled extract with a documented masking rule. Record the rule version and the date it was applied. If the masking rule changes, treat the dataset as new and re-run the approval. Store the generation script with the dataset.
Control who can extend retention
An extension should be an exception with a named owner, a reason, and a new expiry date. Do not let any engineer extend a dataset indefinitely because a test is inconvenient to rebuild. Require approval from the data owner and record the request in the same system as the dataset. The exception should be reviewed when it expires, not left open.
Limit the number of people who can change retention settings. A platform administrator may apply the change, but the data owner should decide it. Keep an audit trail of who extended what and why. If extensions become routine, the default retention period or the test-data tooling needs revision. Review that short list at the same cadence as the ordinary access reviews.
Audit the environment against the rule
Run a monthly audit that samples datasets and checks their class, approval, age, and masking status. Compare the result with the deletion log and the access list. A dataset with no owner or an expired approval is a finding, even if it is not personal data. The audit should produce a short list of actions, not a dashboard nobody reads.
Check the backups and exports as well as the live database. A deleted table can survive in a snapshot or a downloaded CSV. Record where the copies live and who can restore them. If a copy cannot be accounted for, treat it as a potential exposure and follow the incident path. A snapshot can outlive the database it was copied from.
Put the rule in the onboarding pack
A new offshore engineer should learn the retention rule before receiving access. Include the data classes, the request path, the default expiry, and the deletion schedule in the onboarding pack. Explain what to do when a test needs data that is not approved. The rule should be easy to find from the environment's login page. Link the rule from the access request form.
Ask the new engineer to walk through one dataset request during onboarding. Confirm that they can name the owner, the expiry, and the deletion evidence. Update the pack when the tooling or the rule changes. A retention rule that lives only in a policy document will not survive the first urgent ticket. Record the walkthrough date in the onboarding log.
Copy-ready brief
Put the operating agreement in writing.
The engineer names the dataset, class, owner, and test purpose.
The data owner confirms masking, expiry, and access scope.
The platform job deletes the data and records the evidence.
Frequently asked questions
How long should test data live?
Set a short default from creation time, such as thirty days for masked data, and require a new request to extend it.
Can we copy production data into staging?
Only through a documented masking or synthesis step, with a data owner, a purpose, and an expiry.
What proves deletion happened?
A logged job result with the dataset id, row count, related files, and completion time.
Sources
- NIST Privacy Framework
Data minimization and lifecycle controls referenced here.
- FTC, protecting personal information
Practical safeguards for personal data.
- OWASP Application Security Verification Standard
Verification expectations for sensitive data handling.
