CodeQL library for Ruby
codeql/ruby-all 0.8.15-dev (changelog, source)
Search

Module Kernel

Provides modeling for the Kernel class.

Import path

import codeql.ruby.frameworks.core.Kernel

Classes

EvalCallCodeExecution

A call to Kernel.eval, which executes its first argument as Ruby code. ruby a = 1 Kernel.eval("a = 2") a # => 2

KernelExecCall

A system command executed via the Kernel.exec method. Kernel.exec takes the same argument forms as Kernel.system. See KernelSystemCall for details. Ruby documentation: https://docs.ruby-lang.org/en/3.0.0/Kernel.html#method-i-exec

KernelMethodCall

The Kernel module is included by the Object class, so its methods are available in every Ruby object. In addition, its module methods can be called by providing a specific receiver as in Kernel.exit.

KernelSpawnCall

A system command executed via the Kernel.spawn method. Kernel.spawn takes the same argument forms as Kernel.system. See KernelSystemCall for details. Ruby documentation: https://docs.ruby-lang.org/en/3.0.0/Kernel.html#method-i-spawn TODO: document and handle the env and option arguments. spawn([env,] command... [,options]) -> pid

KernelSystemCall

A system command executed via the Kernel.system method. Kernel.system accepts three argument forms: - A single string. If it contains no shell meta characters, keywords or builtins, it is executed directly in a subprocess. Otherwise, it is executed in a subshell. ruby system("cat foo.txt | tail") - A command and one or more arguments. The command is executed in a subprocess. ruby system("cat", "foo.txt") - An array containing the command name and argv[0], followed by zero or more arguments. The command is executed in a subprocess. ruby system(["cat", "cat"], "foo.txt") In addition, Kernel.system accepts an optional environment hash as the first argument and an optional options hash as the last argument. We don’t yet distinguish between these arguments and the command arguments. ruby system({"FOO" => "BAR"}, "cat foo.txt | tail", {unsetenv_others: true}) Ruby documentation: https://docs.ruby-lang.org/en/3.0.0/Kernel.html#method-i-system

MethodCallCodeExecution

A call to method, public_method or singleton_method which returns a method object. To actually execute the method, the call method needs to be called on the object. ruby m = method("exit") m.call()

SendCallCodeExecution

A call to Kernel#send, which executes its first argument as a Ruby method call. ruby arr = [] arr.send("push", 1) arr # => [1]