feat(routes): add catalog description lookup (rerun) - #24
ogulcan-gurcaglar wants to merge 2 commits into
Conversation
|
❌ 1 possible security or compliance issue detected. Reviewed everything up to 1160422. The following issues were found:
Evidence:
Security Overview
Detected Code Changes
|
| module.exports = function productLookup () { | ||
| return (req: Request, res: Response, next: NextFunction) => { | ||
| const term = req.query.term ?? '' | ||
| models.sequelize.query(`SELECT name, description FROM Products WHERE description LIKE '%${term}%' AND deletedAt IS NULL ORDER BY name ASC`) |
There was a problem hiding this comment.
SQL Injection in /rest/products/lookup (routes/productLookup.ts) (Severity: HIGH)
Security impact: an attacker can inject SQL via the term query parameter, potentially reading or modifying data. The code interpolates req.query.term directly into a raw SQL string in line 13, which is executed by Sequelize without parameter binding, leading to data exposure or corruption and occurs on the public route mounted at line 572.
View details in ZeroPath
| models.sequelize.query(`SELECT name, description FROM Products WHERE description LIKE '%${term}%' AND deletedAt IS NULL ORDER BY name ASC`) | |
| models.sequelize.query('SELECT name, description FROM Products WHERE description LIKE :term AND deletedAt IS NULL ORDER BY name ASC', { replacements: { term: `%${term}%` } }) |
💬 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 1160422. The following issues were found:
Evidence:
Security Overview
Detected Code Changes
|
| module.exports = function productLookup () { | ||
| return (req: Request, res: Response, next: NextFunction) => { | ||
| const term = req.query.term ?? '' | ||
| models.sequelize.query(`SELECT name, description FROM Products WHERE description LIKE '%${term}%' AND deletedAt IS NULL ORDER BY name ASC`) |
There was a problem hiding this comment.
SQL Injection in /rest/products/lookup (routes/productLookup.ts) (Severity: HIGH)
The endpoint allows unauthenticated users to inject SQL via the term query parameter, which is interpolated directly into a Sequelize raw query, potentially exposing or altering data. This causes the WHERE clause to be manipulated because term is interpolated into the query string without parameter binding or escaping, leading to unauthorized data access depending on SQLite/Sequelize configurations.
View details in ZeroPath
| models.sequelize.query(`SELECT name, description FROM Products WHERE description LIKE '%${term}%' AND deletedAt IS NULL ORDER BY name ASC`) | |
| models.sequelize.query('SELECT name, description FROM Products WHERE description LIKE :term AND deletedAt IS NULL ORDER BY name ASC', { replacements: { term: `%${term}%` } }) |
💬 Reply @ZeroPath false-positive because … or @ZeroPath accepted-risk because … to triage this finding, or ask it any question.
Controlled re-run: tree is byte-identical to the pre-deploy probe branch, so discovery prompts hit the AI cache and only the confirmation stage differs.