SQL Injection

SQL queries built with template literals or string concat (ORM-aware)

criticalSecuritysql-injection

Severity depends on context. Warning instead of critical when the project uses an ORM or query builder that parameterizes by default (Prisma, Drizzle, Knex, TypeORM, Sequelize).

Why this matters

String-concatenated SQL lets attackers inject arbitrary queries. They can dump your entire database, modify data, or escalate privileges. ORMs prevent this by parameterizing automatically.

Example

Flaggedserver/users.ts
app.get("/users", async (req, res) => {
  const { name } = req.query;
  const result = await db.query(
    `SELECT * FROM users WHERE name = '${name}'`
  );
  res.json(result.rows);
});
Fixedserver/users.ts
app.get("/users", async (req, res) => {
  const { name } = req.query;
  const result = await db.query(
    "SELECT * FROM users WHERE name = $1",
    [name]
  );
  res.json(result.rows);
});

How to fix

Always use parameterized queries or an ORM (Prisma, Drizzle, Knex). Never interpolate user input into SQL strings.

Reference

In the output
Findings carry "ruleId": "sql-injection" in --json and the same id in SARIF and in the terminal.
Silence one line
// prodlint-disable-next-line sql-injection
Silence a whole file
// prodlint-disable sql-injection at the top of the file
How it works
Reads the syntax tree, with a text fallback for files that don't parse. Source on GitHub