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.
Design a consent orchestration platform (central service) supporting granular legal bases, purpose scoping, revocation, and provenance for multiple brands and subdomains. Include APIs for SDKs, webhooks for downstream systems, versioning of consent schemas, and migration strategy for legacy apps.
Sample Answer
Direct answer. A central consent service that is the single source of truth for what each person agreed to, per purpose, per brand, with an immutable history. SDKs and apps ask it ("may I use this for purpose X?") and receive signed answers (replies carrying a cryptographic signature, so the app can check they came from the service and were not altered); downstream systems are notified of changes by webhooks. Consent is data with a schema version, not a boolean. Build in this order: the consent record and decision API first, then webhooks, then versioning and multi-brand scoping, then the legacy migration.
Core model.
- Subject: a pseudonymous ID plus linked identifiers across brands and subdomains (the cross-brand link only if the user has an account or agreed to it).
- Purpose: a catalogue entry (analytics, personalization, marketing email) with a stable ID, description text and version.
- Legal basis per purpose: consent, contract, legitimate interests (the organisation's own justified need, weighed against the person's rights) and so on. Lawful basis is the legal ground for processing; consent is only one. The service stores the basis so a consent withdrawal does not wrongly stop processing that rests on contract, and so counsel's mapping is visible. Which basis is valid is a legal decision.
- Consent record (an append-only event: each change is a new entry and old entries are never edited): subject, purpose, version of notice text, decision (grant or revoke), timestamp, brand, channel, collection method, and evidence (what UI was shown). Provenance is this evidence trail. Current state is derived from the latest event; nothing is overwritten. An illustrative grant and a later revoke:
{"event_id":"evt_8f31","subject":"sub_2b7c","purpose":"marketing_email","purpose_version":3,"notice_version":"2026-03-b","decision":"grant","brand":"A","channel":"web_banner","ts":"2026-05-02T09:14:07Z","evidence":"ui_snapshot_551"}
{"event_id":"evt_9a07","subject":"sub_2b7c","purpose":"marketing_email","purpose_version":3,"notice_version":"2026-03-b","decision":"revoke","brand":"A","channel":"settings_page","ts":"2026-08-19T16:40:12Z","evidence":"ui_snapshot_602"}
Asking for the decisions of sub_2b7c on brand A now returns marketing_email: revoked (from evt_9a07), while the history endpoint still shows both events.
APIs.
GET /v1/subjects/{id}/decisions?brand=A -> current decision per purpose + decision version + signature
POST /v1/subjects/{id}/decisions -> grant/revoke list [{purpose, decision, notice_version}] (idempotency key required)
GET /v1/purposes?brand=A -> purposes and notice text for the SDK to render
GET /v1/subjects/{id}/history -> events for access requests and audits
An idempotency key is a unique ID the client sends so that retrying the same request after a timeout records it only once. SDKs cache decisions briefly and fail closed (default to the safe state): if the service is unreachable, non-essential processing is off. Clients should hold only a short-lived signed token, never write state directly.
Webhooks. Events such as consent.changed delivered at least once (so duplicates can happen), signed, with an event ID so consumers deduplicate; consumers must be idempotent (handling the same event twice has the same effect as handling it once) and the service retries with backoff and a dead-letter queue (a holding area for events that kept failing, where a person can inspect them). Revocation is time-sensitive, so each downstream system has a target time to stop processing, and the service reports consumers that have not acknowledged. In the example above, the revoke on brand A at 16:40 emits consent.changed; the email platform acknowledges at 16:41 and drops the user from sends; the ad-audience sync has not acknowledged, so the service flags it to its owner; brand B is untouched because the notice the user saw named only brand A.
Versioning schema. Purposes and notice texts are versioned. A change in meaning (not wording) creates a new purpose version and requires fresh consent; old events keep pointing to the version the user saw. API versions are in the URL with long deprecation windows.
Multi-brand scoping. Each purpose is scoped to a brand or a brand group. A user's consent to brand A does not carry to brand B unless the notice named both. Subdomains share a first-party cookie or token only within the same legal controller (the organisation that decides why and how the data is used).
Legacy migration. Phase 1: read-only shadow, import existing flags with provenance "legacy, unverified" and treat weak ones as needing re-consent. Phase 2: apps call the service in parallel with their own check, alerting on mismatch. Phase 3: switch decisions to the service, then delete local stores. Do the highest-risk apps (marketing, ad tech) first.
Trade-offs. A central service is a dependency and an availability risk (hence fail-closed caching) and a high-value target (strong authentication, minimal stored PII). A federated model is easier to roll out but cannot give one consistent revocation.
As a PM, propose an organizational playbook that defines when to escalate privacy questions to specialist teams (privacy/legal/security): include decision criteria, expected response SLAs, and how to handle urgent vs. non-urgent escalations.
Sample Answer
Direct answer. A one-page playbook with three tiers: a PM may decide alone for the routine, must consult a specialist for defined triggers, and must escalate urgently when there may be harm now. The criteria are about the data and the user impact, so a PM does not need to judge the law. SLA means service-level agreement, here an agreed response time.
Decision criteria: escalate when any is true
- New category of personal data (health, biometrics, precise location, children's data, financial).
- New purpose for data already held, or sharing it with a new third party or country.
- Automated decisions with significant effects on people, or profiling at scale.
- Change to consent, retention, deletion or defaults.
- A regulator, user complaint or customer contract clause raises a privacy question.
- Suspected exposure of personal data (always urgent).
Tiers, owners and response times (illustrative, tune to team size)
| Tier | Example | Route to | Acknowledge | Answer |
|---|---|---|---|---|
| 1 Urgent | Suspected data exposure, regulator or legal demand | Security incident channel, privacy lead and counsel at once | 1 hour | Triage decision within 4 hours, then updates every day, weekends included, until contained |
| 2 Standard | New data field or vendor, new purpose, consent change (a near launch date can ask for an expedited review, but does not make it Tier 1) | Privacy intake form to privacy engineering, counsel if a legal question | 1 business day | 5 business days |
| 3 Routine | Question covered by existing guidance | Self-serve FAQ and weekly office hours | n/a | Same week |
Urgent versus non-urgent handling. Urgent means harm may be happening now or a legal clock may be running (for example, GDPR requires notifying the supervisory authority within 72 hours of becoming aware of a personal data breach, where feasible), so the PM pages the incident route first and writes it up afterwards. Tier 1 times are calendar hours on a 24x7 on-call rota, because the 72-hour clock counts every hour from awareness, nights and weekends included; Tier 2 times are business days. Non-urgent items go through the intake form, which asks: what data, what purpose, who gets it, launch date. The PM stays owner of the product decision; specialists own the answer in their domain.
Checks that it works. Track time to acknowledge, items escalated that turned out routine (tune criteria), and items not escalated that later caused rework (tighten criteria).
Pitfall. Escalating everything buries specialists, and then SLAs slip; keep Tier 3 self-serve.
Explain how to build traceability between privacy requirements and implemented controls for an ML product. Describe artifacts (requirements, user stories, design docs, tests), tool integrations, and how to demonstrate traceability to auditors.
Sample Answer
Direct answer. Give every privacy requirement a stable ID, then make each later artifact (user story, design doc section, code or pipeline control, test, release evidence) cite that ID. Traceability means an auditor can pick any requirement and walk forward to the control and the proof it works, or pick any control and walk backward to the requirement it serves. For an ML product this chain must also cover data and models, not only code.
Artifacts, in order
- Requirement with an ID, an owner and a testable sentence. Example
PR-07: "Records of users who withdrew consent must not enter any training set built after the withdrawal." - User story and acceptance criteria in the ticket tracker, tagged
PR-07. - Design doc section (including the data-flow diagram and the privacy design review record) that says where the control lives, for example "training-set builder joins against the consent table and drops withdrawn users".
- Control in the system: the join in the dataset build job, with a pull request that references
PR-07. - Tests tagged
PR-07: a unit test with a withdrawn synthetic user, and a pipeline test asserting that user's ID is absent from the built training set. - Build and release evidence: the CI run for that commit, the dataset and model version identifiers, the release approval, and the signed-off review. Store them under the release ID.
Traceability matrix (excerpt)
| Req | Story | Design | Control | Test | Release evidence |
|---|---|---|---|---|---|
| PR-07 consent withdrawal excluded from training | ENG-412 | Design doc 3.2 | build_training_set consent join | test_withdrawn_excluded | CI run for release 2.8, dataset v41 |
| PR-09 raw inputs not written to logs | ENG-430 | Design doc 4.1 | log redaction filter | test_log_canary | CI run for release 2.8 |
Tool integrations. Use the ticket tracker as the source of IDs, require the ID in branch names or pull request titles (a CI check, meaning an automated build-and-test step that runs on every change, rejects merges without one), tag tests with the ID (test markers or naming), and have CI publish a machine-readable report that joins IDs to test results. The model registry (a catalog of each trained model version) and data versioning tool (which records exactly which snapshot of a dataset was used) record which dataset version trained which model, so the ML-specific link (requirement to dataset to model to release) is queryable instead of reconstructed from memory.
Demonstrating it to auditors. Run a live walk: the auditor picks PR-07 (or a control at random), and you open the matrix, then the pull request, the passing test for that exact release, and the release record. Show the reverse direction too, from a control back to its requirement, and show the report that flags requirements with no test, which proves gaps are visible. The report might read:
Requirement coverage, release 2.8
PR-07 OK test_withdrawn_excluded: pass
PR-09 OK test_log_canary: pass
PR-11 NO TEST no test tagged PR-11
An auditor typically samples items, so the matrix must be generated from the tools, not hand-edited, or the sample will expose drift.
Pitfalls. Hand-maintained spreadsheets rot within a sprint. Requirements written as policy prose ("protect user privacy") cannot be traced because nothing is testable. Evidence for the release you shipped matters, not a later re-run.
You have a legacy monolith storing lots of PII and you must introduce data minimization and lifecycle management. Create a migration plan that minimizes user disruption, ensures compliance, and provides rollback paths. Include milestone-based checkpoints and testing strategies.
Sample Answer
Direct answer. Do not try to clean the monolith in one cut. First find and classify what PII (personally identifiable information) it holds, then add lifecycle controls in the least risky order: stop new over-collection, tag data with retention rules, archive or delete the cold data in reversible stages, and only then drop columns. Each stage ships behind a switch with a checkpoint that decides go or stop.
Phases and milestone checkpoints.
- Discover (weeks, not months). Build a data map: tables, columns, logs, caches, exports, backups, downstream copies. Tag each field with purpose, owner, sensitivity and a retention proposal. Checkpoint: owners sign the map; unknown fields are flagged, not guessed.
- Stop the bleeding. Block new collection that has no purpose, mask PII in logs, and add a retention-class column to new records. Checkpoint: new-write audit shows no unapproved fields.
- Soft-delete first. Records past retention move to a "pending deletion" state (hidden from the app, still restorable) for a window such as 30 days. Checkpoint: zero user-facing errors; support tickets about missing data stay at baseline.
- Hard delete in batches. A scheduled job deletes in small keyset batches (each batch continues from the last ID it deleted instead of re-scanning the table), rate-limited so production load is protected, writing a count log. Checkpoint: row counts match the pending list.
- Minimize the schema. Replace stored values with derived ones where possible (store age band, not birth date), then drop unused columns using expand-then-contract (add the replacement first, move every reader over to it, and only then remove the old column): stop writes, then stop reads, then drop.
- Enforce continuously. Retention job becomes permanent, with evidence logs and an alert if data older than its class exists.
Two checkpoints are non-negotiable whatever the team size: owner sign-off on the data map (phase 1) and a proven restore drill before any hard delete (phase 4). The others can be tightened or relaxed to fit the system.
Worked example: users.birth_date. Illustrative table of 2,400,000 rows. Phase 1 tags the column: purpose "age check at signup", owner the identity team, proposed retention "not needed after signup". Before any birth date is hidden, the replacement is built first (the expand step of Phase 5): add an age_band column beside birth_date and backfill it from the existing birth_date values in batches of 2,000 rows (2,400,000 / 2,000 = 1,200 batches), because once birth dates are soft-deleted or hard-deleted there is nothing left to derive the band from. Phase 2 then switches the signup path: with the column in place, new signups write age_band (for example "25-34") and no birth date. Then run the Phase 3 job in shadow mode: it reports what it would hide and, by tracing who reads the column, finds three readers, a marketing age report, a fraud model and a finance export; the owners agree all three can use age_band, and each is switched over and verified. Only then does Phase 3 move stored birth dates of users past the retention rule to pending deletion, Phase 4 hard-delete them after the restore drill, and Phase 5 stop any remaining writes to birth_date (the signup path already stopped in Phase 2, so this means leftovers such as an admin edit form or an import job), stop reads, and drop the column. Doing the soft-delete before the readers move would hide data that three downstream consumers still need.
Minimizing disruption. Feature flags (runtime switches) per data class; shadow mode first (the job runs but only reports what it would delete, and engineers compare that to expectations); announce changes to downstream teams that read these tables before touching them; check reports, analytics and finance dependencies.
Rollback paths. Phases 1 to 3 roll back by flipping a flag or restoring the soft-deleted state. After hard delete, rollback is only a restore from backup, so the gate before phase 4 is strict: a snapshot, a restore drill proven on a copy, and sign-off from the data owner and legal for the retention period. Schema drops are the last, most irreversible step.
Testing strategy. Replay tests (re-running real production data, with personal values masked, through the new job); unit tests for the retention rule; a restore drill (actually restoring a backup onto a copy to prove it works); consumer contract tests (tests each downstream reader owns that fail if a column they depend on changes); and a canary (a first run on 1% of tenants or rows, watched before the full run). For the retention boundary, take a 365-day class with the rule "delete when age is greater than 365 days": a record created on 2025-01-01 is kept through 2026-01-01 (age 365) and deleted by the run on 2026-01-02 (age 366). Test ages 364, 365 and 366, and write the choice into the policy so the job cannot drift.
Compliance. Which retention period applies is a legal and policy decision (counsel and the data owner), including legal-hold exceptions (records a lawyer has told you to keep for a dispute or investigation). Engineering's job is to make the period enforceable and evidenced.
Trade-offs. Soft-delete windows prolong storage but buy safety; batch deletes take longer but protect uptime.
You must choose between end-to-end encryption (E2EE) for messages and features that require server-side indexing/search over message content. Discuss the technical trade-offs, user experience trade-offs, and product-level decision framework you would use to decide which features to ship and how to mitigate loss of functionality.
Sample Answer
Direct answer. End-to-end encryption (E2EE) means only the participants' devices can read the messages (the readable text is plaintext; the scrambled form the server would store is ciphertext), so anything the server must do with the plaintext (index, search, scan, preview) stops working on the server. I would make E2EE the default for private conversations, rebuild the highest-value features on the device, and make anything that needs server access an explicit, labelled opt-in per conversation or tenant, never a silent default.
Technical trade-offs
- Server-side search: the server cannot index ciphertext. Alternatives are a local encrypted index on each device, searchable-encryption schemes (these let the server match a search token against encrypted data without decrypting it, but the server still sees which stored items match each query and how often, which are search patterns; they are rarely used for full-text message search in production), or searching metadata only (sender, time) if the server holds it.
- Multi-device and history: a new device has no history unless keys and messages are transferred from another device or an encrypted backup the user controls.
- Abuse and spam detection: server-side scanning is lost. Move to client-side reporting, rate limits on metadata and user reports.
- Link previews, translation, smart replies: either the device does them or they become opt-in with disclosure.
- Compliance exports and retention: enterprise customers may need eDiscovery (producing a company's messages on request for a lawsuit or investigation), which conflicts with E2EE, so offer a separate non-E2EE tenant mode (a tenant is one customer organisation's workspace), clearly labelled.
User experience trade-offs
- On-device search covers only what is stored locally, so older messages need a restore or sync step. Say so in the product. On a new phone, a search might first return only the 3 months transferred, with a banner such as "Searching 3 months on this device. Restore older messages" and a restore button.
- Setup friction: key backup and recovery prompts. A forgotten recovery key can mean permanently lost history.
- Slower first search on a new device, plus storage and battery cost for the local index.
Decision framework
- State the promise: "no one but you and your recipients can read this". If a feature breaks it, the feature is not shipped in that mode.
- Segment conversations: private 1:1 and small groups (E2EE always), large public channels or company workspaces (E2EE optional).
- List each feature with: needs plaintext on the server? on-device substitute? cost? Ship by value over cost. For example:
| Feature | Server plaintext needed? | On-device substitute | Cost | Call |
|---|---|---|---|---|
| Message search | Yes (server index) | Local encrypted index | Storage, slow first search on a new device | Ship, recent history first |
| Link preview | Yes if the server fetches the page | Sender's device fetches and attaches the preview | Sender's bandwidth | Ship on device |
| Spam detection | Yes (content scanning) | User reports, rate limits on metadata | Slower detection | Ship |
| Smart replies | Yes (cloud model) | Small on-device model | Lower quality, battery | Opt-in only |
- Anything needing server plaintext requires an explicit per-conversation switch, a visible indicator in the chat, and cannot be turned on retroactively for old messages.
- Review: security signs off the threat model (who might attack or misuse the system and what each can reach), product the user impact, legal the obligations (lawful requests, child safety and similar duties vary by jurisdiction, and counsel decides).
Mitigating loss of functionality. Ship on-device search first for recent history (for instance the last 12 months, illustrative), then a restore flow. Provide filters that use data devices already have: sender, date, attachment type. Be honest in the UI about what E2EE conversations cannot do.
What would flip the call. If the target customers are regulated enterprises that must archive messages, make the managed, non-E2EE mode the default for their tenants and keep E2EE for consumer use.
Unlock Full Question Bank
Get access to all 8 Privacy by Design and Default interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.