Merge branch 'main' into rust-df-array

This commit is contained in:
Simon Friis Vindum
2024-12-05 11:08:54 +01:00
389 changed files with 3867 additions and 3629 deletions

View File

@@ -1,3 +1,4 @@
| a_file.rs:0:0:0:0 | a_file.rs |
| another_file.rs:0:0:0:0 | another_file.rs |
| lib.rs:0:0:0:0 | lib.rs |
| Cargo.toml:0:0:0:0 | Cargo.toml | fromSource: no |
| a_file.rs:0:0:0:0 | a_file.rs | fromSource: yes |
| another_file.rs:0:0:0:0 | another_file.rs | fromSource: yes |
| lib.rs:0:0:0:0 | lib.rs | fromSource: yes |

View File

@@ -1,5 +1,7 @@
import rust
from File f
where exists(f.getRelativePath())
select f
from File f, string fromSource
where
exists(f.getRelativePath()) and
if f.fromSource() then fromSource = "fromSource: yes" else fromSource = "fromSource: no"
select f, fromSource

View File

@@ -34,34 +34,15 @@ canonicalPaths
| regular.rs:40:1:46:1 | fn enum_qualified_usage | repo::test | crate::regular::enum_qualified_usage |
| regular.rs:48:1:55:1 | fn enum_unqualified_usage | repo::test | crate::regular::enum_unqualified_usage |
| regular.rs:51:5:51:18 | Use | None | None |
| regular.rs:57:1:63:1 | fn enum_match | repo::test | crate::regular::enum_match |
resolvedPaths
| anonymous.rs:1:5:1:9 | super | None | None |
| anonymous.rs:1:5:1:18 | ...::regular | repo::test | crate::regular |
| anonymous.rs:1:5:1:25 | ...::Trait | repo::test | crate::regular::Trait |
| anonymous.rs:10:10:10:19 | OtherTrait | repo::test | {0}::OtherTrait |
| anonymous.rs:10:25:10:35 | OtherStruct | repo::test | {0}::OtherStruct |
| anonymous.rs:14:10:14:19 | OtherTrait | repo::test | {0}::OtherTrait |
| anonymous.rs:14:25:14:29 | crate | None | None |
| anonymous.rs:14:25:14:38 | ...::regular | repo::test | crate::regular |
| anonymous.rs:14:25:14:46 | ...::Struct | repo::test | crate::regular::Struct |
| anonymous.rs:18:10:18:14 | crate | None | None |
| anonymous.rs:18:10:18:23 | ...::regular | repo::test | crate::regular |
| anonymous.rs:18:10:18:30 | ...::Trait | repo::test | crate::regular::Trait |
| anonymous.rs:18:36:18:46 | OtherStruct | repo::test | {0}::OtherStruct |
| anonymous.rs:27:17:27:27 | OtherStruct | repo::test | {0}::OtherStruct |
| anonymous.rs:27:17:27:30 | OtherStruct {...} | repo::test | {0}::OtherStruct |
| anonymous.rs:28:9:28:9 | s | None | None |
| anonymous.rs:28:9:28:13 | ... .f(...) | repo::test | <{0}::OtherStruct as crate::regular::Trait>::f |
| anonymous.rs:29:9:29:9 | s | None | None |
| anonymous.rs:29:9:29:13 | ... .g(...) | repo::test | <{0}::OtherStruct as {0}::OtherTrait>::g |
| anonymous.rs:30:9:30:14 | nested | repo::test | {0}::nested |
| regular.rs:1:3:1:8 | derive | None | None |
| regular.rs:8:6:8:10 | Trait | repo::test | crate::regular::Trait |
| regular.rs:8:16:8:21 | Struct | repo::test | crate::regular::Struct |
| regular.rs:12:6:12:11 | Struct | repo::test | crate::regular::Struct |
| regular.rs:20:9:20:10 | Eq | lang:core | crate::cmp::Eq |
| regular.rs:20:13:20:32 | TraitWithBlanketImpl | repo::test | crate::regular::TraitWithBlanketImpl |
| regular.rs:20:38:20:38 | T | None | None |
| regular.rs:27:13:27:18 | Struct | repo::test | crate::regular::Struct |
| regular.rs:27:13:27:21 | Struct {...} | repo::test | crate::regular::Struct |
| regular.rs:28:5:28:5 | s | None | None |
| regular.rs:28:5:28:9 | ... .f(...) | repo::test | <crate::regular::Struct as crate::regular::Trait>::f |
| regular.rs:29:5:29:5 | s | None | None |
@@ -69,21 +50,17 @@ resolvedPaths
| regular.rs:30:5:30:5 | s | None | None |
| regular.rs:30:5:30:9 | ... .h(...) | repo::test | <_ as crate::regular::TraitWithBlanketImpl>::h |
| regular.rs:31:5:31:8 | free | repo::test | crate::regular::free |
| regular.rs:36:14:36:18 | usize | None | None |
| regular.rs:37:19:37:23 | usize | None | None |
| regular.rs:41:9:41:14 | Option | lang:core | crate::option::Option |
| regular.rs:41:9:41:26 | ...::None::<...> | lang:core | crate::option::Option::None |
| regular.rs:42:9:42:14 | Option | lang:core | crate::option::Option |
| regular.rs:42:9:42:20 | ...::Some | lang:core | crate::option::Option::Some |
| regular.rs:43:9:43:14 | MyEnum | repo::test | crate::regular::MyEnum |
| regular.rs:43:9:43:24 | ...::Variant1 | repo::test | crate::regular::MyEnum::Variant1 |
| regular.rs:44:9:44:14 | MyEnum | repo::test | crate::regular::MyEnum |
| regular.rs:44:9:44:24 | ...::Variant2 | repo::test | crate::regular::MyEnum::Variant2 |
| regular.rs:45:9:45:14 | MyEnum | repo::test | crate::regular::MyEnum |
| regular.rs:45:9:45:24 | ...::Variant3 | repo::test | crate::regular::MyEnum::Variant3 |
| regular.rs:45:9:45:33 | ...::Variant3 {...} | repo::test | crate::regular::MyEnum::Variant3 |
| regular.rs:49:9:49:18 | None::<...> | lang:core | crate::option::Option::None |
| regular.rs:50:9:50:12 | Some | lang:core | crate::option::Option::Some |
| regular.rs:51:9:51:14 | MyEnum | repo::test | crate::regular::MyEnum |
| regular.rs:52:9:52:16 | Variant1 | repo::test | crate::regular::MyEnum::Variant1 |
| regular.rs:53:9:53:16 | Variant2 | repo::test | crate::regular::MyEnum::Variant2 |
| regular.rs:54:9:54:16 | Variant3 | repo::test | crate::regular::MyEnum::Variant3 |
| regular.rs:54:9:54:25 | Variant3 {...} | repo::test | crate::regular::MyEnum::Variant3 |
| regular.rs:58:11:58:11 | e | None | None |
| regular.rs:59:9:59:24 | ...::Variant1 | repo::test | crate::regular::MyEnum::Variant1 |
| regular.rs:60:9:60:27 | ...::Variant2(...) | repo::test | crate::regular::MyEnum::Variant2 |
| regular.rs:61:9:61:31 | ...::Variant3 {...} | repo::test | crate::regular::MyEnum::Variant3 |

View File

@@ -53,3 +53,11 @@ fn enum_unqualified_usage() {
_ = Variant2(0);
_ = Variant3 { x: 1 };
}
fn enum_match(e: MyEnum) {
match e {
MyEnum::Variant1 => {}
MyEnum::Variant2(_) => {}
MyEnum::Variant3 { .. } => {}
}
}

View File

@@ -13,7 +13,7 @@ BlockExpr/gen_block_expr.rs 17b06c726e304e0efcfde8e71afd9c657860312be55436689423
BoxPat/gen_box_pat.rs 1493e24b732370b577ade38c47db17fa157df19f5390606a67a6040e49b501c0 1493e24b732370b577ade38c47db17fa157df19f5390606a67a6040e49b501c0
BreakExpr/gen_break_expr.rs aacdf9df7fc51d19742b9e813835c0bd0913017e8d62765960e06b27d58b9031 aacdf9df7fc51d19742b9e813835c0bd0913017e8d62765960e06b27d58b9031
CallExpr/gen_call_expr.rs 013a7c878996aefb25b94b68eebc4f0b1bb74ccd09e91c491980817a383e2401 013a7c878996aefb25b94b68eebc4f0b1bb74ccd09e91c491980817a383e2401
CastExpr/gen_cast_expr.rs abd59cc7b92578b56098ac0045cf7de4b15c645cce79e3bdad8d3b6f4657360d abd59cc7b92578b56098ac0045cf7de4b15c645cce79e3bdad8d3b6f4657360d
CastExpr/gen_cast_expr.rs c3892211fbae4fed7cb1f25ff1679fd79d2878bf0bf2bd4b7982af23d00129f5 c3892211fbae4fed7cb1f25ff1679fd79d2878bf0bf2bd4b7982af23d00129f5
ClosureBinder/gen_closure_binder.rs 78d3219bdfc58a22f333e3c82468fc23001e92b1d5acb085de7f48d7d1722244 78d3219bdfc58a22f333e3c82468fc23001e92b1d5acb085de7f48d7d1722244
ClosureExpr/gen_closure_expr.rs 15bd9abdb8aaffabb8bb335f8ebd0571eb5f29115e1dc8d11837aa988702cd80 15bd9abdb8aaffabb8bb335f8ebd0571eb5f29115e1dc8d11837aa988702cd80
Comment/gen_comment.rs 1e1f9f43161a79c096c2056e8b7f5346385ab7addcdec68c2d53b383dd3debe6 1e1f9f43161a79c096c2056e8b7f5346385ab7addcdec68c2d53b383dd3debe6

View File

@@ -1,6 +1,6 @@
// generated by codegen, do not edit
fn test_cast_expr() -> () {
// A cast expression. For example:
// A type cast expression. For example:
value as u64;
}

View File

@@ -1,26 +1,26 @@
| gen_path.rs:5:9:5:18 | some_crate | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | no | hasPart: | yes |
| gen_path.rs:5:9:5:31 | ...::some_module | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | yes | hasPart: | yes |
| gen_path.rs:5:9:5:42 | ...::some_item | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | yes | hasPart: | yes |
| gen_path.rs:6:5:6:7 | foo | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | no | hasPart: | yes |
| gen_path.rs:6:5:6:12 | ...::bar | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | yes | hasPart: | yes |
| gen_path_expr.rs:5:13:5:20 | variable | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | no | hasPart: | yes |
| gen_path_expr.rs:6:13:6:15 | foo | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | no | hasPart: | yes |
| gen_path_expr.rs:6:13:6:20 | ...::bar | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | yes | hasPart: | yes |
| gen_path_expr.rs:7:13:7:15 | <...> | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | no | hasPart: | yes |
| gen_path_expr.rs:7:13:7:20 | ...::foo | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | yes | hasPart: | yes |
| gen_path_expr.rs:7:14:7:14 | T | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | no | hasPart: | yes |
| gen_path_expr.rs:7:14:7:14 | T | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | no | hasPart: | yes |
| gen_path_expr.rs:8:13:8:31 | <...> | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | no | hasPart: | yes |
| gen_path_expr.rs:8:13:8:36 | ...::foo | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | yes | hasPart: | yes |
| gen_path_expr.rs:8:14:8:21 | TypeRepr | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | no | hasPart: | yes |
| gen_path_expr.rs:8:14:8:21 | TypeRepr | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | no | hasPart: | yes |
| gen_path_pat.rs:5:11:5:11 | x | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | no | hasPart: | yes |
| gen_path_pat.rs:6:9:6:11 | Foo | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | no | hasPart: | yes |
| gen_path_pat.rs:6:9:6:16 | ...::Bar | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | yes | hasPart: | yes |
| gen_path_type_repr.rs:5:14:5:16 | std | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | no | hasPart: | yes |
| gen_path_type_repr.rs:5:14:5:29 | ...::collections | hasResolvedPath: | yes | hasResolvedCrateOrigin: | yes | hasQualifier: | yes | hasPart: | yes |
| gen_path_type_repr.rs:5:14:5:48 | ...::HashMap::<...> | hasResolvedPath: | yes | hasResolvedCrateOrigin: | yes | hasQualifier: | yes | hasPart: | yes |
| gen_path_type_repr.rs:5:40:5:42 | i32 | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | no | hasPart: | yes |
| gen_path_type_repr.rs:5:45:5:47 | i32 | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | no | hasPart: | yes |
| gen_path_type_repr.rs:6:14:6:14 | X | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | no | hasPart: | yes |
| gen_path_type_repr.rs:6:14:6:20 | ...::Item | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasQualifier: | yes | hasPart: | yes |
| gen_path.rs:5:9:5:18 | some_crate | hasQualifier: | no | hasPart: | yes |
| gen_path.rs:5:9:5:31 | ...::some_module | hasQualifier: | yes | hasPart: | yes |
| gen_path.rs:5:9:5:42 | ...::some_item | hasQualifier: | yes | hasPart: | yes |
| gen_path.rs:6:5:6:7 | foo | hasQualifier: | no | hasPart: | yes |
| gen_path.rs:6:5:6:12 | ...::bar | hasQualifier: | yes | hasPart: | yes |
| gen_path_expr.rs:5:13:5:20 | variable | hasQualifier: | no | hasPart: | yes |
| gen_path_expr.rs:6:13:6:15 | foo | hasQualifier: | no | hasPart: | yes |
| gen_path_expr.rs:6:13:6:20 | ...::bar | hasQualifier: | yes | hasPart: | yes |
| gen_path_expr.rs:7:13:7:15 | <...> | hasQualifier: | no | hasPart: | yes |
| gen_path_expr.rs:7:13:7:20 | ...::foo | hasQualifier: | yes | hasPart: | yes |
| gen_path_expr.rs:7:14:7:14 | T | hasQualifier: | no | hasPart: | yes |
| gen_path_expr.rs:7:14:7:14 | T | hasQualifier: | no | hasPart: | yes |
| gen_path_expr.rs:8:13:8:31 | <...> | hasQualifier: | no | hasPart: | yes |
| gen_path_expr.rs:8:13:8:36 | ...::foo | hasQualifier: | yes | hasPart: | yes |
| gen_path_expr.rs:8:14:8:21 | TypeRepr | hasQualifier: | no | hasPart: | yes |
| gen_path_expr.rs:8:14:8:21 | TypeRepr | hasQualifier: | no | hasPart: | yes |
| gen_path_pat.rs:5:11:5:11 | x | hasQualifier: | no | hasPart: | yes |
| gen_path_pat.rs:6:9:6:11 | Foo | hasQualifier: | no | hasPart: | yes |
| gen_path_pat.rs:6:9:6:16 | ...::Bar | hasQualifier: | yes | hasPart: | yes |
| gen_path_type_repr.rs:5:14:5:16 | std | hasQualifier: | no | hasPart: | yes |
| gen_path_type_repr.rs:5:14:5:29 | ...::collections | hasQualifier: | yes | hasPart: | yes |
| gen_path_type_repr.rs:5:14:5:48 | ...::HashMap::<...> | hasQualifier: | yes | hasPart: | yes |
| gen_path_type_repr.rs:5:40:5:42 | i32 | hasQualifier: | no | hasPart: | yes |
| gen_path_type_repr.rs:5:45:5:47 | i32 | hasQualifier: | no | hasPart: | yes |
| gen_path_type_repr.rs:6:14:6:14 | X | hasQualifier: | no | hasPart: | yes |
| gen_path_type_repr.rs:6:14:6:20 | ...::Item | hasQualifier: | yes | hasPart: | yes |

View File

@@ -2,18 +2,10 @@
import codeql.rust.elements
import TestUtils
from
Path x, string hasResolvedPath, string hasResolvedCrateOrigin, string hasQualifier, string hasPart
from Path x, string hasQualifier, string hasPart
where
toBeTested(x) and
not x.isUnknown() and
(if x.hasResolvedPath() then hasResolvedPath = "yes" else hasResolvedPath = "no") and
(
if x.hasResolvedCrateOrigin()
then hasResolvedCrateOrigin = "yes"
else hasResolvedCrateOrigin = "no"
) and
(if x.hasQualifier() then hasQualifier = "yes" else hasQualifier = "no") and
if x.hasPart() then hasPart = "yes" else hasPart = "no"
select x, "hasResolvedPath:", hasResolvedPath, "hasResolvedCrateOrigin:", hasResolvedCrateOrigin,
"hasQualifier:", hasQualifier, "hasPart:", hasPart
select x, "hasQualifier:", hasQualifier, "hasPart:", hasPart

View File

@@ -1,6 +1,6 @@
| gen_path.rs:6:5:6:12 | ...::bar | getNumberOfAttrs: | 0 | hasPath: | yes |
| gen_path_expr.rs:5:13:5:20 | variable | getNumberOfAttrs: | 0 | hasPath: | yes |
| gen_path_expr.rs:6:13:6:20 | ...::bar | getNumberOfAttrs: | 0 | hasPath: | yes |
| gen_path_expr.rs:7:13:7:20 | ...::foo | getNumberOfAttrs: | 0 | hasPath: | yes |
| gen_path_expr.rs:8:13:8:36 | ...::foo | getNumberOfAttrs: | 0 | hasPath: | yes |
| gen_path_pat.rs:5:11:5:11 | x | getNumberOfAttrs: | 0 | hasPath: | yes |
| gen_path.rs:6:5:6:12 | ...::bar | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfAttrs: | 0 |
| gen_path_expr.rs:5:13:5:20 | variable | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfAttrs: | 0 |
| gen_path_expr.rs:6:13:6:20 | ...::bar | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfAttrs: | 0 |
| gen_path_expr.rs:7:13:7:20 | ...::foo | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfAttrs: | 0 |
| gen_path_expr.rs:8:13:8:36 | ...::foo | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfAttrs: | 0 |
| gen_path_pat.rs:5:11:5:11 | x | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfAttrs: | 0 |

View File

@@ -2,10 +2,19 @@
import codeql.rust.elements
import TestUtils
from PathExpr x, int getNumberOfAttrs, string hasPath
from
PathExpr x, string hasResolvedPath, string hasResolvedCrateOrigin, string hasPath,
int getNumberOfAttrs
where
toBeTested(x) and
not x.isUnknown() and
getNumberOfAttrs = x.getNumberOfAttrs() and
if x.hasPath() then hasPath = "yes" else hasPath = "no"
select x, "getNumberOfAttrs:", getNumberOfAttrs, "hasPath:", hasPath
(if x.hasResolvedPath() then hasResolvedPath = "yes" else hasResolvedPath = "no") and
(
if x.hasResolvedCrateOrigin()
then hasResolvedCrateOrigin = "yes"
else hasResolvedCrateOrigin = "no"
) and
(if x.hasPath() then hasPath = "yes" else hasPath = "no") and
getNumberOfAttrs = x.getNumberOfAttrs()
select x, "hasResolvedPath:", hasResolvedPath, "hasResolvedCrateOrigin:", hasResolvedCrateOrigin,
"hasPath:", hasPath, "getNumberOfAttrs:", getNumberOfAttrs

View File

@@ -0,0 +1,7 @@
// generated by codegen, do not edit
import codeql.rust.elements
import TestUtils
from PathExpr x
where toBeTested(x) and not x.isUnknown()
select x, x.getResolvedCrateOrigin()

View File

@@ -0,0 +1,7 @@
// generated by codegen, do not edit
import codeql.rust.elements
import TestUtils
from PathExpr x
where toBeTested(x) and not x.isUnknown()
select x, x.getResolvedPath()

View File

@@ -1 +1 @@
| gen_path_pat.rs:6:9:6:16 | ...::Bar | hasPath: | yes |
| gen_path_pat.rs:6:9:6:16 | ...::Bar | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes |

View File

@@ -2,9 +2,16 @@
import codeql.rust.elements
import TestUtils
from PathPat x, string hasPath
from PathPat x, string hasResolvedPath, string hasResolvedCrateOrigin, string hasPath
where
toBeTested(x) and
not x.isUnknown() and
(if x.hasResolvedPath() then hasResolvedPath = "yes" else hasResolvedPath = "no") and
(
if x.hasResolvedCrateOrigin()
then hasResolvedCrateOrigin = "yes"
else hasResolvedCrateOrigin = "no"
) and
if x.hasPath() then hasPath = "yes" else hasPath = "no"
select x, "hasPath:", hasPath
select x, "hasResolvedPath:", hasResolvedPath, "hasResolvedCrateOrigin:", hasResolvedCrateOrigin,
"hasPath:", hasPath

View File

@@ -2,6 +2,6 @@
import codeql.rust.elements
import TestUtils
from Path x
from PathPat x
where toBeTested(x) and not x.isUnknown()
select x, x.getResolvedCrateOrigin()

View File

@@ -2,6 +2,6 @@
import codeql.rust.elements
import TestUtils
from Path x
from PathPat x
where toBeTested(x) and not x.isUnknown()
select x, x.getResolvedPath()

View File

@@ -1,2 +0,0 @@
| gen_path_type_repr.rs:5:14:5:29 | ...::collections | lang:std |
| gen_path_type_repr.rs:5:14:5:48 | ...::HashMap::<...> | lang:std |

View File

@@ -1,2 +0,0 @@
| gen_path_type_repr.rs:5:14:5:29 | ...::collections | crate::collections |
| gen_path_type_repr.rs:5:14:5:48 | ...::HashMap::<...> | crate::collections::hash::map::HashMap |

View File

@@ -1,4 +1,4 @@
| gen_record_expr.rs:5:17:5:34 | Foo {...} | hasPath: | yes | hasRecordExprFieldList: | yes |
| gen_record_expr.rs:6:18:6:38 | Foo {...} | hasPath: | yes | hasRecordExprFieldList: | yes |
| gen_record_expr.rs:7:5:7:22 | Foo {...} | hasPath: | yes | hasRecordExprFieldList: | yes |
| gen_record_expr.rs:8:5:8:14 | Foo {...} | hasPath: | yes | hasRecordExprFieldList: | yes |
| gen_record_expr.rs:5:17:5:34 | Foo {...} | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | hasRecordExprFieldList: | yes |
| gen_record_expr.rs:6:18:6:38 | Foo {...} | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | hasRecordExprFieldList: | yes |
| gen_record_expr.rs:7:5:7:22 | Foo {...} | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | hasRecordExprFieldList: | yes |
| gen_record_expr.rs:8:5:8:14 | Foo {...} | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | hasRecordExprFieldList: | yes |

View File

@@ -2,12 +2,21 @@
import codeql.rust.elements
import TestUtils
from RecordExpr x, string hasPath, string hasRecordExprFieldList
from
RecordExpr x, string hasResolvedPath, string hasResolvedCrateOrigin, string hasPath,
string hasRecordExprFieldList
where
toBeTested(x) and
not x.isUnknown() and
(if x.hasResolvedPath() then hasResolvedPath = "yes" else hasResolvedPath = "no") and
(
if x.hasResolvedCrateOrigin()
then hasResolvedCrateOrigin = "yes"
else hasResolvedCrateOrigin = "no"
) and
(if x.hasPath() then hasPath = "yes" else hasPath = "no") and
if x.hasRecordExprFieldList()
then hasRecordExprFieldList = "yes"
else hasRecordExprFieldList = "no"
select x, "hasPath:", hasPath, "hasRecordExprFieldList:", hasRecordExprFieldList
select x, "hasResolvedPath:", hasResolvedPath, "hasResolvedCrateOrigin:", hasResolvedCrateOrigin,
"hasPath:", hasPath, "hasRecordExprFieldList:", hasRecordExprFieldList

View File

@@ -0,0 +1,7 @@
// generated by codegen, do not edit
import codeql.rust.elements
import TestUtils
from RecordExpr x
where toBeTested(x) and not x.isUnknown()
select x, x.getResolvedCrateOrigin()

View File

@@ -0,0 +1,7 @@
// generated by codegen, do not edit
import codeql.rust.elements
import TestUtils
from RecordExpr x
where toBeTested(x) and not x.isUnknown()
select x, x.getResolvedPath()

View File

@@ -1,2 +1,2 @@
| gen_record_pat.rs:6:9:6:26 | Foo {...} | hasPath: | yes | hasRecordPatFieldList: | yes |
| gen_record_pat.rs:7:9:7:18 | Foo {...} | hasPath: | yes | hasRecordPatFieldList: | yes |
| gen_record_pat.rs:6:9:6:26 | Foo {...} | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | hasRecordPatFieldList: | yes |
| gen_record_pat.rs:7:9:7:18 | Foo {...} | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | hasRecordPatFieldList: | yes |

View File

@@ -2,10 +2,19 @@
import codeql.rust.elements
import TestUtils
from RecordPat x, string hasPath, string hasRecordPatFieldList
from
RecordPat x, string hasResolvedPath, string hasResolvedCrateOrigin, string hasPath,
string hasRecordPatFieldList
where
toBeTested(x) and
not x.isUnknown() and
(if x.hasResolvedPath() then hasResolvedPath = "yes" else hasResolvedPath = "no") and
(
if x.hasResolvedCrateOrigin()
then hasResolvedCrateOrigin = "yes"
else hasResolvedCrateOrigin = "no"
) and
(if x.hasPath() then hasPath = "yes" else hasPath = "no") and
if x.hasRecordPatFieldList() then hasRecordPatFieldList = "yes" else hasRecordPatFieldList = "no"
select x, "hasPath:", hasPath, "hasRecordPatFieldList:", hasRecordPatFieldList
select x, "hasResolvedPath:", hasResolvedPath, "hasResolvedCrateOrigin:", hasResolvedCrateOrigin,
"hasPath:", hasPath, "hasRecordPatFieldList:", hasRecordPatFieldList

View File

@@ -0,0 +1,7 @@
// generated by codegen, do not edit
import codeql.rust.elements
import TestUtils
from RecordPat x
where toBeTested(x) and not x.isUnknown()
select x, x.getResolvedCrateOrigin()

View File

@@ -0,0 +1,7 @@
// generated by codegen, do not edit
import codeql.rust.elements
import TestUtils
from RecordPat x
where toBeTested(x) and not x.isUnknown()
select x, x.getResolvedPath()

View File

@@ -1,3 +1,3 @@
| gen_tuple_struct_pat.rs:6:9:6:27 | Tuple(...) | getNumberOfFields: | 4 | hasPath: | yes |
| gen_tuple_struct_pat.rs:7:9:7:20 | Tuple(...) | getNumberOfFields: | 2 | hasPath: | yes |
| gen_tuple_struct_pat.rs:8:9:8:17 | Tuple(...) | getNumberOfFields: | 1 | hasPath: | yes |
| gen_tuple_struct_pat.rs:6:9:6:27 | Tuple(...) | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfFields: | 4 |
| gen_tuple_struct_pat.rs:7:9:7:20 | Tuple(...) | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfFields: | 2 |
| gen_tuple_struct_pat.rs:8:9:8:17 | Tuple(...) | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfFields: | 1 |

View File

@@ -2,10 +2,19 @@
import codeql.rust.elements
import TestUtils
from TupleStructPat x, int getNumberOfFields, string hasPath
from
TupleStructPat x, string hasResolvedPath, string hasResolvedCrateOrigin, string hasPath,
int getNumberOfFields
where
toBeTested(x) and
not x.isUnknown() and
getNumberOfFields = x.getNumberOfFields() and
if x.hasPath() then hasPath = "yes" else hasPath = "no"
select x, "getNumberOfFields:", getNumberOfFields, "hasPath:", hasPath
(if x.hasResolvedPath() then hasResolvedPath = "yes" else hasResolvedPath = "no") and
(
if x.hasResolvedCrateOrigin()
then hasResolvedCrateOrigin = "yes"
else hasResolvedCrateOrigin = "no"
) and
(if x.hasPath() then hasPath = "yes" else hasPath = "no") and
getNumberOfFields = x.getNumberOfFields()
select x, "hasResolvedPath:", hasResolvedPath, "hasResolvedCrateOrigin:", hasResolvedCrateOrigin,
"hasPath:", hasPath, "getNumberOfFields:", getNumberOfFields

View File

@@ -0,0 +1,7 @@
// generated by codegen, do not edit
import codeql.rust.elements
import TestUtils
from TupleStructPat x
where toBeTested(x) and not x.isUnknown()
select x, x.getResolvedCrateOrigin()

View File

@@ -0,0 +1,7 @@
// generated by codegen, do not edit
import codeql.rust.elements
import TestUtils
from TupleStructPat x
where toBeTested(x) and not x.isUnknown()
select x, x.getResolvedPath()

View File

@@ -16,6 +16,16 @@ fn test_identify() {
sink(identity(s)); // $ hasValueFlow=1
}
// has a flow model
fn coerce(_i: i64) -> i64 {
0
}
fn test_coerce() {
let s = source(14);
sink(coerce(s)); // $ hasTaintFlow=14
}
enum MyPosEnum {
A(i64),
B(i64),

View File

@@ -1,57 +1,113 @@
models
edges
| main.rs:15:13:15:21 | source(...) | main.rs:16:19:16:19 | s | provenance | |
| main.rs:15:13:15:21 | source(...) | main.rs:16:19:16:19 | s | provenance | |
| main.rs:16:19:16:19 | s | main.rs:16:10:16:20 | identity(...) | provenance | |
| main.rs:30:13:30:21 | source(...) | main.rs:31:27:31:27 | s | provenance | |
| main.rs:31:14:31:28 | ...::A(...) [A] | main.rs:32:22:32:23 | e1 [A] | provenance | |
| main.rs:31:27:31:27 | s | main.rs:31:14:31:28 | ...::A(...) [A] | provenance | |
| main.rs:32:22:32:23 | e1 [A] | main.rs:32:10:32:24 | get_var_pos(...) | provenance | |
| main.rs:43:13:43:21 | source(...) | main.rs:44:26:44:26 | s | provenance | |
| main.rs:44:14:44:27 | set_var_pos(...) [B] | main.rs:47:9:47:23 | ...::B(...) [B] | provenance | |
| main.rs:44:26:44:26 | s | main.rs:44:14:44:27 | set_var_pos(...) [B] | provenance | |
| main.rs:47:9:47:23 | ...::B(...) [B] | main.rs:47:22:47:22 | i | provenance | |
| main.rs:47:22:47:22 | i | main.rs:47:33:47:33 | i | provenance | |
| main.rs:62:13:62:21 | source(...) | main.rs:63:40:63:40 | s | provenance | |
| main.rs:63:14:63:42 | ...::C {...} [C] | main.rs:64:24:64:25 | e1 [C] | provenance | |
| main.rs:63:40:63:40 | s | main.rs:63:14:63:42 | ...::C {...} [C] | provenance | |
| main.rs:64:24:64:25 | e1 [C] | main.rs:64:10:64:26 | get_var_field(...) | provenance | |
| main.rs:75:13:75:21 | source(...) | main.rs:76:28:76:28 | s | provenance | |
| main.rs:76:14:76:29 | set_var_field(...) [D] | main.rs:79:9:79:37 | ...::D {...} [D] | provenance | |
| main.rs:76:28:76:28 | s | main.rs:76:14:76:29 | set_var_field(...) [D] | provenance | |
| main.rs:79:9:79:37 | ...::D {...} [D] | main.rs:79:35:79:35 | i | provenance | |
| main.rs:79:35:79:35 | i | main.rs:79:47:79:47 | i | provenance | |
| main.rs:16:19:16:19 | s | main.rs:16:10:16:20 | identity(...) | provenance | |
| main.rs:25:13:25:22 | source(...) | main.rs:26:17:26:17 | s | provenance | |
| main.rs:26:17:26:17 | s | main.rs:26:10:26:18 | coerce(...) | provenance | |
| main.rs:40:13:40:21 | source(...) | main.rs:41:27:41:27 | s | provenance | |
| main.rs:40:13:40:21 | source(...) | main.rs:41:27:41:27 | s | provenance | |
| main.rs:41:14:41:28 | ...::A(...) [A] | main.rs:42:22:42:23 | e1 [A] | provenance | |
| main.rs:41:14:41:28 | ...::A(...) [A] | main.rs:42:22:42:23 | e1 [A] | provenance | |
| main.rs:41:27:41:27 | s | main.rs:41:14:41:28 | ...::A(...) [A] | provenance | |
| main.rs:41:27:41:27 | s | main.rs:41:14:41:28 | ...::A(...) [A] | provenance | |
| main.rs:42:22:42:23 | e1 [A] | main.rs:42:10:42:24 | get_var_pos(...) | provenance | |
| main.rs:42:22:42:23 | e1 [A] | main.rs:42:10:42:24 | get_var_pos(...) | provenance | |
| main.rs:53:13:53:21 | source(...) | main.rs:54:26:54:26 | s | provenance | |
| main.rs:53:13:53:21 | source(...) | main.rs:54:26:54:26 | s | provenance | |
| main.rs:54:14:54:27 | set_var_pos(...) [B] | main.rs:57:9:57:23 | ...::B(...) [B] | provenance | |
| main.rs:54:14:54:27 | set_var_pos(...) [B] | main.rs:57:9:57:23 | ...::B(...) [B] | provenance | |
| main.rs:54:26:54:26 | s | main.rs:54:14:54:27 | set_var_pos(...) [B] | provenance | |
| main.rs:54:26:54:26 | s | main.rs:54:14:54:27 | set_var_pos(...) [B] | provenance | |
| main.rs:57:9:57:23 | ...::B(...) [B] | main.rs:57:22:57:22 | i | provenance | |
| main.rs:57:9:57:23 | ...::B(...) [B] | main.rs:57:22:57:22 | i | provenance | |
| main.rs:57:22:57:22 | i | main.rs:57:33:57:33 | i | provenance | |
| main.rs:57:22:57:22 | i | main.rs:57:33:57:33 | i | provenance | |
| main.rs:72:13:72:21 | source(...) | main.rs:73:40:73:40 | s | provenance | |
| main.rs:72:13:72:21 | source(...) | main.rs:73:40:73:40 | s | provenance | |
| main.rs:73:14:73:42 | ...::C {...} [C] | main.rs:74:24:74:25 | e1 [C] | provenance | |
| main.rs:73:14:73:42 | ...::C {...} [C] | main.rs:74:24:74:25 | e1 [C] | provenance | |
| main.rs:73:40:73:40 | s | main.rs:73:14:73:42 | ...::C {...} [C] | provenance | |
| main.rs:73:40:73:40 | s | main.rs:73:14:73:42 | ...::C {...} [C] | provenance | |
| main.rs:74:24:74:25 | e1 [C] | main.rs:74:10:74:26 | get_var_field(...) | provenance | |
| main.rs:74:24:74:25 | e1 [C] | main.rs:74:10:74:26 | get_var_field(...) | provenance | |
| main.rs:85:13:85:21 | source(...) | main.rs:86:28:86:28 | s | provenance | |
| main.rs:85:13:85:21 | source(...) | main.rs:86:28:86:28 | s | provenance | |
| main.rs:86:14:86:29 | set_var_field(...) [D] | main.rs:89:9:89:37 | ...::D {...} [D] | provenance | |
| main.rs:86:14:86:29 | set_var_field(...) [D] | main.rs:89:9:89:37 | ...::D {...} [D] | provenance | |
| main.rs:86:28:86:28 | s | main.rs:86:14:86:29 | set_var_field(...) [D] | provenance | |
| main.rs:86:28:86:28 | s | main.rs:86:14:86:29 | set_var_field(...) [D] | provenance | |
| main.rs:89:9:89:37 | ...::D {...} [D] | main.rs:89:35:89:35 | i | provenance | |
| main.rs:89:9:89:37 | ...::D {...} [D] | main.rs:89:35:89:35 | i | provenance | |
| main.rs:89:35:89:35 | i | main.rs:89:47:89:47 | i | provenance | |
| main.rs:89:35:89:35 | i | main.rs:89:47:89:47 | i | provenance | |
nodes
| main.rs:15:13:15:21 | source(...) | semmle.label | source(...) |
| main.rs:15:13:15:21 | source(...) | semmle.label | source(...) |
| main.rs:16:10:16:20 | identity(...) | semmle.label | identity(...) |
| main.rs:16:10:16:20 | identity(...) | semmle.label | identity(...) |
| main.rs:16:19:16:19 | s | semmle.label | s |
| main.rs:30:13:30:21 | source(...) | semmle.label | source(...) |
| main.rs:31:14:31:28 | ...::A(...) [A] | semmle.label | ...::A(...) [A] |
| main.rs:31:27:31:27 | s | semmle.label | s |
| main.rs:32:10:32:24 | get_var_pos(...) | semmle.label | get_var_pos(...) |
| main.rs:32:22:32:23 | e1 [A] | semmle.label | e1 [A] |
| main.rs:43:13:43:21 | source(...) | semmle.label | source(...) |
| main.rs:44:14:44:27 | set_var_pos(...) [B] | semmle.label | set_var_pos(...) [B] |
| main.rs:44:26:44:26 | s | semmle.label | s |
| main.rs:47:9:47:23 | ...::B(...) [B] | semmle.label | ...::B(...) [B] |
| main.rs:47:22:47:22 | i | semmle.label | i |
| main.rs:47:33:47:33 | i | semmle.label | i |
| main.rs:62:13:62:21 | source(...) | semmle.label | source(...) |
| main.rs:63:14:63:42 | ...::C {...} [C] | semmle.label | ...::C {...} [C] |
| main.rs:63:40:63:40 | s | semmle.label | s |
| main.rs:64:10:64:26 | get_var_field(...) | semmle.label | get_var_field(...) |
| main.rs:64:24:64:25 | e1 [C] | semmle.label | e1 [C] |
| main.rs:75:13:75:21 | source(...) | semmle.label | source(...) |
| main.rs:76:14:76:29 | set_var_field(...) [D] | semmle.label | set_var_field(...) [D] |
| main.rs:76:28:76:28 | s | semmle.label | s |
| main.rs:79:9:79:37 | ...::D {...} [D] | semmle.label | ...::D {...} [D] |
| main.rs:79:35:79:35 | i | semmle.label | i |
| main.rs:79:47:79:47 | i | semmle.label | i |
| main.rs:16:19:16:19 | s | semmle.label | s |
| main.rs:25:13:25:22 | source(...) | semmle.label | source(...) |
| main.rs:26:10:26:18 | coerce(...) | semmle.label | coerce(...) |
| main.rs:26:17:26:17 | s | semmle.label | s |
| main.rs:40:13:40:21 | source(...) | semmle.label | source(...) |
| main.rs:40:13:40:21 | source(...) | semmle.label | source(...) |
| main.rs:41:14:41:28 | ...::A(...) [A] | semmle.label | ...::A(...) [A] |
| main.rs:41:14:41:28 | ...::A(...) [A] | semmle.label | ...::A(...) [A] |
| main.rs:41:27:41:27 | s | semmle.label | s |
| main.rs:41:27:41:27 | s | semmle.label | s |
| main.rs:42:10:42:24 | get_var_pos(...) | semmle.label | get_var_pos(...) |
| main.rs:42:10:42:24 | get_var_pos(...) | semmle.label | get_var_pos(...) |
| main.rs:42:22:42:23 | e1 [A] | semmle.label | e1 [A] |
| main.rs:42:22:42:23 | e1 [A] | semmle.label | e1 [A] |
| main.rs:53:13:53:21 | source(...) | semmle.label | source(...) |
| main.rs:53:13:53:21 | source(...) | semmle.label | source(...) |
| main.rs:54:14:54:27 | set_var_pos(...) [B] | semmle.label | set_var_pos(...) [B] |
| main.rs:54:14:54:27 | set_var_pos(...) [B] | semmle.label | set_var_pos(...) [B] |
| main.rs:54:26:54:26 | s | semmle.label | s |
| main.rs:54:26:54:26 | s | semmle.label | s |
| main.rs:57:9:57:23 | ...::B(...) [B] | semmle.label | ...::B(...) [B] |
| main.rs:57:9:57:23 | ...::B(...) [B] | semmle.label | ...::B(...) [B] |
| main.rs:57:22:57:22 | i | semmle.label | i |
| main.rs:57:22:57:22 | i | semmle.label | i |
| main.rs:57:33:57:33 | i | semmle.label | i |
| main.rs:57:33:57:33 | i | semmle.label | i |
| main.rs:72:13:72:21 | source(...) | semmle.label | source(...) |
| main.rs:72:13:72:21 | source(...) | semmle.label | source(...) |
| main.rs:73:14:73:42 | ...::C {...} [C] | semmle.label | ...::C {...} [C] |
| main.rs:73:14:73:42 | ...::C {...} [C] | semmle.label | ...::C {...} [C] |
| main.rs:73:40:73:40 | s | semmle.label | s |
| main.rs:73:40:73:40 | s | semmle.label | s |
| main.rs:74:10:74:26 | get_var_field(...) | semmle.label | get_var_field(...) |
| main.rs:74:10:74:26 | get_var_field(...) | semmle.label | get_var_field(...) |
| main.rs:74:24:74:25 | e1 [C] | semmle.label | e1 [C] |
| main.rs:74:24:74:25 | e1 [C] | semmle.label | e1 [C] |
| main.rs:85:13:85:21 | source(...) | semmle.label | source(...) |
| main.rs:85:13:85:21 | source(...) | semmle.label | source(...) |
| main.rs:86:14:86:29 | set_var_field(...) [D] | semmle.label | set_var_field(...) [D] |
| main.rs:86:14:86:29 | set_var_field(...) [D] | semmle.label | set_var_field(...) [D] |
| main.rs:86:28:86:28 | s | semmle.label | s |
| main.rs:86:28:86:28 | s | semmle.label | s |
| main.rs:89:9:89:37 | ...::D {...} [D] | semmle.label | ...::D {...} [D] |
| main.rs:89:9:89:37 | ...::D {...} [D] | semmle.label | ...::D {...} [D] |
| main.rs:89:35:89:35 | i | semmle.label | i |
| main.rs:89:35:89:35 | i | semmle.label | i |
| main.rs:89:47:89:47 | i | semmle.label | i |
| main.rs:89:47:89:47 | i | semmle.label | i |
subpaths
testFailures
invalidSpecComponent
#select
| main.rs:16:10:16:20 | identity(...) | main.rs:15:13:15:21 | source(...) | main.rs:16:10:16:20 | identity(...) | $@ | main.rs:15:13:15:21 | source(...) | source(...) |
| main.rs:32:10:32:24 | get_var_pos(...) | main.rs:30:13:30:21 | source(...) | main.rs:32:10:32:24 | get_var_pos(...) | $@ | main.rs:30:13:30:21 | source(...) | source(...) |
| main.rs:47:33:47:33 | i | main.rs:43:13:43:21 | source(...) | main.rs:47:33:47:33 | i | $@ | main.rs:43:13:43:21 | source(...) | source(...) |
| main.rs:64:10:64:26 | get_var_field(...) | main.rs:62:13:62:21 | source(...) | main.rs:64:10:64:26 | get_var_field(...) | $@ | main.rs:62:13:62:21 | source(...) | source(...) |
| main.rs:79:47:79:47 | i | main.rs:75:13:75:21 | source(...) | main.rs:79:47:79:47 | i | $@ | main.rs:75:13:75:21 | source(...) | source(...) |
| main.rs:16:10:16:20 | identity(...) | main.rs:15:13:15:21 | source(...) | main.rs:16:10:16:20 | identity(...) | $@ | main.rs:15:13:15:21 | source(...) | source(...) |
| main.rs:26:10:26:18 | coerce(...) | main.rs:25:13:25:22 | source(...) | main.rs:26:10:26:18 | coerce(...) | $@ | main.rs:25:13:25:22 | source(...) | source(...) |
| main.rs:42:10:42:24 | get_var_pos(...) | main.rs:40:13:40:21 | source(...) | main.rs:42:10:42:24 | get_var_pos(...) | $@ | main.rs:40:13:40:21 | source(...) | source(...) |
| main.rs:42:10:42:24 | get_var_pos(...) | main.rs:40:13:40:21 | source(...) | main.rs:42:10:42:24 | get_var_pos(...) | $@ | main.rs:40:13:40:21 | source(...) | source(...) |
| main.rs:57:33:57:33 | i | main.rs:53:13:53:21 | source(...) | main.rs:57:33:57:33 | i | $@ | main.rs:53:13:53:21 | source(...) | source(...) |
| main.rs:57:33:57:33 | i | main.rs:53:13:53:21 | source(...) | main.rs:57:33:57:33 | i | $@ | main.rs:53:13:53:21 | source(...) | source(...) |
| main.rs:74:10:74:26 | get_var_field(...) | main.rs:72:13:72:21 | source(...) | main.rs:74:10:74:26 | get_var_field(...) | $@ | main.rs:72:13:72:21 | source(...) | source(...) |
| main.rs:74:10:74:26 | get_var_field(...) | main.rs:72:13:72:21 | source(...) | main.rs:74:10:74:26 | get_var_field(...) | $@ | main.rs:72:13:72:21 | source(...) | source(...) |
| main.rs:89:47:89:47 | i | main.rs:85:13:85:21 | source(...) | main.rs:89:47:89:47 | i | $@ | main.rs:85:13:85:21 | source(...) | source(...) |
| main.rs:89:47:89:47 | i | main.rs:85:13:85:21 | source(...) | main.rs:89:47:89:47 | i | $@ | main.rs:85:13:85:21 | source(...) | source(...) |

View File

@@ -25,6 +25,16 @@ private class SummarizedCallableIdentity extends SummarizedCallable::Range {
}
}
private class SummarizedCallableCoerce extends SummarizedCallable::Range {
SummarizedCallableCoerce() { this = "repo::test::_::crate::coerce" }
override predicate propagatesFlow(string input, string output, boolean preservesValue) {
input = "Argument[0]" and
output = "ReturnValue" and
preservesValue = false
}
}
private class SummarizedCallableGetVarPos extends SummarizedCallable::Range {
SummarizedCallableGetVarPos() { this = "repo::test::_::crate::get_var_pos" }
@@ -71,7 +81,7 @@ module CustomConfig implements DataFlow::ConfigSig {
predicate isSink(DataFlow::Node sink) { DefaultFlowConfig::isSink(sink) }
}
import ValueFlowTest<CustomConfig>
import FlowTest<CustomConfig, CustomConfig>
from PathNode source, PathNode sink
where flowPath(source, sink)

View File

@@ -10,9 +10,9 @@ module MyFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof ThreatModelSource }
predicate isSink(DataFlow::Node sink) {
any(CallExpr call |
call.getFunction().(PathExpr).getPath().getResolvedPath() = "crate::test::sink"
).getArgList().getAnArg() = sink.asExpr().getExpr()
any(CallExpr call | call.getFunction().(PathExpr).getResolvedPath() = "crate::test::sink")
.getArgList()
.getAnArg() = sink.asExpr().getExpr()
}
}

View File

@@ -0,0 +1,8 @@
| main.rs:4:5:4:8 | 1000 | main.rs:4:5:4:12 | ... + ... | |
| main.rs:4:12:4:12 | i | main.rs:4:5:4:12 | ... + ... | |
| main.rs:13:10:13:10 | a | main.rs:13:10:13:14 | ... + ... | |
| main.rs:13:14:13:14 | 1 | main.rs:13:10:13:14 | ... + ... | |
| main.rs:18:11:18:11 | a | main.rs:18:10:18:11 | - ... | |
| main.rs:23:13:23:13 | a | main.rs:23:13:23:19 | a as u8 | |
| main.rs:24:10:24:10 | b | main.rs:24:10:24:17 | b as i64 | |
| main.rs:38:23:38:23 | s | main.rs:38:23:38:29 | s[...] | |

View File

@@ -0,0 +1,4 @@
import codeql.rust.dataflow.DataFlow
import codeql.rust.dataflow.internal.TaintTrackingImpl
query predicate additionalTaintStep = RustTaintTracking::defaultAdditionalTaintStep/3;

View File

@@ -0,0 +1,18 @@
models
edges
| main.rs:12:13:12:22 | source(...) | main.rs:13:10:13:14 | ... + ... | provenance | |
| main.rs:17:13:17:22 | source(...) | main.rs:18:10:18:11 | - ... | provenance | |
| main.rs:22:13:22:22 | source(...) | main.rs:24:10:24:17 | b as i64 | provenance | |
nodes
| main.rs:12:13:12:22 | source(...) | semmle.label | source(...) |
| main.rs:13:10:13:14 | ... + ... | semmle.label | ... + ... |
| main.rs:17:13:17:22 | source(...) | semmle.label | source(...) |
| main.rs:18:10:18:11 | - ... | semmle.label | - ... |
| main.rs:22:13:22:22 | source(...) | semmle.label | source(...) |
| main.rs:24:10:24:17 | b as i64 | semmle.label | b as i64 |
subpaths
testFailures
#select
| main.rs:13:10:13:14 | ... + ... | main.rs:12:13:12:22 | source(...) | main.rs:13:10:13:14 | ... + ... | $@ | main.rs:12:13:12:22 | source(...) | source(...) |
| main.rs:18:10:18:11 | - ... | main.rs:17:13:17:22 | source(...) | main.rs:18:10:18:11 | - ... | $@ | main.rs:17:13:17:22 | source(...) | source(...) |
| main.rs:24:10:24:17 | b as i64 | main.rs:22:13:22:22 | source(...) | main.rs:24:10:24:17 | b as i64 | $@ | main.rs:22:13:22:22 | source(...) | source(...) |

View File

@@ -0,0 +1,12 @@
/**
* @kind path-problem
*/
import rust
import utils.InlineFlowTest
import DefaultFlowTest
import TaintFlow::PathGraph
from TaintFlow::PathNode source, TaintFlow::PathNode sink
where TaintFlow::flowPath(source, sink)
select sink, source, sink, "$@", source, source.toString()

View File

@@ -0,0 +1,50 @@
// Tests for taint flow.
fn source(i: i64) -> i64 {
1000 + i
}
fn sink(s: i64) {
println!("{}", s);
}
fn addition() {
let a = source(42);
sink(a + 1); // $ hasTaintFlow=42
}
fn negation() {
let a = source(17);
sink(-a); // $ hasTaintFlow=17
}
fn cast() {
let a = source(77);
let b = a as u8;
sink(b as i64); // $ hasTaintFlow=77
}
mod string {
fn source(i: i64) -> String {
format!("{}", i)
}
fn sink(s: &str) {
println!("{}", s);
}
pub fn string_slice() {
let s = source(35);
let sliced = &s[1..3];
sink(sliced); // $ MISSING: hasTaintFlow=35
}
}
use string::*;
fn main() {
addition();
negation();
cast();
string_slice();
}

View File

@@ -5,4 +5,3 @@
| main.rs:0:0:0:0 | main.rs | File successfully extracted. |
| my_macro.rs:0:0:0:0 | my_macro.rs | File successfully extracted. |
| my_struct.rs:0:0:0:0 | my_struct.rs | File successfully extracted. |
| options.yml:0:0:0:0 | options.yml | File successfully extracted. |

View File

@@ -5,4 +5,5 @@
| lib.rs:0:0:0:0 | lib.rs | 5 |
| does_not_compile.rs:0:0:0:0 | does_not_compile.rs | 3 |
| error.rs:0:0:0:0 | error.rs | 3 |
| Cargo.toml:0:0:0:0 | Cargo.toml | 0 |
| options.yml:0:0:0:0 | options.yml | 0 |

View File

@@ -1,10 +1,10 @@
| Elements extracted | 382 |
| Elements extracted | 404 |
| Elements unextracted | 0 |
| Extraction errors | 0 |
| Extraction warnings | 7 |
| Files extracted - total | 8 |
| Files extracted - total | 7 |
| Files extracted - with errors | 3 |
| Files extracted - without errors | 5 |
| Files extracted - without errors | 4 |
| Inconsistencies - AST | 0 |
| Inconsistencies - CFG | 0 |
| Inconsistencies - data flow | 0 |