Mask a dataset and then try to re-identify it
Task
Produce a masked copy of a small dataset, then attack your own masking with plausible outside knowledge. The re-identification is the lesson.
Steps
- Write
lab/data/source.csvwith 200 generated rows including at least three quasi-identifiers and one sensitive attribute. - Produce
lab/data/masked.csvby replacing direct identifiers with realistic false values, preserving referential integrity and the distribution of the sensitive attribute. - Write
lab/data/reident.shthat counts how many rows are UNIQUE on the combination of quasi-identifiers alone. - Run it. Record the number of uniquely identifiable rows in
lab/data/reident.md. - Generalise one quasi-identifier -- truncate the area code, bucket the date of birth to a year or a decade -- re-run, and record the new number and the analytical value you lost.
Verify
wc -l < lab/data/source.csv
wc -l < lab/data/masked.csv
sh lab/data/reident.sh
grep -Ec '[0-9]+' lab/data/reident.md
Both files 200 rows, and the re-identification count recorded BEFORE and AFTER generalisation, with the second lower. If the first count was zero, your quasi-identifiers are too coarse to be realistic -- real data is far more identifying than generated data usually is.
This is an independent study companion for CompTIA SecurityX CAS-005 and is not produced by or endorsed by CompTIA.