Files
codeql-intro-csharp/SqlInjection-sink.ql
2024-12-04 14:35:06 -08:00

22 lines
554 B
Plaintext

/**
* @name SQLI Vulnerability
* @description Using untrusted strings in a sql query allows sql injection attacks.
* @kind problem
* @id workshop/sqlivulnerable
* @problem.severity warning
*/
import csharp
/*
* 2. Identify the /sink/ part of the
* : var command = new SqliteCommand(query, connection))
* expression, the =query= argument.
*/
from ObjectCreation oc, Expr queryArg
where
oc.getObjectType().getName() = "SqliteCommand" and
oc.getArgument(0) = queryArg
select queryArg, "Sink identified: " + queryArg.toString()