Skip to content

feat: GDPR data export and account deletion workflow#143

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/add-gdpr-data-export-delete-workflow
Draft

feat: GDPR data export and account deletion workflow#143
Copilot wants to merge 4 commits intomainfrom
copilot/add-gdpr-data-export-delete-workflow

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 23, 2026

No standard "download my data" or "delete account" workflow existed across packages. This adds GDPR Article 17 (erasure) and Article 20 (portability) support.

Backend — worker/routes/user-data.ts

  • GET /api/users/me/export — Collects user data across all registered models (profile, accounts, sessions, roles, memberships, audit logs, todos, plus conditionally comments/referrals if enabled), strips sensitive fields (passwordHash, OAuth tokens), returns as downloadable JSON.
  • POST /api/users/me/delete — Cascading delete of all user-owned rows after email confirmation. Audit logs are anonymized rather than deleted to preserve the compliance trail.

Both endpoints are rate-limited and session-authenticated. Deletion requires the user to echo their email address back.

Frontend — UserProfilePage.tsx

New "Data & Privacy" card added to existing profile settings page:

  • Export button triggers blob download
  • Delete button opens confirmation dialog requiring email input; hard-redirects to / after deletion to clear all client state

Route wiring — router.ts

Two new route entries in the existing method dispatchers.

Tests — 11 unit tests

Covers auth gates, email mismatch rejection, sensitive field stripping, audit log anonymization, and the happy path for both export and delete.

// Export: strips passwordHash, OAuth tokens from output
const body = JSON.parse(await response.text());
expect(body.profile.passwordHash).toBeUndefined();
expect(body.accounts[0].access_token).toBeUndefined();

// Delete: anonymizes audit logs instead of deleting
expect(auditLog.set).toHaveBeenCalledWith('userEmail', ANONYMIZED_USER_EMAIL);
expect(auditLog.save).toHaveBeenCalled();

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Copilot AI and others added 3 commits March 23, 2026 18:52
- Add GET /api/users/me/export for user data export (JSON download)
- Add POST /api/users/me/delete for account deletion with email confirmation
- Add Data & Privacy section to UserProfilePage with export/delete UI
- Audit log both export and delete actions for compliance
- Rate limit export and delete endpoints
- Anonymize audit logs on deletion (preserve compliance trail)
- Delete all related rows: sessions, accounts, roles, memberships, todos, comments, referrals

Co-authored-by: thinkdj <688055+thinkdj@users.noreply.github.com>
Agent-Logs-Url: https://github.com/thinkdj/ottabase/sessions/fe0d523c-ad1c-4f50-baf5-979a39006005
…tity, remove session note

Co-authored-by: thinkdj <688055+thinkdj@users.noreply.github.com>
Agent-Logs-Url: https://github.com/thinkdj/ottabase/sessions/fe0d523c-ad1c-4f50-baf5-979a39006005
Copilot AI changed the title [WIP] Add GDPR-style export and delete my data workflow feat: GDPR data export and account deletion workflow Mar 23, 2026
Copilot AI requested a review from thinkdj March 23, 2026 19:02
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.

2 participants