Skip to content

Commit e458441

Browse files
committed
Add a bit of modelling
1 parent 8ff043e commit e458441

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-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: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
- [
11+
"lang:std",
12+
"crate::fs::read_to_string",
13+
"Argument[0]",
14+
"path-injection",
15+
"manual",
16+
]
17+
18+
- addsTo:
19+
pack: codeql/rust-all
20+
extensible: summaryModel
21+
data:
22+
- [
23+
"lang:std",
24+
"<crate::path::PathBuf as crate::convert::From>::from",
25+
"Argument[0]",
26+
"ReturnValue",
27+
"taint",
28+
"manual",
29+
]
30+
- [
31+
"lang:std",
32+
"<crate::path::Path>::join",
33+
"Argument[self]",
34+
"ReturnValue",
35+
"taint",
36+
"manual",
37+
]
38+
- [
39+
"lang:std",
40+
"<crate::path::Path>::join",
41+
"Argument[0]",
42+
"ReturnValue",
43+
"taint",
44+
"manual",
45+
]

0 commit comments

Comments
 (0)