Commit Graph

4011 Commits

Author SHA1 Message Date
Tom Hvitved
c66679c03b Merge pull request #21564 from hvitved/rust/type-inference-additional-constraints
Rust: Take additional type parameter constraints into account
2026-03-26 14:38:06 +01:00
Tom Hvitved
09a2dd4a2e Update rust/ql/lib/codeql/rust/internal/typeinference/FunctionType.qll
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-25 15:01:39 +01:00
Tom Hvitved
c579ec9ea7 Merge pull request #21575 from hvitved/rust/model-generator-taint-steps
Rust: Include taint steps when generating flow models
2026-03-25 14:41:36 +01:00
Tom Hvitved
fba4a83dc8 Rust: Include taint steps when generating flow models 2026-03-25 12:52:08 +01:00
Owen Mansel-Chan
f25d7456da Fix QL formatting 2026-03-25 10:05:04 +00:00
Tom Hvitved
6295f57a87 Rust: Take additional type parameter constraints into account 2026-03-25 10:11:04 +01:00
Owen Mansel-Chan
bedfe1e755 Apply suggestions from code review
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2026-03-24 22:06:53 +00:00
Tom Hvitved
ddc407257f Rust: Type inference test 2026-03-24 15:41:43 +01:00
Owen Mansel-Chan
7e6319d648 Remove unused field 2026-03-24 10:39:32 +00:00
Owen Mansel-Chan
93231794ee Document that MaD barriers for hardcoded credentials apply to all kinds 2026-03-24 10:39:05 +00:00
Owen Mansel-Chan
5762191832 Enable MaD barriers for queries with MaD sinks 2026-03-24 10:28:25 +00:00
Owen Mansel-Chan
fd8821fcb5 Merge pull request #21475 from owen-mc/rust/mad-barriers
Rust: Add support for defining barriers and barrier guards using models-as-data
2026-03-24 09:31:24 +00:00
Owen Mansel-Chan
8d16a2b4fa Fix parameter -> argument in QLDoc 2026-03-23 16:24:03 +00:00
Owen Mansel-Chan
97ebc0e839 Update QLDoc in FlowBarrier.qll 2026-03-23 16:22:27 +00:00
Owen Mansel-Chan
d82fc67b36 Fix QLDoc formatting 2026-03-23 16:11:22 +00:00
Owen Mansel-Chan
093c27955f Fix incorrect QLDoc
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-20 15:24:15 +00:00
Tom Hvitved
f99f26f908 Merge pull request #21464 from hvitved/rust/type-inference-trait-bound-impl-overlap
Rust: Disambiguate types inferred from trait bounds
2026-03-20 15:14:24 +01:00
Owen Mansel-Chan
bde9378cee Update MaD barrier guard test output 2026-03-20 11:10:08 +00:00
Owen Mansel-Chan
769b3a6aae Instantiate flow barrier guards from MaD 2026-03-20 11:08:53 +00:00
Owen Mansel-Chan
7d65baccb2 Add FlowBarrierGuard to FlowBarrier.qll 2026-03-20 11:08:33 +00:00
Owen Mansel-Chan
77cb35380c Add MaD barrier guard model to make test pass 2026-03-20 11:06:41 +00:00
Owen Mansel-Chan
c5457d3e30 Add (failing) test for MaD barrier guard 2026-03-20 11:06:39 +00:00
Owen Mansel-Chan
2f0d3288ce Misc: fix typos in QLDocs 2026-03-20 11:06:38 +00:00
Owen Mansel-Chan
93c656065d Add test for MaD barriers 2026-03-20 11:06:36 +00:00
Owen Mansel-Chan
e86ce8feed Instantiate flow barriers from MaD 2026-03-20 11:06:35 +00:00
Owen Mansel-Chan
d3177b9e82 Add FlowBarrier.qll 2026-03-20 11:06:33 +00:00
Owen Mansel-Chan
f9521e9e88 Update interpretModelForTest 2026-03-20 11:06:30 +00:00
Owen Mansel-Chan
f342bae962 Update empty.model.yml 2026-03-20 11:06:29 +00:00
Owen Mansel-Chan
bceab0b44e Add extensible predicates 2026-03-20 11:06:26 +00:00
Óscar San José
2139b97628 Merge branch 'main' into post-release-prep/codeql-cli-2.25.0 2026-03-19 13:07:00 +01:00
Tom Hvitved
7fc1d53ede Rust: Disambiguate types inferred from trait bounds 2026-03-19 12:57:22 +01:00
Tom Hvitved
2ff5c2c234 Rust: Fix two bad joins
Before
```
Evaluated relational algebra for predicate TypeInference::DeconstructionPatMatchingInput::Access.getNodeAt/1#dispred#cc149bc2@88f6f09n with tuple counts:
           142521   ~1%    {3} r1 = JOIN num#FunctionType::TReturnFunctionPosition#a15fd6be WITH TypeInference::DeconstructionPatMatchingInput::Access#a2676dcb CARTESIAN PRODUCT OUTPUT Rhs.0, Lhs.0, Rhs.0

           131938   ~0%    {3} r2 = JOIN `TupleStructPat::Generated::TupleStructPat.getField/1#dispred#ac9c1af6` WITH TypeInference::DeconstructionPatMatchingInput::Access#a2676dcb ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Lhs.2
           131938   ~6%    {3}    | JOIN WITH `FunctionType::FunctionPosition.asPosition/0#dispred#efcc0611_10#join_rhs` ON FIRST 1 OUTPUT Lhs.1, Rhs.1, Lhs.2

          3071346   ~0%    {2} r3 = SCAN `Name::Generated::Name.getText/0#dispred#107a5a39` OUTPUT In.1, In.0
        103064442   ~2%    {3}    | JOIN WITH `StructPat::StructPat.getPatField/1#5e21ea0e_102#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Rhs.2
        103064442   ~3%    {3}    | JOIN WITH TypeInference::DeconstructionPatMatchingInput::Access#a2676dcb ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Lhs.0
        103064438   ~1%    {3}    | JOIN WITH `StructPatField::Generated::StructPatField.getPat/0#dispred#1aadfeff` ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Rhs.1
         20514858   ~2%    {3}    | JOIN WITH `StructField::Generated::StructField.getName/0#dispred#e0248569_10#join_rhs` ON FIRST 1 OUTPUT Lhs.1, Rhs.1, Lhs.2
            59554   ~1%    {3}    | JOIN WITH `StructPat::StructPat.getNthStructField/1#dispred#de537654_021#join_rhs` ON FIRST 2 OUTPUT Rhs.2, Lhs.0, Lhs.2
            59542   ~0%    {3}    | JOIN WITH `FunctionType::FunctionPosition.asPosition/0#dispred#efcc0611_10#join_rhs` ON FIRST 1 OUTPUT Lhs.1, Rhs.1, Lhs.2

           334001   ~0%    {3} r4 = r1 UNION r2 UNION r3
                           return r4

Evaluated relational algebra for predicate TypeInference::ConstructionMatchingInput::Access.getNodeAt/1#dispred#acd835e6@bfb1f1e1 with tuple counts:
          1395153   ~3%    {3} r1 = JOIN TypeInference::ConstructionMatchingInput::PathExprAccess#b7a80c43 WITH num#FunctionType::TReturnFunctionPosition#a15fd6be CARTESIAN PRODUCT OUTPUT Lhs.0, Rhs.0, Lhs.0

            34290   ~3%    {3} r2 = JOIN StructExpr::Generated::StructExpr#d0a89c56 WITH num#FunctionType::TReturnFunctionPosition#a15fd6be CARTESIAN PRODUCT OUTPUT Lhs.0, Rhs.0, Lhs.0

          3071346   ~0%    {2} r3 = SCAN `Name::Generated::Name.getText/0#dispred#107a5a39` OUTPUT In.1, In.0
        145365745   ~0%    {3}    | JOIN WITH `StructExpr::StructExpr.getFieldExpr/1#cd55566d_102#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Rhs.2
        145365745   ~1%    {3}    | JOIN WITH StructExpr::Generated::StructExpr#d0a89c56 ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Lhs.2
         33371514   ~0%    {3}    | JOIN WITH `StructField::Generated::StructField.getName/0#dispred#e0248569_10#join_rhs` ON FIRST 1 OUTPUT Lhs.1, Rhs.1, Lhs.2
           108831   ~0%    {3}    | JOIN WITH `StructExpr::StructExpr.getNthStructField/1#dispred#89ad7e20_021#join_rhs` ON FIRST 2 OUTPUT Rhs.2, Lhs.0, Lhs.2
           108751   ~0%    {3}    | JOIN WITH `FunctionType::FunctionPosition.asPosition/0#dispred#efcc0611_10#join_rhs` ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Rhs.1
           108751   ~4%    {3}    | JOIN WITH `StructExprField::Generated::StructExprField.getExpr/0#dispred#956e6ba1` ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Rhs.1

          1748398   ~4%    {3} r4 = `TypeInference::ConstructionMatchingInput::NonAssocCallAccess.getNodeAt/1#dispred#ef232b1f` UNION r1 UNION r2 UNION r3
                           return r4
```

After
```
Evaluated relational algebra for predicate TypeInference::DeconstructionPatMatchingInput::Access.getNodeAt/1#dispred#cc149bc2@2ea6ebjs with tuple counts:
        142521   ~1%    {3} r1 = JOIN num#FunctionType::TReturnFunctionPosition#a15fd6be WITH TypeInference::DeconstructionPatMatchingInput::Access#a2676dcb CARTESIAN PRODUCT OUTPUT Rhs.0, Lhs.0, Rhs.0

        131938   ~0%    {3} r2 = JOIN `TupleStructPat::Generated::TupleStructPat.getField/1#dispred#ac9c1af6` WITH TypeInference::DeconstructionPatMatchingInput::Access#a2676dcb ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Lhs.2
        131938   ~6%    {3}    | JOIN WITH `FunctionType::FunctionPosition.asPosition/0#dispred#efcc0611_10#join_rhs` ON FIRST 1 OUTPUT Lhs.1, Rhs.1, Lhs.2

        166829   ~3%    {3} r3 = JOIN `_Name::Generated::Name.getText/0#dispred#107a5a39_StructField::Generated::StructField.getName/0#disp__#shared` WITH `StructPat::StructPat.getNthStructField/1#dispred#de537654_201#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Rhs.2
        166817   ~2%    {3}    | JOIN WITH TypeInference::DeconstructionPatMatchingInput::Access#a2676dcb ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Lhs.0
        166817   ~0%    {3}    | JOIN WITH `FunctionType::FunctionPosition.asPosition/0#dispred#efcc0611_10#join_rhs` ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Rhs.1
         59542   ~0%    {3}    | JOIN WITH `StructPat::StructPat.getPatField/1#5e21ea0e` ON FIRST 2 OUTPUT Rhs.2, Lhs.0, Lhs.2
         59542   ~0%    {3}    | JOIN WITH `StructPatField::Generated::StructPatField.getPat/0#dispred#1aadfeff` ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Rhs.1

        334001   ~0%    {3} r4 = r1 UNION r2 UNION r3
                        return r4

Evaluated relational algebra for predicate TypeInference::ConstructionMatchingInput::Access.getNodeAt/1#dispred#acd835e6@c7f267fp with tuple counts:
        1395153   ~3%    {3} r1 = JOIN TypeInference::ConstructionMatchingInput::PathExprAccess#b7a80c43 WITH num#FunctionType::TReturnFunctionPosition#a15fd6be CARTESIAN PRODUCT OUTPUT Lhs.0, Rhs.0, Lhs.0

          34290   ~3%    {3} r2 = JOIN StructExpr::Generated::StructExpr#d0a89c56 WITH num#FunctionType::TReturnFunctionPosition#a15fd6be CARTESIAN PRODUCT OUTPUT Lhs.0, Rhs.0, Lhs.0

         159331   ~0%    {3} r3 = JOIN `_Name::Generated::Name.getText/0#dispred#107a5a39_StructField::Generated::StructField.getName/0#disp__#shared` WITH `StructExpr::StructExpr.getNthStructField/1#dispred#89ad7e20_201#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Rhs.2
         159231   ~3%    {3}    | JOIN WITH StructExpr::Generated::StructExpr#d0a89c56 ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Lhs.0
         159231   ~3%    {3}    | JOIN WITH `FunctionType::FunctionPosition.asPosition/0#dispred#efcc0611_10#join_rhs` ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Rhs.1
         108731   ~0%    {3}    | JOIN WITH `StructExpr::StructExpr.getFieldExpr/1#cd55566d` ON FIRST 2 OUTPUT Rhs.2, Lhs.0, Lhs.2
         108731   ~4%    {3}    | JOIN WITH `StructExprField::Generated::StructExprField.getExpr/0#dispred#956e6ba1` ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Rhs.1

        1748378   ~4%    {3} r4 = `TypeInference::ConstructionMatchingInput::NonAssocCallAccess.getNodeAt/1#dispred#ef232b1f` UNION r1 UNION r2 UNION r3
                         return r4
```
2026-03-18 20:42:57 +01:00
Tom Hvitved
98d8cd1d6d Rust: Make getATypeParameterConstraint return a TypeMention again 2026-03-18 19:52:45 +01:00
Tom Hvitved
e8e46accc0 Rust: Refine AssociatedTypeTypeParameter.toString 2026-03-18 19:52:43 +01:00
Tom Hvitved
06f0c1189f Shared: Generalize SatisfiesConstraint module 2026-03-18 19:52:41 +01:00
Tom Hvitved
082dc61620 Rust: Add type inference test 2026-03-18 19:52:39 +01:00
Tom Hvitved
2e7da72277 Merge pull request #21488 from paldepind/rust/tuple-constructor-self
Rust: Unify handling of struct and tuple constructors
2026-03-18 19:52:06 +01:00
Owen Mansel-Chan
5b17d8cf76 Merge pull request #21472 from owen-mc/adjust-severity/xss-log-injection
Adjust `@security-severity` metadata for XSS and log injection queries
2026-03-18 16:51:14 +00:00
Simon Friis Vindum
f2a0724620 Rust: Use getReturnType 2026-03-18 15:06:34 +01:00
Simon Friis Vindum
b8222167d2 Rust: Ensure that TPositionalArgumentPosition is large enough for struct expressions 2026-03-18 15:06:32 +01:00
Simon Friis Vindum
6efd844180 Rust: Rename into "construction" and "deconstruction" 2026-03-18 15:06:23 +01:00
Simon Friis Vindum
d180900ab4 Rust: Minor improvements to documentation comments
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-17 19:01:22 +01:00
Simon Friis Vindum
97670b3674 Rust: Unify handling of struct and tuple constructors 2026-03-17 16:41:18 +01:00
Owen Mansel-Chan
3aaee9d981 Change @security-severity for rust/log-injection from 2.6 to 6.1 2026-03-17 12:01:05 +00:00
Tom Hvitved
1ac9e5a2a4 Rust: Elaborate QL doc on FunctionPosition class 2026-03-17 09:51:15 +01:00
github-actions[bot]
e3dbf5b022 Post-release preparation for codeql-cli-2.25.0 2026-03-16 16:03:22 +00:00
github-actions[bot]
d6055754b6 Release preparation for version 2.25.0 2026-03-16 12:15:34 +00:00
Tom Hvitved
ca2838b361 Address review comments 2026-03-13 15:38:07 +01:00
Tom Hvitved
7a6ab70091 Rust: Add test for free function with context-based typing 2026-03-13 15:36:06 +01:00
Tom Hvitved
7094fb07a4 Rust: Replace FunctionPosition with FunctionPositionAdj 2026-03-13 14:37:40 +01:00