Refactor to use SummarizedCallable, sourceElement and sinkElement

This commit is contained in:
Owen Mansel-Chan
2021-12-15 12:06:52 -05:00
committed by Owen Mansel-Chan
parent ec3dd1e1c0
commit da8f8e2eef
2 changed files with 8 additions and 5 deletions

View File

@@ -396,6 +396,13 @@ SourceOrSinkElement interpretElement(
)
}
/** Holds if there is an external specification for `f`. */
predicate hasExternalSpecification(Function f) {
f = any(SummarizedCallable sc).asFunction()
or
exists(SourceOrSinkElement e | f = e.asEntity() | sourceElement(e, _, _) or sinkElement(e, _, _))
}
private predicate parseField(string c, DataFlow::FieldContent f) {
specSplit(_, c, _) and
exists(string fieldRegex, string package, string className, string fieldName |

View File

@@ -713,11 +713,7 @@ module Public {
or
exists(c.(MethodCallNode).getTarget().getBody())
or
exists(string package, string type, string name |
c.(MethodCallNode).getTarget().hasQualifiedName(package, type, name)
|
exists(interpretElement(package, type, _, name, "", _))
)
hasExternalSpecification(c.(DataFlow::MethodCallNode).getTarget())
)
}