mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
ruby: push getMethodName into DataFlow::CallNode
This commit is contained in:
@@ -58,16 +58,9 @@ class CallNode extends LocalSourceNode {
|
||||
|
||||
/** Gets the data-flow node corresponding to the named argument of the call corresponding to this data-flow node */
|
||||
Node getKeywordArgument(string name) { result.asExpr() = node.getKeywordArgument(name) }
|
||||
}
|
||||
|
||||
/** A data-flow node corresponding to a method call in the control-flow graph. */
|
||||
class MethodCallNode extends CallNode {
|
||||
private CfgNodes::ExprNodes::MethodCallCfgNode node;
|
||||
|
||||
MethodCallNode() { node = this.asExpr() }
|
||||
|
||||
/** Gets the name of the the method called by the method call corresponding to this data-flow node */
|
||||
string getMethodName() { result = node.getExpr().getMethodName() }
|
||||
/** Gets the name of the the method called by the method call (if any) corresponding to this data-flow node */
|
||||
string getMethodName() { result = node.getExpr().(MethodCall).getMethodName() }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,8 +5,7 @@ private import codeql.ruby.DataFlow
|
||||
private import codeql.ruby.dataflow.FlowSummary
|
||||
|
||||
/** Defines calls to `ActiveStorage::Filename#sanitized` as path sanitizers. */
|
||||
class ActiveStorageFilenameSanitizedCall extends Path::PathSanitization::Range,
|
||||
DataFlow::MethodCallNode {
|
||||
class ActiveStorageFilenameSanitizedCall extends Path::PathSanitization::Range, DataFlow::CallNode {
|
||||
ActiveStorageFilenameSanitizedCall() {
|
||||
this.getReceiver() =
|
||||
API::getTopLevelMember("ActiveStorage").getMember("Filename").getAnInstantiation() and
|
||||
|
||||
@@ -99,7 +99,7 @@ module IO {
|
||||
}
|
||||
|
||||
/**
|
||||
* A `DataFlow::MethodCallNode` that reads data using the `IO` class. For example,
|
||||
* A `DataFlow::CallNode` that reads data using the `IO` class. For example,
|
||||
* the `IO.read call in:
|
||||
*
|
||||
* ```rb
|
||||
@@ -112,7 +112,7 @@ module IO {
|
||||
* filesystem. For working with filesystem accesses specifically, see
|
||||
* `IOFileReader` or the `FileSystemReadAccess` concept.
|
||||
*/
|
||||
class IOReader extends DataFlow::MethodCallNode {
|
||||
class IOReader extends DataFlow::CallNode {
|
||||
private boolean classMethodCall;
|
||||
private string api;
|
||||
|
||||
@@ -149,7 +149,7 @@ module IO {
|
||||
}
|
||||
|
||||
/**
|
||||
* A `DataFlow::MethodCallNode` that reads data from the filesystem using the `IO`
|
||||
* A `DataFlow::CallNode` that reads data from the filesystem using the `IO`
|
||||
* class. For example, the `IO.read call in:
|
||||
*
|
||||
* ```rb
|
||||
@@ -217,7 +217,7 @@ module File {
|
||||
/**
|
||||
* A call to a `File` method that may return one or more filenames.
|
||||
*/
|
||||
class FileModuleFilenameSource extends FileNameSource, DataFlow::MethodCallNode {
|
||||
class FileModuleFilenameSource extends FileNameSource, DataFlow::CallNode {
|
||||
FileModuleFilenameSource() {
|
||||
// Class methods
|
||||
this =
|
||||
@@ -236,7 +236,7 @@ module File {
|
||||
}
|
||||
|
||||
private class FileModulePermissionModification extends FileSystemPermissionModification::Range,
|
||||
DataFlow::MethodCallNode {
|
||||
DataFlow::CallNode {
|
||||
private DataFlow::Node permissionArg;
|
||||
|
||||
FileModulePermissionModification() {
|
||||
@@ -319,7 +319,7 @@ module FileUtils {
|
||||
}
|
||||
|
||||
private class FileUtilsPermissionModification extends FileSystemPermissionModification::Range,
|
||||
DataFlow::MethodCallNode {
|
||||
DataFlow::CallNode {
|
||||
private DataFlow::Node permissionArg;
|
||||
|
||||
FileUtilsPermissionModification() {
|
||||
|
||||
@@ -26,8 +26,6 @@ class KernelMethodCall extends DataFlow::CallNode {
|
||||
)
|
||||
}
|
||||
|
||||
string getMethodName() { result = methodCall.getMethodName() }
|
||||
|
||||
int getNumberOfArguments() { result = methodCall.getNumberOfArguments() }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user