Skip to content

fix(customerpayment): return 404 on cross-tenant access — close tenant enumeration leak#226

Merged
CryptoJones merged 1 commit into
masterfrom
fix/customerpayment-secure-404-on-cross-tenant-access
May 19, 2026
Merged

fix(customerpayment): return 404 on cross-tenant access — close tenant enumeration leak#226
CryptoJones merged 1 commit into
masterfrom
fix/customerpayment-secure-404-on-cross-tenant-access

Conversation

@CryptoJones
Copy link
Copy Markdown
Owner

Closes #225.

Same secure-404 pattern as the 10 prior fixes, now on customer-cascade-scoped CustomerPayment.

Test plan

  • npm run lint clean
  • npm test — 672 → 675 (+3)

Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/

…lose tenant-enumeration leak

Same class as the ten prior secure-404 fixes, applied to the
customer-cascade-scoped CustomerPayment:

  cpayCustId → Customer.custCompId

Collapse 403 "exists but not yours" into 404 "Not found." so
scoped callers can't enumerate `cpayId` populations across the
whole tenant table by status code.

Pinned in `tests/api/customerpayment.test.js` with three
controller-level unit tests spying on `auth.getCompanyIdByCustomerId`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@CryptoJones CryptoJones merged commit 1864803 into master May 19, 2026
3 checks passed
@CryptoJones CryptoJones deleted the fix/customerpayment-secure-404-on-cross-tenant-access branch May 19, 2026 11:12
CryptoJones added a commit that referenced this pull request May 19, 2026
…enant-enumeration leak (#238)

Same class as the 13 prior secure-404 fixes, applied to TimeEntry's
getById / update / remove handlers. TimeEntry is direct-company-
scoped via `teCompId`.

Collapse 403 "exists but not yours" into 404 "Not found." so
scoped callers can't enumerate `teId` populations across the
whole tenant table by status code.

Pinned in `tests/api/timeentry.test.js` with three controller-level
unit tests spying on `auth.isMaster` / `auth.getCompanyId`.

This completes the secure-404 series for the 14 single-resource
domain entities (#174 / #188 / #192 / #196 / #200 / #204 / #210 /
#214 / #218 / #222 / #226 / #230 / #234). Two domain controllers
remain outside the series: VersionInfo (master-gated; different
auth shape) and Customer (large refactor; the `findAndRespond`
helper short-circuits to 200+null on a non-existent id which is
a separate bug worth its own PR).

Co-authored-by: Aaron K. Clark <akclark@thenetwerk.net>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

customerpayment: cross-tenant GET/PATCH/DELETE returns 403 — same class as #221 (secure-404)

1 participant