Skip to content

Commit 2a72e89

Browse files
committed
add a runsImmediately predicate to CodeExecution (name chosen by Copilot)
1 parent d77b316 commit 2a72e89

File tree

6 files changed

+16
-0
lines changed

6 files changed

+16
-0
lines changed

ruby/ql/lib/codeql/ruby/Concepts.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,9 @@ module SystemCommandExecution {
701701
class CodeExecution extends DataFlow::Node instanceof CodeExecution::Range {
702702
/** Gets the argument that specifies the code to be executed. */
703703
DataFlow::Node getCode() { result = super.getCode() }
704+
705+
/** Holds if this execution immediately runs the input as code, as opposed to loading some code using the input as a "path". */
706+
predicate runsImmediately() { super.runsImmediately() }
704707
}
705708

706709
/** Provides a class for modeling new dynamic code execution APIs. */
@@ -714,6 +717,9 @@ module CodeExecution {
714717
abstract class Range extends DataFlow::Node {
715718
/** Gets the argument that specifies the code to be executed. */
716719
abstract DataFlow::Node getCode();
720+
721+
/** Holds if this execution immediately runs the input as code, as opposed to loading some code using the input as a "path". */
722+
predicate runsImmediately() { any() }
717723
}
718724
}
719725

ruby/ql/lib/codeql/ruby/frameworks/ActiveJob.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ module ActiveJob {
2525
}
2626

2727
override DataFlow::Node getCode() { result = this.getArgument(0) }
28+
29+
override predicate runsImmediately() { none() }
2830
}
2931
}
3032
}

ruby/ql/lib/codeql/ruby/frameworks/ActiveStorage.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,5 +221,7 @@ module ActiveStorage {
221221
}
222222

223223
override DataFlow::Node getCode() { result = this.getArgument(0) }
224+
225+
override predicate runsImmediately() { none() }
224226
}
225227
}

ruby/ql/lib/codeql/ruby/frameworks/ActiveSupport.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ module ActiveSupport {
3535
}
3636

3737
override DataFlow::Node getCode() { result = this.getReceiver() }
38+
39+
override predicate runsImmediately() { none() }
3840
}
3941

4042
/**

ruby/ql/lib/codeql/ruby/frameworks/core/Kernel.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ module Kernel {
166166
SendCallCodeExecution() { this.getMethodName() = "send" }
167167

168168
override DataFlow::Node getCode() { result = this.getArgument(0) }
169+
170+
override predicate runsImmediately() { none() }
169171
}
170172

171173
private class TapSummary extends SimpleSummarizedCallable {

ruby/ql/lib/codeql/ruby/frameworks/core/Module.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,7 @@ module Module {
4242
}
4343

4444
override DataFlow::Node getCode() { result = this.getArgument(0) }
45+
46+
override predicate runsImmediately() { none() }
4547
}
4648
}

0 commit comments

Comments
 (0)