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>
1.5 KiB
1.5 KiB
issue, title, severity, domain, labels, status, created, source
| issue | title | severity | domain | labels | status | created | source | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 062 | Backend: payment update routes lack ownership/role guards (cluster) | high | Payment |
|
open | 2026-05-30 | Full Codebase Audit 2026-05-30 |
Backend: payment update routes lack ownership/role guards (cluster)
Severity: high Domain: Payment Labels: security, backend, authorization, idor
Description
PUT /:id updatePayment, PATCH /marketplace/payments/:id, and status-change routes in paymentControllerRoutes.ts require only authenticateToken — no role check, no ownership check, no status-transition whitelist. Any authenticated user can change any payment's status to any value.
Options
- Add an admin-role middleware to all payment status-mutating routes and a status whitelist.
- Add ownership checks (
req.user.id === buyerId/sellerId) plus a strict allowed-status-transition validator shared across routes. - Both: admin-only for arbitrary status writes; constrained self-service transitions for owners.
Recommendation
Introduce a shared requireAdmin middleware for arbitrary status writes and a centralized transition validator; owners may only trigger whitelisted transitions. This is a business-logic and authZ change across multiple routes.
Affected Files
backend/src/services/payment/paymentControllerRoutes.ts:17
References
- Full Codebase Audit 2026-05-30 — DEC-22