-
Notifications
You must be signed in to change notification settings - Fork 0
feat(ventes): add the regional sales report endpoint #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,17 @@ | ||||||
| /* | ||||||
| * Copyright (c) 2014-2024 Bjoern Kimminich & the OWASP Juice Shop contributors. | ||||||
| * SPDX-License-Identifier: MIT | ||||||
| */ | ||||||
|
|
||||||
| import * as models from '../models/index' | ||||||
| import { type Request, type Response, type NextFunction } from 'express' | ||||||
|
|
||||||
| // Rapport des ventes — gère les caractères accentués, les emoji 🚚 et les CRLF. | ||||||
| module.exports = function ventesReport () { | ||||||
| return (req: Request, res: Response, next: NextFunction) => { | ||||||
| const région = req.query.région ?? '' | ||||||
| models.sequelize.query(`SELECT * FROM Deliveries WHERE name = '${région}'`) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SQL Injection in ventésReport endpoint (routes/ventesReport.ts) (Severity: HIGH) Unauthenticated input in the /rest/ventes/report endpoint allows SQL injection: the région query parameter is interpolated into a SQL query in routes/ventesReport.ts which causes the WHERE clause to be altered. This input is used directly in a Sequelize raw query without binding or escaping, leading to potential data disclosure or modification.
Suggested change
💬 Reply |
||||||
| .then(([rows]: any) => { res.json({ rows }) }) | ||||||
| .catch((error: Error) => { next(error) }) | ||||||
| } | ||||||
| } | ||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SQL Injection in ventesReport GET /rest/ventes/report (Severity: HIGH)
SQL injection risk: an anonymous user can manipulate the query by supplying région, since the value is interpolated directly into the SQL without authentication, parameterization, or escaping. This leads to potential data leakage or modification as the region parameter flows from req.query.région into the SELECT statement in routes/ventesReport.ts:13.
View details in ZeroPath
💬 Reply
@ZeroPath false-positive because …or@ZeroPath accepted-risk because …to triage this finding, or ask it any question.All commands