Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions routes/ventesReport.ts
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}'`)

@zeropath-ai-staging zeropath-ai-staging Bot Sep 9, 2026

Copy link
Copy Markdown

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

Suggested change
models.sequelize.query(`SELECT * FROM Deliveries WHERE name = '${région}'`)
models.sequelize.query('SELECT * FROM Deliveries WHERE name = :region', { replacements: { region: région } })

💬 Reply @ZeroPath false-positive because … or @ZeroPath accepted-risk because … to triage this finding, or ask it any question.

All commands

@zeropath-ai-staging zeropath-ai-staging Bot Sep 9, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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.
View details in ZeroPath

Suggested change
models.sequelize.query(`SELECT * FROM Deliveries WHERE name = '${région}'`)
models.sequelize.query('SELECT * FROM Deliveries WHERE name = ?', { replacements: [région] })

💬 Reply @ZeroPath false-positive because … or @ZeroPath accepted-risk because … to triage this finding, or ask it any question.

All commands

.then(([rows]: any) => { res.json({ rows }) })
.catch((error: Error) => { next(error) })
}
}
2 changes: 2 additions & 0 deletions server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const web3Wallet = require('./routes/web3Wallet')
const updateProductReviews = require('./routes/updateProductReviews')
const likeProductReviews = require('./routes/likeProductReviews')
const security = require('./lib/insecurity')
const ventesReport = require('./routes/ventesReport')
const app = express()
const server = require('http').Server(app)
const appConfiguration = require('./routes/appConfiguration')
Expand Down Expand Up @@ -571,6 +572,7 @@ restoreOverwrittenFilesWithOriginals().then(() => {
app.get('/rest/basket/:id', basket())
app.post('/rest/basket/:id/checkout', order())
app.put('/rest/basket/:id/coupon/:coupon', coupon())
app.get('/rest/ventes/report', ventesReport())
app.get('/rest/admin/application-version', appVersion())
app.get('/rest/admin/application-configuration', appConfiguration())
app.get('/rest/repeat-notification', repeatNotification())
Expand Down