File tree Expand file tree Collapse file tree 5 files changed +36
-3
lines changed
test/library-tests/dataflow/sources Expand file tree Collapse file tree 5 files changed +36
-3
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,19 @@ module EnvironmentSource {
73
73
}
74
74
}
75
75
76
+ /**
77
+ * A data flow source for remote (network) data.
78
+ */
79
+ class RemoteSource extends ThreatModelSource instanceof RemoteSource:: Range { }
80
+
81
+ module RemoteSource {
82
+ abstract class Range extends ThreatModelSource:: Range {
83
+ override string getThreatModel ( ) { result = "remote" }
84
+
85
+ override string getSourceType ( ) { result = "RemoteSource" }
86
+ }
87
+ }
88
+
76
89
/**
77
90
* A data-flow node that constructs a SQL statement.
78
91
*
Original file line number Diff line number Diff line change 2
2
* This file imports all models of frameworks and libraries.
3
3
*/
4
4
5
+ private import codeql.rust.frameworks.Reqwest
5
6
private import codeql.rust.frameworks.stdlib.Env
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Provides modeling for the `reqwest` library.
3
+ */
4
+
5
+ private import rust
6
+ private import codeql.rust.Concepts
7
+
8
+ /**
9
+ * A call to `reqwest::get` or `reqwest::blocking::get`.
10
+ */
11
+ private class ReqwestGet extends RemoteSource:: Range {
12
+ ReqwestGet ( ) {
13
+ this .asExpr ( ) .( CallExpr ) .getExpr ( ) .( PathExpr ) .getPath ( ) .getResolvedPath ( ) =
14
+ [ "crate::get" , "crate::blocking::get" ]
15
+ }
16
+ }
Original file line number Diff line number Diff line change 12
12
| test.rs:50:15:50:37 | CallExpr | CommandLineArgs (commandargs) |
13
13
| test.rs:51:15:51:37 | CallExpr | CommandLineArgs (commandargs) |
14
14
| test.rs:52:16:52:35 | CallExpr | CommandLineArgs (commandargs) |
15
+ | test.rs:60:26:60:70 | CallExpr | RemoteSource (remote, DEFAULT) |
16
+ | test.rs:63:26:63:70 | CallExpr | RemoteSource (remote, DEFAULT) |
17
+ | test.rs:66:26:66:60 | CallExpr | RemoteSource (remote, DEFAULT) |
Original file line number Diff line number Diff line change @@ -57,13 +57,13 @@ fn test_env_dirs() {
57
57
}
58
58
59
59
async fn test_reqwest ( ) -> Result < ( ) , reqwest:: Error > {
60
- let remote_string1 = reqwest:: blocking:: get ( "http://example.com/" ) ?. text ( ) ?; // $ MISSING: Alert[rust/summary/taint-sources]
60
+ let remote_string1 = reqwest:: blocking:: get ( "http://example.com/" ) ?. text ( ) ?; // $ Alert[rust/summary/taint-sources]
61
61
sink ( remote_string1) ; // $ MISSING: hasTaintFlow
62
62
63
- let remote_string2 = reqwest:: blocking:: get ( "http://example.com/" ) . unwrap ( ) . text ( ) . unwrap ( ) ; // $ MISSING: Alert[rust/summary/taint-sources]
63
+ let remote_string2 = reqwest:: blocking:: get ( "http://example.com/" ) . unwrap ( ) . text ( ) . unwrap ( ) ; // $ Alert[rust/summary/taint-sources]
64
64
sink ( remote_string2) ; // $ MISSING: hasTaintFlow
65
65
66
- let remote_string3 = reqwest:: get ( "http://example.com/" ) . await ?. text ( ) . await ?; // $ MISSING: Alert[rust/summary/taint-sources]
66
+ let remote_string3 = reqwest:: get ( "http://example.com/" ) . await ?. text ( ) . await ?; // $ Alert[rust/summary/taint-sources]
67
67
sink ( remote_string3) ; // $ MISSING: hasTaintFlow
68
68
69
69
Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments