Skip to content

Commit f0fa2b0

Browse files
committed
wip4
1 parent a19200d commit f0fa2b0

File tree

9 files changed

+18
-13
lines changed

9 files changed

+18
-13
lines changed

rust/ql/examples/snippets/simple_constant_password.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module ConstantPasswordConfig implements DataFlow::ConfigSig {
3030

3131
predicate isSink(DataFlow::Node node) {
3232
// `node` is an argument whose corresponding parameter name matches the pattern "pass%"
33-
exists(CallExpr call, Function target, int argIndex, Variable v |
33+
exists(Call call, Function target, int argIndex, Variable v |
3434
call.getStaticTarget() = target and
3535
v.getParameter() = target.getParam(argIndex) and
3636
v.getText().matches("pass%") and

rust/ql/examples/snippets/simple_sql_injection.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module SqlInjectionConfig implements DataFlow::ConfigSig {
2323

2424
predicate isSink(DataFlow::Node node) {
2525
// `node` is the first argument of a call to `sqlx_core::query::query`
26-
exists(CallExpr call |
26+
exists(Call call |
2727
call.getStaticTarget().getCanonicalPath() = "sqlx_core::query::query" and
2828
call.getArgument(0) = node.asExpr()
2929
)

rust/ql/lib/codeql/rust/elements/internal/CallImpl.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ module Impl {
77
/**
88
* A call.
99
*
10-
* Either a `CallExpr`, a `MethodCallExpr`, an `Operation`, or an `IndexExpr`.
10+
* Either
11+
*
12+
* - a `ParenArgsExpr` that targets a function,
13+
* - a `MethodCallExpr`,
14+
* - an `Operation` that targets an overloadable opeator, or
15+
* - an `IndexExpr`.
1116
*/
1217
abstract class Call extends ExprImpl::Expr {
1318
/** Gets the `i`th positional argument of this call, if any. */

rust/ql/lib/codeql/rust/security/AccessAfterLifetimeExtensions.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ module AccessAfterLifetime {
100100
a = b.getEnclosingBlock*()
101101
or
102102
// propagate through function calls
103-
exists(CallExpr ce |
104-
mayEncloseOnStack(a, ce.getEnclosingBlock()) and
105-
ce.getStaticTarget() = b.getEnclosingCallable()
103+
exists(Call call |
104+
mayEncloseOnStack(a, call.getEnclosingBlock()) and
105+
call.getStaticTarget() = b.getEnclosingCallable()
106106
)
107107
}
108108

rust/ql/lib/codeql/rust/security/HardcodedCryptographicValueExtensions.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ module HardcodedCryptographicValue {
103103
*/
104104
private class GetRandomBarrier extends Barrier {
105105
GetRandomBarrier() {
106-
exists(CallExpr call |
106+
exists(Call call |
107107
call.getStaticTarget().getCanonicalPath() = ["getrandom::fill", "getrandom::getrandom"] and
108108
this.asExpr().getParentNode*() = call.getArgument(0)
109109
)

rust/ql/lib/codeql/rust/security/InsecureCookieExtensions.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ module InsecureCookie {
8080
* as `false`.
8181
*/
8282
predicate cookieSetNode(DataFlow::Node node, string attrib, boolean value) {
83-
exists(FlowSummaryNode summaryNode, CallExpr call, int arg, DataFlow::Node argNode |
83+
exists(FlowSummaryNode summaryNode, Call call, int arg, DataFlow::Node argNode |
8484
// decode the models-as-data `OptionalBarrier`
8585
cookieOptionalBarrier(summaryNode, attrib, arg) and
8686
// find a call and arg referenced by this optional barrier

rust/ql/lib/codeql/rust/security/regex/RegexInjectionExtensions.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module RegexInjection {
5353
*/
5454
private class NewSink extends Sink {
5555
NewSink() {
56-
exists(CallExpr call, Function f |
56+
exists(Call call, Function f |
5757
call.getStaticTarget() = f and
5858
f.getCanonicalPath() = "<regex::regex::string::Regex>::new" and
5959
this.asExpr() = call.getArgument(0) and

rust/ql/src/queries/security/CWE-696/BadCtorInitialization.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class CtorAttr extends Attr {
3030
/**
3131
* A call into the Rust standard library, that is, a sink for this query.
3232
*/
33-
class StdCall extends CallExpr {
33+
class StdCall extends Call {
3434
StdCall() { this.getStaticTarget().getCanonicalPath().matches(["std::%", "<std::%"]) }
3535
}
3636

@@ -54,11 +54,11 @@ predicate edgesFwd(PathElement pred, PathElement succ) {
5454
or
5555
// [forwards reachable] callable -> enclosed call
5656
edgesFwd(_, pred) and
57-
pred = succ.(CallExpr).getEnclosingCallable()
57+
pred = succ.(Call).getEnclosingCallable()
5858
or
5959
// [forwards reachable] call -> target callable
6060
edgesFwd(_, pred) and
61-
pred.(CallExpr).getStaticTarget() = succ
61+
pred.(Call).getStaticTarget() = succ
6262
}
6363

6464
/**

rust/ql/test/library-tests/type-inference/type-inference.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module ResolveTest implements TestSig {
3232
source.fromSource() and
3333
not source.isFromMacroExpansion()
3434
|
35-
target = source.(CallExpr).getStaticTarget() and
35+
target = source.(Call).getStaticTarget() and
3636
functionHasValue(target, value) and
3737
// `isFromMacroExpansion` does not always work
3838
not target.(Function).getName().getText() = ["panic_fmt", "_print", "format", "must_use"] and

0 commit comments

Comments
 (0)