Skip to content

Fix authorization bypass in user document download route - #1893

Merged
sublime247 merged 1 commit into
sublime247:mainfrom
OluwapelumiElisha:1778-Bug-Fix-authorization-bypass-in-user-document-download-route
Aug 28, 2026
Merged

Fix authorization bypass in user document download route#1893
sublime247 merged 1 commit into
sublime247:mainfrom
OluwapelumiElisha:1778-Bug-Fix-authorization-bypass-in-user-document-download-route

Conversation

@OluwapelumiElisha

Copy link
Copy Markdown
Contributor

Description

Patches an Insecure Direct Object Reference (IDOR) authorization bypass vulnerability in the user document (invoice/receipt) download routes.

Previously, the /:id/receipt and /:id/invoice endpoints in transactions.ts only checked if a request contained a valid authentication token. They did not verify if the requested transaction ID actually belonged to the authenticated user, potentially allowing arbitrary users to download other users' sensitive transaction documents.

This PR adds an explicit authorization boundary verifying that transaction.userId matches the authenticated req.jwtUser.userId (or that the user holds an admin role in the V1 route).

Changes Made

  • Added user ownership validation to the /receipt and /invoice endpoints in src/routes/transactions.ts.
  • Added user ownership validation to the /invoice endpoint in src/routes/v1/transactions.ts.
  • Endpoints now return a secure 403 Forbidden response for unauthorized access attempts.

Related Issues

Fixes #1778

@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@OluwapelumiElisha Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@sublime247
sublime247 merged commit 0f22fd5 into sublime247:main Aug 28, 2026
2 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.

[Bug] Fix authorization bypass in user document download route

2 participants