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.
How to think about this
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.
| Level | Time needed |
|---|---|
| Advanced | 4-6 hours |
What you need (tools and setup)
| Tool | What it is | Why you need it | Cost |
|---|---|---|---|
| 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 |
| Git | Version 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
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
- List every table in the schema that stores data about a person, directly or indirectly (through a foreign key).
- Write one query per table (or a consistent set of joins), each scoped by the same bound subject id parameter.
- Assemble the results into a single structured export document (e.g. JSON), reviewed for completeness against the table list.
- Have a second person review the export logic against the schema to catch any table the author might have missed.
- 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
| Check | Why it matters | How to verify |
|---|---|---|
| Complete table coverage | A right-to-access request is incomplete if it misses a table | Confirm the schema was reviewed table by table for personal data |
| Consistent scoping everywhere | A single unscoped join could include another person's data | Confirm every query/join is filtered by the same bound subject id |
| Independent review | Easy to miss a table when the original author built the list alone | Confirm a second reviewer checked the table coverage |
Quick check
1. The biggest risk in a personal data export feature is usually...
Completeness and correct scoping are the core risks.