feat(vendor): add vendor report endpoint with review note - #39
feat(vendor): add vendor report endpoint with review note#39ogulcan-gurcaglar wants to merge 1 commit into
Conversation
|
❌ 1 possible security or compliance issue detected. Reviewed everything up to 2b12e34. The following issues were found:
Evidence:
Security Overview
Detected Code Changes
|
| module.exports = function vendorReport () { | ||
| return (req: Request, res: Response, next: NextFunction) => { | ||
| const vendor = req.query.vendor ?? '' | ||
| models.sequelize.query(`SELECT * FROM Products WHERE name = '${vendor}'`) |
There was a problem hiding this comment.
SQL Injection in vendorReport GET /rest/vendor/report (Severity: HIGH)
The endpoint is vulnerable to SQL injection because the vendor query parameter is interpolated into the SQL string without binding, which causes attacker-controlled input to alter the query logic and potentially extract or manipulate product data. This occurs in routes/vendorReport.ts line 24 where the value is read and concatenated into the query, leading to unauthorized access and escalation risks.
View details in ZeroPath
| models.sequelize.query(`SELECT * FROM Products WHERE name = '${vendor}'`) | |
| models.sequelize.query('SELECT * FROM Products WHERE name = :vendor', { replacements: { vendor } }) |
💬 Reply @ZeroPath false-positive because … or @ZeroPath accepted-risk because … to triage this finding, or ask it any question.
|
❌ 1 possible security or compliance issue detected. Reviewed everything up to 2b12e34. The following issues were found:
Evidence: server.ts line 575 mounts vendorReport() on a public GET route with no authentication middleware; routes/vendorReport.ts line 23 reads req.query.vendor and line 24 interpolates it into models.sequelize.query(...).
Security Overview
Detected Code Changes
|
| module.exports = function vendorReport () { | ||
| return (req: Request, res: Response, next: NextFunction) => { | ||
| const vendor = req.query.vendor ?? '' | ||
| models.sequelize.query(`SELECT * FROM Products WHERE name = '${vendor}'`) |
There was a problem hiding this comment.
SQL Injection in GET /rest/vendor/report (routes/vendorReport.ts) (Severity: CRITICAL)
An attacker can inject SQL via the vendor query parameter which is interpolated into the query string, leading to potential data exposure or modification. This occurs because vendor is read from req.query.vendor and concatenated into the SQL statement in models.sequelize.query without parameterization or escaping, and the route is publicly reachable with no authentication.
View details in ZeroPath
| models.sequelize.query(`SELECT * FROM Products WHERE name = '${vendor}'`) | |
| models.sequelize.query('SELECT * FROM Products WHERE name = :vendor', { replacements: { vendor } }) |
💬 Reply @ZeroPath false-positive because … or @ZeroPath accepted-risk because … to triage this finding, or ask it any question.
Adds the vendor report endpoint. Includes the security review note from the audit.