Skip to content

fix(backend): requireLoanOwner IDOR — compare loan owner to caller - #1455

Merged
ogazboiz merged 2 commits into
LabsCrypt:mainfrom
TCROWN10:fix/1365-requireLoanOwner-idor-regression
Jul 30, 2026
Merged

fix(backend): requireLoanOwner IDOR — compare loan owner to caller#1455
ogazboiz merged 2 commits into
LabsCrypt:mainfrom
TCROWN10:fix/1365-requireLoanOwner-idor-regression

Conversation

@TCROWN10

Copy link
Copy Markdown
Contributor

Summary

  • Fixes / locks down requireLoanOwner in backend/src/middleware/loanAccess.ts so ownership checks compare the loan's stored owner (row.address) to the caller's JWT public key — not the caller key to itself (pk !== pk).
  • Adds regression unit tests covering owner allowed, non-owner 403, missing loan 404, and unauthenticated 401.

Closes #1365

Test plan

  • npm test -- --testPathPatterns=loanAccess.test (5 passing)
  • CI green

TCROWN10 and others added 2 commits July 30, 2026 11:13
…ests

Clarify that requireLoanOwner compares the loan's stored owner address to
the caller public key (not the caller to itself) and add unit coverage for
the previous IDOR path.

Closes LabsCrypt#1365

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@TCROWN10
TCROWN10 force-pushed the fix/1365-requireLoanOwner-idor-regression branch from 513e24a to 75147fd Compare July 30, 2026 10:13
@ogazboiz
ogazboiz merged commit 4abe020 into LabsCrypt:main Jul 30, 2026
11 of 13 checks passed
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.

[Backend] IDOR: loan-owner check compares a value to itself

2 participants