mirror of
https://github.com/github/codeql.git
synced 2026-01-29 14:23:03 +01:00
Fix compilation errors with new DataFlowCallable
This commit is contained in:
committed by
Owen Mansel-Chan
parent
b10d5cf0b0
commit
30ab22f5a6
@@ -72,11 +72,9 @@ module InsecureRandomness {
|
||||
*/
|
||||
class PasswordFnSink extends Sink {
|
||||
PasswordFnSink() {
|
||||
exists(FuncDecl passwordFn |
|
||||
passwordFn.getName().regexpMatch("(?i).*(gen(erate)?|salt|make|mk)Password.*")
|
||||
|
|
||||
this.getEnclosingCallable() = passwordFn
|
||||
)
|
||||
this.getEnclosingCallable()
|
||||
.getName()
|
||||
.regexpMatch("(?i).*(gen(erate)?|salt|make|mk)Password.*")
|
||||
}
|
||||
|
||||
override string getKind() { result = "a password-related function" }
|
||||
|
||||
@@ -26,9 +26,9 @@ predicate isNil(DataFlow::Node node) { node = Builtin::nil().getARead() }
|
||||
* `nil` for the pointer return value at some return site.
|
||||
*/
|
||||
predicate calleeMayReturnNilWithError(DataFlow::CallNode call) {
|
||||
not exists(call.getACallee())
|
||||
not exists(call.getACallee().getFuncDef())
|
||||
or
|
||||
exists(FuncDef callee | callee = call.getACallee() |
|
||||
exists(FuncDef callee | callee = call.getACallee().getFuncDef() |
|
||||
not exists(callee.getBody())
|
||||
or
|
||||
exists(IR::ReturnInstruction ret, DataFlow::Node ptrReturn, DataFlow::Node errReturn |
|
||||
|
||||
@@ -20,7 +20,7 @@ predicate isDeferred(DataFlow::CallNode call) {
|
||||
from DataFlow::CallNode recoverCall, FuncDef f, string msg
|
||||
where
|
||||
recoverCall.getTarget() = Builtin::recover() and
|
||||
f = recoverCall.getEnclosingCallable() and
|
||||
f = recoverCall.getEnclosingCallable().getFuncDef() and
|
||||
(
|
||||
isDeferred(recoverCall) and
|
||||
msg = "Deferred calls to 'recover' have no effect."
|
||||
|
||||
@@ -31,7 +31,7 @@ class HostKeyCallbackFunc extends DataFlow::Node {
|
||||
(
|
||||
this instanceof DataFlow::FunctionNode
|
||||
or
|
||||
exists(DataFlow::CallNode call | not exists(call.getACallee().getBody()) |
|
||||
exists(DataFlow::CallNode call | not exists(call.getACallee().getFuncDef().getBody()) |
|
||||
this = call.getAResult()
|
||||
)
|
||||
)
|
||||
|
||||
@@ -54,7 +54,9 @@ predicate isCleaned(DataFlow::Node nd) {
|
||||
isCleaned(nd.getAPredecessor())
|
||||
or
|
||||
exists(FuncDef f, FunctionInput inp | nd = inp.getExitNode(f) |
|
||||
forex(DataFlow::CallNode call | call.getACallee() = f | isCleaned(inp.getEntryNode(call)))
|
||||
forex(DataFlow::CallNode call | call.getACallee().getFuncDef() = f |
|
||||
isCleaned(inp.getEntryNode(call))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -87,7 +89,9 @@ predicate urlPath(DataFlow::Node nd) {
|
||||
urlPath(nd.getAPredecessor())
|
||||
or
|
||||
exists(FuncDef f, FunctionInput inp | nd = inp.getExitNode(f) |
|
||||
forex(DataFlow::CallNode call | call.getACallee() = f | urlPath(inp.getEntryNode(call)))
|
||||
forex(DataFlow::CallNode call | call.getACallee().getFuncDef() = f |
|
||||
urlPath(inp.getEntryNode(call))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import go
|
||||
|
||||
query predicate missingCall(DeclaredFunction f, DataFlow::CallNode call) {
|
||||
call.getACallee() = f.getFuncDecl() and
|
||||
call.getACallee().asFunction() = f and
|
||||
not call = f.getACall()
|
||||
}
|
||||
|
||||
query predicate spuriousCall(DeclaredFunction f, DataFlow::CallNode call) {
|
||||
call = f.getACall() and
|
||||
exists(FuncDecl fd | fd = f.getFuncDecl() | not call.getACallee() = fd)
|
||||
not call.getACallee().asFunction() = f
|
||||
}
|
||||
|
||||
@@ -16,10 +16,10 @@ string metadata(Locatable l, string key) {
|
||||
|
||||
query predicate missingCallee(DataFlow::CallNode call, FuncDef callee) {
|
||||
metadata(call.asExpr(), "callee") = metadata(callee, "name") and
|
||||
not call.getACallee() = callee
|
||||
not call.getACallee().getFuncDef() = callee
|
||||
}
|
||||
|
||||
query predicate spuriousCallee(DataFlow::CallNode call, FuncDef callee) {
|
||||
call.getACallee() = callee and
|
||||
call.getACallee().getFuncDef() = callee and
|
||||
not metadata(call.asExpr(), "callee") = metadata(callee, "name")
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ string metadata(Locatable l, string key) {
|
||||
|
||||
query predicate missingCallee(DataFlow::CallNode call, FuncDef callee) {
|
||||
metadata(call.asExpr(), "callee") = metadata(callee, "name") and
|
||||
not viableCallable(call.asExpr()) = callee
|
||||
not viableCallable(call.asExpr()).getFuncDef() = callee
|
||||
}
|
||||
|
||||
query predicate spuriousCallee(DataFlow::CallNode call, FuncDef callee) {
|
||||
viableCallable(call.asExpr()) = callee and
|
||||
viableCallable(call.asExpr()).getFuncDef() = callee and
|
||||
not metadata(call.asExpr(), "callee") = metadata(callee, "name")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user