Skip to content

Commit a37737d

Browse files
committed
Replace string kind with boolean preservesValue
1 parent cdc3595 commit a37737d

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

ql/lib/codeql/ruby/dataflow/FlowSummary.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ abstract class SummarizedCallable extends LibraryCallable {
9696
* but uses an external (string) representation of the input and output stacks.
9797
*/
9898
pragma[nomagic]
99-
predicate propagatesFlowExt(string input, string output, string kind) { none() }
99+
predicate propagatesFlowExt(string input, string output, boolean preservesValue) { none() }
100100

101101
/**
102102
* Holds if values stored inside `content` are cleared on objects passed as

ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImplSpecific.qll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ DataFlowType getCallbackReturnType(DataFlowType t, ReturnKind rk) { any() }
4545
* `input`, output specification `output`, and kind `kind`.
4646
*/
4747
predicate summaryElement(DataFlowCallable c, string input, string output, string kind) {
48-
exists(FlowSummary::SummarizedCallable sc |
49-
sc.propagatesFlowExt(input, output, kind) and
50-
c.asLibraryCallable() = sc
48+
exists(FlowSummary::SummarizedCallable sc, boolean preservesValue |
49+
sc.propagatesFlowExt(input, output, preservesValue) and
50+
c.asLibraryCallable() = sc and
51+
if preservesValue = true then kind = "value" else kind = "taint"
5152
)
5253
}
5354

ql/test/library-tests/dataflow/summaries/Summaries.ql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ private class SummarizedCallableIdentity extends SummarizedCallable {
1818

1919
override MethodCall getACall() { result.getMethodName() = this }
2020

21-
override predicate propagatesFlowExt(string input, string output, string kind) {
21+
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
2222
input = "Argument[0]" and
2323
output = "ReturnValue" and
24-
kind = "value"
24+
preservesValue = true
2525
}
2626
}
2727

@@ -30,14 +30,14 @@ private class SummarizedCallableApplyBlock extends SummarizedCallable {
3030

3131
override MethodCall getACall() { result.getMethodName() = this }
3232

33-
override predicate propagatesFlowExt(string input, string output, string kind) {
33+
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
3434
input = "Argument[0]" and
3535
output = "Parameter[0] of BlockArgument" and
36-
kind = "value"
36+
preservesValue = true
3737
or
3838
input = "ReturnValue of BlockArgument" and
3939
output = "ReturnValue" and
40-
kind = "value"
40+
preservesValue = true
4141
}
4242
}
4343

@@ -46,14 +46,14 @@ private class SummarizedCallableApplyLambda extends SummarizedCallable {
4646

4747
override MethodCall getACall() { result.getMethodName() = this }
4848

49-
override predicate propagatesFlowExt(string input, string output, string kind) {
49+
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
5050
input = "Argument[1]" and
5151
output = "Parameter[0] of Argument[0]" and
52-
kind = "value"
52+
preservesValue = true
5353
or
5454
input = "ReturnValue of Argument[0]" and
5555
output = "ReturnValue" and
56-
kind = "value"
56+
preservesValue = true
5757
}
5858
}
5959

0 commit comments

Comments
 (0)