Skip to content

Commit 784327c

Browse files
committed
Java/Ruby: Hardcode generated flag to false.
1 parent 8e1fa35 commit 784327c

File tree

3 files changed

+37
-23
lines changed

3 files changed

+37
-23
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImplSpecific.qll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ DataFlowType getCallbackReturnType(DataFlowType t, ReturnKind rk) {
8686
/**
8787
* Holds if an external flow summary exists for `c` with input specification
8888
* `input`, output specification `output`, kind `kind`, and a flag `generated`
89-
* stating whether the summary is autogenerated or not.
89+
* stating whether the summary is autogenerated.
9090
*/
9191
predicate summaryElement(
9292
DataFlowCallable c, string input, string output, string kind, boolean generated
@@ -101,8 +101,8 @@ predicate summaryElement(
101101

102102
/**
103103
* Holds if an external source specification exists for `e` with output specification
104-
* `output`, kind `kind`, and a flag `generated` stating whether the summary is
105-
* autogenerated or not.
104+
* `output`, kind `kind`, and a flag `generated` stating whether the source specification is
105+
* autogenerated.
106106
*/
107107
predicate sourceElement(Element e, string output, string kind, boolean generated) {
108108
exists(
@@ -114,9 +114,9 @@ predicate sourceElement(Element e, string output, string kind, boolean generated
114114
}
115115

116116
/**
117-
* Holds if an external sink specification exists for `n` with input specification
118-
* `input`, kind `kind` and a flag `generated` stating whether the summary is
119-
* autogenerated or not..
117+
* Holds if an external sink specification exists for `e` with input specification
118+
* `input`, kind `kind` and a flag `generated` stating whether the sink specification is
119+
* autogenerated.
120120
*/
121121
predicate sinkElement(Element e, string input, string kind, boolean generated) {
122122
exists(

java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImplSpecific.qll

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,18 @@ DataFlowType getCallbackReturnType(DataFlowType t, ReturnKind rk) {
5353

5454
/**
5555
* Holds if an external flow summary exists for `c` with input specification
56-
* `input`, output specification `output`, and kind `kind`.
56+
* `input`, output specification `output`, kind `kind`, and a flag `generated`
57+
* stating whether the summary is autogenerated.
5758
*/
58-
predicate summaryElement(DataFlowCallable c, string input, string output, string kind) {
59+
predicate summaryElement(
60+
DataFlowCallable c, string input, string output, string kind, boolean generated
61+
) {
5962
exists(
6063
string namespace, string type, boolean subtypes, string name, string signature, string ext
6164
|
6265
summaryModel(namespace, type, subtypes, name, signature, ext, input, output, kind) and
63-
c.asCallable() = interpretElement(namespace, type, subtypes, name, signature, ext)
66+
c.asCallable() = interpretElement(namespace, type, subtypes, name, signature, ext) and
67+
generated = false
6468
)
6569
}
6670

@@ -112,27 +116,31 @@ class SourceOrSinkElement = Top;
112116

113117
/**
114118
* Holds if an external source specification exists for `e` with output specification
115-
* `output` and kind `kind`.
119+
* `output`, kind `kind`, and a flag `generated` stating whether the source specification is
120+
* autogenerated.
116121
*/
117-
predicate sourceElement(SourceOrSinkElement e, string output, string kind) {
122+
predicate sourceElement(SourceOrSinkElement e, string output, string kind, boolean generated) {
118123
exists(
119124
string namespace, string type, boolean subtypes, string name, string signature, string ext
120125
|
121126
sourceModel(namespace, type, subtypes, name, signature, ext, output, kind) and
122-
e = interpretElement(namespace, type, subtypes, name, signature, ext)
127+
e = interpretElement(namespace, type, subtypes, name, signature, ext) and
128+
generated = false
123129
)
124130
}
125131

126132
/**
127133
* Holds if an external sink specification exists for `e` with input specification
128-
* `input` and kind `kind`.
134+
* `input`, kind `kind` and a flag `generated` stating whether the sink specification is
135+
* autogenerated.
129136
*/
130-
predicate sinkElement(SourceOrSinkElement e, string input, string kind) {
137+
predicate sinkElement(SourceOrSinkElement e, string input, string kind, boolean generated) {
131138
exists(
132139
string namespace, string type, boolean subtypes, string name, string signature, string ext
133140
|
134141
sinkModel(namespace, type, subtypes, name, signature, ext, input, kind) and
135-
e = interpretElement(namespace, type, subtypes, name, signature, ext)
142+
e = interpretElement(namespace, type, subtypes, name, signature, ext) and
143+
generated = false
136144
)
137145
}
138146

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,17 @@ DataFlowType getCallbackReturnType(DataFlowType t, ReturnKind rk) { any() }
4242

4343
/**
4444
* Holds if an external flow summary exists for `c` with input specification
45-
* `input`, output specification `output`, and kind `kind`.
45+
* `input`, output specification `output`, kind `kind`, and a flag `generated`
46+
* stating whether the summary is autogenerated.
4647
*/
47-
predicate summaryElement(DataFlowCallable c, string input, string output, string kind) {
48+
predicate summaryElement(
49+
DataFlowCallable c, string input, string output, string kind, boolean generated
50+
) {
4851
exists(FlowSummary::SummarizedCallable sc, boolean preservesValue |
4952
sc.propagatesFlowExt(input, output, preservesValue) and
5053
c.asLibraryCallable() = sc and
51-
if preservesValue = true then kind = "value" else kind = "taint"
54+
(if preservesValue = true then kind = "value" else kind = "taint") and
55+
generated = false
5256
)
5357
}
5458

@@ -128,16 +132,18 @@ NormalReturnKind getReturnValueKind() { any() }
128132
*/
129133
private module UnusedSourceSinkInterpretation {
130134
/**
131-
* Holds if an external source specification exists for `e` with output specification
132-
* `output` and kind `kind`.
135+
* Holds if an external source specification exists for `n` with output specification
136+
* `output`, kind `kind`, and a flag `generated` stating whether the source specification is
137+
* autogenerated.
133138
*/
134-
predicate sourceElement(AstNode n, string output, string kind) { none() }
139+
predicate sourceElement(AstNode n, string output, string kind, boolean generated) { none() }
135140

136141
/**
137142
* Holds if an external sink specification exists for `n` with input specification
138-
* `input` and kind `kind`.
143+
* `input`, kind `kind` and a flag `generated` stating whether the sink specification is
144+
* autogenerated.
139145
*/
140-
predicate sinkElement(AstNode n, string input, string kind) { none() }
146+
predicate sinkElement(AstNode n, string input, string kind, boolean generated) { none() }
141147

142148
class SourceOrSinkElement = AstNode;
143149

0 commit comments

Comments
 (0)