Why You Should Not Test with Production Data: Personal Data in Development Databases and How to Fix It
· DataMint · 7 min read
"That bug only happens in production." Every developer has said this at least once. No wonder: the development DB holds just the ten customers a tester entered, while production holds fifteen years of data. So the easiest fix comes up. Dump the production DB as it is and load it onto the development server.
The conclusion first: the problem is using production data as is, not using production data at all. If you bring it over with only the personal data values changed, the distribution and structure of production remain and the people do not. Below, we start with why it should not be used as is.
What changes the moment the production DB is copied
The production DB is usually the best-protected place in a company. Who can connect is fixed, who queried what is logged, and sensitive columns are encrypted. But when the same data moves to a development server, these safeguards do not follow it.
| Production DB | Development and test DB | |
|---|---|---|
| Who connects | DBAs and a few operators | Developers, outsourced staff, testers |
| Accounts | One per person | Shared accounts passed around are common |
| Query logs | Kept | Not kept, or nobody looks |
| Copies | Only within the backup policy | Spread to personal PCs, spreadsheets and other test servers |
| Deletion | According to the retention period | Left as is even after the project ends |
In short, the best-protected information piles up in the least-protected place. And incidents usually happen not in production but on this periphery: a test server two years after its project ended, or a dump file left on the laptop of an outsourced developer who has since left.
It is not a comfortable position legally either. In Korea, the Personal Information Protection Act (PIPA) says to process personal data only as much as needed within the scope of the purpose for which it was collected (Article 3), and to take measures to manage it safely (Article 29). Whether a developer using the information a customer provided when opening an account to test a screen falls within that purpose is something nobody can confidently answer "yes" to. This is why inspections look at test environments separately.
Still, made-up data does not work for testing
So many companies set the principle that "testing is done only with data we created ourselves." The principle is right, but it is not kept. Try it and you see why right away.
- Relationships cannot be matched by hand. One customer has three accounts, each account has hundreds of transactions, each transaction has a counterparty account. Filling in the relationships of two hundred tables by hand is close to impossible.
- It does not pass input validation. Values such as
홍길동1,010-0000-0000and111111-1111111are caught by the format checks on screens. - There is no odd data. Production has customers with one-character names, customers whose address is in the old lot-number format, and customers who signed up in 2003 with a mobile number starting with 011. Bugs usually come from places like these.
- The volume is different. A query that was fast on ten rows takes thirty seconds on ten million. Performance problems only show up after release to production.
In the end, when the schedule gets tight, someone brings in production data "just this once." And that once keeps going. A ban with no alternative only creates people who do it in secret.
The middle path: change the values, keep the shape and relationships
This means bringing production data over with the personal data values changed to different values. It is not the same as blanking them with asterisks. A resident registration number (RRN, Korea's national ID number) still looks like an RRN, and a name is still a person's name. It is just not that person.
| Item | Production | Test |
|---|---|---|
| Name | 홍길동 | 김서윤 |
| RRN | 900101-1234568 | 900101-1947305 |
| Mobile | 010-1234-5678 | 010-8271-4406 |
| hong@corp.co.kr | kxwe@corp.co.kr | |
| Sign-up date | 2003-04-17 | 2003-04-17 |
| Balance | 1,250,000 | 1,250,000 |
Three things have to hold when changing values this way.
Format
Numbers have to be correct down to the check digit. The last digit of a card number is calculated from the digits before it, and the same goes for a business registration number. If it is wrong, you are blocked the moment you press Save.
Relationships
If 홍길동 in the customer table became 김서윤, it must also be 김서윤 in the account table and the consultation table. The same original has to change to the same value everywhere for joins to match. This is covered separately in why masking breaks joins.
No way back
It must not be possible to work out the original value from the changed one. A rule like adding 1 to the back part unravels everything once a single case is known. The transformation uses a secret key, and that key is kept outside the test environment.
Changing the values is not the end
Even when the transformation works well, inspections ask a different question. "Who took which production data, when, with whose approval, and when was it deleted?" Answering this takes a few things beyond the transformation script.
- Jobs that read production data run only after approval
- For each run, a record is kept of how many rows were read from which table and how many were inserted
- Permissions are divided by who can use which DB
- Test data that is no longer needed is deleted after a set period
We have seen several companies manage this with shell scripts and a spreadsheet register. It works for the first year. Once the person who built it moves on, nobody can touch it.
DataMint Core puts this process into one product
DataMint Core, which we build, changes the values read from the production DB while they are being moved and loads them into development and test DBs. It is installed on the company's internal network, so data does not leave the company, and only changed values ever enter the development DB.

Jobs that use production data have to go through approval before they run, and the request reason and approval comment are kept together in the run record. Results are kept per table, and if some rows could not be inserted because of their values, Core reports the counts by reason.

Closing
"Do not test with production data" is correct, but that alone changes nothing. What developers need is not a ban but test data as usable as production data. If they can request it and get it within a day, there is no reason left to take a dump in secret.
If you are at the stage of choosing a method, read on with a comparison of three ways to create test data.
- #testing with production data
- #personal data in development databases
- #test data
- #data privacy
- #DBA
- #test data de-identification