Skip to content

feat(hostile): add reporting endpoints with awkward path names - #34

Open
ogulcan-gurcaglar wants to merge 1 commit into
masterfrom
zpchaos-x5-hostile-paths
Open

feat(hostile): add reporting endpoints with awkward path names#34
ogulcan-gurcaglar wants to merge 1 commit into
masterfrom
zpchaos-x5-hostile-paths

Conversation

@ogulcan-gurcaglar

Copy link
Copy Markdown

Adds four reporting endpoints. Paths follow the existing localisation naming.

@zeropath-ai-staging

Copy link
Copy Markdown

2 possible security or compliance issues detected. Reviewed everything up to 32ab4b1.

The following issues were found:

  • Issue 1: SQL Injection
    • Location: routes/-dashdir/audit.ts:12
    • Score: HIGH (88.0)
    • Description: The newly exposed /rest/hostile/dash endpoint interpolates the attacker-controlled qd query parameter directly into a SQL statement. An unauthenticated caller can alter the WHERE clause or append SQL, potentially reading or modifying database data depending on SQLite/Sequelize behavior.

Evidence: const qd = req.query.qd ?? '' is taken directly from the request, and line 12 executes SELECT * FROM Baskets WHERE name = '${qd}' without replacements, bind parameters, or escaping. The route is registered with app.get('/rest/hostile/dash', dashDirAudit()) and has no visible authorization middleware.

  • Issue 2: SQL Injection
    • Location: routes/o'brien.ts:12
    • Score: HIGH (83.0)
    • Description: The newly exposed /rest/hostile/quote endpoint interpolates the attacker-controlled qb query parameter directly into a SQL statement. An unauthenticated caller can manipulate the query and potentially extract or alter database data depending on database driver behavior.

Evidence: const qb = req.query.qb ?? '' comes from the request, and line 12 executes SELECT * FROM Cards WHERE name = '${qb}' without bind parameters, replacements, or escaping. The route is registered as app.get('/rest/hostile/quote', obrienReport()) with no visible authorization middleware.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► routes/-dashdir/audit.ts
    Add new audit endpoint for dashdir queries
► routes/o'brien.ts
    Add new obrienReport route to serve Cards data
► routes/quarterly report.ts
    Add new quarterlyReportSpace route to serve Orders data
► routes/rapport-cafüe.ts
    Add new rapportCafe route to serve Addresses data
► server.ts
    Wire new hostile routes (dash, quote, unicode, quarterly report) into app

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

@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 /rest/hostile/dash (routes/-dashdir/audit.ts) (Severity: HIGH)

The endpoint allows unauthenticated access and uses a user-supplied qd parameter directly in a SQL string, which causes an SQL injection risk that could read or modify data. The code reads qd from req.query and interpolates it into the query on line 12 as SELECT * FROM Baskets WHERE name = '${qd}', which leads to potential data exposure or manipulation depending on the database driver.
View details in ZeroPath

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

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

All commands

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

@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 /rest/hostile/quote (routes/o'brien.ts:12) (Severity: HIGH)

Unauthenticated users can manipulate the qb query parameter which causes the app to interpolate it directly into a SQL statement, leading to potential data leakage or modification via the Cards table. The code in routes/o'brien.ts line 12 builds the query without parameters or escaping, resulting in a risky query execution path when /rest/hostile/quote is requested.
View details in ZeroPath

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

💬 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

4 possible security or compliance issues detected. Reviewed everything up to 32ab4b1.

The following issues were found:

  • Issue 1: SQL Injection
    • Location: server.ts:581
    • Score: CRITICAL (91.0)
    • Description: The newly added public /rest/hostile/dash endpoint invokes a handler that directly interpolates attacker-controlled qd into a raw SQL query over Baskets. Anonymous attackers can inject SQL and disclose basket contents or arbitrary database data.

Evidence: server.ts mounts app.get('/rest/hostile/dash', dashDirAudit()) without authentication or authorization. The handler executes SELECT * FROM Baskets WHERE name = '${qd}' and returns the rows as JSON.

  • Issue 2: SQL Injection
    • Location: server.ts:579
    • Score: HIGH (89.0)
    • Description: The newly added public /rest/hostile/quote endpoint invokes a handler that interpolates attacker-controlled qb directly into a raw SQL query over the Cards table. Anonymous attackers can inject SQL and retrieve payment-card records or arbitrary database data.

Evidence: server.ts mounts app.get('/rest/hostile/quote', obrienReport()) without authentication or authorization. The handler executes SELECT * FROM Cards WHERE name = '${qb}' and serializes the resulting rows into the response.

  • Issue 3: SQL Injection
    • Location: server.ts:580
    • Score: HIGH (87.0)
    • Description: The newly added public /rest/hostile/unicode endpoint invokes a handler that concatenates attacker-controlled qc into a raw SQL query over Addresses. An anonymous attacker can inject SQL to disclose other users' addresses or arbitrary database rows.

Evidence: server.ts mounts app.get('/rest/hostile/unicode', rapportCafe()) without authentication or authorization. The handler executes SELECT * FROM Addresses WHERE name = '${qc}' and returns rows as JSON.

  • Issue 4: SQL Injection
    • Location: server.ts:578
    • Score: HIGH (83.0)
    • Description: The newly added public /rest/hostile/space endpoint invokes a handler that interpolates the attacker-controlled qa query parameter directly into a raw SQL query. An anonymous requester can inject SQL and retrieve arbitrary database rows, including other users' order data and potentially data from other tables.

Evidence: server.ts mounts app.get('/rest/hostile/space', quarterlyReportSpace()) without authentication or authorization middleware. The newly added handler executes SELECT * FROM Orders WHERE name = '${qa}' and returns rows as JSON.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► routes/-dashdir/audit.ts
    Add new audit endpoint for dashdir queries
► routes/o'brien.ts
    Add new obrienReport route to serve Cards data
► routes/quarterly report.ts
    Add new quarterlyReportSpace route to serve Orders data
► routes/rapport-cafüe.ts
    Add new rapportCafe route to serve Addresses data
► server.ts
    Wire new hostile routes (dash, quote, unicode, quarterly report) into app

Comment thread server.ts
app.post('/rest/basket/:id/checkout', order())
app.put('/rest/basket/:id/coupon/:coupon', coupon())
app.get('/rest/hostile/space', quarterlyReportSpace())
app.get('/rest/hostile/quote', obrienReport())

@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 via /rest/hostile/quote in server.ts (Severity: HIGH)

The endpoint /rest/hostile/quote allows attackers to inject SQL through the qb parameter, which is interpolated directly into a raw query on the Cards table, risking exposure of payment-card or arbitrary data. This occurs because the handler at server.ts:579 builds a query like SELECT * FROM Cards WHERE name = '${qb}' without input sanitization or authentication, leading to unauthorized data access.
View details in ZeroPath

Automatic patch generation was not possible for this finding.

View reasoning


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

All commands

Comment thread server.ts
app.get('/rest/hostile/space', quarterlyReportSpace())
app.get('/rest/hostile/quote', obrienReport())
app.get('/rest/hostile/unicode', rapportCafe())
app.get('/rest/hostile/dash', dashDirAudit())

@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 via /rest/hostile/dash in server.ts (Severity: CRITICAL)

The vulnerability allows an attacker to inject SQL through the qd parameter, which is interpolated into a raw query in the /rest/hostile/dash handler, leading to disclosure of basket contents and other data. This occurs because server.ts mounts the route without auth and the dashDirAudit() handler executes a query like SELECT * FROM Baskets WHERE name = '${qd}' without input sanitization, allowing arbitrary SQL execution. An attacker can access the endpoint publicly, triggering data leaks via the vulnerable query.
View details in ZeroPath

Automatic patch generation was not possible for this finding.

View reasoning


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

All commands

Comment thread server.ts
app.put('/rest/basket/:id/coupon/:coupon', coupon())
app.get('/rest/hostile/space', quarterlyReportSpace())
app.get('/rest/hostile/quote', obrienReport())
app.get('/rest/hostile/unicode', rapportCafe())

@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.

SQLi in /rest/hostile/unicode handler (server.ts:580) (Severity: HIGH)

SQL injection risk: an attacker can inject into the query used to fetch Addresses. The handler concatenates qc into a raw SQL string in a vulnerable SELECT, which causes exposure of other users’ addresses or arbitrary rows when the endpoint is called without auth. This is triggered by the /rest/hostile/unicode route mounted in server.ts at line 580 via rapportCafe(), leading to unsafe query construction.
View details in ZeroPath

Automatic patch generation was not possible for this finding.

View reasoning


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

All commands

Comment thread server.ts
app.get('/rest/basket/:id', basket())
app.post('/rest/basket/:id/checkout', order())
app.put('/rest/basket/:id/coupon/:coupon', coupon())
app.get('/rest/hostile/space', quarterlyReportSpace())

@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 via /rest/hostile/space endpoint in server.ts (Severity: HIGH)

The attack can exfiltrate data because the handler uses the attacker-controlled qa parameter to build a raw SQL query, which causes the database to return arbitrary rows. This occurs in server.ts at line 578 where app.get('/rest/hostile/space', quarterlyReportSpace()) is mounted without auth and the handler executes SELECT * FROM Orders WHERE name = '${qa}' and returns JSON results, leading to exposure of other users’ orders and potentially other tables.
View details in ZeroPath

Automatic patch generation was not possible for this finding.

View reasoning


💬 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