Skip to content

feat(ventes): add the regional sales report endpoint - #37

Open
ogulcan-gurcaglar wants to merge 1 commit into
masterfrom
zpchaos-x9-encoding
Open

ogulcan-gurcaglar wants to merge 1 commit into
masterfrom
zpchaos-x9-encoding

Conversation

@ogulcan-gurcaglar

Copy link
Copy Markdown

Adds the regional sales report endpoint.

@zeropath-ai-staging

Copy link
Copy Markdown

1 possible security or compliance issue detected. Reviewed everything up to af763c1.

The following issues were found:

  • Issue 1: SQL Injection
    • Location: routes/ventesReport.ts:13
    • Score: HIGH (88.0)
    • Description: The newly mounted GET /rest/ventes/report endpoint interpolates the attacker-controlled région query parameter directly into a SQL statement. No authentication, authorization, parameterization, or escaping is applied, so an anonymous remote user can alter the query and potentially read or manipulate database data depending on the database driver and stacked statements support.

Evidence: server.ts line 575 mounts app.get('/rest/ventes/report', ventesReport()) without an authentication middleware; routes/ventesReport.ts line 12 reads req.query.région, and line 13 inserts it into SELECT * FROM Deliveries WHERE name = '${région}'.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► routes/ventesReport.ts
      Introduce ventesReport route for deliveries report
► server.ts
      Register new /rest/ventes/report route using ventesReport

Comment thread routes/ventesReport.ts
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

Copy link
Copy Markdown

1 possible security or compliance issue detected. Reviewed everything up to af763c1.

The following issues were found:

  • Issue 1: SQL Injection
    • Location: routes/ventesReport.ts:13
    • Score: HIGH (87.0)
    • Description: The newly exposed /rest/ventes/report endpoint interpolates the attacker-controlled région query parameter directly into a SQL statement. An unauthenticated caller can alter the WHERE clause and potentially execute additional SQL depending on the SQLite/Sequelize configuration.

Evidence: const région = req.query.région ?? '' reads the request query, and line 13 constructs SELECT * FROM Deliveries WHERE name = '${région}' without parameter binding or escaping.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► routes/ventesReport.ts
      Introduce ventesReport route for deliveries report
► server.ts
      Register new /rest/ventes/report route using ventesReport

Comment thread routes/ventesReport.ts
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 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant