-
Hi 👋, I'm working on a project and I need a way to determine if Invocations nodes, without any found callees, originate from an external library. I'm not sure if there exists a mechanism to determine this information due to the callee not being found. To my knowledge, for JavaScript, CodeQL does not analyze the node_modules by default and contains modeling of certain popular external libraries like express. For example in this code: var url = require('fast-url-parser');
.
.
.
var path = url.parse(request.url).pathname Running this query: from DataFlow::InvokeNode node
where not exists(node.getACallee(0))
select node, ... Correctly finds the callee parse as not being found. However there are many invocation nodes without found callees throughout most packages and I just want to focus on the nodes that relate to external libraries. I've looked into libraries like Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @jghebre 👋🏻 Would you be able to give an example of the sort of nodes you would want to exclude? |
Beta Was this translation helpful? Give feedback.
Does this do the job for you:
With your test code, this gets me the three calls to the three external function calls. If you want to additionally check that there's no callee, then you could do something like this: