CtrlK
BlogDocsLog inGet started
Tessl Logo

testland/pii-masking-pipeline-builder

Build-an-X workflow that owns the full detect → mask → verify pipeline for PII in test data. Walks the author through (1) classifying each field against the cross-regime PII catalog (GDPR / CCPA-CPRA / NIST SP 800-122 / HIPAA, in references/pii-categories.md), (2) picking a masking operator from the techniques catalog (seven canonical operators + Presidio operators + privacy models, in references/masking-techniques.md), (3) deciding pseudonymisation (reversible, in GDPR scope) vs anonymisation (irreversible, out of scope), (4) ordering the pipeline (detect → operator → audit) and emitting a deployable YAML config for Presidio + Faker + Synthea wrappers (Faker-as-masking-operator detail in references/faker-masking-operators.md), and (5) running the adversarial verification pass that re-detects PII in the masked output and blocks promotion on a leak. Use when non-production environments need masked production data - from field classification through runnable masking config to the leak audit.

75

Quality

94%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Low

Low-risk findings worth noting

Overview
Quality
Evals
Security
Files

privacy-models.mdreferences/

Privacy models - NIST SP 800-188

Deep reference behind masking-techniques.md. Consult after per-field operators are chosen, when quasi-identifiers remain and the whole dataset's disclosure risk must be bounded.

NIST SP 800-188:2023 ("De-Identifying Government Datasets", csrc.nist.gov/pubs/sp/800/188/final) formalises statistical privacy models layered above the per-field techniques.

k-anonymity

A dataset is k-anonymous if every record is indistinguishable from at least k - 1 other records when projected on the quasi-identifiers (Sweeney 2002, cited in NIST 800-188).

  • Achieve via: Generalisation (age 47 → "40 - 50"), suppression (drop the row), and aggregation.
  • Picks k: Typical values are k = 5, k = 10, k = 100 depending on dataset size + risk tolerance.
  • Weakness: Vulnerable to homogeneity attack - if all k records share the same sensitive value, k-anonymity doesn't protect it.

l-diversity

Strengthens k-anonymity by requiring at least l well-represented values of the sensitive attribute within each equivalence class (Machanavajjhala et al. 2007).

  • Achieve via: Suppression of records that would break l, or perturbation of sensitive values.
  • Weakness: Vulnerable to skewness / similarity attack - the l values may be semantically similar.

t-closeness

Strengthens l-diversity by requiring the distribution of the sensitive attribute in each equivalence class be close (within t, by Earth Mover's Distance) to the distribution in the overall dataset (Li et al. 2007).

  • Trade-off: Higher t = better utility, lower t = stronger privacy.

Differential privacy

A formal mathematical guarantee: the probability of any output changes by at most a multiplicative factor (e^ε) when a single record is added/removed. ε (epsilon) is the privacy budget - lower ε = stronger privacy.

  • Achieve via: Noise injection (Laplace / Gaussian mechanism) on query outputs, not on the raw dataset.
  • Trade-off: Utility-vs-budget. Apple, Google, US Census 2020 use differential privacy.
  • Cite: NIST SP 800-188:2023 §6; original Dwork 2006 "Calibrating noise to sensitivity."

Picking the model

  • k-anonymity - baseline for quasi-identifier sets; pick k >= 5 (k = 10+ for high-risk datasets).
  • l-diversity - add when a homogeneity attack on the sensitive attribute is plausible.
  • t-closeness - add when the sensitive attribute's distribution itself leaks (skewness / similarity).
  • Differential privacy - use for statistical query release, not raw-dataset export; keep ε <= 1 for strong privacy, ε <= 10 relaxed.

References

  • NIST SP 800-188:2023 "De-Identifying Government Datasets" - csrc.nist.gov/pubs/sp/800/188/final. Definitions of k-anonymity, l-diversity, t-closeness, differential privacy.
  • Sweeney 2002 (k-anonymity), Machanavajjhala et al. 2007 (l-diversity), Li et al. 2007 (t-closeness), Dwork 2006 "Calibrating noise to sensitivity" (differential privacy) - all cited in NIST 800-188.

SKILL.md

tile.json