Skip to content

Commit

Permalink
Rust: Restrict ReqwestGet by crate origin.
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffw0 committed Nov 22, 2024
1 parent 75a3c93 commit d8b58f2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rust/ql/lib/codeql/rust/frameworks/Reqwest.qll
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ private import codeql.rust.Concepts
* A call to `reqwest::get` or `reqwest::blocking::get`.
*/
private class ReqwestGet extends RemoteSource::Range {
CallExpr ce;

Check notice

Code scanning / CodeQL

Field only used in CharPred Note

Field is only used in CharPred.

ReqwestGet() {
this.asExpr().getExpr().(CallExpr).getExpr().(PathExpr).getPath().getResolvedPath() =
["crate::get", "crate::blocking::get"]
this.asExpr().getExpr() = ce and
ce.getExpr().(PathExpr).getPath().getResolvedCrateOrigin().matches("%reqwest") and
ce.getExpr().(PathExpr).getPath().getResolvedPath() = ["crate::get", "crate::blocking::get"]
}
}

0 comments on commit d8b58f2

Please sign in to comment.