mirror of
https://github.com/hohn/codeql-dataflow-sql-injection-go.git
synced 2025-12-16 02:03:05 +01:00
21 lines
491 B
Plaintext
21 lines
491 B
Plaintext
/**
|
|
* Identify the source: the return value of function `getUserInfo`.
|
|
* Uses AST matching to find return expressions within that function.
|
|
*/
|
|
|
|
import go
|
|
|
|
/** A source expression corresponding to the value returned from getUserInfo. */
|
|
predicate isSource(Expr e) {
|
|
exists(Function f, ReturnStmt r, int i |
|
|
f.getName() = "getUserInfo" and
|
|
r.getEnclosingFunction() = f and
|
|
e = r.getExpr(i)
|
|
)
|
|
}
|
|
|
|
from Expr e
|
|
where isSource(e)
|
|
select e, "Source: return value of getUserInfo"
|
|
|