Commit Graph

3491 Commits

Author SHA1 Message Date
Paolo Tranquilli
f4a6ba9e50 Merge pull request #20857 from github/post-release-prep/codeql-cli-2.23.6
Post-release preparation for codeql-cli-2.23.6
2025-11-18 15:14:39 +01:00
Tom Hvitved
71e84439d7 Merge pull request #20830 from hvitved/rust/path-resolution-slice-array-builtin
Rust: Model builtin types in path resolution
2025-11-18 14:42:59 +01:00
Tom Hvitved
ec15085c34 Address review comments 2025-11-18 13:44:25 +01:00
Paolo Tranquilli
48ee9dd149 Merge branch 'main' into post-release-prep/codeql-cli-2.23.6 2025-11-18 12:18:09 +01:00
github-actions[bot]
5ee45af3aa Post-release preparation for codeql-cli-2.23.6 2025-11-18 09:53:12 +00:00
Geoffrey White
9ab7f87603 Merge pull request #20776 from geoffw0/rustexamples
Rust: Add example queries
2025-11-18 09:34:48 +00:00
github-actions[bot]
18fa6799ce Release preparation for version 2.23.6 2025-11-17 16:38:07 +00:00
Tom Hvitved
bf0dc3c4d1 Rust: Use useUniversalConditions() { none() } 2025-11-17 13:57:00 +01:00
Tom Hvitved
46f5d89674 Rust: Handle builtin types in path resolution 2025-11-17 13:56:56 +01:00
Tom Hvitved
39720a17ef Rust: More type inference tests 2025-11-17 13:54:39 +01:00
Simon Friis Vindum
9971936036 Rust: Improvements to docs from review comments 2025-11-17 12:39:37 +01:00
Simon Friis Vindum
a07f015d01 Rust: Accept changes to expected files 2025-11-17 12:39:36 +01:00
Simon Friis Vindum
089bffff94 Rust: Make impl blocks only give rise to direct trait implementation 2025-11-17 10:22:18 +01:00
Tom Hvitved
8455663255 Rust: Speedup AccessAfterLifetime.ql 2025-11-15 15:21:03 +01:00
Tom Hvitved
8668473916 Merge pull request #20683 from hvitved/rust/type-inference-arg-target-typed
Rust: Restrict type propagation into arguments
2025-11-14 10:46:04 +01:00
Tom Hvitved
4c7f9c0144 Rust: Rename ContextType -> UnknownType 2025-11-14 10:16:21 +01:00
Tom Hvitved
79bdf897d7 Rust: Context typing for constructors 2025-11-14 09:45:03 +01:00
Tom Hvitved
c16b42119d Rust: More type inference tests 2025-11-14 09:45:02 +01:00
Tom Hvitved
e69ff0d5e8 Rust: Restrict type propagation into arguments 2025-11-14 09:44:58 +01:00
Tom Hvitved
72b7dd8955 Rust: Add more type inference tests 2025-11-14 09:41:30 +01:00
Tom Hvitved
f926a076b8 Rust: Fix bad join
Before
```
Evaluated relational algebra for predicate TypeMention::NonAliasPathTypeMention.getTypeMentionForTypeParameter/1#f0c507c8@d7d71dnu with tuple counts:
            12496   ~2%    {3} r1 = SCAN `TypeMention::NonAliasPathTypeMention.getAnAssocTypeArgument/1#c61d1deb` OUTPUT In.2, In.0, In.1
            12421   ~0%    {3}    | JOIN WITH TypeMention::TypeMention#3ab935d1 ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Lhs.0
            12421   ~0%    {3}    | JOIN WITH TypeMention::NonAliasPathTypeMention#9123dc7e ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Lhs.2
            12421   ~0%    {3}    | JOIN WITH cached_Type::TAssociatedTypeTypeParameter#14a276f6 ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
            12421   ~0%    {3}    | JOIN WITH Type::TypeParameter#f85657da ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Lhs.2

                1   ~0%    {2} r2 = SCAN `Stdlib::FnOnceTrait.getTypeParam/0#dispred#93f20bbc` OUTPUT In.1, In.0
                1   ~0%    {2}    | JOIN WITH cached_Type::TTypeParamTypeParameter#868c69a5 ON FIRST 1 OUTPUT Rhs.1, Lhs.1
                1   ~0%    {2}    | JOIN WITH Type::TypeParameter#f85657da ON FIRST 1 OUTPUT Lhs.1, Lhs.0
             3216   ~0%    {2}    | JOIN WITH TypeMention::NonAliasPathTypeMention#9123dc7e_10#join_rhs ON FIRST 1 OUTPUT Rhs.1, Lhs.1
             3216   ~0%    {3}    | JOIN WITH `Path::Generated::Path.getSegment/0#dispred#1c7ef50f` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.0
             3201   ~0%    {3}    | JOIN WITH `PathSegment::Generated::PathSegment.getParenthesizedArgList/0#dispred#cd573956` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
             3201   ~0%    {3}    | JOIN WITH TypeMention::TypeMention#3ab935d1 ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Lhs.0

                1   ~0%    {2} r3 = SCAN `Stdlib::FnOnceTrait.getOutputType/0#0d2e9ef1` OUTPUT In.1, In.0
                1   ~0%    {2}    | JOIN WITH cached_Type::TAssociatedTypeTypeParameter#14a276f6 ON FIRST 1 OUTPUT Rhs.1, Lhs.1
                1   ~0%    {2}    | JOIN WITH Type::TypeParameter#f85657da ON FIRST 1 OUTPUT Lhs.1, Lhs.0
             3216   ~3%    {2}    | JOIN WITH TypeMention::NonAliasPathTypeMention#9123dc7e_10#join_rhs ON FIRST 1 OUTPUT Rhs.1, Lhs.1
             3216   ~0%    {3}    | JOIN WITH `Path::Generated::Path.getSegment/0#dispred#1c7ef50f` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.0
             2958   ~0%    {3}    | JOIN WITH `PathSegment::Generated::PathSegment.getRetType/0#dispred#9d400241` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
             2958   ~0%    {3}    | JOIN WITH `RetTypeRepr::Generated::RetTypeRepr.getTypeRepr/0#dispred#fd85a980` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
             2944   ~0%    {3}    | JOIN WITH TypeMention::TypeMention#3ab935d1 ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Lhs.0

            54186   ~3%    {2} r4 = JOIN `TypeAlias::Generated::TypeAlias.getTypeRepr/0#dispred#5fd7e521_10#join_rhs` WITH TypeMention::TypeMention#3ab935d1 ON FIRST 1 OUTPUT Lhs.1, Lhs.0
          1446369  ~12%    {3}    | JOIN WITH `PathResolution::ItemNode.getASuccessor/1#8f430f71_201#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Rhs.2
            36945   ~0%    {3}    | JOIN WITH `PathResolution::ImplItemNode.getTraitPath/0#dispred#3b7d1cb6` ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Rhs.1
        377232832   ~1%    {4}    | JOIN WITH `Name::Generated::Name.getText/0#dispred#107a5a39_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2, Lhs.0
        370815806   ~5%    {4}    | JOIN WITH `TypeAlias::Generated::TypeAlias.getName/0#dispred#bf886045_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2, Lhs.3
          1490317   ~0%    {4}    | JOIN WITH cached_Type::TAssociatedTypeTypeParameter#14a276f6 ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2, Lhs.3
          1490317   ~0%    {4}    | JOIN WITH `Type::AssociatedTypeTypeParameter.getTrait/0#dispred#41eb3020` ON FIRST 1 OUTPUT Lhs.2, Rhs.1, Lhs.1, Lhs.3
            36413   ~1%    {4}    | JOIN WITH TypeMention::NonAliasPathTypeMention#9123dc7e ON FIRST 2 OUTPUT Lhs.1, Lhs.3, Lhs.2, Lhs.0
            36413   ~1%    {3}    | JOIN WITH `PathResolution::ImplOrTraitItemNode.getAssocItem/1#f77bb9ed` ON FIRST 2 OUTPUT Rhs.2, Lhs.2, Lhs.3
            36413   ~0%    {3}    | JOIN WITH cached_Type::TAssociatedTypeTypeParameter#14a276f6 ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
            36413   ~0%    {3}    | JOIN WITH Type::TypeParameter#f85657da ON FIRST 1 OUTPUT Lhs.2, Lhs.0, Lhs.1

            54979   ~3%    {3} r5 = r1 UNION r2 UNION r3 UNION r4
                           return r5
```

After
```
Evaluated relational algebra for predicate TypeMention::NonAliasPathTypeMention.getTypeMentionForTypeParameter/1#f0c507c8@a37ac19m with tuple counts:
          12496   ~2%    {3} r1 = SCAN `TypeMention::NonAliasPathTypeMention.getAnAssocTypeArgument/1#c61d1deb` OUTPUT In.2, In.0, In.1
          12421   ~0%    {3}    | JOIN WITH TypeMention::TypeMention#3ab935d1 ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Lhs.0
          12421   ~0%    {3}    | JOIN WITH TypeMention::NonAliasPathTypeMention#9123dc7e ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Lhs.2
          12421   ~0%    {3}    | JOIN WITH Type::TAssociatedTypeTypeParameter#14a276f6 ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
          12421   ~0%    {3}    | JOIN WITH Type::TypeParameter#f85657da ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Lhs.2

              1   ~0%    {2} r2 = SCAN `Stdlib::FnOnceTrait.getTypeParam/0#dispred#93f20bbc` OUTPUT In.1, In.0
              1   ~0%    {2}    | JOIN WITH Type::TTypeParamTypeParameter#868c69a5 ON FIRST 1 OUTPUT Rhs.1, Lhs.1
              1   ~0%    {2}    | JOIN WITH Type::TypeParameter#f85657da ON FIRST 1 OUTPUT Lhs.1, Lhs.0
           3216   ~0%    {2}    | JOIN WITH TypeMention::NonAliasPathTypeMention#9123dc7e_10#join_rhs ON FIRST 1 OUTPUT Rhs.1, Lhs.1
           3216   ~0%    {3}    | JOIN WITH `Path::Generated::Path.getSegment/0#dispred#1c7ef50f` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.0
           3201   ~0%    {3}    | JOIN WITH `PathSegment::Generated::PathSegment.getParenthesizedArgList/0#dispred#cd573956` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
           3201   ~0%    {3}    | JOIN WITH TypeMention::TypeMention#3ab935d1 ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Lhs.0

              1   ~0%    {2} r3 = SCAN `Stdlib::FnOnceTrait.getOutputType/0#0d2e9ef1` OUTPUT In.1, In.0
              1   ~0%    {2}    | JOIN WITH Type::TAssociatedTypeTypeParameter#14a276f6 ON FIRST 1 OUTPUT Rhs.1, Lhs.1
              1   ~0%    {2}    | JOIN WITH Type::TypeParameter#f85657da ON FIRST 1 OUTPUT Lhs.1, Lhs.0
           3216   ~3%    {2}    | JOIN WITH TypeMention::NonAliasPathTypeMention#9123dc7e_10#join_rhs ON FIRST 1 OUTPUT Rhs.1, Lhs.1
           3216   ~0%    {3}    | JOIN WITH `Path::Generated::Path.getSegment/0#dispred#1c7ef50f` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.0
           2958   ~0%    {3}    | JOIN WITH `PathSegment::Generated::PathSegment.getRetType/0#dispred#9d400241` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
           2958   ~0%    {3}    | JOIN WITH `RetTypeRepr::Generated::RetTypeRepr.getTypeRepr/0#dispred#fd85a980` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
           2944   ~0%    {3}    | JOIN WITH TypeMention::TypeMention#3ab935d1 ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Lhs.0

          54186   ~3%    {2} r4 = JOIN `TypeAlias::Generated::TypeAlias.getTypeRepr/0#dispred#5fd7e521_10#join_rhs` WITH TypeMention::TypeMention#3ab935d1 ON FIRST 1 OUTPUT Lhs.1, Lhs.0
        1446369  ~12%    {3}    | JOIN WITH `PathResolution::ItemNode.getASuccessor/1#8f430f71_201#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Rhs.2
          36945   ~2%    {3}    | JOIN WITH `PathResolution::ImplItemNode.getTraitPath/0#dispred#3b7d1cb6` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
          36398   ~3%    {3}    | JOIN WITH TypeMention::NonAliasPathTypeMention#9123dc7e ON FIRST 1 OUTPUT Lhs.0, Lhs.2, Lhs.1
          36413   ~1%    {3}    | JOIN WITH `TypeMention::NonAliasPathTypeMention.getResolvedAlias/1#c48b878e` ON FIRST 2 OUTPUT Rhs.2, Lhs.2, Lhs.0
          36413   ~0%    {3}    | JOIN WITH Type::TAssociatedTypeTypeParameter#14a276f6 ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
          36413   ~0%    {3}    | JOIN WITH Type::TypeParameter#f85657da ON FIRST 1 OUTPUT Lhs.2, Lhs.0, Lhs.1

          54979   ~3%    {3} r5 = r1 UNION r2 UNION r3 UNION r4
                         return r5
```
2025-11-13 21:31:32 +01:00
Tom Hvitved
1b6b1e56ed Rust: Fix bad join
Before
```
Pipeline standard for ElementImpl::Impl::MacroExpansion::isFromMacroExpansion/1#69965d18@7580bdbj was evaluated in 205 iterations totaling 49106ms (delta sizes total: 1254645).
        8014745124  ~4%    {1} r1 = AstNodeImpl::Impl::AstNode#22e758cf AND NOT `ElementImpl::Impl::MacroExpansion::isFromMacroExpansion/1#69965d18#prev`(FIRST 1)
         822416474  ~0%    {2}    | JOIN WITH `ElementImpl::Impl::MacroExpansion::getImmediatelyEnclosingMacroInvocation/1#1eb32ecc` ON FIRST 1 OUTPUT Rhs.1, Lhs.0
           1254645  ~0%    {1}    | JOIN WITH `ElementImpl::Impl::MacroExpansion::isFromMacroExpansion/1#69965d18#prev_delta` ON FIRST 1 OUTPUT Lhs.1
                           return r1
```

After
```
Pipeline standard for ElementImpl::Impl::MacroExpansion::isFromMacroExpansion/1#69965d18@f39b84ka was evaluated in 205 iterations totaling 138ms (delta sizes total: 1254645).
        4675568  ~0%    {1} r1 = JOIN `ElementImpl::Impl::MacroExpansion::isFromMacroExpansion/1#69965d18#prev_delta` WITH `ElementImpl::Impl::MacroExpansion::getImmediatelyEnclosingMacroInvocation/1#1eb32ecc_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1
        4672186  ~0%    {1}    | JOIN WITH AstNodeImpl::Impl::AstNode#22e758cf ON FIRST 1 OUTPUT Lhs.0
        1254645  ~0%    {1}    | AND NOT `ElementImpl::Impl::MacroExpansion::isFromMacroExpansion/1#69965d18#prev`(FIRST 1)
                        return r1
```
2025-11-13 15:26:01 +01:00
Tom Hvitved
bfa35629ac Merge pull request #20744 from hvitved/rust/path-resolution-unqualified-use-tree
Rust: Handle unqualified `UseTree`s in path resolution
2025-11-13 11:18:41 +01:00
Tom Hvitved
c6164b33e5 Address review comment 2025-11-13 10:47:04 +01:00
Tom Hvitved
467bd541d2 Merge pull request #20770 from hvitved/rust/attribute-macro-expansion-filter
Rust: Remove elements superseded by attribute macro expansions
2025-11-12 19:52:09 +01:00
Geoffrey White
9598772477 Update rust/ql/examples/snippets/simple_constant_password.ql
Co-authored-by: Tom Hvitved <hvitved@github.com>
2025-11-12 14:37:45 +00:00
Geoffrey White
109abddc36 Apply suggestions from code review
Co-authored-by: Simon Friis Vindum <paldepind@github.com>
2025-11-11 09:32:14 +00:00
Geoffrey White
8624f9c660 Merge pull request #20749 from github/copilot/add-secure-cookie-test-cases
Add test coverage for actix-web, poem, and http-types cookie secure attribute
2025-11-11 09:26:26 +00:00
Geoffrey White
4b212239e1 Rust: Remove unnecessary .(BlockExpr). 2025-11-10 12:35:39 +00:00
Tom Hvitved
de367eaad6 Update rust/ql/lib/codeql/rust/elements/internal/ElementImpl.qll
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-10 12:42:28 +01:00
Tom Hvitved
c81f5f5190 Rust: Remove elements superseded by attribute macro expansions 2025-11-10 09:18:58 +01:00
Tom Hvitved
0bf458a56f Rust: Run codegen 2025-11-09 20:40:13 +01:00
Geoffrey White
61481b51e7 Rust: Change note. 2025-11-07 16:55:35 +00:00
Geoffrey White
7e3ab99d6b Rust: Add much more detailed code comments, since these are examples. 2025-11-07 13:48:03 +00:00
Geoffrey White
7b6e06e8de Rust: Add simple constant password example. 2025-11-07 13:30:53 +00:00
Geoffrey White
49aefe2110 Rust: Add simple SQL injection example. 2025-11-06 18:49:55 +00:00
Geoffrey White
6ce0a0d9df Rust: Add example from the basic-query-for-rust-code.rst. 2025-11-06 17:50:59 +00:00
Geoffrey White
84b50606ed Rust: Add example queries pack. 2025-11-06 17:33:15 +00:00
Tom Hvitved
000f33fcbf Merge pull request #20765 from hvitved/rust/variable-if-let-guard
Rust: Handle variables introduced in if-let guards
2025-11-06 13:49:38 +01:00
Geoffrey White
b4b444de48 Merge pull request #20746 from geoffw0/mv3
Rust: Clean up some models
2025-11-06 10:07:43 +00:00
Geoffrey White
680870dbf3 Rust: Fix after merge. 2025-11-06 09:39:51 +00:00
Tom Hvitved
f8cde74eac Merge pull request #20736 from github/copilot/add-constaccess-class
Rust: Add ConstAccess class with getConst() predicate
2025-11-06 10:25:06 +01:00
Geoffrey White
1ce787a185 Merge branch 'main' into mv3 2025-11-06 09:23:01 +00:00
Tom Hvitved
c80301d58a Rust: Handle variables introduced in if-let guards 2025-11-05 19:46:54 +01:00
Geoffrey White
1e7acc5e1a Merge branch 'main' into copilot/add-secure-cookie-test-cases 2025-11-05 17:53:02 +00:00
Geoffrey White
62e77687ca Rust: Move async_std::io models. 2025-11-05 15:09:39 +00:00
Tom Hvitved
db7b187961 Rust: Add more variables tests 2025-11-05 15:32:24 +01:00
Geoffrey White
e78018769b Rust: Add the model file (missed on previous commits). 2025-11-05 12:50:26 +00:00
Geoffrey White
6e35cb9748 Rust: Change note. 2025-11-05 11:36:04 +00:00
Geoffrey White
ad24b7414e Rust: Fix for Poem cookies defaulting secure. 2025-11-05 11:32:30 +00:00