Skip to content

Privacy and preparation

Dataset privacy regression testing: keep removed fields out

By SourceX Editorial · Reviewed by Noah Loul ·

10 sections

Short answer

To stop a new export from reintroducing removed fields, approve the output as an allowlist of fields and file types, freeze a privacy baseline from the last approved release, and run the same regression tests on every export: schema, canary values, identifier scans, quasi-identifier group sizes, keys, metadata and transformation version. Anything removed before that reappears blocks the release until a named privacy owner decides.

Redaction

Dataset privacy regression

This page covers dataset privacy regression testing: keep removed fields out.Illustrative

Key takeaways

  • Removed fields usually return through changes around the redaction step: new columns, renamed fields, joins, free text, attachments or an old configuration.
  • Approve the output as an allowlist of fields and file types; a list of removed fields cannot catch a field nobody has seen.
  • Seed canary values in removed source fields and fail any export where one appears.
  • Compare quasi-identifier group sizes with the approved baseline, since one finer column can single people out.
  • Give the release gate four outcomes with named owners, and track usefulness in the same run.

How do you stop a new export from bringing back fields you removed?

Fix the approved output as an allowlist of fields and file types, freeze a privacy baseline from the last approved release, and run the same regression tests on every new export before it leaves your systems. Any column, value, attachment or identifying combination that was removed before and appears again blocks the release until a named reviewer decides.

Dataset privacy regression testing borrows a habit from software: once a defect is fixed, a test makes sure it never comes back unnoticed. The defect here is disclosure. A field removed in the first release can reappear in the fourth because a source system added a column, someone rebuilt the extract from an old query, or a new join pulled a contact table along with the record you wanted.

The asset below is a test suite and a release gate a data owner can run on every refresh. It covers direct identifiers, the combinations that identify people indirectly, linked files such as photos and attachments, and the usefulness of the result, because a gate that only removes things will eventually remove the value too.

Six routes by which a removed field returns

Most reintroductions are not mistakes in the redaction step; they come from changes around it. Knowing the routes tells you where the tests must look.

At a glance

Six routes by which a removed field returns

  • A new column in the source export: the business application adds a field, such as a secondary phone number, and a select-all extract carries it through.
  • A renamed field: the removed field comes back under a new name, so a denylist keyed on the old name misses it.
  • A new join: an analyst joins a contacts, users or assets table to enrich the records and brings its identifying columns along.
  • Free text and comments: a field that was structured and removed now appears inside notes, subject lines or chat transcripts.
  • Linked files and metadata: attachments, file names, embedded document properties and photo metadata travel with the records.
  • An old pipeline configuration: a rerun uses a superseded transformation script or a stale mapping, undoing a later removal.

Why the output schema has to be an allowlist

Approve fields by name and type, and fail the export on anything extra. A denylist of removed fields only catches what you already know; an allowlist catches everything new, including the field nobody has seen yet.

Common tooling supports this directly. A dbt model contract, when enforced, must list every column's name and data type, and dbt runs a preflight check that the model returns matching columns or fails to build. Great Expectations' expectation that table columns match a set fails on additional columns when exact_match is true, its default. Either can stand as the first gate, but neither looks inside values, so the schema check is necessary and not sufficient.

Keep the allowlist in version control next to the extract query, with a short reason for every approved field and the reviewer who approved it. When the source application is upgraded, read its release notes for new or renamed fields before the next export, not after the gate fails. A select-all query anywhere in the pipeline should itself count as a defect, because it turns every upstream schema change into a possible disclosure.

The privacy regression test suite, check by check

Run every test on every export, compare with the frozen baseline, and record results with the export's version. The suite is ordered from cheap structural checks to slower content and combination checks, so a broken export fails fast.

The privacy regression test suite, check by check
TestWhat it checksHow to run itFails the export when
PR1 Schema allowlistColumn names and types against the approved listEnforced model contract or exact-match column set checkAny added, renamed or retyped column
PR2 File manifestFile types, counts and folder structure against the approved manifestCompare a generated manifest with the baseline manifestA new file type, such as attachments, appears
PR3 Canary valuesSeeded or known values from removed fields, such as test customer emails and phone numbers placed in the sourceSearch every field and file for the canary listAny canary is found anywhere
PR4 Pattern and entity scanEmails, phone numbers, account numbers, names and addresses in free textRegex checks plus an entity detector, sampled by field and sourceDetections exceed the baseline rate for that field, or a new field has any
PR5 Quasi-identifier combinationsGroup sizes for combinations such as location, date and job typeFrequency counts on the agreed key variables, compared with baselineAny combination falls below the agreed minimum group size
PR6 Keys and joinsPseudonymous keys are not reversible and do not match source system IDsCompare a key sample with source IDs and with last release's keysA key equals a source ID or a key scheme changed without review
PR7 MetadataPhoto metadata, document properties, file names and embedded pathsMetadata extraction on a sample of every file typeLocation, author or person names present
PR8 Transformation versionThe script, configuration and mapping that produced the exportHash of the configuration against the approved versionHash differs from the approved release
PR9 Human review sampleRecords a reviewer reads in full, weighted to new sources and free textStratified sample by source, field and periodReviewer finds an identifier the automated tests missed

The release gate: outcomes, owners and what each one blocks

Give the gate four outcomes and a named owner for each, so nobody waves through a failure because the delivery date is close. The privacy owner decides holds and blocks; the data engineer fixes the pipeline; the business owner confirms any intended change in scope.

The release gate: outcomes, owners and what each one blocks
OutcomeConditionWhat happens nextWho signs
ReleaseAll tests pass against the baselineExport is published with its test record and versionData engineer and privacy owner
Release with notesPattern detections within baseline rates, no new fields, reviewer notes minor issuesNotes attached; fixes scheduled for the next exportPrivacy owner
HoldA new field, file type or combination change that might be intendedChange review decides; baseline updated only after approvalPrivacy owner and business owner
Block and investigateA canary appears, a removed field returns or keys match source IDsExport destroyed or quarantined; root cause fixed at the stage that introduced it; incident process followed if anything left your controlPrivacy owner, with counsel if needed

Which identifying combination could survive the transformation?

Agree the key variables for the combination test before the first release, using the fields an outsider could plausibly know or find, such as location, dates, job or product type and household or business size. Removing direct identifiers is not enough, because the fields that remain can still single people out in combination. NIST SP 800-188 explains that early releases removed only direct identifiers and researchers then re-identified people by triangulating the remaining data, and it defines k-anonymity as no fewer than k matching records for every combination of quasi-identifiers.

That is why PR5 compares group sizes with the baseline. A new column such as a finer date or a site postal code can shrink groups sharply even though nothing it contains looks like a name. sdcMicro's freqCalc computes sample and population frequency counts for chosen key variables, which is one practical way to run this check.

Linked modalities need the same thinking. A photo of a storefront, a voice recording or a scanned form can identify a person or business even when the table beside it is clean. For health information, HHS guidance describes two de-identification methods, Safe Harbor and Expert Determination; Safe Harbor also requires that the entity have no actual knowledge that the remaining information could identify the individual.

Testing usefulness in the same run

Run usefulness checks beside the privacy tests, because each tightening can quietly damage the task the data is for. A gate that blocks new identifiers but never notices that half the resolution notes are now empty will pass an export nobody can use.

Track fill rates for the fields the task needs, the share of free text replaced by placeholders, and whether event order and durations survive any date shifting. Set the expected ranges from the approved baseline. When a privacy fix pushes a usefulness metric outside its range, record the trade-off and let the business owner and privacy owner decide together, rather than letting the stricter check win by default.

Keep the usefulness checks as concrete as the privacy ones. If the dataset is meant to teach a model how technicians resolve faults, test that fault codes, parts used and resolution notes are still present in the share of records the baseline had, and that placeholders replace names consistently so a conversation still reads as one customer talking to one technician.

Worked example (illustrative): version 3 of a field service export

This example is illustrative; the company, fields and findings are invented to show the gate working, not drawn from a real export. A field service company has released two approved versions of its work order export. Version 3 is rebuilt after the scheduling application is upgraded.

The lesson from the illustrative run is that none of the four failures came from the redaction step itself. Each came from a change upstream: an application upgrade, a default export setting, a new working habit among technicians and a well-meant change to date precision. A one-time review of version 1 would have caught none of them.

Worked example (illustrative): version 3 of a field service export
TestFinding in version 3Root causeGate decision
PR1 Schema allowlistNew column site_contact_mobileUpgrade added the field and the extract selects all columnsBlock; extract changed to the allowlist
PR2 File manifestPhoto attachments appear for the first timeDefault export setting now includes attachmentsHold; photos out of scope until reviewed
PR3 Canary valuesOne seeded test phone number found in technician notesTechnicians now paste customer callbacks into notesBlock; free-text redaction extended to the notes field
PR5 Quasi-identifier combinationsGroups for town and visit date fall below the agreed minimumVisit date changed from month to exact dayHold; date generalized back to month after review
PR8 Transformation versionConfiguration hash matches the approved versionNo changePass

When a returning field is deliberate, and when to stop

Sometimes a field is meant to come back, such as a coarse region that a buyer needs and a reviewer has approved. Treat that as a change, not a regression: record the decision, rerun the combination checks with the new field, update the baseline, and version the allowlist so the next export is tested against the new approved state.

Stop and bring in a specialist when the free text is dense with personal detail, when records include health, financial or children's information, when images or audio are in scope, or when a regression has already left your control. Those cases need a privacy specialist and often counsel. Automated detection also has limits: Presidio's own documentation warns that, because its detection is automated, it may not find all sensitive information and other protections should be added.

How should exports be prepared for a SourceX license?

If you are preparing records to license for AI training, a documented regression gate shows that every refresh is held to the same standard as the first delivery. Under SourceX's standing offer terms, de-identification is performed by SourceX through approved processing routes, and the company approves the scope and signs the agreement before any data is delivered.

Your own export controls still matter, because they decide what leaves your systems in the first place. Eligibility for a license is settled first, in a brief company assessment that comes before any record is shared or uploaded.

Frequently asked questions

What is dataset privacy regression testing?

It is a set of automated and sampled checks run on every new export to confirm that fields, values, files and identifying combinations removed in earlier releases have not returned. Each export is compared with a frozen baseline from the last approved release, and failures block the release.

Why use an allowlist instead of a list of removed fields?

A list of removed fields only catches the names you already know about. An allowlist of approved fields fails on anything new or renamed, which is how most reintroduced identifiers arrive after a source system upgrade or a new join.

What are canary values in a privacy test?

They are known test values, such as a dummy customer email or phone number, placed in the source fields you remove. If any canary appears anywhere in an export, including free text or attachments, the removal has failed somewhere in the pipeline.

Can a dataset leak identity without any direct identifiers?

Yes. Combinations of ordinary fields, such as town, exact date and job type, can single out a person or household. Compare group sizes for those combinations with the approved baseline on every export.

Does a passing regression test mean the data is de-identified?

No. It shows the new export is no worse than the approved baseline on the checks you run. Whether the baseline itself is adequately de-identified for the intended use is a separate assessment for a privacy specialist and, where needed, counsel.

Sources

  • When a dbt model contract is enforced it must include every column's name and data type, and dbt runs a preflight check that the model returns matching columns or fails to build. Source
  • Great Expectations' expect_table_columns_to_match_set requires an exact match of columns when exact_match is true, the default; with false, additional columns pass. Source
  • Great Expectations' expect_column_values_to_not_match_regex expects column entries not to match a given regular expression. Source
  • NIST SP 800-188 describes re-identification by triangulating remaining fields and defines k-anonymity over combinations of quasi-identifiers. Source
  • sdcMicro's freqCalc computes sample and population frequency counts for key variables for risk estimation. Source
  • HHS guidance describes the Expert Determination and Safe Harbor de-identification methods; Safe Harbor includes a no-actual-knowledge condition. Source
  • Presidio's documentation warns that automated detection may not find all sensitive information and that additional protections should be employed. Source

See if your company qualifies

A short company assessment. No data uploads are needed.

See if your company qualifies