Skip to content

SQL query built from strings

Gaphigh severity · reads .ts .tsx .js .jsx .mjs .cjs .pyBeta

String-built SQL can let an attacker read or change your data (SQL injection). When Lintsure finds this, it marks it as a Gap: the code itself shows the problem.

What it looks like

A line Lintsure flags in its own test app:

// src/more.ts
db.query(`SELECT * FROM users WHERE id = ${user.id}`);

How to fix it

Use parameterized queries or your ORM's query builder.

Through a coding agent, Lintsure suggests the change and waits. Nothing is edited until you approve it.

Controls it relates to

  • SOC 2CC7.1Detect and fix vulnerabilities
  • ISO 27001A.8.28Secure coding
  • GDPRArt. 32Security of processing

What the framework asks

EU AI Act Art. 15: Accuracy, robustness, security

The system should perform as stated, cope with errors and resist attacks such as data poisoning or prompt injection.

Evidence a reviewer may ask for: Test results and the security measures in place.

GDPR Art. 32: Security of processing

Protect personal data with security that fits the risk: encryption, access control, testing and the ability to recover.

Evidence a reviewer may ask for: Security measures and when they were last tested.

SOC 2 CC7.1: Finding vulnerabilities

You look for weaknesses and misconfigurations and fix them.

Evidence a reviewer may ask for: Scan results and fix history.

ISO 27001 A.8.25–8.29: Secure development

Build software securely: secure design, coding, testing and separation of environments.

Evidence a reviewer may ask for: Secure coding guidelines and test results.

Summaries are our own reading of the public texts, not the official wording.

Read more: Which SOC 2 controls you can check in code

Check your code for this

Runs on your machine. Your code is never uploaded.

npx lintsure scan

Quickstart · Use it in Claude Code or Cursor

This rule is in Beta: its mapping to framework controls is waiting for review by a qualified compliance professional. Lintsure is a readiness tool, not an audit or legal advice. A finding, or the lack of one, doesn't make you compliant. Disclaimer

Related rules