Home / Learn Secure SQL / Project: Secure Personal Data Export (GDPR-Style Access Request)

Project: Secure Personal Data Export (GDPR-Style Access Request)

Build a complete, correctly-scoped personal data export.

Quick summaryBuild a complete, correctly-scoped personal data export.

How to think about this

Personal data exportschema reviewed forevery personal-data…one scoped query/joinper tableassembled into oneexportindependentlyreviewed for…
Personal data export

The basic idea

Privacy regulations in many places give individuals a right to receive a copy of their personal data; this project builds a query set that gathers everything about one specific person from across several tables, scoped correctly so no other person's data is ever included.

Why this comes up

Real projects are where secure patterns become habits instead of theory.

The mechanics

Work through the steps in order; do not skip the checklist.

Where it is used

  • Portfolio project
  • Code review practice
  • Interview preparation

What you will build

Privacy regulations in many places give individuals a right to receive a copy of their personal data; this project builds a query set that gathers everything about one specific person from across several tables, scoped correctly so no other person's data is ever included.

LevelTime needed
Advanced4-6 hours

What you need (tools and setup)

ToolWhat it isWhy you need itCost
Code editor (VS Code or similar)The program you write code in.You need somewhere to write and run the example app.free
A language runtime (Node.js, Python, PHP or similar)Installs the interpreter so your code can run on your computer.The project examples run as small scripts.free
SQLite (bundled, no install needed)A tiny file-based database engine.Every project in this course can be tried with SQLite first, with zero setup.free
GitVersion control: tracks every change you make.Lets you compare the insecure version and the fixed version of the code.free

Step 1: see the problem and the fix in the sandbox

Cross-table personal data export, consistently scoped by subject_idSQL: edit and run

Every table that stores personal data is joined and filtered by the same bound person_id/subject id, so the export cannot accidentally widen to include other people's related rows.

Step by step

  1. List every table in the schema that stores data about a person, directly or indirectly (through a foreign key).
  2. Write one query per table (or a consistent set of joins), each scoped by the same bound subject id parameter.
  3. Assemble the results into a single structured export document (e.g. JSON), reviewed for completeness against the table list.
  4. Have a second person review the export logic against the schema to catch any table the author might have missed.
  5. Write a test requesting an export for one person and confirming no fields from any other person appear anywhere in the result.

Security checklist before you ship it

CheckWhy it mattersHow to verify
Complete table coverageA right-to-access request is incomplete if it misses a tableConfirm the schema was reviewed table by table for personal data
Consistent scoping everywhereA single unscoped join could include another person's dataConfirm every query/join is filtered by the same bound subject id
Independent reviewEasy to miss a table when the original author built the list aloneConfirm a second reviewer checked the table coverage
Tip:Commit the insecure version and the fixed version as two separate commits, so the diff itself becomes a teaching example.

Quick check

1. The biggest risk in a personal data export feature is usually...