Remove uses of getEnclosingCallable

This commit is contained in:
Sauyon Lee
2021-09-29 08:17:57 -07:00
committed by Owen Mansel-Chan
parent 30ab22f5a6
commit d62f417130
4 changed files with 4 additions and 6 deletions

View File

@@ -72,9 +72,7 @@ module InsecureRandomness {
*/
class PasswordFnSink extends Sink {
PasswordFnSink() {
this.getEnclosingCallable()
.getName()
.regexpMatch("(?i).*(gen(erate)?|salt|make|mk)Password.*")
this.getRoot().(FuncDef).getName().regexpMatch("(?i).*(gen(erate)?|salt|make|mk)Password.*")
}
override string getKind() { result = "a password-related function" }

View File

@@ -86,7 +86,7 @@ module UnsafeUnzipSymlink {
* Gets a `CallNode` that may call `node`'s enclosing function.
*/
private DataFlow::CallNode getACaller(DataFlow::CallNode node) {
result.getACallee() = node.getEnclosingCallable()
result.getACallee().getFuncDef() = node.getRoot()
}
/**

View File

@@ -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().getFuncDef() and
f = recoverCall.getRoot() and
(
isDeferred(recoverCall) and
msg = "Deferred calls to 'recover' have no effect."

View File

@@ -24,7 +24,7 @@ where
sink =
min(DataFlow::PathNode sink2, int line |
cfg.hasFlowPath(_, sink2) and
sink2.getNode().getEnclosingCallable() = sink.getNode().getEnclosingCallable() and
sink2.getNode().getRoot() = sink.getNode().getRoot() and
sink2.hasLocationInfo(_, line, _, _, _)
|
sink2 order by line