Will It Vibe logoWill It Vibe?
INJECT-007Medium severity-8 points

SQL built with fmt.Sprintf / concatenation (Go)

Part of Security, which counts for 30% of the overall score. When this check fires it deducts 8 points from that category, once per scan, no matter how many places it turns up.

What it detects

A database/sql Query/Exec call builds its SQL with fmt.Sprintf or + concatenation instead of passing $1/? placeholders and arguments.

Why it matters

Passing fmt.Sprintf output or a concatenated string to database/sql Query/Exec sends the formatted value as query text, which is SQL injection. The driver already supports placeholders and argument values for exactly this. It is a heuristic since a Sprintf of trusted constants is a false positive.

How to fix it

Use the placeholder form: db.Query("SELECT ... WHERE id = $1", id) for pq/pgx, or ? for MySQL, passing the values as trailing arguments. Remove the fmt.Sprintf/concatenation from the query string. For dynamic identifiers, validate against an allowlist.

The paid report includes a ready-to-paste prompt for your AI coding agent for every check it finds, pointed at the exact findings from your scan. See pricing

Does your repo trip this check?

Paste a GitHub URL or drop a project folder. Scans run in your browser and take seconds.

Scan your repo

Related Security checks