Skip to content

Commit fad9d6f

Browse files
authored
chore(detectors): Add page for Query Injection Issues (#14209)
this pr adds a page for Query Injection Vulernability Issues.
1 parent 129a4db commit fad9d6f

File tree

1 file changed

+38
-0
lines changed
  • docs/product/issues/issue-details/query-injection-issues

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: "Potential Query Injection Vulnerability Issues"
3+
sidebar_order: 50
4+
description: "Learn more about Potential Query Injection Vulnerability issues and how to diagnose and fix them."
5+
---
6+
7+
Potential Query Injection Vulnerability issues are raised when Sentry detects values taken directly from an incoming request being incorporated into a database query. Unsanitized interpolation of user input can lead to [SQL injection](https://owasp.org/www-community/attacks/SQL_Injection) and related attacks.
8+
9+
## Detection Criteria
10+
11+
The detector evaluates each request in **two stages**:
12+
13+
1. **Filter request values** – Discards tokens that are:
14+
15+
- too short,
16+
- SQL keywords, or
17+
- other frequently benign values
18+
19+
2. **Match against queries** – Scans database queries and if **both** a payload key _and_ its value appear in the same query, Sentry creates a Potential Query Injection Vulnerability issue.
20+
21+
### Example
22+
23+
```
24+
Request → GET /api?username=bob
25+
Query → SELECT * FROM users WHERE username = 'bob'
26+
```
27+
28+
Because the value `'bob'` is inserted directly from the `username` parameter into the query, Sentry flags the operation as potentially vulnerable. **An issue indicates a security _risk_, not a confirmation that an exploit has already occurred.**
29+
30+
### False Positives
31+
32+
Some ORMs or query‑builder libraries assemble SQL strings internally before parameterizing them. We automatically suppress many known libraries, but unrecognized ones may still trigger the detector. If you believe an issue is a false positive, leave feedback on the issue page.
33+
34+
## Remediation
35+
36+
- Use **parameterised queries / prepared statements** instead of string concatenation.
37+
- **Validate and sanitise** all external input.
38+
- Avoid **raw queries** when safe ORM APIs are available.

0 commit comments

Comments
 (0)