Skip to content

Commit 0245cd8

Browse files
Copilotgeoffw0
andcommitted
Remove deprecated Rust dataflow predicates and associated classes
Co-authored-by: geoffw0 <[email protected]>
1 parent 69d50e1 commit 0245cd8

File tree

2 files changed

+3
-132
lines changed

2 files changed

+3
-132
lines changed

rust/ql/lib/codeql/rust/dataflow/internal/ModelsAsData.qll

Lines changed: 3 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,7 @@ private import codeql.rust.dataflow.FlowSource
4949
private import codeql.rust.dataflow.FlowSink
5050
private import codeql.rust.elements.internal.CallExprBaseImpl::Impl as CallExprBaseImpl
5151

52-
/**
53-
* DEPRECATED: Do not use.
54-
*
55-
* Holds if in a call to the function with canonical path `path`, defined in the
56-
* crate `crate`, the value referred to by `output` is a flow source of the given
57-
* `kind`.
58-
*
59-
* `output = "ReturnValue"` simply means the result of the call itself.
60-
*
61-
* For more information on the `kind` parameter, see
62-
* https://github.com/github/codeql/blob/main/docs/codeql/reusables/threat-model-description.rst.
63-
*/
64-
extensible predicate sourceModelDeprecated(
65-
string crate, string path, string output, string kind, string provenance,
66-
QlBuiltins::ExtensionId madId
67-
);
52+
6853

6954
/**
7055
* Holds if in a call to the function with canonical path `path`, the value referred
@@ -79,23 +64,7 @@ extensible predicate sourceModel(
7964
string path, string output, string kind, string provenance, QlBuiltins::ExtensionId madId
8065
);
8166

82-
/**
83-
* DEPRECATED: Do not use.
84-
*
85-
* Holds if in a call to the function with canonical path `path`, defined in the
86-
* crate `crate`, the value referred to by `input` is a flow sink of the given
87-
* `kind`.
88-
*
89-
* For example, `input = Argument[0]` means the first argument of the call.
90-
*
91-
* The following kinds are supported:
92-
*
93-
* - `sql-injection`: a flow sink for SQL injection.
94-
*/
95-
extensible predicate sinkModelDeprecated(
96-
string crate, string path, string input, string kind, string provenance,
97-
QlBuiltins::ExtensionId madId
98-
);
67+
9968

10069
/**
10170
* Holds if in a call to the function with canonical path `path`, the value referred
@@ -111,20 +80,7 @@ extensible predicate sinkModel(
11180
string path, string input, string kind, string provenance, QlBuiltins::ExtensionId madId
11281
);
11382

114-
/**
115-
* DEPRECATED: Do not use.
116-
*
117-
* Holds if in a call to the function with canonical path `path`, defined in the
118-
* crate `crate`, the value referred to by `input` can flow to the value referred
119-
* to by `output`.
120-
*
121-
* `kind` should be either `value` or `taint`, for value-preserving or taint-preserving
122-
* steps, respectively.
123-
*/
124-
extensible predicate summaryModelDeprecated(
125-
string crate, string path, string input, string output, string kind, string provenance,
126-
QlBuiltins::ExtensionId madId
127-
);
83+
12884

12985
/**
13086
* Holds if in a call to the function with canonical path `path`, the value referred
@@ -144,66 +100,23 @@ extensible predicate summaryModel(
144100
* This predicate should only be used in tests.
145101
*/
146102
predicate interpretModelForTest(QlBuiltins::ExtensionId madId, string model) {
147-
exists(string crate, string path, string output, string kind |
148-
sourceModelDeprecated(crate, path, output, kind, _, madId) and
149-
model = "Source: " + crate + "; " + path + "; " + output + "; " + kind
150-
)
151-
or
152103
exists(string path, string output, string kind |
153104
sourceModel(path, output, kind, _, madId) and
154105
model = "Source: " + path + "; " + output + "; " + kind
155106
)
156107
or
157-
exists(string crate, string path, string input, string kind |
158-
sinkModelDeprecated(crate, path, input, kind, _, madId) and
159-
model = "Sink: " + crate + "; " + path + "; " + input + "; " + kind
160-
)
161-
or
162108
exists(string path, string input, string kind |
163109
sinkModel(path, input, kind, _, madId) and
164110
model = "Sink: " + path + "; " + input + "; " + kind
165111
)
166112
or
167-
exists(string type, string path, string input, string output, string kind |
168-
summaryModelDeprecated(type, path, input, output, kind, _, madId) and
169-
model = "Summary: " + type + "; " + path + "; " + input + "; " + output + "; " + kind
170-
)
171-
or
172113
exists(string path, string input, string output, string kind |
173114
summaryModel(path, input, output, kind, _, madId) and
174115
model = "Summary: " + path + "; " + input + "; " + output + "; " + kind
175116
)
176117
}
177118

178-
private class SummarizedCallableFromModelDeprecated extends SummarizedCallable::Range {
179-
private string crate;
180-
private string path;
181-
182-
SummarizedCallableFromModelDeprecated() {
183-
summaryModelDeprecated(crate, path, _, _, _, _, _) and
184-
exists(CallExprBase call, Resolvable r |
185-
call.getStaticTarget() = this and
186-
r = CallExprBaseImpl::getCallResolvable(call) and
187-
r.getResolvedPath() = path and
188-
r.getResolvedCrateOrigin() = crate
189-
)
190-
}
191119

192-
override predicate propagatesFlow(
193-
string input, string output, boolean preservesValue, string model
194-
) {
195-
exists(string kind, QlBuiltins::ExtensionId madId |
196-
summaryModelDeprecated(crate, path, input, output, kind, _, madId) and
197-
model = "MaD:" + madId.toString()
198-
|
199-
kind = "value" and
200-
preservesValue = true
201-
or
202-
kind = "taint" and
203-
preservesValue = false
204-
)
205-
}
206-
}
207120

208121
private class SummarizedCallableFromModel extends SummarizedCallable::Range {
209122
private string path;
@@ -233,22 +146,7 @@ private class SummarizedCallableFromModel extends SummarizedCallable::Range {
233146
}
234147
}
235148

236-
private class FlowSourceFromModelDeprecated extends FlowSource::Range {
237-
private string crate;
238-
private string path;
239-
240-
FlowSourceFromModelDeprecated() {
241-
sourceModelDeprecated(crate, path, _, _, _, _) and
242-
this.callResolvesTo(crate, path)
243-
}
244149

245-
override predicate isSource(string output, string kind, Provenance provenance, string model) {
246-
exists(QlBuiltins::ExtensionId madId |
247-
sourceModelDeprecated(crate, path, output, kind, provenance, madId) and
248-
model = "MaD:" + madId.toString()
249-
)
250-
}
251-
}
252150

253151
private class FlowSourceFromModel extends FlowSource::Range {
254152
private string path;
@@ -266,22 +164,7 @@ private class FlowSourceFromModel extends FlowSource::Range {
266164
}
267165
}
268166

269-
private class FlowSinkFromModelDeprecated extends FlowSink::Range {
270-
private string crate;
271-
private string path;
272-
273-
FlowSinkFromModelDeprecated() {
274-
sinkModelDeprecated(crate, path, _, _, _, _) and
275-
this.callResolvesTo(crate, path)
276-
}
277167

278-
override predicate isSink(string input, string kind, Provenance provenance, string model) {
279-
exists(QlBuiltins::ExtensionId madId |
280-
sinkModelDeprecated(crate, path, input, kind, provenance, madId) and
281-
model = "MaD:" + madId.toString()
282-
)
283-
}
284-
}
285168

286169
private class FlowSinkFromModel extends FlowSink::Range {
287170
private string path;

rust/ql/lib/codeql/rust/dataflow/internal/empty.model.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,16 @@
11
extensions:
22
# Make sure that the extensible model predicates have at least one definition
33
# to avoid errors about undefined extensionals.
4-
- addsTo:
5-
pack: codeql/rust-all
6-
extensible: sourceModelDeprecated
7-
data: []
84
- addsTo:
95
pack: codeql/rust-all
106
extensible: sourceModel
117
data: []
128

13-
- addsTo:
14-
pack: codeql/rust-all
15-
extensible: sinkModelDeprecated
16-
data: []
179
- addsTo:
1810
pack: codeql/rust-all
1911
extensible: sinkModel
2012
data: []
2113

22-
- addsTo:
23-
pack: codeql/rust-all
24-
extensible: summaryModelDeprecated
25-
data: []
2614
- addsTo:
2715
pack: codeql/rust-all
2816
extensible: summaryModel

0 commit comments

Comments
 (0)