feat(ops): add warehouse audit endpoint - #28
ogulcan-gurcaglar wants to merge 1 commit into
Conversation
|
❌ 1 possible security or compliance issue detected. Reviewed everything up to 03559bb. The following issues were found:
Evidence:
Security Overview
Detected Code Changes
|
| module.exports = function warehouseAudit () { | ||
| return (req: Request, res: Response, next: NextFunction) => { | ||
| const zone = req.query.zone ?? '' | ||
| models.sequelize.query(`SELECT * FROM Products WHERE description LIKE '%${zone}%'`) |
There was a problem hiding this comment.
SQL Injection in /rest/warehouse/audit (warehouseAudit.ts) (Severity: CRITICAL)
The route allows unauthenticated access which can lead to data exposure. It interpolates req.query.zone directly into a SQL statement, causing injection that could read arbitrary tables; this is performed without parameter binding, resulting in the returned rows in the JSON response.
View details in ZeroPath
| models.sequelize.query(`SELECT * FROM Products WHERE description LIKE '%${zone}%'`) | |
| models.sequelize.query('SELECT * FROM Products WHERE description LIKE ?', { replacements: [`%${zone}%`] }) |
💬 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 03559bb. The following issues were found:
Evidence:
Security Overview
Detected Code Changes
|
| module.exports = function warehouseAudit () { | ||
| return (req: Request, res: Response, next: NextFunction) => { | ||
| const zone = req.query.zone ?? '' | ||
| models.sequelize.query(`SELECT * FROM Products WHERE description LIKE '%${zone}%'`) |
There was a problem hiding this comment.
SQL Injection in warehouseAudit endpoint (routes/warehouseAudit.ts) (Severity: HIGH)
SQL injection risk exposes or alters data because the zone query parameter is interpolated directly into a LIKE clause in a raw SQL query, which can be exploited by supplying special characters. This occurs in routes/warehouseAudit.ts line 13 where zone is read from req.query.zone and embedded in sequelize.query without parameter binding, leading to potentially unintended queries executed by GET /rest/warehouse/audit.
View details in ZeroPath
| models.sequelize.query(`SELECT * FROM Products WHERE description LIKE '%${zone}%'`) | |
| models.sequelize.query('SELECT * FROM Products WHERE description LIKE :zone', { replacements: { zone: `%${zone}%` } }) |
💬 Reply @ZeroPath false-positive because … or @ZeroPath accepted-risk because … to triage this finding, or ask it any question.
Adds the warehouse audit endpoint and registers it.