Privacy by Design and Default Questions
Designing privacy into products, architectures and the software development lifecycle instead of bolting it on afterward. Covers the privacy-by-design principles and privacy-protective defaults, data minimization and purpose limitation at design time, personal-data flow mapping and PII inventory for a feature, consent and preference design including consent storage, enforcement across web and mobile and region-specific consent flows, retention and deletion design including legal holds, deletion across backups and immutable logs, provable deletion, and data-subject access, export and erasure flows, PII-safe logging, telemetry and session replay, on-device processing to limit data exposure, privacy-versus-personalization trade-offs, privacy in ML training data, feature stores and erasure from trained models, and privacy review gates, checklists, CI/CD checks, release readiness and requirements traceability inside engineering workflows. Includes designing privacy-first features, reference architectures, remediating privacy design flaws and rollout programs across product teams, and working with product, legal and security partners. Cryptographic and statistical privacy techniques, formal impact assessments, data-protection law, cross-border transfer rules, vendor risk, and encryption or access-control mechanics are covered elsewhere.
How would you reconcile immutable audit logs and WORM backups with a GDPR 'right to be forgotten' request that targets a user's personally identifiable data appearing in logs and backups? Propose a design that preserves audit integrity but enables erasure obligations, and explain technical and legal trade-offs of redaction, cryptographic erasure (key deletion), and selective redaction strategies.
Sample Answer
Direct answer. Keep personal data out of the immutable store in the first place, and where it must be there, protect it so it can be made unreadable later. The best design is to log pseudonymous IDs and encrypt any personal fields with a per-user key held outside the log; erasure then means destroying the key (crypto-shredding), which leaves the log's hash chain and integrity intact. Redaction by rewriting works only when the store is not truly write-once.
Why the conflict exists. The GDPR right to erasure (Art. 17) has exceptions, including processing needed for a legal obligation and for establishing, exercising or defending legal claims (Art. 17(3)(b) and (e)). Some audit logs may qualify; whether a given log or backup does is a decision for counsel and the DPO (data protection officer, the person an organization appoints to advise on and monitor data protection compliance), not engineering. Where no exception applies, you need a technical way to honor erasure.
What "tamper-evident" means here. Each log entry stores a hash of its own content plus the previous entry's hash, which forms a hash chain (a hash is a short fingerprint of data, and any change to the data produces a different fingerprint). Edit one old entry and its fingerprint changes, which no longer matches what the next entry recorded, so the tampering shows. That is why rewriting a log to delete personal data counts as tampering unless you re-seal it, meaning recompute and re-sign every later fingerprint, which is exactly the privilege an immutable log is meant to remove. Crypto-shredding is the technique that makes the conflict go away, because it erases without touching a single stored byte.
A worked example (runnable, standard library only; the cipher is a toy for the demo, use a vetted library such as AES-GCM in production).
import hashlib, hmac, json
def keystream(key, nonce, n):
out, i = b"", 0
while len(out) < n:
out += hmac.new(key, nonce + i.to_bytes(4, "big"), hashlib.sha256).digest()
i += 1
return out[:n]
def crypt(key, nonce, data): # XOR with keystream: same call encrypts and decrypts
return bytes(a ^ b for a, b in zip(data, keystream(key, nonce, len(data))))
keys = {"u_7f3a": hashlib.sha256(b"demo-key-u_7f3a").digest()} # held by the key service
nonce = (0).to_bytes(8, "big")
blob = crypt(keys["u_7f3a"], nonce, b"jane.doe@example.com")
prev = "0" * 8
h = hashlib.sha256((prev + "u_7f3a" + "login" + blob.hex()).encode()).hexdigest()[:8]
entry = {"seq": 0, "user": "u_7f3a", "event": "login", "pii": blob.hex(), "prev": prev, "hash": h}
print(json.dumps(entry))
print("before:", crypt(keys["u_7f3a"], nonce, bytes.fromhex(entry["pii"])).decode())
del keys["u_7f3a"] # erasure: destroy the key
check = hashlib.sha256((prev + "u_7f3a" + "login" + entry["pii"]).encode()).hexdigest()[:8]
print("after: key gone, entry unchanged, chain valid:", check == entry["hash"])
redacted = hashlib.sha256((prev + "u_7f3a" + "login" + b"REDACTED".hex()).encode()).hexdigest()[:8]
print("rewrite instead: new hash", redacted, "!= stored", entry["hash"])
Output:
{"seq": 0, "user": "u_7f3a", "event": "login", "pii": "c3fa910e37d893fcf804e5dbe612983d19f63572", "prev": "00000000", "hash": "1a6b5f66"}
before: jane.doe@example.com
after: key gone, entry unchanged, chain valid: True
rewrite instead: new hash 163c0af8 != stored 1a6b5f66
The stored line never changes. Before erasure the key turns the pii field back into the email. After the key is destroyed the same bytes stay in the log, the fingerprint still matches, and the email is unrecoverable. Redacting by rewriting the field produces a different fingerprint, which breaks the chain.
Three approaches compared.
| Approach | How | Audit integrity | Erasure strength | Cost and risks |
|---|---|---|---|---|
| Redaction by rewrite | Replace the personal fields in log entries and re-seal | Breaks hash chains and write-once guarantees unless you re-sign; needs a controlled, logged exception | Strong if every copy is rewritten | Hard on WORM (write once, read many) storage, which by design cannot be rewritten |
| Crypto-shredding (key deletion) | Encrypt personal fields per user; delete the key | Log bytes unchanged, chain valid | Strong if the key and all its copies are truly destroyed and ciphertext cannot be recovered otherwise | Key management load; keys in backups; weak crypto or leaked plaintext elsewhere defeats it |
| Selective redaction | Hide (mask) fields flagged as personal only when someone reads or exports the log; the stored data is unchanged | Preserved | Weak: data still exists | Fine for access control, not for erasure |
Recommended design.
- Minimize at the source: logs carry a pseudonymous user ID and event type; names, emails and IP addresses go through a tokenization step (swap the value for a random placeholder, with the real value kept in a separate protected lookup table) or are dropped.
- Envelope fields: where personal data must appear, encrypt just that field (the envelope) with a per-user data key, one secret key per person as in the demo. A key service (a separate, access-controlled system that stores and hands out keys) holds it with its own audit trail.
- Erasure procedure: verify the request, check exceptions with legal, delete the user's key from the key service and its backups, and record a signed erasure event (user hash, time, scope). Verified by trying to decrypt a sample entry.
- Backups and WORM: apply the same keys, so shredding covers backups; for older WORM data with plaintext, let it expire on its retention date and document it, since you cannot change it.
- Integrity: log entries are hashed over the ciphertext, so shredding does not break the chain.
End-to-end encrypted backups where only the user holds keys. Here the provider cannot read the data at all, because it stores only ciphertext (data scrambled by encryption) and never has the key. Erasure at design level means deleting the encrypted blobs the provider holds. Where blobs sit in immutable storage and cannot be deleted, the user's key is the control: if the user discards it and the provider can never obtain it, the ciphertext is unreadable, which is the same crypto-shredding as above with the key held by the user instead of a key service. The provider documents this. Whether unreadable ciphertext counts as erased is a legal judgment, since encrypted data can still be personal data if the key exists somewhere.
Trade-offs. Per-user keys cost key management; not all logs need to be immutable; shorter retention reduces the problem more than any technique.
Design a provable deletion system that provides auditable proof (for regulators) that user data was deleted across databases, backups, and third-party vendors. Include APIs for requesting deletion, mechanisms to track deletion propagation, and how to handle immutable backups.
Sample Answer
Direct answer. Build a deletion orchestrator: one request ID fans out to every system that holds the user's data, each system deletes and confirms, and the orchestrator keeps an append-only ledger that shows completion per system. "Proof" means evidence that deletion was requested, executed or scheduled in each system, and that remaining copies expire on a known date. It cannot honestly claim a byte was erased from places it does not control.
Request API.
POST /v1/deletion-requests {subject_id, verified_identity_ref, scope} -> {request_id, due_date}
GET /v1/deletion-requests/{id} -> state per system: pending | deleted | scheduled(expiry date) | unconfirmed | failed | exempt(reason)
For example, POST {"subject_id":"sub_7a1","verified_identity_ref":"idv_5521","scope":"all"} received on 2026-08-05 returns {"request_id":"del_0192","due_date":"2026-09-05"}, and a later GET shows {search_index: deleted, primary_db: deleted, backups: scheduled(2026-09-12), crm_vendor: unconfirmed}.
The request is accepted only after identity verification, and the due date is set against the legal clock (the deadline the law gives you to answer; for GDPR, a response within one month of receipt, extendable by two further months with notice, Art. 12(3)).
Propagation tracking. A data inventory lists each system and its deletion adapter (database tables, search index, caches, data lake, analytics, support tools, and vendors). The orchestrator publishes one task per system through a queue (a buffer holding tasks until each system picks them up) with retries and a dead-letter queue (where tasks that keep failing are parked for a person to inspect); each deletion adapter (a small connector that knows how to delete in one specific system) returns a receipt (a record from that system proving the work: system, record count affected, timestamp, job ID). Failed tasks page the owner. A subject index or token mapping (a way to find a user's records across systems by one ID) is what makes deletion complete; without it you cannot find the data. For example, one person is user 42 in the main database, cust-0042 in the CRM and an email fingerprint 9f2c41 in analytics; the index row {subject_id: sub_7a1, main_db: 42, crm: cust-0042, analytics: 9f2c41} lets one request reach all three. Deletion is verified by a follow-up query that finds zero rows for the subject, run by a separate job.
Third-party vendors. Send a deletion call to each vendor's API or contractual channel (GDPR Art. 19 requires telling each recipient the data was shared with about an erasure, unless that proves impossible or involves disproportionate effort). Store the vendor's acknowledgement and, where the contract requires, a deletion certificate. Where a vendor cannot confirm, mark it "unconfirmed" and escalate; do not mark it deleted.
Immutable backups. You cannot edit a write-once backup. Options: (1) let it expire on its normal cycle and record the expiry date as the completion date for that copy; (2) keep a suppression list of deleted user IDs so that if a backup is restored, the deletion job reruns before the data goes live; (3) for encrypted backups using per-user keys, destroy the key (crypto-shredding: with the key gone, the encrypted copies can no longer be read). Typical design: option 1 plus 2, with the backup retention period short and documented.
The evidence record (what a regulator sees). For each request: request ID, dates, per-system receipts, backup expiry date, vendor acknowledgements, exemptions with reason (such as a legal hold), and the verifying query results. The ledger is append-only and hash-chained (each entry includes a fingerprint of the previous entry, so any later edit breaks the chain and shows), and holds no personal data beyond a salted hash of the subject ID (a one-way fingerprint with a secret random value mixed in, so it identifies the request without revealing the ID), so the proof of deletion does not itself keep the data. An illustrative entry: {seq: 1841, request: "del_0192", system: "search_index", state: "deleted", count: 3, ts: "2026-08-08T10:02:11Z", subject_hash: "c41e...", prev_hash: "a41f...", hash: "7c9e..."}. Keep the ledger for a defined audit period that counsel sets, and delete it afterwards. Likewise keep deletion-verification logs minimal: IDs, timestamps and counts only, no content.
Worked example. Request on day 0. Primary databases and search are deleted on day 3. Backups rotate every 35 days, so the last copy expires on day 38 (3 + 35). The user is told by day 30, inside the one-month limit, that live data is deleted and that backup copies remain until day 38 and are never used. Illustrative numbers; whether that backup period is acceptable is for counsel.
Trade-offs. A full inventory is costly to keep current; unmapped systems are the usual cause of failed deletion. Whether a backup's retention is acceptable is a legal view, so involve counsel.
A product will process sensitive data such as health and biometric information. What would you require before release, and what does your go/no-go decision look like?
Sample Answer
Direct answer. I would require a short list of blocking conditions that must all be true, ship nothing on a promise, and make go/no-go a recorded decision by named people. Health data, and biometric data used to identify a person, are special category data (the kinds GDPR treats as especially sensitive) under GDPR Article 9: processing is prohibited unless an exception applies, such as explicit consent for specified purposes (Art. 9(2)(a)), and a DPIA (data protection impact assessment, a structured risk assessment done before processing) is required for large-scale processing of such data (Art. 35(3)(b)). Counsel decides which laws and exceptions apply; engineering decides what controls are real.
Required before release (blockers)
- Legal basis (the lawful reason GDPR requires for processing, such as consent) and consent flow decided and built: explicit, per-purpose, separate from general terms, withdrawable as easily as given, with the choice stored.
- DPIA completed and approved, with high residual risks (the risk left after the controls are applied) accepted in writing by an accountable executive, and the advice of the data protection officer (DPO, the role that advises on privacy compliance and monitors it) recorded where one exists.
- Data minimization shown (collect only what the feature needs): a data map listing each field and purpose; anything not needed for the feature is not collected. Prefer processing on the device where the feature allows, so raw biometric or health data never leaves it.
- Retention and deletion: stated retention per data class, an erasure (deleting a person's data on request) and access flow tested end to end, including copies in analytics and backups policy.
- Controls verified: access limited and logged, no sensitive values in logs or telemetry, security review passed, incident response and breach notification path ready.
- Third parties that receive the data are reviewed and have contracts in place.
Conditional (ship with a dated owner): items such as a lower-risk reporting gap, tracked with a deadline and visible to the approver.
Go/no-go decision
| Question | Result |
|---|---|
| Any blocker unmet? | No-go, regardless of schedule |
| Only conditionals open, with owner and date? | Go with conditions |
| All met? | Go |
A worked case (illustrative). A wellness app scores stress from a wearable's heart rate and signs users in with a face scan. At the review: consent screen built and stored per purpose (met); DPIA approved, but one high residual risk is open because face templates sit on the company's servers and no deletion path has been tested. That is an unmet blocker, so the decision is no-go regardless of the launch date. The team moves face matching onto the phone's built-in biometric login so templates never leave the device, retests deletion for the heart-rate data, and the privacy lead and security re-review. One gap remains: the monthly access-log review report is still produced by hand instead of automatically, so the first review is due in 30 days. That is a lower-risk conditional: the security lead owns the fix, the automated report is due 30 days after launch, and the approver sees it on the launch record. A gap such as retention running longer than the stated period would not qualify, because it is a blocker. So the decision becomes go with conditions.
Who signs off. The product owner owns the decision to ship, the privacy lead or DPO advises, security signs that controls work, and an executive accepts residual risk.
What would change my call. A pilot with synthetic data or a limited, consented beta can proceed earlier; a purely on-device feature that never transmits the data lowers the DPIA burden but does not remove the need to confirm that with counsel.
You are designing a feature that collects a user's location and contact list. Which privacy-by-design principles change your design, and what concrete decisions do you make about what to collect, defaults, retention, and what the user is shown?
Sample Answer
Direct answer
Location and a contact list are both high-risk data, and the contact list is worse in one specific way: it describes people who never agreed to anything (the user's friends). The principles that change the design most are data minimization (collect only what the feature needs), privacy by default (off until asked), purpose limitation (use it only for the stated feature, so location shared for "nearby friends" is not later used for ad targeting), transparency, and lifecycle protection (delete data when the feature no longer needs it). Then I turn each into a decision on collection, defaults, retention and what the user sees, and tie each to user trust: people share more when they believe the app will not misuse it.
Decisions
| Area | Location | Contact list |
|---|---|---|
| What to collect | Coarse location (city or neighbourhood; for example rounding coordinates to two decimal places, about 1.1 km of north-south precision) unless the feature truly needs precise GPS. Ask for "while using the app", not "always". | Only the fields the feature needs (phone number or email), not names, addresses, notes or photos. |
| Default | Permission requested at the moment the feature is used, with a one-line reason, not at app launch. Feature off until accepted. | Off by default. The user opts in with a specific prompt. A denied prompt degrades gracefully (manual search still works). |
| Processing location | Resolve place names on the device and send only the result (for example "store 12") where possible. | Do matching on the device where feasible, or send a one-way transformation (a hash, a scrambled fingerprint that cannot be reversed directly) and discard it after matching. Treat hashing phone numbers as weak protection: a 10-digit number has only 10^10 = 10,000,000,000 possibilities, a short enough list that someone can hash every one and look up your "scrambled" values to recover the numbers. |
| Retention | Raw coordinates kept only as long as the feature needs, for example the current session; a coarse history only if the user turns on a timeline. | Imported contacts deleted once matches are computed; matched results kept only while the user keeps the feature on. |
| What the user is shown | A visible indicator when location is in use, and a settings page to view and clear history. | A clear statement that contacts will be checked against existing members, and a "remove my imported contacts" control. |
| Security | Encrypted in transit and at rest, access limited to the service that needs it, and no location in debug logs. | Same, plus no contact data in analytics events. |
Worked example
Suppose the feature is "meet nearby friends". The privacy-minimizing design computes distance buckets ("under 1 km", "1 to 5 km", "5 to 20 km") on the server from coarse locations, never shows a friend's exact position, stores no location trail, and imports contacts only after the user taps "Find friends" and then deletes the raw upload. The product still works; the risk surface is a small, short-lived dataset instead of a movement log plus an address book.
Trade-offs and pitfalls
- Coarser location gives lower accuracy. Decide with product what accuracy is needed, then use the lowest level that satisfies it.
- On-device processing limits exposure but constrains the model and complicates updates, so I choose it where it keeps the feature working.
- A single "agree to everything" prompt is not meaningful consent, and a feature that breaks when permission is denied pushes users to accept.
- The reviewer's question for any field: "what feature breaks if we drop this?" If none, drop it.
Tell me about a time when you worked with product managers, legal, or security teams to implement a privacy requirement (for example, consent UI, data minimization, or deletion flows). Use the STAR method: describe the Situation, the Task you owned, the Actions you took (technical and communication), and the Results including measurable outcomes and lessons learned.
Sample Answer
Direct answer
Choose one real project from your own work and tell it in STAR order (Situation, Task, Action, Result). Below is a model shape using a deletion flow, with illustrative details you should replace with your own facts and numbers.
Situation
Our app let users close accounts, but the "delete my data" request was a manual ticket that took support days and missed some systems (the analytics warehouse and email tool, stores nobody had registered as holding user data). A privacy requirement said deletion requests must be completed within the legal window (one month under GDPR Article 12(3), extendable in complex cases; our counsel confirmed this), and a customer complaint showed we were not reliable.
Task
I owned the technical design and delivery of an automated deletion flow, working with the product manager (user experience and scope), legal (what must be kept, for example invoices), and the security team (access control and audit).
Actions (technical and communication)
- Discovery. Listed every store holding user data with an owner for each, and found 9 stores, 3 of which nobody had registered.
- Alignment with legal. Agreed which records to delete, which to keep with the reason (invoices under accounting rules, confirmed by legal), and the retention for each.
- Design. A deletion service that fans out (sends the request to every store in parallel), records per-store status, and retries (tries again after a failure). Added a nightly test that creates and deletes a dummy user.
- Working with product. Proposed a 7-day grace period before hard deletion so accidental requests can be undone (the grace period counts inside the legal window, leaving 30 - 7 = 23 days for the work), with a clear confirmation email.
- Escalation. When one team resisted the work due to roadmap pressure, I escalated with the evidence I had prepared: the list of unregistered stores, the missed-deadline count from the ticket history, and the options with effort. For non-technical stakeholders I framed it as "a customer can ask us to forget them and we cannot yet prove we did".
- Trigger signals I used to escalate: a requirement with a legal deadline, a gap shown by evidence, and an owner who could not resolve it alone. The message was short: "We cannot currently show that a deletion request reaches 3 of our 9 data stores, and 6 of last quarter's 38 requests missed the 30-day deadline. Can we agree an owner and two sprints this quarter?"
Result
Illustrative numbers: in the quarter before, 38 requests, median completion 14 days, 6 finished after the 30-day deadline (15.8%). In the quarter after, 41 requests, 38 handled with no human step (92.7%), median completion 8 days (the 7-day grace period plus a day of processing), 0 missed deadlines, and all 9 stores covered. The 3 manual cases were accounts under a legal hold, which the flow routes to a person on purpose. When you tell your own story, say what you can measure: requests handled automatically instead of manually, completion time versus the deadline, the number of stores covered, and zero missed requests in the following quarter, if true. Be honest about what you could not measure.
Lessons
Inventory first, since you cannot delete what you cannot find. Bring legal in before building, not after. Test deletion continuously, as it breaks silently when new stores are added. What I would do differently: add the deletion registration step to the service-creation template from day one.
Telling it well
Use "I" for your actions, name the trade-off you handled, give one concrete number or fact you can defend, and avoid claiming a result you cannot back up. If your story is a consent UI or data minimization change instead, keep the same structure.
Unlock Full Question Bank
Get access to all 17 Privacy by Design and Default interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.