Skip to content

Commit cd15899

Browse files
committed
Add a bit of modelling
1 parent ceff7cc commit cd15899

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

rust/ql/lib/codeql/rust/Frameworks.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
*/
44

55
private import codeql.rust.frameworks.rustcrypto.RustCrypto
6+
private import codeql.rust.frameworks.Poem
67
private import codeql.rust.frameworks.Sqlx
78
private import codeql.rust.frameworks.stdlib.Clone
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* Provides modeling for the `Poem` library.
3+
*/
4+
5+
private import rust
6+
private import codeql.rust.Concepts
7+
private import codeql.rust.dataflow.DataFlow
8+
9+
/**
10+
* Parameters of a handler function
11+
*/
12+
private class PoemHandlerParam extends RemoteSource::Range {
13+
PoemHandlerParam() {
14+
exists(TupleStructPat param |
15+
param.getResolvedPath() = ["crate::web::query::Query", "crate::web::path::Path"]
16+
|
17+
this.asPat().getPat() = param.getAField()
18+
)
19+
}
20+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
extensions:
2+
- addsTo:
3+
pack: codeql/rust-all
4+
extensible: sourceModel
5+
data: []
6+
- addsTo:
7+
pack: codeql/rust-all
8+
extensible: sinkModel
9+
data:
10+
- ["lang:std", "crate::fs::read_to_string", "Argument[0]", "path-injection", "manual"]
11+
12+
- addsTo:
13+
pack: codeql/rust-all
14+
extensible: summaryModel
15+
data:
16+
- ["lang:std", "<crate::path::PathBuf as crate::convert::From>::from", "Argument[0]", "ReturnValue", "taint", "manual"]
17+
- ["lang:std", "<crate::path::Path>::join", "Argument[self]", "ReturnValue", "taint", "manual"]
18+
- ["lang:std", "<crate::path::Path>::join", "Argument[0]", "ReturnValue", "taint", "manual"]

0 commit comments

Comments
 (0)