Module O-9·30 min read

GDPR, HIPAA, CCPA, and DPDP as design constraints; PII tokenisation and vaulting; and crypto-shredding as the answer to deletion over an immutable log.

JJS
Written by Jatin Jain Saraf · Senior Software Engineer

Module O-9 — Compliance, Privacy, and Data Sovereignty

What this module covers: Privacy regulation reduced to the four engineering capabilities it actually demands — know where personal data is, limit where it goes, retrieve or delete it everywhere on request, and prove all three. Why none of that can be bolted on: an architecture either supports the obligations or it does not. The unglamorous prerequisite of data inventory and classification, including the places unmapped copies actually live. Minimisation and purpose limitation as design rules, with consent modelled as data that pipelines query rather than a banner. Tokenisation and vaulting as the same scope-collapsing move Module P-24 made with card numbers. Pseudonymisation versus anonymisation, and why the first is still personal data. Residency, where the usual violation is your telemetry pipeline and where "access is processing" makes an engineer's debugging session a cross-border transfer. And then the problem six earlier modules deferred to this one: how a deletion request reaches an immutable backup, an append-only log and a warehouse — for which the answer is to delete a key rather than a record.


Four Engineering Capabilities, Not a Paperwork Exercise

Regulations differ in wording and overlap heavily in what they require you to be able to do:

  1. Know where personal data is — every store, pipeline, index, cache, log and third party.
  2. Limit where it goes — residency, minimisation, purpose limitation, retention.
  3. Act on a subject's request — access, portability, rectification and erasure, reaching every copy, within a legal deadline.
  4. Prove it — an audit trail of access and of the actions you took.

Each of those is an engineering capability with an architectural precondition, which is why compliance cannot be added at the end:

A system that copied personal data into eleven places without recording that it did cannot satisfy an erasure request, regardless of how much legal effort is applied afterwards.

The practical consequence is that the cheap moment to build these capabilities is when the data model is designed, and the expensive moment is when the first request arrives.

Analogy: a library's obligation to remove a book from circulation. If there is a catalogue recording every copy, every branch, every reading list and every scan, removal is a procedure. If copies were lent freely, photocopied, and shipped between branches without record, the library cannot honestly claim it has removed the book — and the failure is not one of will or of legal advice, it is that nobody wrote down where the copies went. Notice also that "we shredded the copy on the shelf" is not compliance if the microfilm archive is unchanged.


The Regimes, in Engineering Terms

Not legal advice — the point is what each one asks you to build.

RegimeDistinctive engineering demand
GDPR / UK GDPRa lawful basis recorded per purpose; minimisation and storage limitation; subject requests (access, erasure, portability, rectification) within ~1 month; breach notification in 72 hours; processor agreements; a transfer mechanism for data leaving the EEA
CCPA / CPRAopt-out of sale/sharing, honoured including the Global Privacy Control browser signal — a header your code must respect; deletion and disclosure on request
HIPAAPHI safeguards, business-associate agreements, audit of who viewed a record, and "minimum necessary" access
DPDP (India)consent notice and withdrawal machinery, data-fiduciary duties, breach notification
PCI DSSscope minimisation is the whole game (Module P-24) — never touch a card number and most requirements do not apply to you

Two demands from that table are easy to miss and are pure engineering. The GPC signal means a browser header must change what your backend records, which is code rather than policy. And auditing reads, not just writes, is a requirement in health contexts and good practice everywhere — "who looked at this customer's record" is the question that gets asked, and Module A-13's audit log is where it is answered.


Inventory and Classification: the Prerequisite Nobody Enjoys

You cannot do any of the four capabilities without knowing what you hold and where it flows. That means two artefacts, both maintained:

A field-level classification. Which columns are personal data, which are special category (health, biometrics, religion, sexual orientation, trade union membership — stricter handling), and which are neither. Make it machine-readable and enforce it:

sql

Then a CI check that any new column has a classification, so the inventory cannot silently rot — the same chokepoint argument as Module A-13 and Module O-3, applied to metadata.

A data-flow map. Where each classified field goes, which is a longer list than teams expect:

DestinationUsually forgotten?
Primary database and its replicasno
Backups and snapshots (Module O-7)yes — and they are immutable by design
The warehouse and its derived tables (P-22)sometimes
Search index (P-20), vector store (P-21)yes
Caches (P-12)yes
Event log / Kafka topics (P-15)yes — and it is append-only
CDC pipelines and their sinks (P-23)yes
Application logs, traces and prompt logs (O-1, A-12)almost always
Third-party SaaS (support desk, CRM, analytics, email)frequently
ML training sets and embeddingsyes

The rows in bold are where the unmapped copies live. Logs are the most common: a request body in a log line is a PII store, replicated to a vendor, retained for months, and often shipped to a single region regardless of residency rules.

And two classifications that surprise engineers. Pseudonymous identifiers — device IDs, cookie IDs, IP addresses — are generally personal data under GDPR, so "we only store a device ID" is not an exemption. And an embedding is derived personal data: a vector computed from a person's text is not anonymous, since text can be partially reconstructed from embeddings, which means Module P-21's vector store is in scope for both residency and erasure.


The cheapest compliance strategy is not collecting the data. Each step down this ladder removes obligations wholesale:

  1. Do not collect it.
  2. If you must collect it, do not store it (use it in the request and discard).
  3. If you must store it, store less of it — a hash where you only need equality, an age band rather than a date of birth, a truncated IP, a token rather than a card number.
  4. If you must store it, do not keep it — a retention policy that actually deletes, enforced by a job rather than by intention.

Concretely, four rules that remove most incidental exposure: do not log request bodies, allowlist the fields you log rather than denylisting the ones you redact (Module O-1), strip EXIF from uploads (Module A-11), and separate identity from behaviour so analytics can work on a pseudonymous key.

Purpose limitation has a specific engineering consequence. Data collected for billing cannot be repurposed for ad targeting without a basis — which means the purpose must be recorded alongside the data, and pipelines must be able to filter by purpose. That is what turns consent from a banner into an enforced property.

So model consent as data that systems query:

sql

Append-only, so the history of what someone agreed to and when is reconstructable — the same immutability argument as Module P-24's ledger, for the same reason: you will be asked to prove it.

And withdrawal must propagate. A revoked consent has to reach the warehouse (so a segment stops including them), the email platform, the ad platform, the recommendation model's training set, and any partner you shared with. If revocation only updates a row in your database, you have built a preference centre rather than a consent system.


Tokenisation and Vaulting: Collapse the Scope

The move that does the most work, and it is the same one Module P-24 made with card numbers: replace the sensitive value with a token, keep the mapping in one vault.

text

Now the great majority of your systems handle tokens, and the compliance surface is one vault instead of eleven stores. Access to real values is a narrow, audited, revocable path rather than an ambient property of the platform.

Two variants with real trade-offs. Format-preserving tokens let legacy systems and validation logic keep working. Deterministic tokens (the same input always yields the same token) preserve the ability to join across systems — at the cost that they are vulnerable to frequency analysis and correlation, so they are pseudonymisation, not anonymisation.

Pseudonymisation is not anonymisation

Sign in to keep reading

The rest of this module is free — sign in with Google to unlock it and track your progress.

Sign in & Register

Discussion

0

Join the discussion

Loading comments...

© 2026 Jatin Jain Saraf (JJS). All rights reserved.