Skip to content

feat(server): data-subject delete + export endpoints (ADR-0004)#64

Merged
Isonimus merged 1 commit into
mainfrom
feat/data-subject-endpoints
Jun 18, 2026
Merged

feat(server): data-subject delete + export endpoints (ADR-0004)#64
Isonimus merged 1 commit into
mainfrom
feat/data-subject-endpoints

Conversation

@Isonimus

Copy link
Copy Markdown
Contributor

Third PR of the Consent & Data-Lifecycle workstream (ADR-0004).

What

  • DELETE /v1/identity/:id (GDPR Art. 17 — erasure): deletes the identity; snapshots, drifts, risk assessments, cluster merges, and account links all cascade (ON DELETE CASCADE on identity_id, verified across migrations 001–004). Project-scoped. 204 on success, 404 on unknown id.
  • GET /v1/identity/:id/export (GDPR Art. 20 — portability): one JSON bundle — identity + snapshots (incl. consent provenance, host()-stripped IP) + drifts + risk assessments + linked accounts.

Security

requireProjectRead returns 401 for any non-GET without an API key, so erasure is strictly key-gated — an admin session can never reach the delete path. Export is a read, so it's reachable by key or admin session like the other read routes.

Tests

  • Integration: export returns the bundle → delete 204 → subsequent GET 404 → snapshots cascaded to 0; DELETE without a key 401; unknown id 404. Full events integration suite: 19 passing locally.

- DELETE /v1/identity/:id (GDPR Art. 17): erases the identity; snapshots, drifts,
  risk assessments, cluster merges, and account links cascade (ON DELETE CASCADE).
  Strictly key-gated — requireProjectRead 401s a non-GET without a key, so an admin
  session can never erase. 404 on unknown id, 204 on success.
- GET /v1/identity/:id/export (GDPR Art. 20): the full bundle — identity + snapshots
  (with consent provenance + host()-stripped IP) + drifts + risk assessments +
  linked accounts. Readable by key or admin session like the other reads.
- Integration tests: export shape, delete cascade (snapshots gone, GET 404),
  key-gating (401 without key), 404 on unknown id.
@Isonimus Isonimus merged commit 3fde08b into main Jun 18, 2026
4 checks passed
@Isonimus Isonimus deleted the feat/data-subject-endpoints branch June 18, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant