Skip to content

Commit 28d0ad9

Browse files
committed
Rust: Add placeholder SQL injection query, linked in test.
1 parent 3673c7c commit 28d0ad9

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* @name Database query built from user-controlled sources
3+
* @description Building a database query from user-controlled sources is vulnerable to insertion of malicious code by the user.
4+
* @kind path-problem
5+
* @problem.severity error
6+
* @security-severity 8.8
7+
* @precision high
8+
* @id rust/sql-injection
9+
* @tags security
10+
* external/cwe/cwe-089
11+
*/
12+
13+
import codeql.rust.dataflow.DataFlow
14+
/*import codeql.rust.security.SqlInjectionQuery
15+
import SqlInjectionFlow::PathGraph
16+
17+
from SqlInjectionFlow::PathNode sourceNode, SqlInjectionFlow::PathNode sinkNode
18+
where SqlInjectionFlow::flowPath(sourceNode, sinkNode)
19+
select sinkNode.getNode(), sourceNode, sinkNode, "This query depends on a $@.",
20+
sourceNode.getNode(), "user-provided value"
21+
*/
22+
select 0

rust/ql/test/query-tests/security/CWE-089/SqlInjection.expected

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
query: queries/security/CWE-089/SqlInjection.ql
2+
postprocess: utils/InlineExpectationsTestQuery.ql

0 commit comments

Comments
 (0)