This is a bug bounty for a missing authentication vulnerability on a payment creation endpoint in a Node.js API. The task is to add an authentication middleware to the `/api/payments` POST route, ensuring only authenticated users can create payment intents. The issue has a specified bounty amount.
A starter prompt for Claude Code, what you'll need, and how to reach them.
You are an expert Node.js security developer. Your task is to fix a critical bug bounty issue for SecureBananaLabs/bug-bounty, specifically issue #1772, titled 'Payment endpoint lacks authentication — unauthenticated payment creation'. The goal is to add an authentication middleware to the `/api/payments` POST route to prevent unauthenticated payment creation. The project uses a standard Node.js/Express stack. Assume `authMiddleware` exists within the codebase. Fork the repository at `https://github.com/SecureBananaLabs/bug-bounty`. Navigate to `apps/api/src/routes/paymentRoutes.js`. Modify the line `paymentRoutes.post("/", createPayment);` to include `authMiddleware`. Create a basic test in a new file `apps/api/tests/paymentAuth.test.js` using `mocha` and `chai` (or `jest` if already configured in the repo) that attempts to make a POST request to `/api/payments` without authentication and asserts that it receives an unauthorized error (e.g., 401 or 403 status code). Ensure the existing test suite passes after your changes. Your deliverable is a pull request to the original repository with the fix and the new test.Bounty (amount on the issue). ## Bug: Missing Authentication on Payment Route **Description:** The `/api/payments` route does not require authentication. Anyone can create payment intents without being logged in. **File:** `apps/api/src/routes/paymentRoutes.js` **Current code:** ```js paymentRoutes.post("/", createPayment); ``` **Expected behavior:** The payment route should require `authMiddleware` to ensure only authenticated users can initiate payments. **Impact:** High — financial endpoint exposed without authentication. This issue is limited only to the creator of this issue. This means that only the issue author can attempt to solve this issue. If you would like to work on it, please create another issue with the same contents and refer to issue #743 for more information.
Standard for any dev work.
Standard for JS development.
Common web framework.
Standard for version control.
Submit a pull request directly to the SecureBananaLabs/bug-bounty repository, referencing issue #1772 in the PR description.
“I've implemented the requested authentication middleware on your `/api/payments` route to resolve issue #1772, including a new test case to verify its functionality. Please review the pull request.”
Open the original ↗