CodeQL library for JavaScript/TypeScript
codeql/javascript-all 1.0.3-dev (changelog, source)
Search

Member predicate API::Node::asSource

Get a data-flow node where this value enters the current codebase.

For example:

// API::moduleImport("fs").asSource()
require('fs');

// API::moduleImport("fs").getMember("readFile").asSource()
require('fs').readFile;

// API::moduleImport("fs").getMember("readFile").getReturn().asSource()
require('fs').readFile();

require('fs').readFile(
 filename,
 // 'y' matched by API::moduleImport("fs").getMember("readFile").getParameter(1).getParameter(0).asSource()
 y => {
   ...
});
SourceNode asSource()