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 {
7373 }
7474}
7575
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+
7689/**
7790 * A data-flow node that constructs a SQL statement.
7891 *
Original file line number Diff line number Diff line change 22 * This file imports all models of frameworks and libraries.
33 */
44
5+ private import codeql.rust.frameworks.Reqwest
56private 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 1212| test.rs:50:15:50:37 | CallExpr | CommandLineArgs (commandargs) |
1313| test.rs:51:15:51:37 | CallExpr | CommandLineArgs (commandargs) |
1414| 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() {
5757}
5858
5959async 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]
6161 sink ( remote_string1) ; // $ MISSING: hasTaintFlow
6262
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]
6464 sink ( remote_string2) ; // $ MISSING: hasTaintFlow
6565
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]
6767 sink ( remote_string3) ; // $ MISSING: hasTaintFlow
6868
6969 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments