Skip to content

Commit b45d079

Browse files
committed
Java: Move and rename externalflow related extensible predicates.
1 parent 9fc1b3a commit b45d079

File tree

2 files changed

+71
-62
lines changed

2 files changed

+71
-62
lines changed

java/ql/lib/semmle/code/java/dataflow/ExternalFlow.qll

Lines changed: 10 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ private import internal.DataFlowPrivate
7878
private import internal.FlowSummaryImpl::Private::External
7979
private import internal.FlowSummaryImplSpecific as FlowSummaryImplSpecific
8080
private import internal.AccessPathSyntax
81+
private import ExternalFlowExtensions as Extensions
8182
private import FlowSummary
8283

8384
/**
@@ -128,33 +129,6 @@ private predicate summaryModelInternal(string row) { any(SummaryModelCsvInternal
128129

129130
private predicate sinkModelInternal(string row) { any(SinkModelCsvInternal s).row(row) }
130131

131-
/**
132-
* Holds if an experimental source model exists for the given parameters.
133-
* This is only for experimental queries.
134-
*/
135-
extensible predicate extExperimentalSourceModel(
136-
string package, string type, boolean subtypes, string name, string signature, string ext,
137-
string output, string kind, string provenance, string filter
138-
);
139-
140-
/**
141-
* Holds if an experimental sink model exists for the given parameters.
142-
* This is only for experimental queries.
143-
*/
144-
extensible predicate extExperimentalSinkModel(
145-
string package, string type, boolean subtypes, string name, string signature, string ext,
146-
string input, string kind, string provenance, string filter
147-
);
148-
149-
/**
150-
* Holds if an experimental summary model exists for the given parameters.
151-
* This is only for experimental queries.
152-
*/
153-
extensible predicate extExperimentalSummaryModel(
154-
string package, string type, boolean subtypes, string name, string signature, string ext,
155-
string input, string output, string kind, string provenance, string filter
156-
);
157-
158132
/**
159133
* A class for activating additional model rows.
160134
*
@@ -172,7 +146,7 @@ abstract class ActiveExperimentalModels extends string {
172146
string package, string type, boolean subtypes, string name, string signature, string ext,
173147
string output, string kind, string provenance
174148
) {
175-
extExperimentalSourceModel(package, type, subtypes, name, signature, ext, output, kind,
149+
Extensions::experimentalSourceModel(package, type, subtypes, name, signature, ext, output, kind,
176150
provenance, this)
177151
}
178152

@@ -183,7 +157,7 @@ abstract class ActiveExperimentalModels extends string {
183157
string package, string type, boolean subtypes, string name, string signature, string ext,
184158
string output, string kind, string provenance
185159
) {
186-
extExperimentalSinkModel(package, type, subtypes, name, signature, ext, output, kind,
160+
Extensions::experimentalSinkModel(package, type, subtypes, name, signature, ext, output, kind,
187161
provenance, this)
188162
}
189163

@@ -194,19 +168,11 @@ abstract class ActiveExperimentalModels extends string {
194168
string package, string type, boolean subtypes, string name, string signature, string ext,
195169
string input, string output, string kind, string provenance
196170
) {
197-
extExperimentalSummaryModel(package, type, subtypes, name, signature, ext, input, output, kind,
198-
provenance, this)
171+
Extensions::experimentalSummaryModel(package, type, subtypes, name, signature, ext, input,
172+
output, kind, provenance, this)
199173
}
200174
}
201175

202-
/**
203-
* Holds if a source model exists for the given parameters.
204-
*/
205-
extensible predicate extSourceModel(
206-
string package, string type, boolean subtypes, string name, string signature, string ext,
207-
string output, string kind, string provenance
208-
);
209-
210176
/** Holds if a source model exists for the given parameters. */
211177
predicate sourceModel(
212178
string package, string type, boolean subtypes, string name, string signature, string ext,
@@ -226,18 +192,12 @@ predicate sourceModel(
226192
row.splitAt(";", 8) = provenance
227193
)
228194
or
229-
extSourceModel(package, type, subtypes, name, signature, ext, output, kind, provenance)
195+
Extensions::sourceModel(package, type, subtypes, name, signature, ext, output, kind, provenance)
230196
or
231197
any(ActiveExperimentalModels q)
232198
.sourceModel(package, type, subtypes, name, signature, ext, output, kind, provenance)
233199
}
234200

235-
/** Holds if a sink model exists for the given parameters. */
236-
extensible predicate extSinkModel(
237-
string package, string type, boolean subtypes, string name, string signature, string ext,
238-
string input, string kind, string provenance
239-
);
240-
241201
/** Holds if a sink model exists for the given parameters. */
242202
predicate sinkModel(
243203
string package, string type, boolean subtypes, string name, string signature, string ext,
@@ -257,18 +217,12 @@ predicate sinkModel(
257217
row.splitAt(";", 8) = provenance
258218
)
259219
or
260-
extSinkModel(package, type, subtypes, name, signature, ext, input, kind, provenance)
220+
Extensions::sinkModel(package, type, subtypes, name, signature, ext, input, kind, provenance)
261221
or
262222
any(ActiveExperimentalModels q)
263223
.sinkModel(package, type, subtypes, name, signature, ext, input, kind, provenance)
264224
}
265225

266-
/** Holds if a summary model exists for the given parameters. */
267-
extensible predicate extSummaryModel(
268-
string package, string type, boolean subtypes, string name, string signature, string ext,
269-
string input, string output, string kind, string provenance
270-
);
271-
272226
/** Holds if a summary model exists for the given parameters. */
273227
predicate summaryModel(
274228
string package, string type, boolean subtypes, string name, string signature, string ext,
@@ -289,21 +243,15 @@ predicate summaryModel(
289243
row.splitAt(";", 9) = provenance
290244
)
291245
or
292-
extSummaryModel(package, type, subtypes, name, signature, ext, input, output, kind, provenance)
246+
Extensions::summaryModel(package, type, subtypes, name, signature, ext, input, output, kind,
247+
provenance)
293248
or
294249
any(ActiveExperimentalModels q)
295250
.summaryModel(package, type, subtypes, name, signature, ext, input, output, kind, provenance)
296251
}
297252

298253
/** Holds if a neutral model exists indicating there is no flow for the given parameters. */
299-
extensible predicate extNeutralModel(
300-
string package, string type, string name, string signature, string provenance
301-
);
302-
303-
/** Holds if a neutral model exists indicating there is no flow for the given parameters. */
304-
predicate neutralModel(string package, string type, string name, string signature, string provenance) {
305-
extNeutralModel(package, type, name, signature, provenance)
306-
}
254+
predicate neutralModel = Extensions::neutralModel/5;
307255

308256
private predicate relevantPackage(string package) {
309257
sourceModel(package, _, _, _, _, _, _, _, _) or
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* This module provides extensible predicates for defining MaD models.
3+
*/
4+
5+
/**
6+
* Holds if a source model exists for the given parameters.
7+
*/
8+
extensible predicate sourceModel(
9+
string package, string type, boolean subtypes, string name, string signature, string ext,
10+
string output, string kind, string provenance
11+
);
12+
13+
/**
14+
* Holds if a sink model exists for the given parameters.
15+
*/
16+
extensible predicate sinkModel(
17+
string package, string type, boolean subtypes, string name, string signature, string ext,
18+
string input, string kind, string provenance
19+
);
20+
21+
/**
22+
* Holds if a summary model exists for the given parameters.
23+
*/
24+
extensible predicate summaryModel(
25+
string package, string type, boolean subtypes, string name, string signature, string ext,
26+
string input, string output, string kind, string provenance
27+
);
28+
29+
/**
30+
* Holds if a neutral model exists indicating there is no flow for the given parameters.
31+
*/
32+
extensible predicate neutralModel(
33+
string package, string type, string name, string signature, string provenance
34+
);
35+
36+
/**
37+
* Holds if an experimental source model exists for the given parameters.
38+
* This is only for experimental queries.
39+
*/
40+
extensible predicate experimentalSourceModel(
41+
string package, string type, boolean subtypes, string name, string signature, string ext,
42+
string output, string kind, string provenance, string filter
43+
);
44+
45+
/**
46+
* Holds if an experimental sink model exists for the given parameters.
47+
* This is only for experimental queries.
48+
*/
49+
extensible predicate experimentalSinkModel(
50+
string package, string type, boolean subtypes, string name, string signature, string ext,
51+
string input, string kind, string provenance, string filter
52+
);
53+
54+
/**
55+
* Holds if an experimental summary model exists for the given parameters.
56+
* This is only for experimental queries.
57+
*/
58+
extensible predicate experimentalSummaryModel(
59+
string package, string type, boolean subtypes, string name, string signature, string ext,
60+
string input, string output, string kind, string provenance, string filter
61+
);

0 commit comments

Comments
 (0)