Skip to content

feat(vendor): add vendor report endpoint - #38

Open
ogulcan-gurcaglar wants to merge 1 commit into
masterfrom
zpchaos-x10a-control
Open

ogulcan-gurcaglar wants to merge 1 commit into
masterfrom
zpchaos-x10a-control

Conversation

@ogulcan-gurcaglar

Copy link
Copy Markdown

Adds the vendor report endpoint.

@zeropath-ai-staging

Copy link
Copy Markdown

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

The following issues were found:

  • Issue 1: SQL Injection
    • Location: routes/vendorReport.ts:12
    • Score: HIGH (83.0)
    • Description: The new unauthenticated vendor report endpoint interpolates the attacker-controlled vendor query parameter directly into a SQL statement. An attacker can supply quotes and SQL syntax to alter the WHERE clause, extract arbitrary database rows, or potentially execute additional statements depending on the SQLite/Sequelize configuration.

Evidence: app.get('/rest/vendor/report', vendorReport()) exposes the handler, and the handler builds SELECT * FROM Products WHERE name = '${vendor}' using req.query.vendor without parameterization or escaping.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► routes/vendorReport.ts
    Add vendorReport route to serve vendor product reports
► server.ts
    Register /rest/vendor/report route with vendorReport handler

Comment thread routes/vendorReport.ts
module.exports = function vendorReport () {
return (req: Request, res: Response, next: NextFunction) => {
const vendor = req.query.vendor ?? ''
models.sequelize.query(`SELECT * FROM Products WHERE name = '${vendor}'`)

@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 vendorReport endpoint (routes/vendorReport.ts:12) (Severity: HIGH)

SQL injection risk: unauthenticated requests to /rest/vendor/report allow manipulation of the query via the vendor parameter, which is interpolated directly into the SQL statement. This leads to potential data exposure or modification as the WHERE clause can be altered, resulting in arbitrary row retrieval or additional statements depending on configuration, with the vulnerability exposed in vendorReport() handling of req.query.vendor.
View details in ZeroPath

Suggested change
models.sequelize.query(`SELECT * FROM Products WHERE name = '${vendor}'`)
models.sequelize.query('SELECT * FROM Products WHERE name = :vendor', { replacements: { vendor: String(vendor) } })

💬 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 7d7cf67.

The following issues were found:

  • Issue 1: SQL Injection
    • Location: routes/vendorReport.ts:12
    • Score: HIGH (85.0)
    • Description: The newly exposed GET /rest/vendor/report endpoint interpolates the attacker-controlled vendor query parameter directly into a SQL statement. An anonymous remote attacker can alter the WHERE clause and inject additional SQL, potentially reading arbitrary Products rows/data and, depending on the database driver and query capabilities, affecting other database operations.

Evidence: server.ts line 575 mounts vendorReport() on a public GET route with no visible authentication middleware; routes/vendorReport.ts line 11 reads req.query.vendor and line 12 concatenates it into SELECT * FROM Products WHERE name = '...'.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► routes/vendorReport.ts
    Add vendorReport route to serve vendor product reports
► server.ts
    Register /rest/vendor/report route with vendorReport handler

Comment thread routes/vendorReport.ts
module.exports = function vendorReport () {
return (req: Request, res: Response, next: NextFunction) => {
const vendor = req.query.vendor ?? ''
models.sequelize.query(`SELECT * FROM Products WHERE name = '${vendor}'`)

@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 GET /rest/vendor/report (routes/vendorReport.ts) (Severity: HIGH)

An anonymous attacker can inject SQL via the vendor query parameter which gets directly concatenated into a SQL statement, leading to potential exposure of Products data. The code reads req.query.vendor in routes/vendorReport.ts and interpolates it into the query in vendorReport(), resulting in arbitrary SQL execution without input validation or parameterization.
View details in ZeroPath

Suggested change
models.sequelize.query(`SELECT * FROM Products WHERE name = '${vendor}'`)
models.sequelize.query('SELECT * FROM Products WHERE name = :vendor', { replacements: { vendor } })

💬 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