Skip to content

Commit d1ef2b5

Browse files
committed
Rust: Model futures::executor::block_on.
1 parent 7bd1c4d commit d1ef2b5

File tree

6 files changed

+26
-5
lines changed

6 files changed

+26
-5
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
extensions:
2+
- addsTo:
3+
pack: codeql/rust-all
4+
extensible: summaryModel
5+
data:
6+
- ["repo:https://github.com/rust-lang/futures-rs:futures-executor", "crate::local_pool::block_on", "Argument[0]", "ReturnValue", "value", "manual"]

rust/ql/test/library-tests/dataflow/global/inline-flow.expected

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
models
2+
| 1 | Summary: repo:https://github.com/rust-lang/futures-rs:futures-executor; crate::local_pool::block_on; Argument[0]; ReturnValue; value |
23
edges
34
| main.rs:12:28:14:1 | { ... } | main.rs:17:13:17:23 | get_data(...) | provenance | |
45
| main.rs:13:5:13:13 | source(...) | main.rs:12:28:14:1 | { ... } | provenance | |
@@ -71,10 +72,15 @@ edges
7172
| main.rs:161:9:161:9 | d [MyInt] | main.rs:162:10:162:10 | d [MyInt] | provenance | |
7273
| main.rs:161:13:161:20 | a.add(...) [MyInt] | main.rs:161:9:161:9 | d [MyInt] | provenance | |
7374
| main.rs:162:10:162:10 | d [MyInt] | main.rs:162:10:162:16 | d.value | provenance | |
75+
| main.rs:200:32:204:1 | { ... } | main.rs:219:41:219:54 | async_source(...) | provenance | |
76+
| main.rs:201:9:201:9 | a | main.rs:200:32:204:1 | { ... } | provenance | |
7477
| main.rs:201:9:201:9 | a | main.rs:202:10:202:10 | a | provenance | |
7578
| main.rs:201:13:201:21 | source(...) | main.rs:201:9:201:9 | a | provenance | |
7679
| main.rs:211:13:211:13 | c | main.rs:212:14:212:14 | c | provenance | |
7780
| main.rs:211:17:211:25 | source(...) | main.rs:211:13:211:13 | c | provenance | |
81+
| main.rs:219:9:219:9 | a | main.rs:220:10:220:10 | a | provenance | |
82+
| main.rs:219:13:219:55 | ...::block_on(...) | main.rs:219:9:219:9 | a | provenance | |
83+
| main.rs:219:41:219:54 | async_source(...) | main.rs:219:13:219:55 | ...::block_on(...) | provenance | MaD:1 |
7884
nodes
7985
| main.rs:12:28:14:1 | { ... } | semmle.label | { ... } |
8086
| main.rs:13:5:13:13 | source(...) | semmle.label | source(...) |
@@ -156,12 +162,17 @@ nodes
156162
| main.rs:161:13:161:20 | a.add(...) [MyInt] | semmle.label | a.add(...) [MyInt] |
157163
| main.rs:162:10:162:10 | d [MyInt] | semmle.label | d [MyInt] |
158164
| main.rs:162:10:162:16 | d.value | semmle.label | d.value |
165+
| main.rs:200:32:204:1 | { ... } | semmle.label | { ... } |
159166
| main.rs:201:9:201:9 | a | semmle.label | a |
160167
| main.rs:201:13:201:21 | source(...) | semmle.label | source(...) |
161168
| main.rs:202:10:202:10 | a | semmle.label | a |
162169
| main.rs:211:13:211:13 | c | semmle.label | c |
163170
| main.rs:211:17:211:25 | source(...) | semmle.label | source(...) |
164171
| main.rs:212:14:212:14 | c | semmle.label | c |
172+
| main.rs:219:9:219:9 | a | semmle.label | a |
173+
| main.rs:219:13:219:55 | ...::block_on(...) | semmle.label | ...::block_on(...) |
174+
| main.rs:219:41:219:54 | async_source(...) | semmle.label | async_source(...) |
175+
| main.rs:220:10:220:10 | a | semmle.label | a |
165176
subpaths
166177
| main.rs:36:26:36:26 | a | main.rs:30:17:30:22 | ...: i64 | main.rs:30:32:32:1 | { ... } | main.rs:36:13:36:27 | pass_through(...) |
167178
| main.rs:41:26:44:5 | { ... } | main.rs:30:17:30:22 | ...: i64 | main.rs:30:32:32:1 | { ... } | main.rs:41:13:44:6 | pass_through(...) |
@@ -186,3 +197,4 @@ testFailures
186197
| main.rs:162:10:162:16 | d.value | main.rs:159:28:159:36 | source(...) | main.rs:162:10:162:16 | d.value | $@ | main.rs:159:28:159:36 | source(...) | source(...) |
187198
| main.rs:202:10:202:10 | a | main.rs:201:13:201:21 | source(...) | main.rs:202:10:202:10 | a | $@ | main.rs:201:13:201:21 | source(...) | source(...) |
188199
| main.rs:212:14:212:14 | c | main.rs:211:17:211:25 | source(...) | main.rs:212:14:212:14 | c | $@ | main.rs:211:17:211:25 | source(...) | source(...) |
200+
| main.rs:220:10:220:10 | a | main.rs:201:13:201:21 | source(...) | main.rs:220:10:220:10 | a | $@ | main.rs:201:13:201:21 | source(...) | source(...) |

rust/ql/test/library-tests/dataflow/global/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ async fn test_async_await_async_part() {
217217

218218
fn test_async_await() {
219219
let a = futures::executor::block_on(async_source());
220-
sink(a); // $ MISSING: hasValueFlow=1
220+
sink(a); // $ hasValueFlow=1
221221

222222
futures::executor::block_on(test_async_await_async_part());
223223
}

rust/ql/test/library-tests/dataflow/global/viableCallable.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@
5050
| main.rs:211:17:211:25 | source(...) | main.rs:1:1:3:1 | fn source |
5151
| main.rs:212:9:212:15 | sink(...) | main.rs:5:1:7:1 | fn sink |
5252
| main.rs:215:5:215:17 | sink(...) | main.rs:5:1:7:1 | fn sink |
53+
| main.rs:219:13:219:55 | ...::block_on(...) | file://:0:0:0:0 | repo:https://github.com/rust-lang/futures-rs:futures-executor::_::crate::local_pool::block_on |
5354
| main.rs:219:41:219:54 | async_source(...) | main.rs:200:1:204:1 | fn async_source |
5455
| main.rs:220:5:220:11 | sink(...) | main.rs:5:1:7:1 | fn sink |
56+
| main.rs:222:5:222:62 | ...::block_on(...) | file://:0:0:0:0 | repo:https://github.com/rust-lang/futures-rs:futures-executor::_::crate::local_pool::block_on |
5557
| main.rs:222:33:222:61 | test_async_await_async_part(...) | main.rs:206:1:216:1 | fn test_async_await_async_part |
5658
| main.rs:226:5:226:22 | data_out_of_call(...) | main.rs:16:1:19:1 | fn data_out_of_call |
5759
| main.rs:227:5:227:21 | data_in_to_call(...) | main.rs:25:1:28:1 | fn data_in_to_call |

rust/ql/test/library-tests/dataflow/local/DataFlowStep.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,6 +1909,7 @@ models
19091909
| 1058 | Summary: lang:std; crate::thread::current::set_current; Argument[0]; ReturnValue.Field[crate::result::Result::Err(0)]; value |
19101910
| 1059 | Summary: lang:std; crate::thread::current::try_with_current; Argument[0].ReturnValue; ReturnValue; value |
19111911
| 1060 | Summary: lang:std; crate::thread::with_current_name; Argument[0].ReturnValue; ReturnValue; value |
1912+
| 1061 | Summary: repo:https://github.com/rust-lang/futures-rs:futures-executor; crate::local_pool::block_on; Argument[0]; ReturnValue; value |
19121913
storeStep
19131914
| file://:0:0:0:0 | [summary] to write: Argument[0].Field[crate::option::Option::Some(0)] in lang:core::_::<crate::option::Option>::zip_with | Some | file://:0:0:0:0 | [post] [summary param] 0 in lang:core::_::<crate::option::Option>::zip_with |
19141915
| file://:0:0:0:0 | [summary] to write: Argument[0].Parameter[0].Reference in lang:alloc::_::<crate::collections::vec_deque::VecDeque>::retain | &ref | file://:0:0:0:0 | [summary] to write: Argument[0].Parameter[0] in lang:alloc::_::<crate::collections::vec_deque::VecDeque>::retain |

rust/ql/test/query-tests/security/CWE-020/RegexInjection.expected

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
| main.rs:6:25:6:30 | &regex | main.rs:4:20:4:32 | ...::var | main.rs:6:25:6:30 | &regex | This regular expression is constructed from a $@. | main.rs:4:20:4:32 | ...::var | user-provided value |
33
edges
44
| main.rs:4:9:4:16 | username | main.rs:5:25:5:44 | MacroExpr | provenance | |
5-
| main.rs:4:20:4:32 | ...::var | main.rs:4:20:4:40 | ...::var(...) [Ok] | provenance | Src:MaD:62 |
6-
| main.rs:4:20:4:40 | ...::var(...) [Ok] | main.rs:4:20:4:66 | ... .unwrap_or(...) | provenance | MaD:1593 |
5+
| main.rs:4:20:4:32 | ...::var | main.rs:4:20:4:40 | ...::var(...) [Ok] | provenance | Src:MaD:63 |
6+
| main.rs:4:20:4:40 | ...::var(...) [Ok] | main.rs:4:20:4:66 | ... .unwrap_or(...) | provenance | MaD:1594 |
77
| main.rs:4:20:4:66 | ... .unwrap_or(...) | main.rs:4:9:4:16 | username | provenance | |
88
| main.rs:5:9:5:13 | regex | main.rs:6:26:6:30 | regex | provenance | |
99
| main.rs:5:17:5:45 | res | main.rs:5:25:5:44 | { ... } | provenance | |
1010
| main.rs:5:25:5:44 | ...::format(...) | main.rs:5:17:5:45 | res | provenance | |
1111
| main.rs:5:25:5:44 | ...::must_use(...) | main.rs:5:9:5:13 | regex | provenance | |
12-
| main.rs:5:25:5:44 | MacroExpr | main.rs:5:25:5:44 | ...::format(...) | provenance | MaD:66 |
13-
| main.rs:5:25:5:44 | { ... } | main.rs:5:25:5:44 | ...::must_use(...) | provenance | MaD:3016 |
12+
| main.rs:5:25:5:44 | MacroExpr | main.rs:5:25:5:44 | ...::format(...) | provenance | MaD:67 |
13+
| main.rs:5:25:5:44 | { ... } | main.rs:5:25:5:44 | ...::must_use(...) | provenance | MaD:3017 |
1414
| main.rs:6:26:6:30 | regex | main.rs:6:25:6:30 | &regex | provenance | |
1515
nodes
1616
| main.rs:4:9:4:16 | username | semmle.label | username |

0 commit comments

Comments
 (0)