Skip to content

clear-data.ts misses leads / email_whitelist — PII survives a full wipe #62

Description

@tkowalczyk

Summary

clear-data.ts truncates the M1/M2 domain + auth tables but omits the M3 tables leads (emails + consent timestamps) and email_whitelist. A "clear all data" / GDPR-erasure run silently leaves every lead in place, and the per-table try/catch masks the omission. (Docs also claim it "preserves auth_user" while it deletes all auth tables.)

Evidence

  • packages/data-ops/scripts/clear-data.ts:30-43 (table list) and :59-67 (sequences) — no leads, no email_whitelist.
  • packages/data-ops/src/drizzle/schema.ts:142-167 — both tables exist; present in all three envs' migrations.

Proposed failing test (TDD)

packages/data-ops/tests/clear-data-coverage.test.ts"clear-data table list covers every pgTable in schema": collect table names from the schema module via getTableName; assert each domain table appears in the script's tables array. Fails on leads, email_whitelist.

Fix direction

Add both tables (and their sequences) to the list; fix the CLAUDE.md note. Consider deriving the list from the schema.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    audit/2026-06Filed from June 2026 deep auditbugSomething isn't workingseverity/mediumMedium severity security or reliability risk

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions