feat(privacy): GDPR-ready PII export & delete workflow [Issue #76]#353
Open
yay9096-hub wants to merge 1 commit intorohitdash08:mainfrom
Open
feat(privacy): GDPR-ready PII export & delete workflow [Issue #76]#353yay9096-hub wants to merge 1 commit intorohitdash08:mainfrom
yay9096-hub wants to merge 1 commit intorohitdash08:mainfrom
Conversation
…itdash08#76) Implements the PII Export & Delete Workflow requested in issue rohitdash08#76. ## Changes ### New: packages/backend/app/routes/privacy.py - GET /privacy/export — generates a downloadable ZIP archive containing all personal data for the authenticated user (profile, expenses, categories, bills, reminders, recurring expenses, subscriptions) as a JSON payload plus a human-readable README.txt. - POST /privacy/delete — permanently and irreversibly deletes the user account after verifying the current password. ON DELETE CASCADE in the DB removes all related rows. The audit entry is flushed before deletion so the record survives the user row being removed. - GET /privacy/audit-log — returns the caller's own audit-trail entries with pagination (limit/offset). ### Updated: app/models.py - Added optional `details` column to AuditLog for richer event metadata. ### Updated: app/db/schema.sql - Added `details VARCHAR(500)` column to audit_logs with a safe ADD COLUMN IF NOT EXISTS migration guard. ### Updated: app/__init__.py - Schema compatibility patch now also runs the audit_logs.details ALTER. ### New: packages/backend/tests/test_privacy.py - 16 tests covering export, delete, and audit-log endpoints including auth enforcement, ZIP structure, password confirmation, cascade deletion, and audit-trail persistence. Closes rohitdash08#76 Part of Algora bounty — https://console.algora.io/challenges
yay9096-hub
commented
Mar 10, 2026
Author
yay9096-hub
left a comment
There was a problem hiding this comment.
ready for review for this pr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the PII Export & Delete Workflow requested in issue #76, making FinMind GDPR-ready by giving users full control over their personal data.
What was implemented
New endpoints (
/privacy/*)GET/privacy/exportPOST/privacy/deleteGET/privacy/audit-logGET /privacy/exportfinmind_export_<uid>.zipcontaining:data.json— machine-readable JSON of every recordREADME.txt— human-readable summary and erasure instructionsPII_EXPORTentry in the audit trailPOST /privacy/deleteON DELETE CASCADEACCOUNT_DELETEDis flushed before the user row is deleted so it survivesGET /privacy/audit-log?limit=and?offset=for paginationSchema changes
details VARCHAR(500)column toaudit_logsfor richer event metadataADD COLUMN IF NOT EXISTS) ensures zero-downtime upgrades_ensure_schema_compatibility()for existing PostgreSQL deploymentsTests
16 new tests in
packages/backend/tests/test_privacy.py:Acceptance criteria
Closes #76