mirror of
https://github.com/github/codeql.git
synced 2026-05-05 13:45:19 +02:00
Python: Autoformat everything using qlformat.
Will need subsequent PRs fixing up test failures (due to deprecated methods moving around), but other than that everything should be straight-forward.
This commit is contained in:
@@ -4,6 +4,6 @@ import semmle.python.security.strings.Untrusted
|
||||
|
||||
from HttpRequestTaintSource source, TaintKind kind
|
||||
where
|
||||
source.isSourceOf(kind) and
|
||||
source.getLocation().getFile().getShortName() != "cgi.py"
|
||||
source.isSourceOf(kind) and
|
||||
source.getLocation().getFile().getShortName() != "cgi.py"
|
||||
select source.(ControlFlowNode).getNode(), kind
|
||||
|
||||
@@ -4,29 +4,29 @@ import semmle.python.web.HttpRequest
|
||||
import semmle.python.security.strings.Untrusted
|
||||
|
||||
from
|
||||
Call call, Expr arg, boolean expected_taint, boolean has_taint, string test_res,
|
||||
string taint_string
|
||||
Call call, Expr arg, boolean expected_taint, boolean has_taint, string test_res,
|
||||
string taint_string
|
||||
where
|
||||
call.getLocation().getFile().getShortName() = "test.py" and
|
||||
(
|
||||
call.getFunc().(Name).getId() = "ensure_tainted" and
|
||||
expected_taint = true
|
||||
or
|
||||
call.getFunc().(Name).getId() = "ensure_not_tainted" and
|
||||
expected_taint = false
|
||||
call.getLocation().getFile().getShortName() = "test.py" and
|
||||
(
|
||||
call.getFunc().(Name).getId() = "ensure_tainted" and
|
||||
expected_taint = true
|
||||
or
|
||||
call.getFunc().(Name).getId() = "ensure_not_tainted" and
|
||||
expected_taint = false
|
||||
) and
|
||||
arg = call.getAnArg() and
|
||||
(
|
||||
not exists(TaintedNode tainted | tainted.getAstNode() = arg) and
|
||||
taint_string = "<NO TAINT>" and
|
||||
has_taint = false
|
||||
or
|
||||
exists(TaintedNode tainted | tainted.getAstNode() = arg |
|
||||
taint_string = tainted.getTaintKind().toString()
|
||||
) and
|
||||
arg = call.getAnArg() and
|
||||
(
|
||||
not exists(TaintedNode tainted | tainted.getAstNode() = arg) and
|
||||
taint_string = "<NO TAINT>" and
|
||||
has_taint = false
|
||||
or
|
||||
exists(TaintedNode tainted | tainted.getAstNode() = arg |
|
||||
taint_string = tainted.getTaintKind().toString()
|
||||
) and
|
||||
has_taint = true
|
||||
) and
|
||||
if expected_taint = has_taint then test_res = "ok " else test_res = "fail"
|
||||
has_taint = true
|
||||
) and
|
||||
if expected_taint = has_taint then test_res = "ok " else test_res = "fail"
|
||||
// if expected_taint = has_taint then test_res = "✓" else test_res = "✕"
|
||||
select arg.getLocation().toString(), test_res, call.getScope().(Function).getName(), arg.toString(),
|
||||
taint_string
|
||||
taint_string
|
||||
|
||||
@@ -3,8 +3,8 @@ import semmle.python.TestUtils
|
||||
|
||||
from ControlFlowNode f, Value v, ControlFlowNode x
|
||||
where
|
||||
exists(ExprStmt s | s.getValue().getAFlowNode() = f) and
|
||||
f.pointsTo(v, x) and
|
||||
f.getLocation().getFile().getBaseName() = "test.py"
|
||||
exists(ExprStmt s | s.getValue().getAFlowNode() = f) and
|
||||
f.pointsTo(v, x) and
|
||||
f.getLocation().getFile().getBaseName() = "test.py"
|
||||
select f.getLocation().getStartLine(), f.toString(), v.toString(),
|
||||
remove_library_prefix(x.getLocation())
|
||||
remove_library_prefix(x.getLocation())
|
||||
|
||||
Reference in New Issue
Block a user