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.
You support several product lines and want automated lifecycle management: how is data tagged with a retention class, who owns the tags, and how are archival and deletion enforced and evidenced across systems?
Sample Answer
Direct answer. Make retention a property of the data, not of each team's memory. Every dataset and field carries a retention class (a named rule such as "support tickets: 3 years"), set by an owner, enforced by platform automation such as storage lifecycle rules and scheduled deletion jobs, and proven by logs. Automation catches drift (new fields with no class) before it becomes a risk.
Tagging. A central catalogue stores the retention class per dataset, table and column. Tags are applied at creation by schema review (a new field cannot merge without a class) and carried by metadata on tables, buckets and topics. A small set of classes (for example transient 30 days, operational 1 year, financial 7 years, legal-hold-eligible) keeps it manageable; teams cannot invent classes.
Ownership. The data owner (a named person in the product line, not the platform team) chooses the class with input from legal and privacy. The platform team owns the enforcement mechanism. Privacy owns the class catalogue. A tag without an owner fails the check, and tags are reviewed annually.
Enforcement.
- Object storage: bucket lifecycle rules (storage settings such as "under prefix logs/, move to cheaper archive storage after 90 days and delete after 365") applied by prefix or tag transition data to the archive tier (cheap, slow storage for rarely read data) and then expire it.
- Warehouse and databases: time-partitioned tables (a table split into chunks by date, such as one chunk per day), so expiry drops a whole partition (one chunk) rather than deleting rows one by one (cheap and quick); row-level deletes for per-user records, in batches. A partition drop cannot spare individual rows, so before dropping a partition the job checks it against the hold registry: a partition that contains held rows is not dropped; the held rows are copied to the restricted hold store (or the partition is kept) and the rest is deleted by row.
- Soft-delete window: expired records are hidden first, then hard-deleted after a short window (for example 30 days) so mistakes are recoverable.
- Legal holds: a hold registry (a table of active legal holds, meaning lawyer-ordered instructions to keep specific records) is consulted at deletion time: delete only if expired and not held. Held data is retained in restricted storage and reviewed regularly.
- Scale: at 100 million users, a delete rate of 2,000 rows per second would take about 13.9 hours for a full table pass, so run in rate-limited, resumable batches off peak and prefer partition drops. These numbers are illustrative.
Detecting new personal-data fields (nightly job). A scheduled scan compares the live schemas and sampled column contents against the catalogue. It flags columns that look like personal data (by name patterns and value detectors, meaning checks on what the data looks like, such as an email-shaped string, rather than on the column name) and have no retention class, then opens a ticket for the table owner and notifies a channel; after a deadline it escalates to the owner's manager, and a rules engine (an automated policy check in the deployment pipeline) can block deployments for unclassified personal-data columns. Detectors produce false positives and misses, so a person confirms.
Evidence. Each run writes: dataset, class, cutoff date, records and partitions deleted, holds excluded, and a verification query result. Logs are retained for the audit period and hold counts and IDs, not content. A dashboard shows data older than its class, which should be zero.
Worked example. A new table chat_attachments appears with a user email column and no class. The nightly scan flags it; the owner picks "operational 1 year"; lifecycle rules apply; the next partition drop deletes data older than 365 days, logged. The catalogue row after classification:
| Dataset | Column | Class | Owner | Reviewed |
|---|---|---|---|---|
warehouse.chat_attachments | user_email | operational (1 year) | Messaging product lead | 2026-10-01 |
Trade-offs. Strict automation can delete something needed; the soft-delete window, holds, and shadow-mode dry runs (running the deletion job in report-only mode first) reduce that. Backups still hold data until their own retention ends.
Take a standard stack: API gateway, authentication service, application servers, relational database, data lake, message queue and analytics pipeline. Where does personal data flow, where would you place privacy controls, and which would you centralize versus enforce per service?
Sample Answer
Direct answer. Personal data enters at the gateway and authentication service, is copied at every hop (application servers, database, queue, data lake, analytics), and becomes riskier as copies multiply and context is lost. I would centralize the controls that must be identical everywhere (classification, consent and preference lookup, deletion orchestration, log redaction, retention policy, audit) and leave per-service the controls that depend on that service's purpose (the reason it holds the data, such as delivering orders: what it collects, what it exposes, which fields it stores).
Data flow and placement
| Component | Personal data present | Controls placed here |
|---|---|---|
| API gateway | IP addresses, tokens, request bodies, headers | Central: log scrubbing (no request bodies or tokens in access logs), rate limits, consent signal passed downstream |
| Authentication service | Identifiers, credentials, contact details, device data | Per service: collect only what login needs; separate store from product data |
| Application servers | Full records during processing | Per service: field-level minimization in own APIs, purpose checks; central redaction library for logs |
| Relational database | System of record | Per service: schema tagged by classification and purpose, retention column; central retention job |
| Message queue | Event payloads | Per service: publish IDs and needed fields only, not whole records; schema registry (a shared catalog of message formats that rejects fields nobody declared) with required tags |
| Data lake | Copies, long retention | Central: ingest only tagged fields, partition by user key (group files by a hash of the user ID, so a deletion request finds and rewrites only the files holding that user instead of scanning the whole lake), access by purpose (data collected for one purpose is not reused for an incompatible one) |
| Analytics pipeline and BI | Derived and aggregated data, dashboards | Central: pseudonymous IDs (stable IDs that stand in for names and link back only through a separate lookup), aggregate-by-default views, row-level access (the database returns only the rows that analyst may see), restrict extracts |
One value through the stack. Follow jane.doe@example.com from sign-up. (1) Gateway: it arrives in the request body, so the access log must not keep bodies. (2) Authentication service: stored as the login identifier. (3) Application server: held in a profile record and at risk of leaking into error logs, so the redaction library masks it. (4) Database: users.email, tagged personal with a retention rule. (5) Queue: the user.signed_up event carries user_id, not the email, and the welcome-email service looks up the address itself. (6) Data lake: only tagged fields are ingested, and the email is dropped or replaced with a pseudonymous ID. (7) Analytics: dashboards see only that ID. A deletion request then has to reach steps 2, 4 and 6, and the queue consumers' own copies.
Centralize versus per service
- Central (platform team owns): data catalog (the inventory of what each store holds and how it is classified) and classification tags, consent and preference service, deletion and access request orchestrator that fans out (sends the request to every store in turn and records that each finished), log redaction library or sidecar (a helper process running next to each service that filters its logs and traffic), retention policy engine, audit logging. Reason: one definition of truth, and a bug fixed once is fixed everywhere.
- Per service: deciding which fields it needs and why, honouring the central consent answer, exposing minimal APIs, declaring its data in its schema. Reason: only the service owner knows the purpose.
Extracts. When an analyst needs row-level detail, the extract is logged, time-limited and stamped with the requester's ID, so a leaked file can be traced and the copy expires.
Trade-off. Central controls create a dependency and a bottleneck; keep them as libraries and APIs with clear service levels so teams adopt them.
You are building consent management for a mobile app that several backend services depend on. Lay out what you would build: how consent is captured, stored, and checked, and how other services learn that a user changed their mind.
Sample Answer
Direct answer
Build one consent service as the system of record. Clients capture choices per purpose, the service stores them as an append-only history, other services check against it, and every change is published as an event so downstream services update without polling. Consent here means the user's recorded choice for a specific purpose.
Capture
- The app shows a notice with a version number and one toggle per purpose (analytics, personalised ads, and so on), none pre-set to yes.
- Each choice is sent with user identity (or an anonymous device ID before login, merged at login), purpose, decision, notice version and timestamp.
- Offline: the SDK (software development kit) queues the change and syncs later, with the device's local time stored next to the server's recorded time.
Store
An append-only event log (one row per grant or revocation, only ever added to, never edited) plus a "current state" view derived from it. This keeps history for proof and a fast read for checks.
Check
- Services call a check API (user, purpose, minimum notice version) or read a cached snapshot.
- Fail closed (when unsure, deny): if the service is down and the cached answer is too old, treat consent-dependent processing as not allowed. Essential processing that does not rely on consent keeps working.
Telling other services the user changed their mind
| Mechanism | Role |
|---|---|
| Publish a consent-changed event to a message topic (a named channel that services subscribe to), with a per-user sequence number (a counter that rises by one for each change that user makes) | Fast push to subscribers |
| Subscribers ignore any event whose sequence number is lower than the last one they applied, and applying the same event twice changes nothing (idempotent) | Safe under retries and reordering |
| Short cache lifetime as a backstop | Covers a missed event |
| Nightly reconciliation (a job that compares each subscriber's stored state with the service and reports differences) | Catches drift |
Worked case for ordering: a user switches personalised ads on at 10:00 (sequence 7) and off at 10:05 (sequence 8). The ad service receives sequence 8 first and records "off"; sequence 7 then arrives late. Because 7 is lower than the 8 already applied, it is ignored and ads stay off. Without the rule, the late grant would silently turn ads back on.
Revocation must be as easy as granting (GDPR Article 7(3)). Stopping future processing is immediate; what happens to data already collected is a per-purpose decision (delete, keep aggregated, keep under another lawful basis) that legal confirms. For example, on revoking ads: stop targeting immediately; delete the user's ad-click history; keep the invoice records that tax law requires.
Conflict rule
If two devices change the same purpose offline, the later effective time wins, and a tie goes to the more restrictive choice. Example: a phone, offline, records analytics off at 09:00; a tablet records analytics on at 09:30; both sync at 11:00. The 09:30 choice is later, so analytics is on. If both had been stamped 09:30, the result would be off. Two details keep this consistent with the ordering rule above: the per-user sequence number is assigned by the consent service when it records the resolved outcome, not by arrival order, so a late-arriving offline event that loses the conflict is kept in history but does not become the current state; and the effective time is the device time clamped to the server's receipt time (a device clock set in the future is not trusted), with the server's recorded time stored beside it as noted under capture.
Pitfall
Checking consent only in the app is not enough: the backend must enforce it, because clients can be out of date.
Create a measurable plan to embed privacy-by-design into the product lifecycle across 20 product teams. Include training, automated checks, architecture patterns, gating, and a retrofit plan for existing services. Explain ownership and how you will demonstrate improvement to compliance auditors.
Sample Answer
Direct answer
I would run a 12-month programme with a small central privacy engineering team that owns the standards, tooling and gate, while each of the 20 product teams owns its own compliance with them. Roll out in waves (4, 8, 8 teams), automate the checks that are cheap to automate, gate only on what matters, retrofit existing services by risk tier, and report to auditors with evidence generated by the pipeline rather than slides.
Ownership
- Executive sponsor (for example the CISO, the chief information security officer, or the CTO) owns the target and budget.
- Central privacy engineering (illustratively 3 to 4 people) owns patterns, linters, review gate and metrics.
- Each product team names a privacy champion (a trained volunteer who is the team's privacy point of contact, giving about 20% of their time during their wave, illustrative) and the team's engineering manager owns the team's backlog.
- Legal or privacy counsel owns interpretation of law and signs off on high-risk reviews. I make the engineering decisions, counsel decides on legal questions.
Timeline
| Phase | Months | Teams | Content |
|---|---|---|---|
| Foundation | 1-2 | 0 | Data inventory template, standards, intake checklist, CI checks built |
| Wave 1 (pilot) | 3-5 | 4 | Training, gate in advisory mode (it reports problems but does not block releases), fix what breaks |
| Wave 2 | 6-8 | 8 | Gate enforced for new features |
| Wave 3 | 9-11 | 8 | Remaining teams, 4 + 8 + 8 = 20 teams |
| Audit readiness | 12 | 20 | Evidence pack, internal sample test |
Retrofit of existing services runs in parallel from month 4.
Training
Role-based: engineers (data minimization, PII-safe logging, deletion flows) about 2 hours of hands-on lab, designers and product managers (consent, defaults, purpose) about 1 hour, champions an extra half-day (these durations and the 95% tag target are illustrative planning figures, to be reset from the month-0 baseline and pilot results). Track completion, then test with a scenario quiz and with whether design reviews improve, since a completion rate alone proves nothing.
Automated checks
- Schema annotations: every field in a data schema carries a classification tag (a label such as
personal,sensitiveorpublic), and CI fails if a new personal field has no tag, retention or owner. For example, a schema lineemail: string # class=personal retention=24m owner=billing-teampasses, while addingphone: stringwith no annotations fails withPRIV-001: field 'phone' has no class, retention or owner. - Log and telemetry linters (automatic code scanners) that flag known personal fields or patterns in log statements.
- Infrastructure checks for storage with no retention policy or with public access.
- Deletion-flow test: a CI or nightly test creates a test user, deletes them, and verifies the data is gone from each registered store.
Automation catches mechanical issues. Design questions (is this purpose justified?) still need a human reviewer.
Architecture patterns
A small catalogue teams reuse: a central consent and preference service (one place that stores what each user agreed to), a shared deletion and access-request bus (one channel that carries a user's request to every store), a tokenization or pseudonymization service (swaps real identifiers for random stand-ins), a privacy-safe event SDK with a typed schema, and retention-by-default storage templates. Start with the event SDK and the storage templates, since the wave-1 CI checks plug straight into them; the consent service, deletion bus and tokenization service are larger builds that follow as the retrofit shows where demand is. These are paved roads (the easy, supported path that teams choose because it is quicker than building their own), and they are adopted faster than rules.
Gating
Intake is required at design start for every feature. Full review applies for sensitive data, children, new third parties, or a new purpose. The release gate (a pipeline step that stops a release until the listed conditions are met) blocks on missing classification tags, missing retention, or a missing review record for flagged features. Exceptions need a named risk owner and an expiry date.
Retrofit plan for existing services
Tier by risk. Illustrative inventory of 60 services: Tier 1 (sensitive data or large volume) 12, Tier 2 (regular personal data) 18, Tier 3 (little or none) 30, and 12 + 18 + 30 = 60. Tier 1 gets a full review and remediation in months 4-9, Tier 2 gets automated scanning plus targeted fixes by month 12, Tier 3 gets tagging only. Track the backlog burn-down (open items remaining, plotted over time) by tier.
Measures and demonstrating improvement to auditors
| Metric | Target by month 12 |
|---|---|
| Teams with intake and CI checks live | 20 of 20 |
| Tier 1 services reviewed and remediated | 12 of 12 |
| Fields in schemas with classification tags | 95% or more (illustrative: a month-0 baseline of 3,100 of 8,000 fields tagged is 38.75%; 7,700 of 8,000 at month 12 is 96.25%, a gain of 57.5 points) |
| Median deletion-request completion time | Within the one-month deadline GDPR sets for responding to requests (Article 12(3), extendable by two months for complex cases; counsel confirms the rule for each region), with a lower internal target, and 100% of requests answered within the deadline (a median alone would let up to half of the requests run late) |
| Launches skipping intake | Zero, any exception logged |
| Post-launch privacy defects | Falling quarter on quarter |
Baseline each metric at month 0 so the improvement is a measured delta. For auditors, produce evidence directly from systems: gate logs, CI results, review records with approver and date, training records, and an exceptions register. An auditor will sample, so I would pre-run a sample test myself. Sign-off on whether the programme satisfies a regulation sits with counsel and the auditor.
Trade-offs and pitfalls
A hard gate on day one stalls delivery, so start advisory in wave 1. Targets that only measure activity (training completed) invite box-ticking, so every outcome metric is paired with one that shows behaviour changed. Retrofit never finishes if it is not tiered.
A new engineer on your team asks what 'privacy by design' actually means. How would you explain it, which principles would you name, and what does each one look like as a real product or engineering decision rather than a slogan?
Sample Answer
Direct answer
Privacy by design means making privacy a property the system has from the first design meeting, not a review step added before launch. "Personal data" is any information that relates to an identifiable person (an email, a device ID, a location trail). The practical test: if the team deleted the privacy policy tomorrow, would the product still collect, keep and expose as little as it needs to? The most widely cited framework is Ann Cavoukian's seven foundational principles. Article 25 of the GDPR (the EU General Data Protection Regulation) turned the idea into a legal duty of "data protection by design and by default"; its second paragraph requires that, by default, only the personal data necessary for each specific purpose is processed, which is principle 2 below written as law. What matters day to day is what each principle changes in a ticket or a design doc.
The seven principles as real decisions
| Principle | What it looks like in practice |
|---|---|
| 1. Proactive not reactive; preventive not remedial | A short privacy question set in the design doc template ("what personal data does this add?") answered before build, instead of a fix after a complaint. |
| 2. Privacy as the default setting | A new account starts with profile private, ad personalization off, and location sharing off. The user never has to find a toggle to be protected. |
| 3. Privacy embedded into design | Data minimization (collect and keep only what a stated purpose needs) is an architecture choice: the order service stores a payment token (a random stand-in the payment provider can exchange for the card), not the card number; a shared "privacy-safe logger" library is the only approved way to log. |
| 4. Full functionality, positive-sum not zero-sum | Refuse the false choice "privacy or feature" (positive-sum means both sides win; zero-sum means one must lose). Example: show nearby stores from city-level location rather than precise GPS, so the feature still works. |
| 5. End-to-end security, full lifecycle protection | Protect data from collection to deletion: encryption in transit (while moving over the network) and at rest (while stored on disk), plus a deletion job that reaches the production database, search indexes and the analytics warehouse, with backups documented to age out on their own schedule because they usually cannot be edited record by record. |
| 6. Visibility and transparency | A privacy settings page that shows in plain words what is collected and why, and an internal data inventory (a maintained list of what personal data each system holds) so engineers can answer the same question. |
| 7. Respect for user privacy, keep it user-centric | Consent screens with equal-weight "accept" and "decline" buttons, and an export-my-data button that actually works. |
Worked example: a "find friends" feature
A team wants to upload address books to suggest friends. Principle 1 triggers a design question before code, for example this line in the design doc template: "What personal data does this add, and what is the least we can collect?" Principle 2 means the upload is off until the user taps an explicit prompt. Principle 3 means contacts are matched and then discarded rather than stored. Principle 4 keeps the feature: suggestions still appear. Principle 5 sets a deletion step for the matching data. Principles 6 and 7 add a plain explanation of what happens to contacts and a way to withdraw.
Pitfalls
- Treating the seven principles as a poster. If a principle cannot be tied to a ticket, a default or a test, it is a slogan.
- Equating privacy with security. Security protects data from outsiders; privacy also asks whether you should hold the data at all.
- Claiming "privacy by design" because of a compliance checklist run at the end, which is the opposite of principle 1.
Unlock Full Question Bank
Get access to all 10 Privacy by Design and Default interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.