IDOR in a new endpoint
A developer adds an endpoint to download invoices. Authentication is checked; ownership is not.
app.get("/invoices/:id/pdf", requireLogin, async (req, res) => {
const invoice = await Invoice.findById(req.params.id);
res.send(await renderPdf(invoice));
});Insecure direct object reference: any logged-in user can download any invoice by id. Scope the query to req.user.accountId and return 404 when it doesn't match.
Result: The most common real-world vulnerability class is caught in the pull request, not in a bug bounty report.