QA needs data that looks like production: the same keys, cities, credit limits and signup dates. It does not need real names, tax IDs, e-mails or phone numbers.
This is a lab example, and even the "production" side is generated: names from two short lists, a tax ID in the CPF layout built from the id (not a valid number), e-mails at example.com. No real data appears. It uses dbSlice by Thinwork and one job file with no password in it.
The job
-
"tipo": "sync","mode": "ForceLoad": empties the target (TRUNCATE) and reloads it. Never point it at production. -
"where": "customer_id % 17 = 0"on the source: one row in 17, so 588 of 10,000. -
"ofuscar": truewith one rule per column:
"ofuscarCampos": {
"full_name": "template:Customer {key}",
"tax_id": "cpf:",
"email": "email:",
"phone": "keep:7,*",
"city": "original",
"segment": "original",
"credit_limit": "original",
"created_at": "original"
}
birth_date has no rule, so it gets the default mask for its type (1900-01-01). Primary and foreign keys are never changed.
dbSlice.exe qa-customers-sample.json sample.log
obfuscate: 5 columns (keys and foreign keys kept)
field map: 4 with their own rule, 4 kept as in the source
impact: DELETES the target (TRUNCATE) and reloads
OK Done: 588 read, 588 inserted, 0 upsert/update in 0.3s
Before and after
Source row 17: Bruno Rocha | 000.017.803-93 | bruno.rocha17@example.com | +55 11 90629-1547 | 1950-08-10 | Santos | corporate | 1401.00
QA row 17: Customer 17 | ***.***.***-** | br***********@example.com | +55 11 ********** | 1900-01-01 | Santos | corporate | 1401.00
The mask runs on read, so the original never reaches the QA database. A second run gives 588 / 588 and the same values, so the refresh is repeatable. Linux (Docker edition) returned the same counts through the jobs API.
One honest note: email: and keep: keep the text length, so the * show how long the original was. Use template: or hash: if that matters. Masking reduces exposure; it is not a legal guarantee.
The full article has the Linux steps, the other rules, scheduling and the list of the four cases in the series: dbslice.net.
dbSlice is our own product, so take this with that in mind.
- Windows: dbSlice on the Microsoft Store.
- Linux / Docker edition: corporate edition, available by contact. Write to contact@dbslice.net.
Originally published at dbslice.net.
Top comments (0)