Skip to content

Fix/83 data deletion completeness#104

Open
Zeemnew wants to merge 2 commits into
ericmt-98:mainfrom
Zeemnew:fix/83-data-deletion-completeness
Open

Fix/83 data deletion completeness#104
Zeemnew wants to merge 2 commits into
ericmt-98:mainfrom
Zeemnew:fix/83-data-deletion-completeness

Conversation

@Zeemnew
Copy link
Copy Markdown

@Zeemnew Zeemnew commented May 29, 2026

Description

This PR addresses and fully completes Issue #83: Data deletion completeness and PII minimization.

It implements a robust, compliant account deletion flow that cascades across all relational and planned database tables, balancing strict user data privacy (GDPR/ARCO/mobile store submission compliance) with financial audit-trail and blockchain protocol integrity.

Closes #83

Key Changes

1. Cascading Data Deletion & Anonymization Policy

Refactored deleteAccount in account.service.ts to perform complete data scrub and minimization:

  • Profile Anonymization (users table): Sets primary identifiers (username, stellar_address, phone_hash) to NULL and populates backup columns (deleted_*) with scrambled, non-identifiable representation hashes (deleted_1234abcd, GABC...WXYZ) rather than cleartext PII.
  • Wallet Removal (wallets table): Fully deletes the linked user wallet.
  • Push Notifications (user_devices table): Removes registered FCM tokens completely to cease all messages.
  • Chat Logs (chat_messages table): Deletes all trade-associated chat messages sent by the user.
  • Disputes (dispute_events table): Removes user-uploaded evidence URLs and anonymizes dispute reason descriptions.
  • Access & Funding Logs (secret_access_log & account_funding_log table): Zeroes out client IP addresses (0.0.0.0), clears User Agent signatures, and masks funding addresses.
  • Financial Audit Trail (trades table): Intact and untouched for accounting integrity, referencing only the already-anonymized user row.

2. Local Fallback Database Improvements (db/schema.ts)

Updated the in-memory fallback engine to fully support local development, testing, and CI pipelines without needing a live Postgres instance:

  • Implemented SQL DELETE query support inside memQuery.
  • Fixed parentheses-stripping regex bug in complex conditional WHERE-clause scanning.
  • Added true boolean literal parsing support (TRUE/FALSE) to match standard SQL cast behavior.

3. Frontend Privacy Copy

  • Synchronized section 5 ("Tus derechos y eliminación de datos") of the frontend page (Privacy.tsx) to precisely articulate the new deletion and data-minimization lifecycle to end-users.

4. Test Suite & Integration

  • Created accountDeletion.test.ts to perform complete data lifecycle testing (inserts mock users, wallets, FCM tokens, chat history, disputes, access logs, and completed trades, and asserts PII is completely wiped out/minimized post-deletion).
  • Configured npm test script in backend package.json for easy local/CI test orchestration.

Verification

Run tests locally to verify passing test assertions:

cd micopay/backend
npm test

zeemscript and others added 2 commits May 28, 2026 16:31
Block success screen when no real activeTrade exists, fetch trade
detail from GET /trades/:id for receipt data, source agent name from
seller_username instead of hardcoded values, label mock hashes as
"Testnet · Simulado", and prevent success navigation on completeTrade
failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@Zeemnew Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Data deletion completeness and PII minimization

2 participants