CodeQL library for JavaScript
Search

Module PrettyPrintCatCall

Predicates for creating an equivalent call to fs.readFile from a command execution of cat.

Import path

import semmle.javascript.security.UselessUseOfCat

Predicates

createCallbackString

Create a string representing the callback func.

createFileArgument

Create a string representation of the expression that determines what file is read by cat.

createFileThatIsReadFromCommandList

Create the file that is read for a call with an explicit command list (e.g. child_process.execFile/execFileSync).

createReadFileCall

Create a string representation of an equivalent call to fs.readFile for a given command execution cat.