Privacy Engineering
Privacy engineering turns privacy principles into concrete system design, code, and process — it is the constructive complement to LINDDUN, which only finds privacy threats. A perfectly secure system can still be hugely privacy-invasive if it over-collects, profiles, or retains personal data beyond purpose: confidentiality is necessary but not sufficient. GDPR Art. 25 makes this a legal duty (data protection by design and by default), and Turkey's KVKK mirrors it. This lesson is built on three pillars — principles & legal basis (GDPR/KVKK), data-lifecycle controls (minimize, limit, retain, delete), and de-identification & PETs — and is honest about their limits, so you never over-trust 'anonymized' data.
The eleven pillars of privacy engineering
From framing privacy as an engineering discipline to the anti-patterns that betray it — each grounded in real law (GDPR/KVKK articles), real standards (NIST/ISO), and real weaknesses (CWE/OWASP).
What privacy engineering is — the constructive complement to LINDDUN
Key points
- Privacy engineering turns privacy *principles* into concrete *system design, code, and process*. It is the constructive complement to LINDDUN, which only *finds* privacy threats: STRIDE/LINDDUN model the threats, privacy engineering builds the controls that answer them.
- Security is not privacy: a perfectly secure system (strong encryption, access control, no breach) can still be hugely privacy-invasive if it over-collects, profiles, links, or retains personal data beyond purpose. Confidentiality is necessary but not sufficient for privacy.
- GDPR codifies this as a duty, not a nicety: controllers must implement 'appropriate technical and organisational measures' (TOMs) by design and by default (Art. 25). Privacy thereby becomes an engineering requirement with legal force.
- Anchor the whole lesson on three pillars: (1) principles & legal basis, (2) data-lifecycle controls (minimize, limit, retain, delete), and (3) de-identification & PETs — with their real-world limits made explicit so learners don't over-trust 'anonymized' data.
References
Privacy by Design & by Default
Key points
- Cavoukian's 7 Foundational Principles of Privacy by Design (PbD): (1) Proactive not Reactive, Preventative not Remedial; (2) Privacy as the Default Setting; (3) Privacy Embedded into Design; (4) Full Functionality — Positive-Sum not Zero-Sum; (5) End-to-End Security, full lifecycle protection; (6) Visibility and Transparency, keep it open; (7) Respect for User Privacy, keep it user-centric.
- PbD originated with Ann Cavoukian (Information & Privacy Commissioner of Ontario) in the 1990s and was adopted as an international resolution at the 2010 Jerusalem International Conference of Data Protection & Privacy Commissioners.
- GDPR Art. 25(1) 'data protection by design' = bake TOMs (e.g. pseudonymisation) into the processing from the design stage; Art. 25(2) 'by default' = by default only the personal data necessary for each specific purpose is processed (collection, extent of processing, storage period, and accessibility all minimized).
- 'By default' is the most engineering-actionable clause: the safest setting must be the *out-of-the-box* one — opt-in not opt-out, narrow scopes, nothing shared publicly unless the user acts. Recital 78 lists example measures: minimising data, pseudonymising as soon as possible, transparency, enabling monitoring, and security features.
- KVKK mirrors the duty through its general principles and security obligations rather than a single 'by design' clause: combine Art. 4 (genel ilkeler) with Art. 12 (veri güvenliği) to express the same engineering posture in Turkish law.
References
Core data-handling principles — minimization, purpose & storage limitation, retention
Key points
- GDPR Art. 5 sets seven principles engineers must implement: 5(1)(a) lawfulness, fairness & transparency; 5(1)(b) purpose limitation; 5(1)(c) data minimisation; 5(1)(d) accuracy; 5(1)(e) storage limitation; 5(1)(f) integrity & confidentiality; and 5(2) accountability.
- Data minimisation (Art. 5(1)(c)): collect only what is adequate, relevant and limited to what is necessary. Engineering practice — drop fields you can't justify, prefer derived/aggregated values over raw, hash/truncate where the exact value isn't needed, and never log full PII.
- Purpose limitation (Art. 5(1)(b)): data collected for one specified purpose must not be reused for an incompatible purpose. Enforce it with per-purpose data stores, scoped access tokens, and processing tags; 'we might need it later' is not a purpose.
- Storage limitation (Art. 5(1)(e)): keep identifiable data no longer than necessary. Engineer a *retention schedule* per data category, with automated TTL/expiry, scheduled deletion jobs, and crypto-shredding (destroy the key to render encrypted data unrecoverable) as a deletion primitive.
- Accountability (Art. 5(2)) is demonstrable, not assumed: keep Records of Processing Activities (RoPA, Art. 30), document lawful bases, and be able to show the controls work. KVKK Art. 4 expresses the same chain — amaçla bağlantılı/sınırlı/ölçülü and muhafaza süresi — and Art. 7 mandates silme/yok etme/anonim hale getirme when the reason for processing ends.
- Common code-level failure: sensitive data leaking into logs, error messages, analytics, or outbound payloads. Track these explicitly as weaknesses — CWE-532 (sensitive info in logs), CWE-201 (sensitive info in sent data), CWE-212 (improper removal before storage/transfer) — not as afterthoughts.
References
Lawful basis & consent
Key points
- Processing needs a lawful basis. GDPR Art. 6 lists six: (a) consent, (b) contract, (c) legal obligation, (d) vital interests, (e) public task, (f) legitimate interests. Consent is one option, often not the best — pick the basis that fits the purpose and document it.
- Consent must be freely given, specific, informed and unambiguous, via a clear affirmative act (Art. 4(11)); Art. 7 requires it to be as easy to withdraw as to give, separable from other terms, and demonstrable. No pre-ticked boxes, no bundling, no 'consent walls' for unrelated processing.
- Special categories of data (health, biometrics, genetics, race, religion, sexual orientation, political opinion) are prohibited by default and need an Art. 9 exception (e.g. explicit consent, substantial public interest). Engineer stricter handling and tagging for these fields.
- KVKK parallel: Art. 5 requires açık rıza (explicit consent) OR a listed exception (kanunda öngörülme, sözleşme, hukuki yükümlülük, alenileştirme, meşru menfaat, etc.); Art. 6 governs özel nitelikli kişisel veriler (special categories), whose processing rules were tightened by the 2024 amendment (Law No. 7499).
- Engineering implication: model 'consent state' as first-class data — granular, versioned, timestamped, revocable, and queryable at processing time, so a withdrawn consent actually stops the pipeline (and cascades to processors). This directly addresses OWASP Top 10 Privacy Risks P10 (collection of data not required for the user-consented purpose).
References
Data subject rights and how to engineer them
Key points
- GDPR Arts. 12–22 give individuals enforceable rights the system must satisfy, usually within one month: Art. 15 access, Art. 16 rectification, Art. 17 erasure ('right to be forgotten'), Art. 18 restriction, Art. 20 portability, Art. 21 objection, Art. 22 protection against solely-automated decisions/profiling. Art. 12 demands the responses be transparent and intelligible.
- Right of access (Art. 15) requires being able to find *all* of a person's data across every store, log, backup, and processor — pushing toward data inventories and identifier maps. Right to portability (Art. 20) requires export in a structured, commonly used, machine-readable format (e.g. JSON/CSV).
- Right to erasure (Art. 17) must reach backups, caches, search indexes, analytics, and downstream processors — crypto-shredding and tombstone/propagation patterns make this tractable. The right originates in CJEU case law (Google Spain v AEPD, C-131/12, 2014).
- Pre-build self-service Data Subject Access Request (DSAR) flows: authenticated request, identity verification, automated collection/redaction of third-party data, and an auditable fulfillment trail — manual DSARs don't scale and miss data.
- KVKK Art. 11 grants the equivalent rights (bilgi talep etme, düzeltme, silme/yok etme, itiraz, otomatik sistem kararlarına itiraz, zararın giderilmesi); VERBİS (Art. 16) is the controllers' registry obligation. Insufficient deletion maps to OWASP Top 10 Privacy Risks P6.
References
De-identification — anonymization vs pseudonymization, and the limits of k-anonymity / l-diversity / t-closeness
Key points
- Pseudonymisation (GDPR Art. 4(5)) replaces identifiers with a token while keeping a separate re-identification key. Crucially, pseudonymised data is STILL personal data and remains in GDPR scope (Recital 26) — it is a security control (named in Art. 32), not an exit from the regulation.
- True anonymisation means re-identification is no longer reasonably possible by any means likely to be used (Recital 26). Only then does data fall outside GDPR. The bar is high and context-dependent; most 'anonymised' datasets are merely de-identified/pseudonymised.
- k-anonymity (Sweeney, 2002): generalize/suppress quasi-identifiers so each record is indistinguishable from at least k-1 others. Its weakness: it ignores the sensitive attribute, so it is broken by the *homogeneity attack* (all k records share the same sensitive value) and the *background-knowledge attack*.
- l-diversity (Machanavajjhala et al., 2007) strengthens k-anonymity by requiring each equivalence class to contain at least l 'well-represented' values of the sensitive attribute — defeating homogeneity. t-closeness (Li, Li & Venkatasubramanian, 2007) goes further: the sensitive-attribute distribution within each class must be within t of the global distribution, defeating the skewness/similarity attacks l-diversity misses.
- These are *syntactic* guarantees and degrade with auxiliary data. Canonical re-identification failures: Sweeney showed ~87% of the US population is uniquely identifiable by ZIP + date-of-birth + gender and re-identified Governor Weld's medical record from 'anonymized' GIC data; the AOL 2006 search-log release re-identified user 4417749; Narayanan & Shmatikov de-anonymized the Netflix Prize dataset via IMDb (IEEE S&P 2008).
- Standards & guidance: ISO/IEC 20889:2018 (de-identification terminology and techniques), NIST IR 8053 (De-Identification of Personal Information), and NIST SP 800-188 (De-Identifying Government Datasets) — teach learners that de-identification is a risk-management process, not a one-time toggle.
References
Differential privacy — the privacy-budget idea and real deployments
Key points
- Differential privacy (Dwork, McSherry, Nissim & Smith, 2006) is a *mathematical* guarantee: adding or removing any single individual's record changes the probability of any output by at most a factor of e^ε. This bounds what an analyst can learn about any one person, regardless of auxiliary information — a much stronger promise than k-anonymity.
- ε (epsilon) is the privacy-loss 'budget': smaller ε = more noise = stronger privacy but lower accuracy. (ε, δ)-differential privacy relaxes the pure form with a small failure probability δ. Composition theorems mean repeated queries *spend* budget — a fixed total ε must be allocated across all releases.
- Core mechanisms add calibrated noise scaled to a query's sensitivity: the Laplace mechanism (pure ε-DP), the Gaussian mechanism ((ε,δ)-DP), and the exponential mechanism for non-numeric outputs. Local DP (noise added on-device before collection) vs central DP (a trusted curator adds noise) is a key architectural choice.
- Real deployments: Apple uses local differential privacy for telemetry (emoji/QuickType/Safari) — 'Learning with Privacy at Scale' (2017); the US Census Bureau adopted differential privacy as its 2020 Census Disclosure Avoidance System (the TopDown algorithm); and Google's RAPPOR (2014) applies local DP to Chrome telemetry.
- Caveats to teach: DP protects individuals against *inference*, not against a breach of the raw data; choosing ε is a policy decision (values from ~0.1 to several units appear in practice); and badly composed or high-ε deployments can leak. NIST SP 800-226 provides guidance for evaluating differential-privacy guarantees.
References
Privacy-Enhancing Technologies (PETs) overview
Key points
- PETs are technologies that let you use data while minimizing exposure of the underlying personal data. Group them as: (1) data-obscuring — pseudonymisation, tokenization, format-preserving encryption, generalization/suppression, synthetic data; (2) provable-privacy — differential privacy; (3) cryptographic compute — homomorphic encryption, secure multi-party computation (SMPC), zero-knowledge proofs; (4) architectural — federated learning, trusted execution environments (TEEs/enclaves), on-device processing.
- Homomorphic encryption (HE) computes directly on ciphertext so the processor never sees plaintext; powerful but computationally expensive — best for narrow, high-value computations. SMPC splits a computation across parties so none sees the others' inputs (e.g. private set intersection, joint analytics).
- Federated learning trains models across devices/silos so raw data never leaves its source — but gradients can still leak, so it is typically combined with DP and/or secure aggregation. TEEs give a hardware-isolated compute enclave but require trusting the hardware vendor and resisting side-channels.
- Zero-knowledge proofs let a party prove a statement (e.g. 'I am over 18') without revealing the underlying data — strong for selective disclosure and minimal-disclosure identity.
- PET selection is a trade-off of privacy strength vs performance vs utility vs implementation maturity; no single PET is a silver bullet, and several are usually layered. ENISA's work on PETs and on pseudonymisation techniques is a solid reference set.
References
Data Protection Impact Assessment (DPIA)
Key points
- A DPIA (GDPR Art. 35) is a structured assessment required *before* processing that is 'likely to result in a high risk' to individuals — e.g. large-scale special-category data, systematic monitoring of public areas, or systematic/extensive automated profiling with legal/significant effects.
- Minimum DPIA content (Art. 35(7)): a systematic description of the processing and purposes; an assessment of necessity and proportionality; an assessment of the risks to data subjects; and the measures envisaged to address those risks (safeguards, security, TOMs).
- If residual risk stays high after mitigations, the controller must seek prior consultation with the supervisory authority (Art. 36). DPIAs feed directly into engineering: they surface the controls (minimization, pseudonymisation, access limits, DP) that must be built before launch.
- Methodology & standards: ISO/IEC 29134:2017 gives DPIA process guidelines, and the CNIL PIA methodology/tool is widely used. The NIST Privacy Framework provides a complementary risk-based structure for the same goal.
- KVKK has no identical DPIA article, but the KVKK Board (Kurul) issues risk-based guidance and the general accountability/security duties (Art. 12) push toward equivalent assessments for high-risk processing — present this honestly as 'analogous, not identical'.
References
Standards & frameworks map
Key points
- NIST Privacy Framework v1.0 (2020) organizes privacy risk management into five Core Functions: Identify-P, Govern-P, Control-P, Communicate-P, and Protect-P — a companion to the NIST Cybersecurity Framework, useful for mapping engineering controls to outcomes.
- NIST SP 800-53 Rev. 5 integrates privacy and security controls in one catalog, with a dedicated PT (PII Processing and Transparency) control family — concrete control statements engineers can implement and audit against.
- ISO/IEC 29100:2011 defines the privacy framework and 11 privacy principles plus core terminology (PII, PII principal, PII controller, PII processor). ISO/IEC 27701:2019 extends ISO/IEC 27001/27002 into a Privacy Information Management System (PIMS); ISO/IEC 27018 covers PII protection in public cloud.
- Legal anchors: GDPR (EU Regulation 2016/679) and Turkey's KVKK (Law No. 6698, 2016) — structurally similar (principles, lawful basis, data-subject rights, security, registry). Teach the mapping so learners can move between regimes.
- The takeaway: standards (NIST/ISO) tell you *how* to engineer; law (GDPR/KVKK) tells you *what you must* achieve — privacy engineering is where the two meet in code and process.
References
Engineering anti-patterns and privacy pitfalls
Key points
- Treating pseudonymisation as anonymisation — shipping 'anonymized' data that is trivially re-identifiable. Always test against an auxiliary-data adversary before declaring data out of scope (Recital 26).
- Leaking PII into logs, traces, analytics, error messages, crash dumps, and outbound payloads — one of the most common real defects; redact/tokenize at the boundary and treat logs as personal-data stores subject to retention and erasure (CWE-532, CWE-201).
- No working deletion path: data persists in backups, search indexes, caches, data lakes, and third-party processors after an erasure request. Design deletion propagation and crypto-shredding up front, not after the first DSAR (CWE-212).
- Over-collection and indefinite retention 'just in case' — violates minimization and storage limitation, and enlarges breach blast radius. Enforce schemas that reject unjustified fields and TTLs that auto-expire data.
- Exposing data through verbose query interfaces, metadata, or sensitive values in URLs/parameters — model these as concrete weaknesses, not edge cases (CWE-202 data queries, CWE-1230 metadata).
- Consent theater — opt-out defaults, bundled/forced consent, dark patterns, or consent that doesn't actually gate the pipeline. 'By default' (Art. 25(2)) means the privacy-protective choice must be the one users get without acting. Operator-sided data leakage is OWASP Top 10 Privacy Risks P2.
References
First find the threats, then build the controls
Privacy engineering builds the controls that answer privacy threats — but you have to find those threats first. LINDDUN is the threat-modeling counterpart: it systematically surfaces Linking, Identifying, Non-repudiation, Detecting, Data Disclosure, Unawareness, and Non-compliance threats that the minimization, de-identification, and PET controls in this lesson are designed to mitigate.