Skip to content

Commit 16cd148

Browse files
authored
Merge pull request #11711 from michaelnebel/externalflowcleanup
C#/Java: Delete deprecated ModelCsv classes and related predicates.
2 parents 1729319 + 2034b00 commit 16cd148

File tree

2 files changed

+5
-271
lines changed

2 files changed

+5
-271
lines changed

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

Lines changed: 4 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -91,121 +91,14 @@ private import internal.FlowSummaryImpl::Public
9191
private import internal.FlowSummaryImpl::Private::External
9292
private import internal.FlowSummaryImplSpecific
9393

94-
/**
95-
* DEPRECATED: Define source models as data extensions instead.
96-
*
97-
* A unit class for adding additional source model rows.
98-
*
99-
* Extend this class to add additional source definitions.
100-
*/
101-
deprecated class SourceModelCsv = SourceModelCsvInternal;
102-
103-
private class SourceModelCsvInternal extends Unit {
104-
/** Holds if `row` specifies a source definition. */
105-
abstract predicate row(string row);
106-
}
107-
108-
/**
109-
* DEPRECATED: Define sink models as data extensions instead.
110-
*
111-
* A unit class for adding additional sink model rows.
112-
*
113-
* Extend this class to add additional sink definitions.
114-
*/
115-
deprecated class SinkModelCsv = SinkModelCsvInternal;
116-
117-
private class SinkModelCsvInternal extends Unit {
118-
/** Holds if `row` specifies a sink definition. */
119-
abstract predicate row(string row);
120-
}
121-
122-
/**
123-
* DEPRECATED: Define summary models as data extensions instead.
124-
*
125-
* A unit class for adding additional summary model rows.
126-
*
127-
* Extend this class to add additional flow summary definitions.
128-
*/
129-
deprecated class SummaryModelCsv = SummaryModelCsvInternal;
130-
131-
private class SummaryModelCsvInternal extends Unit {
132-
/** Holds if `row` specifies a summary definition. */
133-
abstract predicate row(string row);
134-
}
135-
136-
private predicate sourceModelInternal(string row) { any(SourceModelCsvInternal s).row(row) }
137-
138-
private predicate summaryModelInternal(string row) { any(SummaryModelCsvInternal s).row(row) }
139-
140-
private predicate sinkModelInternal(string row) { any(SinkModelCsvInternal s).row(row) }
141-
14294
/** Holds if a source model exists for the given parameters. */
143-
predicate sourceModel(
144-
string namespace, string type, boolean subtypes, string name, string signature, string ext,
145-
string output, string kind, string provenance
146-
) {
147-
exists(string row |
148-
sourceModelInternal(row) and
149-
row.splitAt(";", 0) = namespace and
150-
row.splitAt(";", 1) = type and
151-
row.splitAt(";", 2) = subtypes.toString() and
152-
subtypes = [true, false] and
153-
row.splitAt(";", 3) = name and
154-
row.splitAt(";", 4) = signature and
155-
row.splitAt(";", 5) = ext and
156-
row.splitAt(";", 6) = output and
157-
row.splitAt(";", 7) = kind and
158-
row.splitAt(";", 8) = provenance
159-
)
160-
or
161-
Extensions::sourceModel(namespace, type, subtypes, name, signature, ext, output, kind, provenance)
162-
}
95+
predicate sourceModel = Extensions::sourceModel/9;
16396

16497
/** Holds if a sink model exists for the given parameters. */
165-
predicate sinkModel(
166-
string namespace, string type, boolean subtypes, string name, string signature, string ext,
167-
string input, string kind, string provenance
168-
) {
169-
exists(string row |
170-
sinkModelInternal(row) and
171-
row.splitAt(";", 0) = namespace and
172-
row.splitAt(";", 1) = type and
173-
row.splitAt(";", 2) = subtypes.toString() and
174-
subtypes = [true, false] and
175-
row.splitAt(";", 3) = name and
176-
row.splitAt(";", 4) = signature and
177-
row.splitAt(";", 5) = ext and
178-
row.splitAt(";", 6) = input and
179-
row.splitAt(";", 7) = kind and
180-
row.splitAt(";", 8) = provenance
181-
)
182-
or
183-
Extensions::sinkModel(namespace, type, subtypes, name, signature, ext, input, kind, provenance)
184-
}
98+
predicate sinkModel = Extensions::sinkModel/9;
18599

186100
/** Holds if a summary model exists for the given parameters. */
187-
predicate summaryModel(
188-
string namespace, string type, boolean subtypes, string name, string signature, string ext,
189-
string input, string output, string kind, string provenance
190-
) {
191-
exists(string row |
192-
summaryModelInternal(row) and
193-
row.splitAt(";", 0) = namespace and
194-
row.splitAt(";", 1) = type and
195-
row.splitAt(";", 2) = subtypes.toString() and
196-
subtypes = [true, false] and
197-
row.splitAt(";", 3) = name and
198-
row.splitAt(";", 4) = signature and
199-
row.splitAt(";", 5) = ext and
200-
row.splitAt(";", 6) = input and
201-
row.splitAt(";", 7) = output and
202-
row.splitAt(";", 8) = kind and
203-
row.splitAt(";", 9) = provenance
204-
)
205-
or
206-
Extensions::summaryModel(namespace, type, subtypes, name, signature, ext, input, output, kind,
207-
provenance)
208-
}
101+
predicate summaryModel = Extensions::summaryModel/10;
209102

210103
/** Holds if a model exists indicating there is no flow for the given parameters. */
211104
predicate neutralModel = Extensions::neutralModel/5;
@@ -316,40 +209,6 @@ module ModelValidation {
316209
)
317210
}
318211

319-
private string getInvalidModelSubtype() {
320-
exists(string pred, string row |
321-
sourceModelInternal(row) and pred = "source"
322-
or
323-
sinkModelInternal(row) and pred = "sink"
324-
or
325-
summaryModelInternal(row) and pred = "summary"
326-
|
327-
exists(string b |
328-
b = row.splitAt(";", 2) and
329-
not b = ["true", "false"] and
330-
result = "Invalid boolean \"" + b + "\" in " + pred + " model."
331-
)
332-
)
333-
}
334-
335-
private string getInvalidModelColumnCount() {
336-
exists(string pred, string row, int expect |
337-
sourceModelInternal(row) and expect = 9 and pred = "source"
338-
or
339-
sinkModelInternal(row) and expect = 9 and pred = "sink"
340-
or
341-
summaryModelInternal(row) and expect = 10 and pred = "summary"
342-
|
343-
exists(int cols |
344-
cols = 1 + max(int n | exists(row.splitAt(";", n))) and
345-
cols != expect and
346-
result =
347-
"Wrong number of columns in " + pred + " model row, expected " + expect + ", got " + cols +
348-
" in " + row + "."
349-
)
350-
)
351-
}
352-
353212
private string getInvalidModelSignature() {
354213
exists(
355214
string pred, string namespace, string type, string name, string signature, string ext,
@@ -391,7 +250,7 @@ module ModelValidation {
391250
msg =
392251
[
393252
getInvalidModelSignature(), getInvalidModelInput(), getInvalidModelOutput(),
394-
getInvalidModelSubtype(), getInvalidModelColumnCount(), getInvalidModelKind()
253+
getInvalidModelKind()
395254
]
396255
}
397256
}

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

Lines changed: 1 addition & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -81,54 +81,6 @@ private import internal.AccessPathSyntax
8181
private import ExternalFlowExtensions as Extensions
8282
private import FlowSummary
8383

84-
/**
85-
* DEPRECATED: Define source models as data extensions instead.
86-
*
87-
* A unit class for adding additional source model rows.
88-
*
89-
* Extend this class to add additional source definitions.
90-
*/
91-
deprecated class SourceModelCsv = SourceModelCsvInternal;
92-
93-
private class SourceModelCsvInternal extends Unit {
94-
/** Holds if `row` specifies a source definition. */
95-
abstract predicate row(string row);
96-
}
97-
98-
/**
99-
* DEPRECATED: Define sink models as data extensions instead.
100-
*
101-
* A unit class for adding additional sink model rows.
102-
*
103-
* Extend this class to add additional sink definitions.
104-
*/
105-
deprecated class SinkModelCsv = SinkModelCsvInternal;
106-
107-
private class SinkModelCsvInternal extends Unit {
108-
/** Holds if `row` specifies a sink definition. */
109-
abstract predicate row(string row);
110-
}
111-
112-
/**
113-
* DEPRECATED: Define summary models as data extensions instead.
114-
*
115-
* A unit class for adding additional summary model rows.
116-
*
117-
* Extend this class to add additional flow summary definitions.
118-
*/
119-
deprecated class SummaryModelCsv = SummaryModelCsvInternal;
120-
121-
private class SummaryModelCsvInternal extends Unit {
122-
/** Holds if `row` specifies a summary definition. */
123-
abstract predicate row(string row);
124-
}
125-
126-
private predicate sourceModelInternal(string row) { any(SourceModelCsvInternal s).row(row) }
127-
128-
private predicate summaryModelInternal(string row) { any(SummaryModelCsvInternal s).row(row) }
129-
130-
private predicate sinkModelInternal(string row) { any(SinkModelCsvInternal s).row(row) }
131-
13284
/**
13385
* A class for activating additional model rows.
13486
*
@@ -178,20 +130,6 @@ predicate sourceModel(
178130
string package, string type, boolean subtypes, string name, string signature, string ext,
179131
string output, string kind, string provenance
180132
) {
181-
exists(string row |
182-
sourceModelInternal(row) and
183-
row.splitAt(";", 0) = package and
184-
row.splitAt(";", 1) = type and
185-
row.splitAt(";", 2) = subtypes.toString() and
186-
subtypes = [true, false] and
187-
row.splitAt(";", 3) = name and
188-
row.splitAt(";", 4) = signature and
189-
row.splitAt(";", 5) = ext and
190-
row.splitAt(";", 6) = output and
191-
row.splitAt(";", 7) = kind and
192-
row.splitAt(";", 8) = provenance
193-
)
194-
or
195133
Extensions::sourceModel(package, type, subtypes, name, signature, ext, output, kind, provenance)
196134
or
197135
any(ActiveExperimentalModels q)
@@ -203,20 +141,6 @@ predicate sinkModel(
203141
string package, string type, boolean subtypes, string name, string signature, string ext,
204142
string input, string kind, string provenance
205143
) {
206-
exists(string row |
207-
sinkModelInternal(row) and
208-
row.splitAt(";", 0) = package and
209-
row.splitAt(";", 1) = type and
210-
row.splitAt(";", 2) = subtypes.toString() and
211-
subtypes = [true, false] and
212-
row.splitAt(";", 3) = name and
213-
row.splitAt(";", 4) = signature and
214-
row.splitAt(";", 5) = ext and
215-
row.splitAt(";", 6) = input and
216-
row.splitAt(";", 7) = kind and
217-
row.splitAt(";", 8) = provenance
218-
)
219-
or
220144
Extensions::sinkModel(package, type, subtypes, name, signature, ext, input, kind, provenance)
221145
or
222146
any(ActiveExperimentalModels q)
@@ -228,21 +152,6 @@ predicate summaryModel(
228152
string package, string type, boolean subtypes, string name, string signature, string ext,
229153
string input, string output, string kind, string provenance
230154
) {
231-
exists(string row |
232-
summaryModelInternal(row) and
233-
row.splitAt(";", 0) = package and
234-
row.splitAt(";", 1) = type and
235-
row.splitAt(";", 2) = subtypes.toString() and
236-
subtypes = [true, false] and
237-
row.splitAt(";", 3) = name and
238-
row.splitAt(";", 4) = signature and
239-
row.splitAt(";", 5) = ext and
240-
row.splitAt(";", 6) = input and
241-
row.splitAt(";", 7) = output and
242-
row.splitAt(";", 8) = kind and
243-
row.splitAt(";", 9) = provenance
244-
)
245-
or
246155
Extensions::summaryModel(package, type, subtypes, name, signature, ext, input, output, kind,
247156
provenance)
248157
or
@@ -368,40 +277,6 @@ module ModelValidation {
368277
)
369278
}
370279

371-
private string getInvalidModelSubtype() {
372-
exists(string pred, string row |
373-
sourceModelInternal(row) and pred = "source"
374-
or
375-
sinkModelInternal(row) and pred = "sink"
376-
or
377-
summaryModelInternal(row) and pred = "summary"
378-
|
379-
exists(string b |
380-
b = row.splitAt(";", 2) and
381-
not b = ["true", "false"] and
382-
result = "Invalid boolean \"" + b + "\" in " + pred + " model."
383-
)
384-
)
385-
}
386-
387-
private string getInvalidModelColumnCount() {
388-
exists(string pred, string row, int expect |
389-
sourceModelInternal(row) and expect = 9 and pred = "source"
390-
or
391-
sinkModelInternal(row) and expect = 9 and pred = "sink"
392-
or
393-
summaryModelInternal(row) and expect = 10 and pred = "summary"
394-
|
395-
exists(int cols |
396-
cols = 1 + max(int n | exists(row.splitAt(";", n))) and
397-
cols != expect and
398-
result =
399-
"Wrong number of columns in " + pred + " model row, expected " + expect + ", got " + cols +
400-
" in " + row + "."
401-
)
402-
)
403-
}
404-
405280
private string getInvalidModelSignature() {
406281
exists(
407282
string pred, string package, string type, string name, string signature, string ext,
@@ -443,7 +318,7 @@ module ModelValidation {
443318
msg =
444319
[
445320
getInvalidModelSignature(), getInvalidModelInput(), getInvalidModelOutput(),
446-
getInvalidModelSubtype(), getInvalidModelColumnCount(), getInvalidModelKind()
321+
getInvalidModelKind()
447322
]
448323
}
449324
}

0 commit comments

Comments
 (0)