Skip to content

feat(chaos): add nine reporting endpoints - #33

Open
ogulcan-gurcaglar wants to merge 1 commit into
masterfrom
zpchaos-x3-nine-findings
Open

feat(chaos): add nine reporting endpoints#33
ogulcan-gurcaglar wants to merge 1 commit into
masterfrom
zpchaos-x3-nine-findings

Conversation

@ogulcan-gurcaglar

Copy link
Copy Markdown

Adds nine reporting endpoints for the operations console.

@zeropath-ai-staging

Copy link
Copy Markdown

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

The following issues were found:

  • Issue 1: SQL Injection
    • Location: routes/chaosRoute1.ts:12
    • Score: CRITICAL (93.0)
    • Description: The newly mounted GET /rest/chaos/1 endpoint interpolates the attacker-controlled q1 query parameter directly into a raw SQL statement. No authentication or authorization middleware is mounted for /rest/chaos, so an anonymous remote client can inject SQL and read or manipulate database data depending on the database dialect and query capabilities.

Evidence: server.ts lines 583-591 mount the chaos handlers without an auth middleware; chaosRoute1.ts line 11 reads req.query.q1 and line 12 inserts it into SELECT * FROM Products WHERE name = '${q1}' before returning query rows.

  • Issue 2: SQL Injection
    • Location: routes/chaosRoute2.ts:12
    • Score: HIGH (87.0)
    • Description: The newly mounted GET /rest/chaos/2 endpoint interpolates attacker-controlled q2 directly into a raw SQL query and returns the result, without authentication or parameterization. The same vulnerable implementation is introduced for /rest/chaos/3 through /rest/chaos/9.

Evidence: server.ts lines 583-591 publicly mount all chaos endpoints with no security.isAuthorized() middleware; chaosRoute2.ts line 11 reads req.query.q2 and line 12 constructs SQL using string interpolation.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► routes/chaosRoute1.ts
    Create chaosRoute1
► routes/chaosRoute2.ts
    Create chaosRoute2
► routes/chaosRoute3.ts
    Create chaosRoute3
► routes/chaosRoute4.ts
    Create chaosRoute4
► routes/chaosRoute5.ts
    Create chaosRoute5
► routes/chaosRoute6.ts
    Create chaosRoute6
► routes/chaosRoute7.ts
    Create chaosRoute7
► routes/chaosRoute8.ts
    Create chaosRoute8
► routes/chaosRoute9.ts
    Create chaosRoute9
► server.ts
    Wire up chaosRoute endpoints

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

@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 unauthenticated chaos endpoints (routes/chaosRoute2.ts) (Severity: HIGH)

The endpoint is exposed without authentication, and q2 from req.query is directly interpolated into a raw SQL query, which causes an attacker-controlled input to execute arbitrary SQL. This vulnerable pattern is mirrored for /rest/chaos/3 through /rest/chaos/9, with server.ts mounting all chaos routes without isAuthorized() middleware, leading to potential data leakage or modification.
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

@zeropath-ai-staging

Copy link
Copy Markdown

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

The following issues were found:

  • Issue 1: SQL Injection
    • Location: routes/chaosRoute2.ts:12
    • Score: HIGH (87.0)
    • Description: The new public chaos endpoints 2 through 9 directly interpolate attacker-controlled query parameters into raw SQL. For example, q2 is inserted into a quoted SQL string without binding or escaping, allowing SQL injection and unintended product data retrieval. Identical sinks exist in chaosRoute3.ts through chaosRoute9.ts.

Evidence: req.query.q2 is attacker-controlled and is used in models.sequelize.query(\SELECT * FROM Products WHERE name = '${q2}'`); server.ts registers /rest/chaos/2through/rest/chaos/9` without authentication middleware.

  • Issue 2: SQL Injection
    • Location: routes/chaosRoute1.ts:12
    • Score: HIGH (87.0)
    • Description: The new public /rest/chaos/1 endpoint interpolates the attacker-controlled q1 query parameter directly into a Sequelize raw SQL statement. An attacker can terminate the string literal and append SQL predicates or additional expressions, bypassing the intended product-name filter and retrieving arbitrary rows accessible to the database connection. The same vulnerable implementation is duplicated in chaosRoute2 through chaosRoute9.

Evidence: const q1 = req.query.q1 ?? '' reads request input and line 12 constructs SELECT * FROM Products WHERE name = '${q1}' without replacements, bind parameters, or escaping; server.ts registers it publicly at line 583 without authentication middleware.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► routes/chaosRoute1.ts
    Create Chaos Route 1
► routes/chaosRoute2.ts
    Create Chaos Route 2
► routes/chaosRoute3.ts
    Create Chaos Route 3
► routes/chaosRoute4.ts
    Create Chaos Route 4
► routes/chaosRoute5.ts
    Create Chaos Route 5
► routes/chaosRoute6.ts
    Create Chaos Route 6
► routes/chaosRoute7.ts
    Create Chaos Route 7
► routes/chaosRoute8.ts
    Create Chaos Route 8
► routes/chaosRoute9.ts
    Create Chaos Route 9
► server.ts
    Expose Chaos Routes via /rest/chaos/*

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

@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 on /rest/chaos/1 Route (Severity: CRITICAL)

An attacker can inject SQL via q1 in /rest/chaos, which causes a raw query building with user input to execute unauthorized data access. The code reads req.query.q1 and interpolates it into the statement SELECT * FROM Products WHERE name = '${q1}' with no auth checks on /rest/chaos, leading to possible data leakage or manipulation.
View details in ZeroPath

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

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

All commands

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

@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 chaosRoute1 public endpoint (Severity: HIGH)

The endpoint allows an attacker-controlled q1 parameter to terminate the string and append arbitrary SQL, which causes exposure of product data via a raw query without parameter binding. This results in potential data leakage and unintended access; the vulnerability exists in routes/chaosRoute1.ts line 12 where the query is constructed without replacements, and is similarly replicated in chaosRoute2 through chaosRoute9, with the route registered publicly in server.ts line 583.
View details in ZeroPath

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

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

All commands

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

@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 chaosRoute2.ts (unsanitized query) (Severity: HIGH)

The vulnerability allows attackers to inject SQL via q2, which is directly interpolated into a raw query in chaosRoute2.ts, resulting in unauthorized data access. This occurs because the code builds the SQL string with the attacker-controlled q2 value without binding or escaping, and the same sink exists in chaosRoute3.ts through chaosRoute9.ts.
View details in ZeroPath

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

💬 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