feat(vendor): add vendor report endpoint - #38
ogulcan-gurcaglar wants to merge 1 commit into
Conversation
|
❌ 1 possible security or compliance issue detected. Reviewed everything up to 7d7cf67. 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 endpoint (routes/vendorReport.ts:12) (Severity: HIGH)
SQL injection risk: unauthenticated requests to /rest/vendor/report allow manipulation of the query via the vendor parameter, which is interpolated directly into the SQL statement. This leads to potential data exposure or modification as the WHERE clause can be altered, resulting in arbitrary row retrieval or additional statements depending on configuration, with the vulnerability exposed in vendorReport() handling of req.query.vendor.
View details in ZeroPath
| models.sequelize.query(`SELECT * FROM Products WHERE name = '${vendor}'`) | |
| models.sequelize.query('SELECT * FROM Products WHERE name = :vendor', { replacements: { vendor: String(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 7d7cf67. The following issues were found:
Evidence: server.ts line 575 mounts vendorReport() on a public GET route with no visible authentication middleware; routes/vendorReport.ts line 11 reads req.query.vendor and line 12 concatenates it into SELECT * FROM Products WHERE name = '...'.
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: HIGH)
An anonymous attacker can inject SQL via the vendor query parameter which gets directly concatenated into a SQL statement, leading to potential exposure of Products data. The code reads req.query.vendor in routes/vendorReport.ts and interpolates it into the query in vendorReport(), resulting in arbitrary SQL execution without input validation or parameterization.
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.