Skip to content

Commit df4d09b

Browse files
committed
Python: Don't rely on all DataFlowCall being resolved
I've been living dangerously with that assumption :|
1 parent 478f5ff commit df4d09b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

python/ql/src/Security/CWE-020-ExternalAPIs/ExternalAPIs.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ newtype TInterestingExternalApiCall =
8787
} or
8888
TResolvedCall(DataFlowPrivate::DataFlowCall call) {
8989
exists(call.getLocation().getFile().getRelativePath()) and
90+
exists(call.getCallable()) and
9091
not call.getCallable() = any(SafeExternalApi safe).getSafeCallable() and
9192
// ignore calls inside codebase, and ignore calls that are marked as safe. This is
9293
// only needed as long as we extract dependencies. When we stop doing that, all

python/ql/test/experimental/dataflow/calls/DataFlowCallTest.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ class DataFlowCallTest extends InlineExpectationsTest {
1717
exists(location.getFile().getRelativePath()) and
1818
exists(DataFlowDispatch::DataFlowCall call |
1919
location = call.getLocation() and
20-
element = call.toString()
20+
element = call.toString() and
21+
exists(call.getCallable())
2122
|
2223
value = prettyExpr(call.getNode().getNode()) and
2324
tag = "call"

0 commit comments

Comments
 (0)