Files
nick-doc/Issues/ISSUE-068-backend-datacleanuservice-deletes-payments-without-provider-sco.md
Siavash Sameni dceaf82934 audit: 2026-05-30 full-codebase audit — report, issues, docs, runbooks
Full-codebase-audit 2026-05-30 outputs:
- Audit report: 09 - Audits/Full Codebase Audit - 2026-05-30.md
- 81 issue files ISSUE-055..135 (decisions + 1 skipped no-brainer).
- Scanner docs from scratch (was zero): architecture, data model, API ref, payment
  flow, operations runbook + repo README.
- Doc-sync updates across API reference, data models, flows, design system.
- Secret Rotation Runbook (08 - Operations) for the exposed credentials.
- Reusable workflow guide (07 - Development) + .claude/workflows/full-codebase-audit.js.

Issues remain status:open intentionally — the code fixes are uncommitted-then-committed
working-tree changes per repo and aren't "resolved" until merged/deployed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-30 18:48:04 +04:00

1.5 KiB

issue, title, severity, domain, labels, status, created, source
issue title severity domain labels status created source
068 Backend: dataCleanupService deletes Payments without provider scoping — risk of destroying escrow records high Admin
security
backend
data-loss
escrow
open 2026-05-30 Full Codebase Audit 2026-05-30

Backend: dataCleanupService deletes Payments without provider scoping — risk of destroying escrow records

Severity: high Domain: Admin Labels: security, backend, data-loss, escrow

Description

dataCleanupService.ts:121 deletes Payment documents without filtering by provider. Request Network and SHKeeper escrow payments are webhook-driven and can take hours to confirm. Sweeping them deletes the ledger records that webhooks need to reconcile, silently destroying multi-seller cart records.

This matches the project memory note: "Any Payment-collection cleanup/orphan query MUST scope by provider:."

Options

  1. Scope all payment deletes by provider (exclude request.network/shkeeper escrow records).
  2. Soft-delete instead of hard delete for payments.
  3. Disallow payment-collection cleanup entirely from this tool.

Recommendation

Require provider scoping on every payment delete and prefer soft-delete; never sweep escrow-driven records. This is a data-loss risk.

Affected Files

  • backend/src/services/admin/dataCleanupService.ts:121

References