Learn

Format-preserving masking: why masked data must still look real

Format-preserving masking replaces each value with a different value of the same shape. Digits stay digits, letters stay letters, and the length does not change. The application, its validation and its tests still work on the masked data, and that is why developers want production data.

What goes wrong when masked data does not look real?

Take one card number in production, 4871 8033 4018 7801, and mask it four ways.

MaskIt becomesWhat happens
Stars**** **** **** ****Validation rejects it.
A hash9c1e47ab02f6d81e… 64 charactersIt does not fit a column that holds 19 characters.
One fixed value0000 0000 0000 0000Every row is the same, so tests stop finding problems.
Same format4372 6167 5136 1341It passes the card check, fits the column, and every value is different.

When the masked copy is no use to them, developers ask for access to production or keep an unmasked copy.

What does a mask have to keep?

Joins still match
A foreign key column is masked the same way as the column it references.
One value, one result
The same value becomes the same masked value in every table, so a customer number lines up across the database.
Unique stays unique
Washery checks the policy against your keys before a run and refuses one that would break them.
Primary keys are kept
A key is only masked when the key itself holds sensitive data.
Types and lengths do not change
Every column keeps its type and its length, so your schema and your code work as they are.
No way back to the original
Same-format values use a key made for each run and never stored, so a masked value can’t be traced back.

What does it look like?

Examples show the kind of value a method writes. Every value here is made up.

Kind of dataIn production, and in the masked copy
NamesMia ChenbecomesElla Novak
Phone numbers0412 880 316becomes0413 927 506
Tax and government identifiers628 194 821becomes252 760 189
Card numbers4871 8033 4018 7801becomes4372 6167 5136 1341
Bank account details063-109 1048 2217becomes418-552 7306 9941
Dates of birth1991-07-22becomes1991-06-09

Is it the same as format-preserving encryption?

No. Format-preserving encryption can be reversed by anyone who has the key. Data for development and testing should never be reversible, so a mask uses a key that is thrown away after the run, or no key at all.

How Washery does it

Washery proposes a masking method for every column that holds sensitive data, and each method keeps the data usable for testing. Names become made-up names. Identifiers get the Same format method, which keeps the layout and the check digit.

The Masking panel of a finished Washery run, listing each table, the masking methods applied and the number of rows changed
A finished run: the methods Washery applied to each table, such as fake name, same format and shift date.

Same-format values use a key made for each run and never kept, so a masked value cannot be turned back into the original. How data is masked shows every method.

When is it not the right approach?

  • Free text. Notes and comments have no format to keep. Redact them, because people type sensitive data into them.
  • Passwords, keys and tokens. Clear them. A value that looks like a working secret is no use in a test database.

Related

Mask your first database today

Connect your account, review what Washery will mask, and pay only when you create the masked copy.

Want to talk it through first? Book a 20-minute demo.

Mask your first database