Lesson 3 of 13 · 13m
Derive, Don't Collect
Compute the answer on-device or at ingest and never persist the raw input — the GAEN pattern for contact tracing and beyond.
Ship the answer, not the raw material
On April 10, 2020, Apple and Google announced a joint exposure-notification protocol for COVID contact tracing. The design is worth stealing wholesale. Phones broadcast rotating proximity identifiers — BLE beacons that change roughly every 15 minutes — and logged the identifiers they heard. When someone tested positive, their recent keys were uploaded; your phone downloaded the infected key list and did the matching on the device. No central server ever learned who was near whom, or where anyone was. The answer — "you were near a case" — shipped without the raw material, the location history.
That is the pattern this lesson is about: derive the value at the earliest possible point, and never persist the raw input.
The derivation ladder
Rank every intake from least invasive to most:
- Don't collect. The field doesn't exist. Most "company size" and "phone number" fields die here.
- Compute locally, ship the answer. Face grouping in Apple Photos runs on the device; Live Caption transcribes on-device; Android's Private Compute Core keeps Smart Reply and Live Translate on the handset. The server gets a boolean or a bundle, never the pixels or the audio.
- Degrade precision at the edge. Geolocate the IP and keep
country_code, not the address. Truncate203.0.113.47to203.0.113.0/24— Matomo and Plausible do exactly this — or don't log the address at all. - Aggregate at ingest. You don't need 50 million rows to know daily active users. HyperLogLog sketches give you approximate uniques in kilobytes; rollup tables give you counters. The rows never exist.
- Collect raw, bounded, justified. Sometimes you need it — payment rails, fraud signals. Then it's pseudonymized, access-controlled, and TTL'd. Collection becomes the deliberate choice, not the default.
The mental model to kill
Teams justify raw collection with optionality: "we might need it for ML later." Two problems. First, GDPR Article 5(1)(b) requires specified purposes; "later" is not one. Second, the option is never free — it's paid for continuously, in blast radius, access-surface, DSAR scope, and deletion fan-out. If the hypothetical feature can't name the fields it needs, it doesn't need them.
Federated learning is the honest version of the ML argument. Google shipped it on Gboard in 2017 — McMahan & Ramage's "Communication-Efficient Learning of Deep Networks from Decentralized Data" — training a shared model on gradients computed per-device, never on the keystrokes. When you genuinely need models, federating or DP-ing the training is the answer, not a data lake of everyone's typing.
The tradeoffs, stated plainly
- You can't re-derive later. If your "did the user verify their age" flow stores
verified=trueinstead of a birthdate, you can never run a different check on the birthdate. Accept it — that's minimization working, not a bug. - Debugging gets harder. Aggregated metrics can't answer "what happened to user X at 14:03." You trade observability for non-collection; compensate with short-TTL detail logs under access control rather than permanent row stores.
- On-device compute costs your users. Federated learning burns their battery and bandwidth; on-device inference has real latency. The cost moves off your bill onto their device — it's a tradeoff, and sometimes centralization with a TTL is the honest better answer.
- Local derivation can't be audited centrally. You can't verify every client computed honestly; that's why GAEN's matching needed health-authority key servers for the positive-test list. Design for adversarial inputs at the ingest edge.
The practice
Write an intake table — one row per thing you ingest: raw needed / derived suffices / none. Any "raw needed" without a named consumer gets downgraded or deleted. Then push the derivation as far left as it will go: device → edge → ingest-time transform → bounded row store. Data minimized at collection never needs a deletion pipeline, a DSAR export, or a breach disclosure. It's the only privacy control that's also free to operate.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
Healthcare Ransomware: Why Hospitals Can't Patch Fast Enough
The criminals behind the attack claim to have shared 400GB of patient data. The NHS stated it is working swiftly to confirm the validity of these files. The ransomware attack on the UK's National Health Service (NHS) continues to disrupt health services in London, with a significant amount of…
RSA Is Simple. Deploying RSA Correctly Almost Never Is.
The capstone to our RSA series. The math checks out. Shipping it as written gets you breached. This is the nineteen-year-old attack that proves it, and what belongs in production instead.
RSA in JavaScript Part 2: The JWT Is Where You'll Actually Meet It
Most JavaScript developers never call an RSA function directly. They verify an RS256 token, and two classic attacks turn that into an authentication bypass — both demonstrated here, both fixed by one line.