Skip to content

Commit c35598a

Browse files
committed
Rust: Add Deprecated suffix to existing MaD extensible predicates
1 parent eff1fba commit c35598a

File tree

100 files changed

+186
-201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+186
-201
lines changed

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,3 @@ private module Input implements InputSig<Location, RustDataFlow> {
4444

4545
import MakeConsistency<Location, RustDataFlow, RustTaintTracking, Input>
4646
private import codeql.rust.dataflow.internal.ModelsAsData
47-
48-
query predicate missingMadSummaryCanonicalPath(string crate, string path, Addressable a) {
49-
summaryModel(crate, path, _, _, _, _, _) and
50-
a.getCrateOrigin() = crate and
51-
a.getExtendedCanonicalPath() = path and
52-
not exists(a.getCanonicalPath())
53-
}
54-
55-
query predicate missingMadSourceCanonicalPath(string crate, string path, Addressable a) {
56-
sourceModel(crate, path, _, _, _, _) and
57-
a.getCrateOrigin() = crate and
58-
a.getExtendedCanonicalPath() = path and
59-
not exists(a.getCanonicalPath())
60-
}
61-
62-
query predicate missingMadSinkCanonicalPath(string crate, string path, Addressable a) {
63-
sinkModel(crate, path, _, _, _, _) and
64-
a.getCrateOrigin() = crate and
65-
a.getExtendedCanonicalPath() = path and
66-
not exists(a.getCanonicalPath())
67-
}

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

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ private import codeql.rust.dataflow.FlowSink
5050
private import codeql.rust.elements.internal.CallExprBaseImpl::Impl as CallExprBaseImpl
5151

5252
/**
53+
* DEPRECATED: Do not use.
54+
*
5355
* Holds if in a call to the function with canonical path `path`, defined in the
5456
* crate `crate`, the value referred to by `output` is a flow source of the given
5557
* `kind`.
@@ -59,12 +61,14 @@ private import codeql.rust.elements.internal.CallExprBaseImpl::Impl as CallExprB
5961
* For more information on the `kind` parameter, see
6062
* https://github.com/github/codeql/blob/main/docs/codeql/reusables/threat-model-description.rst.
6163
*/
62-
extensible predicate sourceModel(
64+
extensible predicate sourceModelDeprecated(
6365
string crate, string path, string output, string kind, string provenance,
6466
QlBuiltins::ExtensionId madId
6567
);
6668

6769
/**
70+
* DEPRECATED: Do not use.
71+
*
6872
* Holds if in a call to the function with canonical path `path`, defined in the
6973
* crate `crate`, the value referred to by `input` is a flow sink of the given
7074
* `kind`.
@@ -75,20 +79,22 @@ extensible predicate sourceModel(
7579
*
7680
* - `sql-injection`: a flow sink for SQL injection.
7781
*/
78-
extensible predicate sinkModel(
82+
extensible predicate sinkModelDeprecated(
7983
string crate, string path, string input, string kind, string provenance,
8084
QlBuiltins::ExtensionId madId
8185
);
8286

8387
/**
88+
* DEPRECATED: Do not use.
89+
*
8490
* Holds if in a call to the function with canonical path `path`, defined in the
8591
* crate `crate`, the value referred to by `input` can flow to the value referred
8692
* to by `output`.
8793
*
8894
* `kind` should be either `value` or `taint`, for value-preserving or taint-preserving
8995
* steps, respectively.
9096
*/
91-
extensible predicate summaryModel(
97+
extensible predicate summaryModelDeprecated(
9298
string crate, string path, string input, string output, string kind, string provenance,
9399
QlBuiltins::ExtensionId madId
94100
);
@@ -100,27 +106,27 @@ extensible predicate summaryModel(
100106
*/
101107
predicate interpretModelForTest(QlBuiltins::ExtensionId madId, string model) {
102108
exists(string crate, string path, string output, string kind |
103-
sourceModel(crate, path, kind, output, _, madId) and
109+
sourceModelDeprecated(crate, path, kind, output, _, madId) and
104110
model = "Source: " + crate + "; " + path + "; " + output + "; " + kind
105111
)
106112
or
107113
exists(string crate, string path, string input, string kind |
108-
sinkModel(crate, path, kind, input, _, madId) and
114+
sinkModelDeprecated(crate, path, kind, input, _, madId) and
109115
model = "Sink: " + crate + "; " + path + "; " + input + "; " + kind
110116
)
111117
or
112118
exists(string type, string path, string input, string output, string kind |
113-
summaryModel(type, path, input, output, kind, _, madId) and
119+
summaryModelDeprecated(type, path, input, output, kind, _, madId) and
114120
model = "Summary: " + type + "; " + path + "; " + input + "; " + output + "; " + kind
115121
)
116122
}
117123

118-
private class SummarizedCallableFromModel extends SummarizedCallable::Range {
124+
private class SummarizedCallableFromModelDeprecated extends SummarizedCallable::Range {
119125
private string crate;
120126
private string path;
121127

122-
SummarizedCallableFromModel() {
123-
summaryModel(crate, path, _, _, _, _, _) and
128+
SummarizedCallableFromModelDeprecated() {
129+
summaryModelDeprecated(crate, path, _, _, _, _, _) and
124130
exists(CallExprBase call, Resolvable r |
125131
call.getStaticTarget() = this and
126132
r = CallExprBaseImpl::getCallResolvable(call) and
@@ -133,7 +139,7 @@ private class SummarizedCallableFromModel extends SummarizedCallable::Range {
133139
string input, string output, boolean preservesValue, string model
134140
) {
135141
exists(string kind, QlBuiltins::ExtensionId madId |
136-
summaryModel(crate, path, input, output, kind, _, madId) and
142+
summaryModelDeprecated(crate, path, input, output, kind, _, madId) and
137143
model = "MaD:" + madId.toString()
138144
|
139145
kind = "value" and
@@ -145,35 +151,35 @@ private class SummarizedCallableFromModel extends SummarizedCallable::Range {
145151
}
146152
}
147153

148-
private class FlowSourceFromModel extends FlowSource::Range {
154+
private class FlowSourceFromModelDeprecated extends FlowSource::Range {
149155
private string crate;
150156
private string path;
151157

152-
FlowSourceFromModel() {
153-
sourceModel(crate, path, _, _, _, _) and
158+
FlowSourceFromModelDeprecated() {
159+
sourceModelDeprecated(crate, path, _, _, _, _) and
154160
this.callResolvesTo(crate, path)
155161
}
156162

157163
override predicate isSource(string output, string kind, Provenance provenance, string model) {
158164
exists(QlBuiltins::ExtensionId madId |
159-
sourceModel(crate, path, output, kind, provenance, madId) and
165+
sourceModelDeprecated(crate, path, output, kind, provenance, madId) and
160166
model = "MaD:" + madId.toString()
161167
)
162168
}
163169
}
164170

165-
private class FlowSinkFromModel extends FlowSink::Range {
171+
private class FlowSinkFromModelDeprecated extends FlowSink::Range {
166172
private string crate;
167173
private string path;
168174

169-
FlowSinkFromModel() {
170-
sinkModel(crate, path, _, _, _, _) and
175+
FlowSinkFromModelDeprecated() {
176+
sinkModelDeprecated(crate, path, _, _, _, _) and
171177
this.callResolvesTo(crate, path)
172178
}
173179

174180
override predicate isSink(string input, string kind, Provenance provenance, string model) {
175181
exists(QlBuiltins::ExtensionId madId |
176-
sinkModel(crate, path, input, kind, provenance, madId) and
182+
sinkModelDeprecated(crate, path, input, kind, provenance, madId) and
177183
model = "MaD:" + madId.toString()
178184
)
179185
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ extensions:
33
# to avoid errors about undefined extensionals.
44
- addsTo:
55
pack: codeql/rust-all
6-
extensible: sourceModel
6+
extensible: sourceModelDeprecated
77
data: []
88

99
- addsTo:
1010
pack: codeql/rust-all
11-
extensible: sinkModel
11+
extensible: sinkModelDeprecated
1212
data: []
1313

1414
- addsTo:
1515
pack: codeql/rust-all
16-
extensible: summaryModel
16+
extensible: summaryModelDeprecated
1717
data: []
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
extensions:
22
- addsTo:
33
pack: codeql/rust-all
4-
extensible: sourceModel
4+
extensible: sourceModelDeprecated
55
data:
66
- ["repo:https://github.com/async-rs/async-std:async-std", "<crate::net::tcp::stream::TcpStream>::connect", "ReturnValue.Future.Field[core::result::Result::Ok(0)]", "remote", "manual"]

rust/ql/lib/codeql/rust/frameworks/futures.model.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
extensions:
22
- addsTo:
33
pack: codeql/rust-all
4-
extensible: summaryModel
4+
extensible: summaryModelDeprecated
55
data:
66
- ["repo:https://github.com/rust-lang/futures-rs:futures-executor", "crate::local_pool::block_on", "Argument[0]", "ReturnValue", "value", "manual"]
77
- ["repo:https://github.com/rust-lang/futures-rs:futures-util", "<crate::io::buf_reader::BufReader>::new", "Argument[0]", "ReturnValue", "taint", "manual"]

rust/ql/lib/codeql/rust/frameworks/http.model.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
extensions:
22
- addsTo:
33
pack: codeql/rust-all
4-
extensible: sourceModel
4+
extensible: sourceModelDeprecated
55
data:
66
- ["repo:https://github.com/hyperium/hyper:hyper", "<crate::client::conn::http1::SendRequest>::send_request", "ReturnValue.Future.Field[core::result::Result::Ok(0)]", "remote", "manual"]
77
- ["repo:https://github.com/hyperium/hyper:hyper", "<crate::client::conn::http2::SendRequest>::send_request", "ReturnValue.Future.Field[core::result::Result::Ok(0)]", "remote", "manual"]

rust/ql/lib/codeql/rust/frameworks/libc.model.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
extensions:
22
- addsTo:
33
pack: codeql/rust-all
4-
extensible: sourceModel
4+
extensible: sourceModelDeprecated
55
data:
66
- ["repo:https://github.com/rust-lang/libc:libc", "::free", "Argument[0]", "pointer-invalidate", "manual"]
77
- addsTo:
88
pack: codeql/rust-all
9-
extensible: sinkModel
9+
extensible: sinkModelDeprecated
1010
data:
1111
- ["repo:https://github.com/rust-lang/libc:libc", "::malloc", "Argument[0]", "alloc-size", "manual"]
1212
- ["repo:https://github.com/rust-lang/libc:libc", "::aligned_alloc", "Argument[1]", "alloc-size", "manual"]

rust/ql/lib/codeql/rust/frameworks/log.model.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
extensions:
22
- addsTo:
33
pack: codeql/rust-all
4-
extensible: sinkModel
4+
extensible: sinkModelDeprecated
55
data:
66
- ["repo:https://github.com/rust-lang/log:log", "crate::__private_api::log", "Argument[0]", "log-injection", "manual"] # logger / args (pre v0.4.27)
77
- ["repo:https://github.com/rust-lang/log:log", "crate::__private_api::log", "Argument[1]", "log-injection", "manual"] # args / level (pre v0.4.27)

rust/ql/lib/codeql/rust/frameworks/postgres.model.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
extensions:
22
- addsTo:
33
pack: codeql/rust-all
4-
extensible: sinkModel
4+
extensible: sinkModelDeprecated
55
data:
66
- ["repo:https://github.com/sfackler/rust-postgres:postgres", "<crate::client::Client>::execute", "Argument[0]", "sql-injection", "manual"]
77
- ["repo:https://github.com/sfackler/rust-postgres:postgres", "<crate::client::Client>::batch_execute", "Argument[0]", "sql-injection", "manual"]

rust/ql/lib/codeql/rust/frameworks/regex.model.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
extensions:
33
- addsTo:
44
pack: codeql/rust-all
5-
extensible: summaryModel
5+
extensible: summaryModelDeprecated
66
data:
77
- ["repo:https://github.com/rust-lang/regex:regex", "crate::escape", "Argument[0].Reference", "ReturnValue", "taint", "manual"]

0 commit comments

Comments
 (0)