Compare commits

..

1008 Commits

Author SHA1 Message Date
Chris Smowton
02069b63ba Merge pull request #18549 from github/release-prep/2.20.2
Release preparation for version 2.20.2
2025-01-21 12:59:07 +00:00
Chris Smowton
ffa4e3b6d8 Fix changelog typos 2025-01-21 12:51:15 +00:00
github-actions[bot]
ec70b80a0a Release preparation for version 2.20.2 2025-01-21 12:47:53 +00:00
Chris Smowton
32fb6c4660 Merge pull request #18548 from github/revert-18539-release-prep/2.20.2
Revert "Release preparation for version 2.20.2"
2025-01-21 12:05:49 +00:00
Chris Smowton
90c396b46a Revert "Release preparation for version 2.20.2" 2025-01-21 12:02:52 +00:00
Chris Smowton
f1014abee6 Merge pull request #18539 from github/release-prep/2.20.2
Release preparation for version 2.20.2
2025-01-20 14:48:38 +00:00
Chris Smowton
7aab08810e Fix change-note typo 2025-01-20 14:47:40 +00:00
github-actions[bot]
ec1ca5dc25 Release preparation for version 2.20.2 2025-01-20 14:44:12 +00:00
Geoffrey White
4cf0c8fee1 Merge pull request #18535 from GeekMasher/rust-sql-injection
Rust: Add Models As Data Sinks for SQL Injection
2025-01-20 13:37:33 +00:00
Mathias Vorreiter Pedersen
35dbb6f370 Merge pull request #18531 from MathiasVP/remove-conflation-from-out-nodes
C++: Remove pointer/pointee conflation from parameter nodes
2025-01-20 13:05:15 +00:00
Mathias Vorreiter Pedersen
ed651294b6 Merge branch 'main' into remove-conflation-from-out-nodes 2025-01-20 12:42:26 +00:00
Anders Schack-Mulligen
28d0d65c41 Merge pull request #18515 from aschackmull/dataflow/simplify-rev-throughflow
Dataflow: Simplify the call-edge join in reverse through-flow.
2025-01-20 13:37:42 +01:00
Rasmus Wriedt Larsen
d7df8d798b Merge pull request #18519 from github/dbartol/actions-query-list
Add `actions` queries to generated list
2025-01-20 13:32:12 +01:00
Mathew Payne
39239fbeef fix(rust): Update formatting 2025-01-20 12:25:12 +00:00
Asger F
0097e49288 Merge pull request #18337 from asgerf/rb/diff-informed
Ruby: enable diff-informed data flow queries
2025-01-20 13:21:04 +01:00
Asger F
f31900378b Merge pull request #18528 from asgerf/jss/diff-informed
JS: Enable diff-informed queries
2025-01-20 13:20:36 +01:00
Mathew Payne
cba1c58dd7 feat(rust): Add ModelsAsDataSinks for SQL Injection 2025-01-20 12:14:34 +00:00
Jeroen Ketema
1b2d7bcbfa Merge pull request #18534 from jketema/uncomment
C++: Uncomment more preprocessor tests
2025-01-20 12:59:20 +01:00
Jeroen Ketema
4b85ea3bc6 Merge pull request #18502 from jketema/consteval
C++: Support `if consteval` and `if ! consteval`
2025-01-20 12:49:02 +01:00
Jeroen Ketema
1cbd57e2b9 C++: Uncomment more preprocessor tests 2025-01-20 11:48:01 +01:00
Asger F
29b829bf4a Revert "Add dummy extension with an empty diff"
This reverts commit 772c3363d2.
2025-01-20 11:20:57 +01:00
Asger F
683ebcaf16 Revert "JS: Add dummy extension with an empty diff"
This reverts commit 6e9b95d4e85f4829e788400575570bdb65eda6f6.
2025-01-20 11:20:35 +01:00
Asger F
a948915bb0 JS: Add dummy extension with an empty diff 2025-01-20 11:20:33 +01:00
Asger F
7c29ea9dda JS: Update ExternalAPIUsedwithUntrustedData 2025-01-20 11:20:32 +01:00
Asger F
ecbd7983ba JS: Update DifferentKindsComparisonBypassQuery.qll 2025-01-20 11:20:31 +01:00
Asger F
29da1fb6c8 JS: Update ConditionalBypassQuery.qll 2025-01-20 11:20:30 +01:00
Asger F
8fe622f572 JS: Update PrototypePollutingFunction.ql 2025-01-20 11:20:29 +01:00
Asger F
fd763a0883 JS: Auto-patch diff informed queries 2025-01-20 11:20:27 +01:00
Jeroen Ketema
a9e0f20861 C++: Simplify consteval if to be just a single class with an isNot predicate 2025-01-20 11:20:11 +01:00
Michael Nebel
ef034bce4e Merge pull request #18508 from michaelnebel/csharp/implicitinheritedtostring
C#: Also syntheize calls to inherited `ToString`.
2025-01-20 10:51:22 +01:00
Jeroen Ketema
a74189f6fa Update cpp/ql/lib/change-notes/2024-01-16-consteval-if.md
Co-authored-by: Calum Grant <42069085+calumgrant@users.noreply.github.com>
2025-01-20 10:43:25 +01:00
Jeroen Ketema
378f0368af Update cpp/downgrades/1aa71a4a687fc93f807d4dfeeef70feceeced242/stmts.ql 2025-01-20 10:43:00 +01:00
Michael Nebel
75a80f2a36 Merge pull request #18520 from github/workflow/coverage/update
Update CSV framework coverage reports
2025-01-20 09:52:30 +01:00
github-actions[bot]
00dca29216 Add changed framework coverage reports 2025-01-20 00:21:01 +00:00
Mathias Vorreiter Pedersen
d1bb5970ce Merge branch 'main' into remove-conflation-from-out-nodes 2025-01-18 18:05:22 +00:00
Mathias Vorreiter Pedersen
d661158fed C++: Accept query test changes. 2025-01-18 18:04:40 +00:00
Mathias Vorreiter Pedersen
8de7d4e8ef C++: Accept test changes. 2025-01-18 02:11:52 +00:00
Mathias Vorreiter Pedersen
2448475141 C++: Ensure that 'argumentOf' does not map to multiple argument positions. 2025-01-18 02:11:50 +00:00
Mathias Vorreiter Pedersen
9970f7837b C++: Add pointer/pointee conflation test. 2025-01-17 21:03:44 +00:00
Jeroen Ketema
d8b1d00905 Merge pull request #18516 from jketema/preproc-1
C++: Uncomment preprocessor test cases and add addition `#if` test case
2025-01-17 20:41:23 +01:00
Geoffrey White
2d0c73acfe Merge pull request #18501 from geoffw0/rustmetrics
Rust: More metrics for tracking taint.
2025-01-17 16:15:58 +00:00
Mathias Vorreiter Pedersen
10608bce87 Merge pull request #18526 from MathiasVP/negated-conjunctions-2
C++: Guard conditions from simple boolean identities
2025-01-17 16:08:43 +00:00
Dave Bartolomeo
3be08e369a Merge branch 'main' into dbartol/actions-query-list 2025-01-17 10:03:42 -05:00
docs-bot
8b5bed1a46 Add actions-security-experimental.qls 2025-01-17 09:47:44 -05:00
Mathias Vorreiter Pedersen
5c494c3f66 C++: Infer 'b1 = true' and 'b2 = true' from 'b1 && b2 = true', and infer 'b1 = false' and 'b2 = false' from 'b1 || b2 = false'. 2025-01-17 13:07:41 +00:00
Mathias Vorreiter Pedersen
eadccf27ef C++: Add test cases with missing inferred equalities. 2025-01-17 13:01:03 +00:00
Mathias Vorreiter Pedersen
d8ec6dd155 Merge pull request #18490 from MathiasVP/generate-int-to-bool-conversion-instructions-2
C++: Generate int-to-bool conversions in C code
2025-01-17 12:57:55 +00:00
Mathias Vorreiter Pedersen
21f9e6763d C++: Remove an unnecessary conjunct. 2025-01-17 12:44:22 +00:00
Asger F
772c3363d2 Add dummy extension with an empty diff 2025-01-17 13:44:11 +01:00
Paolo Tranquilli
17d2e4a338 Merge pull request #18500 from github/redsun82/rust-aggregate-workspaces
Rust: aggregate projects into workspaces
2025-01-17 13:23:07 +01:00
Asger F
871cdb014d Ruby: fix TODOs left by the patch query 2025-01-17 13:21:54 +01:00
Asger F
4dc632f742 Ruby: mass enable diff-informed data flow 2025-01-17 13:21:52 +01:00
Mathias Vorreiter Pedersen
b39a932ae1 C++: Update comment in the char pred of 'GuardConditionFromNotExpr'. 2025-01-17 12:17:47 +00:00
yoff
15a18315b7 Merge pull request #18524 from github/redsun82/python-match-fps
Python: add some more FP tests around match
2025-01-17 12:55:56 +01:00
Paolo Tranquilli
e6cb376ad8 Rust: fix typo 2025-01-17 12:31:48 +01:00
Paolo Tranquilli
bbaff8b199 Rust: cleanup workspace aggregation 2025-01-17 12:19:56 +01:00
Asger F
aa0b9559bf Merge pull request #18472 from asgerf/js/test-suite
JS: Port three tests to use the new post processing-based inline test expectations
2025-01-17 12:06:32 +01:00
Paolo Tranquilli
4ab5650979 Python: add some more FP tests around match 2025-01-17 11:01:00 +01:00
Asger F
0d52541f0a Merge pull request #18458 from asgerf/js/angular2-xss-through-dom
JS: Add Angular2 DOM sources
2025-01-17 10:55:14 +01:00
Asger F
2c65946684 JS: Add setOtherInput example 2025-01-17 10:29:03 +01:00
Asger F
e983e26f68 JS: Add example with safe field 2025-01-17 10:28:07 +01:00
Asger F
7b3727b874 JS: Add change note 2025-01-17 10:27:02 +01:00
Asger F
37062763ae JS: Bump extractor version string 2025-01-17 10:27:01 +01:00
Asger F
859783c08b JS: Support [(ngModel)] 2025-01-17 10:26:57 +01:00
Asger F
d55c68c1f1 JS: Add test case with [(ngModel)] 2025-01-17 10:24:16 +01:00
Asger F
97f5559e64 JS: Recognise form input from NgForm 2025-01-17 10:22:20 +01:00
Asger F
1ec3a62242 JS: Add test with NgForm.value 2025-01-17 10:20:59 +01:00
Asger F
d4daa21318 JS: Add DOM event sources in Angular2 model 2025-01-17 10:20:22 +01:00
Asger F
b8ba50a9ac JS: Add Angular test case in XssThroughDom 2025-01-17 10:12:42 +01:00
Asger F
6f46a34873 JS: Refactor domEventSource() into a Range class 2025-01-17 10:12:40 +01:00
Asger F
26a11efc5b Merge branch 'main' into js/test-suite 2025-01-17 10:09:06 +01:00
Anders Schack-Mulligen
498bfd2160 Merge pull request #18512 from aschackmull/dataflow/join-fix2
Dataflow: Another minor join-order fix
2025-01-17 09:09:47 +01:00
Jeroen Ketema
65a11e4e82 Merge pull request #18514 from jketema/objc
C++: Remove some Objective-C specific query code
2025-01-17 08:18:05 +01:00
docs-bot
01c4dd81f0 Add actions queries to generated list 2025-01-16 18:02:46 -05:00
Owen Mansel-Chan
45e9957bd9 Merge pull request #18438 from github/workflow/coverage/update
Update CSV framework coverage reports
2025-01-16 22:58:57 +00:00
Jeroen Ketema
e6eaf5e6ac Merge pull request #18510 from jketema/noreturn
C++: Support more "noreturn" attributes in DefaultOptions
2025-01-16 19:09:44 +01:00
Mathias Vorreiter Pedersen
d5b31eb98c C++: Add more tests. 2025-01-16 17:25:39 +00:00
Jeroen Ketema
ff0d4955cf C++: Fix change note 2025-01-16 17:55:45 +01:00
Mathias Vorreiter Pedersen
d0bd6eb2eb C++: Remove the type restriction on 'GuardConditionFromNotExpr' since this class also applies to C++. 2025-01-16 16:55:10 +00:00
Mathias Vorreiter Pedersen
54faba21ba C++: Add more tests. 2025-01-16 16:44:29 +00:00
Owen Mansel-Chan
8bfab55df7 Merge branch 'main' into workflow/coverage/update 2025-01-16 16:38:06 +00:00
Geoffrey White
e5faf92bab Rust: Make QL-for-QL happy (part 2). 2025-01-16 16:16:02 +00:00
Geoffrey White
5f9e1c3788 Apply suggestions from code review
Co-authored-by: Simon Friis Vindum <paldepind@github.com>
2025-01-16 16:14:33 +00:00
Michael Nebel
bae29aeee4 C#: Update implications test expected output. 2025-01-16 16:57:33 +01:00
Michael Nebel
b6db1a34d6 C#: Also make the implicitToString test print the type declaring the ToString call being synthesized. 2025-01-16 16:57:32 +01:00
Michael Nebel
aab88da117 C#: Update test expected output. 2025-01-16 16:57:30 +01:00
Michael Nebel
260ce805d1 C#: Also support implicit inherited ToString synthetic calls. 2025-01-16 16:57:29 +01:00
Michael Nebel
ec256c3277 C#: More implicit ToString examples. 2025-01-16 16:57:27 +01:00
Jeroen Ketema
dca87f3727 C++: Uncomment preprocessor test cases and add addition #if test case
Note that the new test case shows that line splicing is not correctly handled
in the case of `#if`.
2025-01-16 16:42:35 +01:00
Anders Schack-Mulligen
20af2d5fe2 Dataflow: Fix poor join-order 2025-01-16 16:22:56 +01:00
Anders Schack-Mulligen
3ffc616179 Dataflow: Slight join improvement. 2025-01-16 16:22:55 +01:00
Anders Schack-Mulligen
f310780257 Dataflow: Simplify the call-edge join in reverse through-flow. 2025-01-16 16:07:24 +01:00
Mathias Vorreiter Pedersen
00a1978b0c C++: Add a guard condition test with an example of a negated less-than relation. 2025-01-16 14:57:08 +00:00
Mathias Vorreiter Pedersen
2076c1c51f C++: Add an copy of a (slightly modified) syntax-zoo test as an IR test. 2025-01-16 14:33:25 +00:00
Mathias Vorreiter Pedersen
6ba5f3e472 Merge branch 'main' into generate-int-to-bool-conversion-instructions-2 2025-01-16 14:28:50 +00:00
Jeroen Ketema
aec151dce9 C++: Remove some Objective-C specific query code
We have not supported Objective-C for a long time.
2025-01-16 15:17:30 +01:00
Paolo Tranquilli
133e2696ac Merge pull request #18513 from asgerf/js/fix-flow-summary-spec
JS: Fix semantic merge conflict: Implement new signature members in StepInputSig
2025-01-16 14:47:42 +01:00
Asger F
bd2febcf00 JS: Implementing new signature members in StepInputSig 2025-01-16 13:38:08 +01:00
Jeroen Ketema
52eef7c4c2 C++: Fix typo in test 2025-01-16 13:19:54 +01:00
Asger F
1964b347c7 Merge branch 'main' into js/test-suite 2025-01-16 13:19:07 +01:00
Jeroen Ketema
d027e0c06b C++: Add change note 2025-01-16 13:12:20 +01:00
Jeroen Ketema
bd40d249e3 C++: Support more "noreturn" attributes in DefaultOptions 2025-01-16 13:04:44 +01:00
Jeroen Ketema
f4f5f2899c C++: Add more noreturn attribute tests 2025-01-16 13:01:53 +01:00
Anders Schack-Mulligen
fbf25e43a4 Merge pull request #18507 from aschackmull/dataflow/join-fix
Dataflow: Minor join-order fix
2025-01-16 12:10:23 +01:00
Michael Nebel
9021214937 Merge pull request #18495 from michaelnebel/csharp/refstrucinterfacetests
C# 13: [TEST ONLY] ref structs are allowed to implement interfaces.
2025-01-16 11:46:22 +01:00
Michael Nebel
0452b4af3d Merge pull request #18498 from michaelnebel/csharp/refandunsafe
C# 13: [TEST ONLY] Test example with ref local, unsafe context and ref struct in async- and iterator methods.
2025-01-16 11:42:30 +01:00
Michael Nebel
ba2b7abce9 Merge pull request #18446 from michaelnebel/csharp/implicittostring2
C#: Adding synthetic implicit ToString calls in binary- and string interpolation expressions.
2025-01-16 11:37:21 +01:00
Asger F
6cd9752289 Merge pull request #18467 from github/js/shared-dataflow-branch
JS: Migrate to shared data flow library (targeting main!) 🚀
2025-01-16 11:28:57 +01:00
Anders Schack-Mulligen
4223971f14 Dataflow: Remove outdated comment. 2025-01-16 10:26:40 +01:00
Anders Schack-Mulligen
f11ae49312 Dataflow: Fix a poor join-order. 2025-01-16 10:25:55 +01:00
Jeroen Ketema
6ad342c567 C++: Add change note 2025-01-16 10:22:54 +01:00
Jeroen Ketema
4a3350bd41 C++: Update stats file 2025-01-16 08:18:09 +01:00
Jeroen Ketema
123f1d599a C++: Add upgrade and downgrade scripts 2025-01-16 08:18:07 +01:00
Jeroen Ketema
bc2f203c4b C++: Support if consteval and if ! consteval 2025-01-16 08:17:57 +01:00
Mathias Vorreiter Pedersen
5373e2222e C++: Improve IRGuads logic for 'unlikely' expressions. 2025-01-16 00:45:07 +00:00
Mathias Vorreiter Pedersen
7cca21364b C++: Accept test changes. 2025-01-16 00:39:39 +00:00
Mathias Vorreiter Pedersen
14db788125 C++: Ensure that 'x' in 'if(!x) is also an AST-based GuardCondition. 2025-01-16 00:39:37 +00:00
Mathias Vorreiter Pedersen
b5897e5727 C++: Accept sign analysis changes. 2025-01-16 00:39:36 +00:00
Mathias Vorreiter Pedersen
2d9036eb5f C++: Make 'getInstructionConvertedResultExpression' equivalent in C and C++. 2025-01-16 00:39:35 +00:00
Mathias Vorreiter Pedersen
ebb7f28d39 C++: Remove workaround for missing comparisons against 0 in C code. 2025-01-16 00:39:33 +00:00
Mathias Vorreiter Pedersen
9810a4f34d C++: Remove 'inNonZeroCase' from IRGuards since we now always have implicit comparisons against 0 in C code. 2025-01-16 00:39:32 +00:00
Mathias Vorreiter Pedersen
0d7adac601 C++: Accept Guards test changes. 2025-01-16 00:39:31 +00:00
Mathias Vorreiter Pedersen
5da57cd2b4 C++: Accept test changes. 2025-01-16 00:39:29 +00:00
Mathias Vorreiter Pedersen
65771614ef C++: Insert int-to-bool conversions at binary conditional expressions. 2025-01-16 00:39:28 +00:00
Mathias Vorreiter Pedersen
9d3bc7f510 C++: Accept test changes. 2025-01-16 00:39:26 +00:00
Mathias Vorreiter Pedersen
f30bfb63cf C++: Insert int-to-bool conversions at 'NotExpr's. 2025-01-16 00:39:25 +00:00
Mathias Vorreiter Pedersen
1e33593c79 C++: Accept test changes. 2025-01-16 00:39:23 +00:00
Mathias Vorreiter Pedersen
dd39b97ab0 C++: Insert int-to-bool conversions at conditions. 2025-01-16 00:39:22 +00:00
Mathias Vorreiter Pedersen
2e3d3494de C++: Accept test changes. 2025-01-16 00:39:20 +00:00
Mathias Vorreiter Pedersen
5acd2bb2fb C++: Adjust the result type at 'NotExpr' and at comparisons. 2025-01-16 00:39:17 +00:00
Mathias Vorreiter Pedersen
9429b03896 C++: Provide a hook for overriding 'getResultType'. 2025-01-16 00:39:16 +00:00
Mathias Vorreiter Pedersen
6dd1c5e809 C++: Split out 'NotExpr' to its own class. 2025-01-16 00:39:14 +00:00
Mathias Vorreiter Pedersen
a0d2213268 Merge pull request #18503 from MathiasVP/scanf-check-prepare-fix
C++: Harden `checkedForEof`
2025-01-16 00:38:51 +00:00
github-actions[bot]
09198d9c25 Add changed framework coverage reports 2025-01-16 00:20:36 +00:00
Mathias Vorreiter Pedersen
01cbd2f7f1 C++: Ensure that the instruction being compared is the result of the 'CallInstruction'. 2025-01-15 19:27:28 +00:00
Jeroen Ketema
84c674b992 C++: Fix typos in IR translation comments 2025-01-15 20:16:43 +01:00
Geoffrey White
90faab456d Merge pull request #18473 from geoffw0/sensitive2
Improve shared sensitive data library handling of snake_case variable names
2025-01-15 18:02:33 +00:00
Geoffrey White
bec01daa45 Rust: Update integration tests. 2025-01-15 17:57:16 +00:00
Geoffrey White
98e0b64266 Rust: Make QL-for-QL happy. 2025-01-15 17:51:49 +00:00
Geoffrey White
787a6d11a3 Rust: Autoformat. 2025-01-15 17:25:44 +00:00
Geoffrey White
65b33f3f96 Rust: Improve rust/summary/summary-statistics organization. 2025-01-15 17:16:49 +00:00
Geoffrey White
5a037bcbc4 Rust: Count taint edges as well. 2025-01-15 16:18:58 +00:00
Geoffrey White
72c62ac192 Rust: Add taint reach to rust/summary/summary-statistics. 2025-01-15 16:18:56 +00:00
Geoffrey White
7904ed965b Rust: Add query sink counts query for getting a breakdown. 2025-01-15 16:18:51 +00:00
Paolo Tranquilli
3c064284b0 Rust: aggregate projects into workspaces 2025-01-15 17:17:19 +01:00
Geoffrey White
c6a7be671b Rust: Add both totals to rust/summary/summary-statistics. 2025-01-15 16:16:49 +00:00
Geoffrey White
75f0a7f529 Rust: Add summary query rust/summary/query-sinks. 2025-01-15 16:16:26 +00:00
Michael Nebel
ca23e1b1fc C#: Test example with ref local, unsafe context and ref struct in async and iterator methods. 2025-01-15 15:16:56 +01:00
Michael Nebel
8b6e5521a8 C#: Add some an implements test. 2025-01-15 13:08:07 +01:00
Jeroen Ketema
02ac61f328 Merge pull request #18483 from jketema/extractor-fixes
C++: Fix types of struct/union templates and fix assumptions on proxy classes
2025-01-15 12:01:25 +01:00
Jeroen Ketema
a3cd66844c C++: Add change note 2025-01-15 11:38:09 +01:00
Jeroen Ketema
cd5e77348b C++: Add upgrade and downgrade scripts 2025-01-15 11:38:07 +01:00
Jeroen Ketema
8e39eb9020 C++: Fix incorrect dbscheme assumptions on proxy classes 2025-01-15 11:38:05 +01:00
Jeroen Ketema
13e8853277 C++: Update expected test results after extractor changes 2025-01-15 11:38:03 +01:00
Jeroen Ketema
537feddf06 C++: Introduce usertypes for structs and unions 2025-01-15 11:38:01 +01:00
Paolo Tranquilli
f62a3ace9a Merge pull request #18491 from hvitved/rust/ql-test-recurse
Rust: Include nested `.rs` files in `codeql test run`
2025-01-15 10:10:55 +01:00
Michael Nebel
3de5b224c6 C#: Update other existing tests expected output. 2025-01-15 09:23:34 +01:00
Paolo Tranquilli
e60468e2c7 Rust: add nested test file example 2025-01-15 09:21:57 +01:00
Tom Hvitved
3ceec93499 Merge pull request #18462 from hvitved/rust/variable-without-location
Rust: Avoid location-based variable analysis
2025-01-15 09:20:10 +01:00
Geoffrey White
4ed4f6878f Rust: Add summary query rust/summary/cryptographic-ops. 2025-01-14 17:32:44 +00:00
Michael Nebel
0c5c2a3509 C#: Add implicit to string test. 2025-01-14 17:17:21 +01:00
Michael Nebel
6a406b28d1 C#: Do not insert a synthetic ToString call in interpolation expressions, if the type implements IFormattable. 2025-01-14 17:14:57 +01:00
Michael Nebel
ab70a945e4 C#: Add a summary model for PathString.ToString. 2025-01-14 17:14:12 +01:00
Michael Nebel
024de5eafc C#: Update virtual call in constructor expected test output. 2025-01-14 17:14:11 +01:00
Michael Nebel
2bff2d646f C#: Disregards compiler generated virtual calls as problematic virtual calls. 2025-01-14 17:14:09 +01:00
Michael Nebel
77f9f4c532 C#: Add implicit to string usage in constructor. 2025-01-14 17:14:07 +01:00
Michael Nebel
d40c1bebbf C#: Update expected testoutput for Nullness tests. 2025-01-14 17:14:06 +01:00
Michael Nebel
e62846e4c5 C#: Disregard compiler generated method calls as possible null dereferences. 2025-01-14 17:14:04 +01:00
Michael Nebel
6a31fd7893 C#: Add ImplicitToString example in nullness tests. 2025-01-14 17:14:02 +01:00
Michael Nebel
cd7d2d4ca4 C#: Add change note. 2025-01-14 17:14:00 +01:00
Michael Nebel
20c2b2b2a2 C#: Update other existing tests expected output. 2025-01-14 17:13:59 +01:00
Michael Nebel
f239ab1fbf C#: Update PrintAst expected test output. 2025-01-14 17:13:57 +01:00
Michael Nebel
53c2f76385 C#: Update AST printing to include generated cast (wrapping) expressions and generated ToString calls. 2025-01-14 17:13:56 +01:00
Michael Nebel
6c6e58b337 C#: Add PrintAst test to implicit ToString test. 2025-01-14 17:13:54 +01:00
Michael Nebel
a4049b1d9a C#: Modify compiler generated strip logic to also take generated ToString calls into account. 2025-01-14 17:13:53 +01:00
Michael Nebel
8bf67e37fe C#: Update test expected output. 2025-01-14 17:13:51 +01:00
Michael Nebel
5f539c5515 C#: Make synthetic ToString calls in string interpolation expressions. 2025-01-14 17:13:50 +01:00
Michael Nebel
e9beeac60f C#: Update test expected output. 2025-01-14 17:13:48 +01:00
Michael Nebel
908a3e3563 C#: Make synthetic ToString calls in binary add expressions. 2025-01-14 17:13:46 +01:00
Michael Nebel
f905be4df3 C#: Add a RedundantToStringCall test case. 2025-01-14 17:13:45 +01:00
Michael Nebel
261b8db144 C#: Add some implicit toString data flow test cases. 2025-01-14 17:13:43 +01:00
Geoffrey White
6402aa5332 Merge pull request #18471 from geoffw0/weakhash
Rust: Weak hashing query
2025-01-14 15:54:42 +00:00
Chris Smowton
b2bb143689 Merge pull request #18305 from smowton/smowton/admin/agent-extracted-file-test
Java: Add test for a JavacTool-based compiler that doesn't use standard JavaFileObjects
2025-01-14 15:52:55 +00:00
Chris Smowton
060161cd5e Add change note 2025-01-14 14:22:27 +00:00
Chris Smowton
5ca7d26cf3 Add test for a JavacTool-based compiler that doesn't use standard JavaFileObjects 2025-01-14 14:22:26 +00:00
Tom Hvitved
ed07da4327 Rust: Include nested .rs files in codeql test run 2025-01-14 14:35:34 +01:00
Chris Smowton
3e10e78c95 Merge pull request #18480 from github/smowton/admin/document-serialization-proxy
Java: document serialization proxy pattern
2025-01-14 12:34:01 +00:00
Mathias Vorreiter Pedersen
0ff37f1205 Merge pull request #18486 from MathiasVP/indirect-instruction-barriers
C++: Add a `BarrierGuard` module for indirect instruction/operand nodes.
2025-01-14 11:37:58 +00:00
Simon Friis Vindum
7196892867 Merge pull request #18461 from paldepind/cpp-conditional-expr-range-analysis
C++: Only propagate smallest/largest range bound in conditional expressions
2025-01-14 12:31:21 +01:00
Mathias Vorreiter Pedersen
aa55b8e726 Merge pull request #18485 from MathiasVP/speed-up-cpp-unbounded-write
C++: Speed up the `cpp/unbounded-write` query for an upcoming change
2025-01-14 10:39:03 +00:00
Jeroen Ketema
a2aefc9d61 Merge pull request #18478 from jketema/stats-try
C++: Update stats file
2025-01-14 10:47:20 +01:00
Jeroen Ketema
4951571dd4 Merge pull request #18488 from geoffw0/cleanup
C++: Fix a couple of typos.
2025-01-14 10:46:56 +01:00
Geoffrey White
96008469d4 C++: QLDoc correction. 2025-01-14 09:19:50 +00:00
Paolo Tranquilli
23612b47a4 Merge pull request #18484 from github/redsun82/rust-discover-once
Rust: run sysroot discovery once
2025-01-14 09:54:58 +01:00
Owen Mansel-Chan
883301938b Merge pull request #18161 from owen-mc/java/weak-crypto-algo-more-informative
Java: Make `java/weak-cryptographic-algorithm` give  a reason why the algo is insecure
2025-01-13 23:43:04 +00:00
yoff
599411b440 Merge pull request #17787 from yoff/shared/add-location-to-typetracking-nodes
shared: Add locations to type tracking nodes
2025-01-13 23:06:09 +01:00
Mathias Vorreiter Pedersen
d9d0d9348c C++: Add change note. 2025-01-13 18:53:59 +00:00
Mathias Vorreiter Pedersen
91992e2f3f C++: Accept test changes. 2025-01-13 18:34:42 +00:00
Mathias Vorreiter Pedersen
6f3a2c41b3 C++: Fill in skeleton for indirect instruction/operand barrier nodes. 2025-01-13 18:34:32 +00:00
Mathias Vorreiter Pedersen
4e3b27e920 C++: Add a testcase that needs indirect instruction/operand nodes. 2025-01-13 18:33:52 +00:00
Mathias Vorreiter Pedersen
d63b73406c C++: Add dataflow skeleton for barrier guards on indirect instruction/operand nodes. 2025-01-13 18:33:18 +00:00
Mathias Vorreiter Pedersen
2d44b33598 C++: Speed up the 'cpp/unbounded-write' query. 2025-01-13 16:03:30 +00:00
Paolo Tranquilli
7988729ee6 Rust: run sysroot discovery once 2025-01-13 16:13:55 +01:00
Ian Lynagh
6b182c5ebd Merge pull request #18396 from igfoo/igfoo/path_transformer
Kotlin: Add CODEQL_PATH_TRANSFORMER support
2025-01-13 15:11:41 +00:00
Michael Nebel
c68b55b957 Merge pull request #18385 from michaelnebel/csharp/allowsrefstruct
C# 13: Allows ref struct.
2025-01-13 16:04:03 +01:00
Michael Nebel
d0d5e0d157 C#: Address review comment. 2025-01-13 14:56:24 +01:00
Paolo Tranquilli
ca28087a16 Merge pull request #18479 from github/redsun82/rust-upgrade
Rust: update dependencies
2025-01-13 14:31:49 +01:00
Simon Friis Vindum
e9f2a8b017 C++: Extend nested ternary test with two more terms in the addition 2025-01-13 13:54:05 +01:00
Chris Smowton
0b62338cda Java: document serialization proxy pattern
Note I haven't included a reference because I can't find a sufficiently-authoritative source -- only a blog quoting Effective Java seems close to appropriate, and I suspect that's pirated.
2025-01-13 11:49:36 +00:00
Paolo Tranquilli
cae7236f61 Rust: update dependencies 2025-01-13 12:43:43 +01:00
Simon Friis Vindum
dcdc43933b C++: Minor refactor and documentation tweak to simple range analysis 2025-01-13 12:15:09 +01:00
Simon Friis Vindum
0c9ee4d029 C++: Only propagate smallest/largest bound in conditional expressions 2025-01-13 12:11:45 +01:00
Simon Friis Vindum
847f3f1fc2 C++: Add test for nested ternary expressions of literals 2025-01-13 12:08:50 +01:00
Geoffrey White
e61d6aec22 Rust: Autoformat. 2025-01-13 10:51:49 +00:00
Geoffrey White
676141bbb9 Rust: More suggestions from review. 2025-01-13 10:45:30 +00:00
Geoffrey White
722b7bb55b Apply suggestions from code review
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
2025-01-13 10:28:08 +00:00
Tom Hvitved
33e6d6392c Rust: Avoid location-based variable analysis 2025-01-13 11:08:00 +01:00
Tom Hvitved
d03b284a0a Rust: Add more variable tests 2025-01-13 10:46:54 +01:00
Tom Hvitved
7376449d38 Rust: Rename variables.rs to main.rs 2025-01-13 10:46:53 +01:00
Jeroen Ketema
3f093aea35 C++: Fix join order problem after stats file update
Tuple counts before the change (terminated early):
```
[2025-01-11 17:49:42] (297s) Tuple counts for AliasedSSA::getResultMemoryLocation/1#eb4efd2d/2@c513392o after 13.5s:
                      0          ~0%       {3} r1 = JOIN `_SSAConstruction::getInstructionOpcode/2#ec2d1f97_10#join_rhs__AliasedSSA::canReuseSsaForOldResult/1__#shared` WITH Opcode::MayWriteOpcode#class#21b7b7f2 ON FIRST 1 OUTPUT Lhs.1, Lhs.2 'instr', _
                      0          ~0%       {3}    | REWRITE WITH Out.2 := true

                      30500      ~124%     {2} r2 = SCAN `_AliasedSSA::canReuseSsaForOldResult/1#280fbda5_Opcode::Opcode.getWriteMemoryAccess/0#dispred#531702__#shared` OUTPUT In.1, In.0 'instr'
                                           {2}    | AND NOT `_Opcode::MayWriteOpcode#class#21b7b7f2__SSAConstruction::getInstructionOpcode/2#ec2d1f97_10#join_rhs__#antijoin_rhs#1`(FIRST 2)
                      30500      ~134%     {3}    | SCAN OUTPUT In.0, In.1 'instr', _
                      30500      ~120%     {3}    | REWRITE WITH Out.2 := false

                      30500      ~120%     {3} r3 = r1 UNION r2

                      8000       ~738%     {2} r4 = JOIN r3 WITH num#MemoryAccessKind::TEscapedMemoryAccess#a0368c86 ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.2
                                           {2}    | AND NOT `AliasedSSA::canReuseSsaForOldResult/1#280fbda5`(FIRST 1)
                      4000       ~699%     {2}    | SCAN OUTPUT In.1, In.0 'instr'
                      1501792000 ~686%     {3}    | JOIN WITH num#AliasedSSA::TAllAliasedMemory#4bb632db_102#join_rhs ON FIRST 1 OUTPUT Rhs.2 'result', Lhs.1 'instr', Rhs.1
                      1501788000 ~709%     {3}    | JOIN WITH AliasedSSA::MemoryLocation#4b9f223c ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.2, Lhs.0 'result'
                      0          ~0%       {2}    | JOIN WITH `SSAConstruction::getInstructionEnclosingIRFunction/1#d26c0476` ON FIRST 2 OUTPUT Lhs.0 'instr', Lhs.2 'result'

                      8000       ~674%     {2} r5 = JOIN r3 WITH num#MemoryAccessKind::TNonLocalMemoryAccess#b2a59f45 ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.2
                                           {2}    | AND NOT `AliasedSSA::canReuseSsaForOldResult/1#280fbda5`(FIRST 1)
                      4000       ~689%     {2}    | SCAN OUTPUT In.1, In.0 'instr'
                      310509500  ~547%     {3}    | JOIN WITH num#AliasedSSA::TAllNonLocalMemory#7ba9f6c9_102#join_rhs ON FIRST 1 OUTPUT Rhs.2 'result', Lhs.1 'instr', Rhs.1
                      310504500  ~527%     {3}    | JOIN WITH AliasedSSA::MemoryLocation#4b9f223c ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.2, Lhs.0 'result'
                      0          ~0%       {2}    | JOIN WITH `SSAConstruction::getInstructionEnclosingIRFunction/1#d26c0476` ON FIRST 2 OUTPUT Lhs.0 'instr', Lhs.2 'result'

                      5000       ~2%       {2} r6 = JOIN r3 WITH `AliasedSSA::isIndirectOrBufferMemoryAccess/1#a6492554` ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.2
                      5000       ~2%       {2}    | AND NOT `AliasedSSA::canReuseSsaForOldResult/1#280fbda5`(FIRST 1)

                                           {2} r7 = r6 AND NOT `project#AliasedSSA::hasResultMemoryAccess/9#732473d4#7`(FIRST 1)
                      0          ~0%       {2}    | SCAN OUTPUT In.1, In.0 'instr'
                      0          ~0%       {3}    | JOIN WITH num#AliasedSSA::TUnknownMemoryLocation#e0c2a990_102#join_rhs ON FIRST 1 OUTPUT Rhs.2 'result', Lhs.1 'instr', Rhs.1
                      0          ~0%       {3}    | JOIN WITH AliasedSSA::MemoryLocation#4b9f223c ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.2, Lhs.0 'result'
                      0          ~0%       {2}    | JOIN WITH `SSAConstruction::getInstructionEnclosingIRFunction/1#d26c0476` ON FIRST 2 OUTPUT Lhs.0 'instr', Lhs.2 'result'

                      5000       ~0%       {2} r8 = JOIN r3 WITH num#MemoryAccessKind::TEntireAllocationMemoryAccess#503d0afb ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.2
                      5000       ~0%       {2}    | AND NOT `AliasedSSA::canReuseSsaForOldResult/1#280fbda5`(FIRST 1)
                      4500       ~2%       {4}    | JOIN WITH `Instruction::Instruction.getResultAddressOperand/0#dispred#619d4407` ON FIRST 1 OUTPUT Rhs.1, Lhs.0 'instr', _, Lhs.1
                      4500       ~4%       {3}    | REWRITE WITH Out.2 := booleanNot(In.3) KEEPING 3
                      0          ~0%       {3}    | JOIN WITH `project#AliasAnalysis::addressOperandAllocationAndOffset/3#c64a9862` ON FIRST 1 OUTPUT Rhs.1, Lhs.1 'instr', Lhs.2
                      0          ~0%       {4}    | JOIN WITH num#AliasedSSA::TEntireAllocationMemoryLocation#85bb24dd ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.2, Rhs.1, Rhs.2 'result'
                                           {4}    | REWRITE WITH TEST InOut.1 != InOut.2
                      0          ~0%       {2}    | SCAN OUTPUT In.3 'result', In.0 'instr'
                      0          ~0%       {2}    | JOIN WITH AliasedSSA::MemoryLocation#4b9f223c ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.0 'result'

                      4500       ~0%       {5} r9 = JOIN r6 WITH `project#AliasedSSA::hasResultMemoryAccess/9#732473d4#5_0512346#join_rhs` ON FIRST 2 OUTPUT Lhs.0 'instr', Lhs.1, Rhs.2, Rhs.6, _
                                           {4}    | REWRITE WITH Tmp.4 := false, TEST InOut.3 != Tmp.4 KEEPING 4
                      0          ~0%       {5}    | SCAN OUTPUT In.2, _, In.0 'instr', _, In.1
                      0          ~0%       {4}    | REWRITE WITH Out.1 := false, Out.3 := booleanNot(In.4) KEEPING 4
                      0          ~0%       {4}    | JOIN WITH `AliasedSSA::getGroupedMemoryLocation/3#14ef79fc#ffbf_0213#join_rhs` ON FIRST 2 OUTPUT Lhs.2 'instr', Lhs.3, Rhs.2, Rhs.3 'result'
                                           {4}    | REWRITE WITH TEST InOut.1 != InOut.2
                      0          ~0%       {2}    | SCAN OUTPUT In.3 'result', In.0 'instr'
                      0          ~0%       {2}    | JOIN WITH AliasedSSA::MemoryLocation#4b9f223c ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.0 'result'

                      4500       ~0%       {8} r10 = JOIN r6 WITH `project#AliasedSSA::hasResultMemoryAccess/9#732473d4#5_0512346#join_rhs` ON FIRST 2 OUTPUT Lhs.0 'instr', Lhs.1, Rhs.2, Rhs.3, Rhs.4, Rhs.5, Rhs.6, _
                                           {7}    | REWRITE WITH Tmp.7 := false, TEST InOut.6 = Tmp.7 KEEPING 7
                      4000       ~0%       {6}    | SCAN OUTPUT In.2, In.3, In.4, In.5, In.0 'instr', In.1
                      3500       ~1%       {8}    | JOIN WITH num#AliasedSSA::TVariableMemoryLocation#8e8cb20c_013456#join_rhs ON FIRST 4 OUTPUT Rhs.5 'result', Lhs.4 'instr', Lhs.5, Lhs.0, Lhs.1, Lhs.2, Lhs.3, Rhs.4
                      3000       ~0%       {8}    | JOIN WITH AliasedSSA::MemoryLocation#4b9f223c ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.3, Lhs.4, Lhs.5, Lhs.6, Lhs.2, Lhs.7, Lhs.0 'result'
                      2500       ~2%       {5}    | JOIN WITH `project#AliasedSSA::hasResultMemoryAccess/9#732473d4#6` ON FIRST 6 OUTPUT Lhs.0 'instr', Lhs.6, Lhs.7 'result', _, Lhs.5
                                           {4}    | REWRITE WITH Out.3 := booleanNot(In.4), TEST Out.3 != InOut.1 KEEPING 4
                      2000       ~0%       {2}    | SCAN OUTPUT In.0 'instr', In.2 'result'

                      2000       ~0%       {2} r11 = r4 UNION r5 UNION r7 UNION r8 UNION r9 UNION r10
                                           return r11
```

Tuple counts after:
```
[2025-01-11 17:52:46] (9s) Tuple counts for AliasedSSA::getResultMemoryLocation/1#eb4efd2d/2@6c9e69ae after 6.1s:
                      1283623 ~5%       {3} r1 = JOIN `_SSAConstruction::getInstructionOpcode/2#ec2d1f97_10#join_rhs__AliasedSSA::canReuseSsaForOldResult/1__#shared` WITH Opcode::MayWriteOpcode#class#21b7b7f2 ON FIRST 1 OUTPUT Lhs.1, Lhs.2 'instr', _
                      1283623 ~0%       {3}    | REWRITE WITH Out.2 := true

                      2965447 ~0%       {2} r2 = SCAN `_AliasedSSA::canReuseSsaForOldResult/1#280fbda5_Opcode::Opcode.getWriteMemoryAccess/0#dispred#531702__#shared` OUTPUT In.1, In.0 'instr'
                                        {2}    | AND NOT `_Opcode::MayWriteOpcode#class#21b7b7f2__SSAConstruction::getInstructionOpcode/2#ec2d1f97_10#join_rhs__#antijoin_rhs#1`(FIRST 2)
                      1681824 ~1%       {3}    | SCAN OUTPUT In.0, In.1 'instr', _
                      1681824 ~0%       {3}    | REWRITE WITH Out.2 := false

                      2965447 ~0%       {3} r3 = r1 UNION r2

                      1334818 ~0%       {2} r4 = JOIN r3 WITH num#MemoryAccessKind::TEscapedMemoryAccess#a0368c86 ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.2
                      1334818 ~0%       {2}    | AND NOT `AliasedSSA::canReuseSsaForOldResult/1#280fbda5`(FIRST 1)
                      1334818 ~6%       {3}    | JOIN WITH `SSAConstruction::getInstructionEnclosingIRFunction/1#d26c0476` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.0 'instr'
                      1334818 ~4%       {2}    | JOIN WITH num#AliasedSSA::TAllAliasedMemory#4bb632db ON FIRST 2 OUTPUT Rhs.2 'result', Lhs.2 'instr'
                      1334818 ~2%       {2}    | JOIN WITH AliasedSSA::MemoryLocation#4b9f223c ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.0 'result'

                      363138  ~1%       {2} r5 = JOIN r3 WITH num#MemoryAccessKind::TNonLocalMemoryAccess#b2a59f45 ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.2
                      363138  ~1%       {2}    | AND NOT `AliasedSSA::canReuseSsaForOldResult/1#280fbda5`(FIRST 1)
                      363138  ~5%       {3}    | JOIN WITH `SSAConstruction::getInstructionEnclosingIRFunction/1#d26c0476` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.0 'instr'
                      363138  ~0%       {2}    | JOIN WITH num#AliasedSSA::TAllNonLocalMemory#7ba9f6c9 ON FIRST 2 OUTPUT Rhs.2 'result', Lhs.2 'instr'
                      363138  ~0%       {2}    | JOIN WITH AliasedSSA::MemoryLocation#4b9f223c ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.0 'result'

                      1086950 ~5%       {2} r6 = JOIN r3 WITH `AliasedSSA::isIndirectOrBufferMemoryAccess/1#a6492554` ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.2
                      1086950 ~5%       {2}    | AND NOT `AliasedSSA::canReuseSsaForOldResult/1#280fbda5`(FIRST 1)

                      141434  ~0%       {2} r7 = r6 AND NOT `project#AliasedSSA::hasResultMemoryAccess/9#732473d4#7`(FIRST 1)
                      141434  ~0%       {3}    | JOIN WITH `SSAConstruction::getInstructionEnclosingIRFunction/1#d26c0476` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.0 'instr'
                      141434  ~5%       {2}    | JOIN WITH num#AliasedSSA::TUnknownMemoryLocation#e0c2a990 ON FIRST 2 OUTPUT Rhs.2 'result', Lhs.2 'instr'
                      141434  ~0%       {2}    | JOIN WITH AliasedSSA::MemoryLocation#4b9f223c ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.0 'result'

                      180541  ~0%       {2} r8 = JOIN r3 WITH num#MemoryAccessKind::TEntireAllocationMemoryAccess#503d0afb ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.2
                      180541  ~0%       {2}    | AND NOT `AliasedSSA::canReuseSsaForOldResult/1#280fbda5`(FIRST 1)
                      180541  ~3%       {4}    | JOIN WITH `Instruction::Instruction.getResultAddressOperand/0#dispred#619d4407` ON FIRST 1 OUTPUT Rhs.1, Lhs.0 'instr', _, Lhs.1
                      180541  ~0%       {3}    | REWRITE WITH Out.2 := booleanNot(In.3) KEEPING 3
                      175074  ~2%       {3}    | JOIN WITH `project#AliasAnalysis::addressOperandAllocationAndOffset/3#c64a9862` ON FIRST 1 OUTPUT Rhs.1, Lhs.1 'instr', Lhs.2
                      349412  ~0%       {4}    | JOIN WITH num#AliasedSSA::TEntireAllocationMemoryLocation#85bb24dd ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.2, Rhs.1, Rhs.2 'result'
                                        {4}    | REWRITE WITH TEST InOut.1 != InOut.2
                      174706  ~1%       {2}    | SCAN OUTPUT In.3 'result', In.0 'instr'
                      174706  ~3%       {2}    | JOIN WITH AliasedSSA::MemoryLocation#4b9f223c ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.0 'result'

                      946577  ~0%       {5} r9 = JOIN r6 WITH `project#AliasedSSA::hasResultMemoryAccess/9#732473d4#5_0512346#join_rhs` ON FIRST 2 OUTPUT Lhs.0 'instr', Lhs.1, Rhs.2, Rhs.6, _
                                        {4}    | REWRITE WITH Tmp.4 := false, TEST InOut.3 != Tmp.4 KEEPING 4
                      2122    ~6%       {5}    | SCAN OUTPUT In.2, _, In.0 'instr', _, In.1
                      2122    ~0%       {4}    | REWRITE WITH Out.1 := false, Out.3 := booleanNot(In.4) KEEPING 4
                      4244    ~104%     {4}    | JOIN WITH `AliasedSSA::getGroupedMemoryLocation/3#14ef79fc#ffbf_0213#join_rhs` ON FIRST 2 OUTPUT Lhs.2 'instr', Lhs.3, Rhs.2, Rhs.3 'result'
                                        {4}    | REWRITE WITH TEST InOut.1 != InOut.2
                      2122    ~98%      {2}    | SCAN OUTPUT In.3 'result', In.0 'instr'
                      1061    ~0%       {2}    | JOIN WITH AliasedSSA::MemoryLocation#4b9f223c ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.0 'result'

                      946577  ~0%       {8} r10 = JOIN r6 WITH `project#AliasedSSA::hasResultMemoryAccess/9#732473d4#5_0512346#join_rhs` ON FIRST 2 OUTPUT Lhs.0 'instr', Lhs.1, Rhs.2, Rhs.3, Rhs.4, Rhs.5, Rhs.6, _
                                        {7}    | REWRITE WITH Tmp.7 := false, TEST InOut.6 = Tmp.7 KEEPING 7
                      944455  ~0%       {6}    | SCAN OUTPUT In.2, In.3, In.4, In.5, In.0 'instr', In.1
                      1183383 ~2%       {8}    | JOIN WITH num#AliasedSSA::TVariableMemoryLocation#8e8cb20c_013456#join_rhs ON FIRST 4 OUTPUT Rhs.5 'result', Lhs.4 'instr', Lhs.5, Lhs.0, Lhs.1, Lhs.2, Lhs.3, Rhs.4
                      1183383 ~0%       {8}    | JOIN WITH AliasedSSA::MemoryLocation#4b9f223c ON FIRST 1 OUTPUT Lhs.1 'instr', Lhs.3, Lhs.4, Lhs.5, Lhs.6, Lhs.2, Lhs.7, Lhs.0 'result'
                      1183383 ~0%       {5}    | JOIN WITH `project#AliasedSSA::hasResultMemoryAccess/9#732473d4#6` ON FIRST 6 OUTPUT Lhs.0 'instr', Lhs.6, Lhs.7 'result', _, Lhs.5
                                        {4}    | REWRITE WITH Out.3 := booleanNot(In.4), TEST Out.3 != InOut.1 KEEPING 4
                      944455  ~3%       {2}    | SCAN OUTPUT In.0 'instr', In.2 'result'

                      2959612 ~0%       {2} r11 = r4 UNION r5 UNION r7 UNION r8 UNION r9 UNION r10
                                        return r11
```
2025-01-11 17:50:51 +01:00
Jeroen Ketema
fb047a67d6 C++: Update stats file 2025-01-11 17:40:18 +01:00
Jeroen Ketema
fcf6c3c4e8 Merge pull request #18474 from jketema/cpp20-beta
Drop C++20 beta notification from docs
2025-01-10 17:32:44 +01:00
Jeroen Ketema
35f90a6101 Drop C++20 beta notification from docs 2025-01-10 16:17:46 +01:00
Geoffrey White
edd1f257ad Rust: Attempt to fix the test on CI. 2025-01-10 14:51:15 +00:00
Edward Minnix III
fd878a1f33 Merge pull request #18465 from egregius313/egregius313/go/mad/database/beego-orm
Go: `database` source models for `github.com/beego/beego/client/orm`
2025-01-10 09:41:32 -05:00
Geoffrey White
1b6c289cb4 Rust: Unrelated MaD test impact. :( 2025-01-10 14:38:05 +00:00
Ed Minnix
0f038355ff Fix provenance in test 2025-01-10 09:26:58 -05:00
Geoffrey White
19d3e9dbca Rust: Correct the qhelp. 2025-01-10 14:19:12 +00:00
Michael B. Gale
1cba147087 Merge pull request #18469 from github/mbg/csharp/fix-crash-if-proxy-env-vars-are-already-set
C#: Fix crash if proxy environment variables are already set
2025-01-10 14:11:27 +00:00
Tom Hvitved
b5982643c7 Merge pull request #18445 from hvitved/rust/format-args-index
Rust: Remove `Format.getArgument`
2025-01-10 15:06:43 +01:00
Jeroen Ketema
8c3e5b6f56 Merge pull request #18368 from github/jketema/template-parameters-7
C++: Handle requires clauses and type template type constraints
2025-01-10 15:02:41 +01:00
Ed Minnix
43771d8f19 Fix formatting 2025-01-10 08:50:09 -05:00
Joe Farebrother
a7fb73a2b2 Merge pull request #18185 from joefarebrother/python-lxml
Python: Model additional flow steps for the lxml framework
2025-01-10 13:40:16 +00:00
Tom Hvitved
0795c244e9 Rust: Move QL doc into annotations.py 2025-01-10 14:27:53 +01:00
Ed Minnix
bff243367c Rename test functions to include package name 2025-01-10 08:26:46 -05:00
Edward Minnix III
4bd43b4e70 Reword change note to be more general
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2025-01-10 08:22:28 -05:00
Ed Minnix
46f9448043 Add Ormer models for v1 of the beego ORM 2025-01-10 08:20:26 -05:00
Asger F
bc34a045d3 JS: Triage discrepancies and update test 2025-01-10 14:18:31 +01:00
Asger F
18ab066e79 JS: Remove OK comments that don't provide further explanation 2025-01-10 14:18:30 +01:00
Asger F
c2b65b1f85 JS: Port IncompleteUrlSubstringSanitization test 2025-01-10 14:18:29 +01:00
Asger F
6b4be13a8e JS: Move annotations to the correct line 2025-01-10 14:18:28 +01:00
Asger F
95e20a045b JS: Port IncompleteUrlSchemeCheck test 2025-01-10 14:18:26 +01:00
Asger F
563471dd52 JS: Triage discrepancies and update test 2025-01-10 14:18:25 +01:00
Asger F
48f7a58d01 JS: Update IncompleteHostnameRegExp test to match reality 2025-01-10 14:18:24 +01:00
Asger F
a83508a828 JS: Port IncompleteHostNameRegExt test 2025-01-10 14:18:23 +01:00
Asger F
ce8912ddcc Test: Handle 'problems' result set as an alias for '#select' 2025-01-10 14:18:21 +01:00
Geoffrey White
ad268220bf Rust: Address QL-for-QL comments. 2025-01-10 12:53:12 +00:00
Geoffrey White
39a38c4c53 Rust: Tweak .qhelp layout. 2025-01-10 12:48:53 +00:00
Geoffrey White
bb4322cf7c Rust: Make a type more accurate. 2025-01-10 12:39:10 +00:00
Geoffrey White
c115169dbe Rust: Move ModelledHashOperation to a more logical location. 2025-01-10 12:36:05 +00:00
Geoffrey White
ae26cd6c32 Rust: Update test for changes on main. 2025-01-10 12:36:04 +00:00
Geoffrey White
9b8f561614 Rust: Add another reference. 2025-01-10 12:36:03 +00:00
Geoffrey White
59386597c3 Rust: Add .qhelp. 2025-01-10 12:36:01 +00:00
Geoffrey White
babfa758a3 Rust: Add models for an alternative md5 library. 2025-01-10 11:56:27 +00:00
Geoffrey White
ae0f4f10de Rust: Add hash function sinks. 2025-01-10 11:56:26 +00:00
Geoffrey White
d72b978bc7 Rust: Add sensitive data sources. 2025-01-10 11:56:25 +00:00
Geoffrey White
8f4a52001f Rust: Add query framework. 2025-01-10 11:56:24 +00:00
Geoffrey White
509c6ffb7a Rust: Add tests for weak hashing. 2025-01-10 11:56:23 +00:00
Tom Hvitved
166f8916cc Rust: Remove Format.getArgument 2025-01-10 12:51:42 +01:00
Michael B. Gale
b0f0a24b6a C#: Override env vars in DotNetCliInvoker if already set 2025-01-10 11:36:02 +00:00
Michael B. Gale
f78c6e0924 C#: Remove incorrect log message from DependabotProxy 2025-01-10 11:35:14 +00:00
Geoffrey White
5ef5b04aac Add change notes. 2025-01-10 11:16:53 +00:00
Tom Hvitved
303b11ec36 Merge pull request #18298 from hvitved/rust/mad-source-sink
Rust: Add support for MaD sources and sinks with access paths
2025-01-10 11:49:51 +01:00
Owen Mansel-Chan
0728b3bd60 Update test expectation 2025-01-10 10:37:05 +00:00
Geoffrey White
488738a8b8 Swift: Remove special case that is now redundant. 2025-01-10 10:31:55 +00:00
Geoffrey White
f8659c0a4e Sync identical files. 2025-01-10 10:26:13 +00:00
Geoffrey White
9a8a852277 Rust: Support snake case more widely in SensitiveDataHeuristics.qll. 2025-01-10 10:23:55 +00:00
Mathias Vorreiter Pedersen
a35dc7ea69 Merge pull request #18463 from MathiasVP/add-sysalloc-models
C++: Add MaD models for `SysAllocString` and friends
2025-01-10 10:10:06 +00:00
Geoffrey White
88e351ad4f Rust: Expand sensitive data test cases. 2025-01-10 10:00:13 +00:00
Jeroen Ketema
0a292fbaf5 C++: Add upgrade and downgrade scripts 2025-01-10 10:20:51 +01:00
Jeroen Ketema
7f5772b8a4 C++: Update dbscheme stats file 2025-01-10 10:19:45 +01:00
Jeroen Ketema
3f6a2850cc C++: Add change note 2025-01-10 10:19:44 +01:00
Jeroen Ketema
2c9af9ea30 C++: Add support for requires clauses and constraints on template parameters 2025-01-10 10:19:34 +01:00
Michael Nebel
b358f33f9e C#: Address review comment. 2025-01-10 10:00:44 +01:00
Tom Hvitved
039b2ecf9b Merge pull request #18457 from hvitved/dataflow/disallowed-return-inline-late
Data flow: Fix a bad join order
2025-01-10 09:37:58 +01:00
Ed Minnix
592b46bea8 Change note 2025-01-09 21:55:05 -05:00
Ed Minnix
baec4adbb1 beego models 2025-01-09 21:54:00 -05:00
Jeroen Ketema
204afab427 Merge pull request #18367 from github/jketema/template-parameters-6
C++: Handle template variable specializations
2025-01-09 22:21:03 +01:00
Mathias Vorreiter Pedersen
1822dc4860 C++: Add change note. 2025-01-09 17:56:07 +00:00
Mathias Vorreiter Pedersen
7a84132a6b C++: Add models and accept testcases. 2025-01-09 17:32:34 +00:00
Mathias Vorreiter Pedersen
23acc31885 C++: Add testcases with missing models. 2025-01-09 17:30:37 +00:00
Paolo Tranquilli
928c66aea3 Merge pull request #18443 from github/redsun82/cargo-upgrade
Rust: update rust-analyzer
2025-01-09 17:33:26 +01:00
Jeroen Ketema
12048aefad Merge pull request #18408 from jketema/config-silence
C++: Silence alerts coming from CMake test compilation files
2025-01-09 16:31:55 +01:00
Geoffrey White
0ce409efd7 Update cpp/ql/test/query-tests/Likely Bugs/Likely Typos/ExprHasNoEffect/CMakeFiles/CMakeScratch/TryCompile-abcdef/CheckFunctionExists.c
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2025-01-09 15:17:57 +00:00
Paolo Tranquilli
6ded99ccb1 Merge branch 'main' into redsun82/cargo-upgrade 2025-01-09 16:05:48 +01:00
Erik Krogh Kristensen
70a1a6454d Merge pull request #18452 from asgerf/js/import-spec-strings
JS: Fix crash in case of string literal in export specifier
2025-01-09 15:50:40 +01:00
Paolo Tranquilli
4f79199498 Rust: replace std::fs::canonicalize with dunce::canonicalize
Rust-analyzer turned out to be quite picky about paths, where
`//?/`-prefixed paths can lead to flaky failures. See

https://github.com/rust-lang/rust-analyzer/issues/18894

for details.

This makes paths always be canonicalized with `dunce`. Previously,
`dunce` was used as a fallback, but that stopped working somewhere
after version 0.0.248 of rust-analyzer.
2025-01-09 15:43:15 +01:00
Paolo Tranquilli
cd95cc8f94 Rust: update rust-analyzer to 0.0.257 2025-01-09 15:34:07 +01:00
Michael B. Gale
14cfac506e Merge pull request #18456 from owen-mc/go/fix-test-jmoiron
Go: Fix stub that is making test fail
2025-01-09 13:20:08 +00:00
yoff
b263132ab2 Merge pull request #17998 from yoff/shared/locations-in-range-analysis 2025-01-09 14:05:54 +01:00
Jeroen Ketema
347edc4ff6 C++: Add upgrade and downgrade scripts 2025-01-09 13:26:33 +01:00
Jeroen Ketema
74bc28534f C++: Update dbscheme stats file 2025-01-09 13:23:25 +01:00
Jeroen Ketema
0a57587189 C++: Add change note 2025-01-09 13:23:23 +01:00
Jeroen Ketema
17127356e8 C++: Handle template variable specializations 2025-01-09 13:23:21 +01:00
Nora Dimitrijević
09571135e6 Merge pull request #18425 from d10c/d10c/BigInt.bitLength
Language reference: mention BigInt.bitLength()
2025-01-09 13:19:25 +01:00
Tom Hvitved
653d1227e3 Data flow: Cache known{Source,Sink}Model 2025-01-09 13:11:29 +01:00
Jeroen Ketema
60ae374a88 Merge pull request #18366 from github/jketema/template-parameters-5
C++: Support concept id expressions
2025-01-09 13:02:19 +01:00
Tom Hvitved
91b6a6573c Data flow: Fix a bad join order 2025-01-09 12:58:16 +01:00
Owen Mansel-Chan
1812be7fa8 Fix stub 2025-01-09 11:43:36 +00:00
Asger F
0f6e8bf140 Merge pull request #18451 from asgerf/jss/cleanup-todos
JS: Clean up some TODO comments
2025-01-09 11:50:35 +01:00
Tom Hvitved
a7bb95249b Rust: Implement known{Source,Sink}Model 2025-01-09 11:47:57 +01:00
Jeroen Ketema
ac05bfcf4e C++: Remove some redundant toStrings 2025-01-09 11:04:07 +01:00
Jeroen Ketema
6325dd2ce1 C++: Simplify toString 2025-01-09 11:03:41 +01:00
Asger F
a7fbfb2c2d JS: Change note 2025-01-09 10:48:52 +01:00
Asger F
fd5a3dad90 JS: One more test 2025-01-09 10:46:45 +01:00
Asger F
138b000891 JS: Coerce the local export node to an Identifier 2025-01-09 10:42:25 +01:00
Asger F
db98880163 JS: Add crash reproduction to test case 2025-01-09 10:39:30 +01:00
Asger F
9c4d378a1d JS: Remove TODO comment
It is not subsumed by the other case, both cases are needed
2025-01-09 10:17:16 +01:00
Asger F
3f2882e1c6 JS: Remove an obsolete comment
The RHS of an assignment actually has a post-update node now
2025-01-09 09:59:23 +01:00
Asger F
b2d62a080b JS: Move a test failure explanation into the test suite
We have an issue for fixing the underlying problem
2025-01-09 09:57:44 +01:00
Asger F
d9da9444fa JS: Rephrase TODO
This is useful info, but not something that can be fixed locally in this query, so a TODO comment isn't helping
2025-01-09 09:45:39 +01:00
Asger F
3def8ecdee JS: Remove unimportant TODO 2025-01-09 09:43:03 +01:00
Asger F
388dd871e1 JS: Remove TODO tracked by an issue.
This requires changes to the shared data flow library, not something we should track with a TODO in the JS codebase
2025-01-09 09:41:40 +01:00
Asger F
8b060c4294 JS: Remove TODO about evaluating legacy steps
There is an issue for tracking this. It's not a small fix.
2025-01-09 09:40:29 +01:00
Asger F
a8f93cac05 JS: Remove obsolete comment
The test case actually has the correct result now
2025-01-09 09:39:32 +01:00
Asger F
dd37c474d8 JS: Remove mention of results from comments 2025-01-09 09:39:30 +01:00
Asger F
fb54a3bde8 JS: Remove obsolete TODO comment 2025-01-09 09:39:29 +01:00
Asger F
b29ee2acde JS: Remove references to localFieldStep
These are tracked in https://github.com/github/codeql-javascript-team/issues/456
2025-01-09 09:39:27 +01:00
Asger F
7766f97232 JS: Remove obsolete TODO 2025-01-09 09:39:26 +01:00
Asger F
8ac08db5c2 JS: Remove TODOs about WithArrayElement not being a taint step
This isn't going to become a taint step, the workaround is the permanent solution
2025-01-09 09:39:23 +01:00
Asger F
3cc1525985 JS: Remove obsolete TODOs 2025-01-09 09:19:30 +01:00
Asger F
1997e0a7b6 Merge pull request #18427 from asgerf/jss/change-note
JS: Add migration guide and change note
2025-01-09 09:13:16 +01:00
Paolo Tranquilli
ca05697365 Merge pull request #18429 from github/redsun82/rust-ast-generator-mustache
Rust: make ast-generator use mustache templates
2025-01-09 08:37:07 +01:00
Jeroen Ketema
f08d10065c C++: Add upgrade and downgrade scripts 2025-01-09 00:44:39 +01:00
Jeroen Ketema
7cba263bc4 C++: Update dbscheme stats file 2025-01-09 00:44:38 +01:00
Jeroen Ketema
033f35fe42 C++: Improve PrintAST for concept ids
If a type would be used in multiple places in the AST, rendering of the
AST would be broken. Hence, we cannot directly use types as AST nodes.
2025-01-09 00:44:37 +01:00
Jeroen Ketema
f8458f6025 C++: Add change note 2025-01-09 00:44:36 +01:00
Jeroen Ketema
c48fcf1fb2 C++: Support concept id expressions 2025-01-09 00:44:26 +01:00
Dave Bartolomeo
554ea29547 Merge pull request #18437 from github/post-release-prep/codeql-cli-2.20.1
Post-release preparation for codeql-cli-2.20.1
2025-01-08 14:33:34 -05:00
Geoffrey White
3363235b1c Merge pull request #18414 from geoffw0/sensitive
Rust: Sensitive data library
2025-01-08 17:38:18 +00:00
Edward Minnix III
af15ebad7e Merge pull request #18426 from egregius313/egregius313/go/mad/database/sqlx
Go: Add `database` source models for the `jmoiron/sqlx` package
2025-01-08 11:31:36 -05:00
Owen Mansel-Chan
0f8f5d2793 Merge branch 'main' into post-release-prep/codeql-cli-2.20.1 2025-01-08 16:28:23 +00:00
Owen Mansel-Chan
5cc34a16d1 Merge pull request #18439 from egregius313/egregius313/go/mad/database-sql/revert-varargs
Go: Revert MaD models for `database/sql` to use QL instead
2025-01-08 16:24:04 +00:00
Paolo Tranquilli
53b0a3464d Merge branch 'main' into redsun82/rust-ast-generator-mustache 2025-01-08 17:09:39 +01:00
Paolo Tranquilli
3bf2416e56 Merge pull request #18313 from github/redsun82/rust-mute-warnings-in-uncompiled-blocks
Rust: exclude extraction of code excluded by `cfg`
2025-01-08 17:03:29 +01:00
yoff
21e7a0e828 Merge branch 'main' into shared/locations-in-range-analysis 2025-01-08 16:40:59 +01:00
Ed Minnix
8e4939ee5d Add tests for Conn 2025-01-08 10:25:57 -05:00
Ed Minnix
a4afff2c3c Add extra variable for tracking flow 2025-01-08 10:25:55 -05:00
Ed Minnix
e7f99cdfb7 Order DB, NamedStmt, Stmt, Tx in tests 2025-01-08 10:25:54 -05:00
Ed Minnix
4ed0f7fc40 Alphabetical ordering 2025-01-08 10:25:52 -05:00
Ed Minnix
cc54e75235 Remove duplicate stubs 2025-01-08 10:25:51 -05:00
Ed Minnix
67070e0f2a Change note 2025-01-08 10:25:49 -05:00
Ed Minnix
22a4cd3698 sqlx tests 2025-01-08 10:25:48 -05:00
Ed Minnix
89a68fed7c Vendor sqlx stubs for test 2025-01-08 10:25:42 -05:00
Ed Minnix
4966ed1280 Add missing models 2025-01-08 10:24:12 -05:00
Ed Minnix
b916a7b5a7 Remove duplicate models 2025-01-08 10:24:10 -05:00
Ed Minnix
05ffffe651 jmoiron/sqlx models 2025-01-08 10:24:06 -05:00
Ed Minnix
bc68e4456a Fix test results 2025-01-08 10:22:00 -05:00
Edward Minnix III
7a589c4081 Merge pull request #18405 from egregius313/egregius313/go/mad/database/gorm
Go: Model sources from the `gorm.io/gorm` package
2025-01-08 10:20:10 -05:00
Edward Minnix III
6ac82d6af2 Merge pull request #18440 from egregius313/egregius313/csharp/blazor/traced-integration-tests
C#: Traced-mode integration tests for Blazor
2025-01-08 10:19:12 -05:00
Tom Hvitved
9e5a814f72 Merge pull request #18315 from hvitved/ruby/dataflow-types
Ruby: Track types in data flow
2025-01-08 15:26:38 +01:00
Tom Hvitved
868caf948c Rename {Source,Sink}Node to {Source,Sink}Element 2025-01-08 15:21:43 +01:00
Asger F
10d5d09ad1 JS: Polish taint-tracking section in response to review comment 2025-01-08 14:45:31 +01:00
Tom Hvitved
0dccbb9349 Rust: Add two more AST consistency checks 2025-01-08 14:30:01 +01:00
Tom Hvitved
033cd1778e Rust: Include index in Format.getArgument 2025-01-08 14:04:48 +01:00
Nora Dimitrijević
b5935fcd2d Language reference: mention BigInt.bitLength() 2025-01-08 14:01:01 +01:00
yoff
f02995d72b shared: add qldoc 2025-01-08 13:33:03 +01:00
yoff
aca5a51a78 Merge branch 'main' into shared/add-location-to-typetracking-nodes 2025-01-08 12:47:05 +01:00
Asger F
ecccc7ce8c Update docs/codeql/codeql-language-guides/migrating-javascript-dataflow-queries.rst
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2025-01-08 12:26:42 +01:00
Asger F
26d85d5ece Apply suggestions from code review
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2025-01-08 12:26:18 +01:00
Paolo Tranquilli
c7a9889606 Rust: update rust-analyzer 2025-01-08 11:14:08 +01:00
Asger F
b6b93dcead Merge pull request #18392 from asgerf/jss/deprecate-modules
JS: Deprecate some .qll files
2025-01-08 11:10:28 +01:00
Paolo Tranquilli
bca5f4b74c Merge pull request #18441 from github/redsun82/cargo-upgrade
Ruby, Rust: upgrade all cargo dependencies (excluding `rust-analyzer`)
2025-01-08 10:56:58 +01:00
Paolo Tranquilli
d2c7decd02 Rust/Ruby: upgrade all cargo dependencies excluding rust-analyzer
The rust-analyzer update will need more work as it seems to break rust
analysis on windows.

This was carried out using `cargo upgrade` from `cargo-edit`:
* getting exclusions options for rust-analyzer with
   ```bash
   cargo upgrade -i --dry-run | grep -o 'ra_ap_\S\+' | sort -u | sed 's/^/--exclude=/' > /tmp/exclude
   ```
* running
   ```bash
   cargo upgrade -i $(cat /tmp/exclude)
   misc/bazel/3rdparty/update_cargo_deps.sh
   ```
2025-01-08 09:57:11 +01:00
Tom Hvitved
96bf81ad6c Merge pull request #18333 from hvitved/dataflow/stage1-param-self-prune
Data flow: Prune parameter-self flow in stage 1
2025-01-08 09:16:12 +01:00
Asger F
062391334e JS: Remove notes about changing API in the future 2025-01-08 09:15:13 +01:00
Asger F
df9b95575e JS: Add deprecation qldoc to Configuration classes 2025-01-08 09:15:12 +01:00
Asger F
e7d267e5d2 JS: Add migration guide and change note 2025-01-08 09:12:38 +01:00
Asger F
36f0d2f63e JS: Move VarAccessBarrier outside the deprecated Configuration.qll file 2025-01-08 08:56:53 +01:00
Asger F
c47419e66d JS: Remove an obsolete TODO comment (this has been fixed) 2025-01-08 08:54:41 +01:00
Ed Minnix
819bd3b56f Remove build-mode: none tests 2025-01-07 22:59:42 -05:00
Ed Minnix
ba8489624d Change order of test results 2025-01-07 22:57:37 -05:00
Ed Minnix
32fe74dd01 Remove environment-specific path 2025-01-07 22:57:35 -05:00
Ed Minnix
ea5248912d .NET SDK version 2025-01-07 22:57:34 -05:00
Ed Minnix
144053baea Fix test results 2025-01-07 22:57:32 -05:00
Ed Minnix
068acfd36a Fix path segment 2025-01-07 22:57:31 -05:00
Ed Minnix
e9ac32fbd1 Simplify generated file paths 2025-01-07 22:57:29 -05:00
Ed Minnix
9089c9ca16 Remove line blocking tests 2025-01-07 22:57:27 -05:00
Ed Minnix
6b7f2a725e Make .NET 9 test properly .NET 9 2025-01-07 22:57:26 -05:00
Ed Minnix
b249ee5a01 Basic integration tests 2025-01-07 22:57:23 -05:00
Ed Minnix
e7b0329d5d Test missing models 2025-01-07 22:08:37 -05:00
Ed Minnix
55c6bea08b Add missing models 2025-01-07 22:08:21 -05:00
Ed Minnix
4e5d2e27b1 user.go for example type 2025-01-07 22:07:58 -05:00
Ed Minnix
c086945a9e Fix typo 2025-01-07 21:14:25 -05:00
Ed Minnix
6a862f2f80 Add Rows::Next back 2025-01-07 21:10:48 -05:00
Ed Minnix
ca1e9d7c75 Revert "database/sql summary models for Row types"
This reverts commit 80ad349a48.
2025-01-07 21:08:43 -05:00
github-actions[bot]
fb20f6ca63 Post-release preparation for codeql-cli-2.20.1 2025-01-07 22:07:40 +00:00
Paolo Tranquilli
b390fac105 Rust: make ast-generator use mustache templates
This simplifies the code and decouples the code template from the data
that is fed into it.
2025-01-07 18:05:59 +01:00
Owen Mansel-Chan
5959a736ac Only recommend GCM, and tighten wording 2025-01-07 16:55:10 +00:00
Jeroen Ketema
0258ce70a4 Merge pull request #18362 from github/jketema/template-parameters-4
C++: Support concept templates
2025-01-07 16:42:56 +01:00
Joe Farebrother
35961e454b Fix tests to check for the correct type 2025-01-07 15:23:07 +00:00
Joe Farebrother
8b174ea07c Apply suggestions from code review - update doc comments
Co-authored-by: yoff <lerchedahl@gmail.com>
2025-01-07 15:21:19 +00:00
Ian Lynagh
b18230af23 Merge pull request #18409 from igfoo/igfoo/supJ
Java: Clarify supported language features
2025-01-07 15:07:15 +00:00
Chris Smowton
1761721ef6 Merge pull request #18415 from smowton/smowton/feature/exclude-writereplace-from-serializable-checks
Java: exclude `writeReplace`-defining classes from `Serializable` check
2025-01-07 15:55:47 +01:00
Tom Hvitved
aa024010b1 Address review comment 2025-01-07 14:23:54 +01:00
Jeroen Ketema
b6f412bbad C++: Add change notes 2025-01-07 14:21:45 +01:00
Jeroen Ketema
06f6bac169 C++: Silence alerts coming from CMake test compilation files 2025-01-07 14:12:55 +01:00
Jeroen Ketema
ede801ed88 C++: Add CMake test compilation test 2025-01-07 14:12:11 +01:00
Anders Schack-Mulligen
148b78a5f8 Merge pull request #18423 from aschackmull/dataflow/del-deadcode
Dataflow: Remove some dead code.
2025-01-07 14:08:37 +01:00
Jeroen Ketema
91f9fb24d9 Merge pull request #18424 from jketema/rm-change
Remove change note that somehow occurs in the CodeQL root directory
2025-01-07 13:52:16 +01:00
Ian Lynagh
8652f611b7 Update docs/codeql/reusables/supported-versions-compilers.rst
Co-authored-by: Edward Minnix III <egregius313@github.com>
2025-01-07 12:51:21 +00:00
Ed Minnix
d28e03cda5 Change note 2025-01-07 07:34:27 -05:00
Ed Minnix
c7be77c1af Add gorm tests 2025-01-07 07:34:25 -05:00
Ed Minnix
f38008e73d Add test vendoring 2025-01-07 07:34:23 -05:00
Ed Minnix
20d1ae1396 Fix Association model 2025-01-07 07:34:22 -05:00
Ed Minnix
796a81a0ba gorm models 2025-01-07 07:34:20 -05:00
Jeroen Ketema
4b7b2a2580 Remove change note that somehow occurs in the CodeQL root directory 2025-01-07 13:32:25 +01:00
Edward Minnix III
651052ba7a Merge pull request #18402 from egregius313/egregius313/go/mad/database/database-sql
Go: Add `database` source models for the `database/sql` and `database/sql/driver` packages
2025-01-07 07:31:06 -05:00
Michael B. Gale
96797b4570 Merge pull request #18422 from github/dependabot/go_modules/go/extractor/extractor-dependencies-a7e3f36068
Bump golang.org/x/tools from 0.28.0 to 0.29.0 in /go/extractor in the extractor-dependencies group
2025-01-07 12:11:27 +00:00
Paolo Tranquilli
b4811906ea Rust: address review 2025-01-07 13:05:19 +01:00
Paolo Tranquilli
ce2877da5d Merge branch 'main' into redsun82/rust-mute-warnings-in-uncompiled-blocks 2025-01-07 13:00:04 +01:00
Anders Schack-Mulligen
eea85d8f82 Dataflow: Remove some dead code. 2025-01-07 12:56:26 +01:00
Ed Minnix
b3d8c6b2e8 Add error handling to test 2025-01-07 06:46:54 -05:00
Ed Minnix
60cf1eccae Update test results 2025-01-07 06:41:39 -05:00
Ed Minnix
0f06ddcff0 Change note 2025-01-07 06:41:37 -05:00
Ed Minnix
128c02b488 database/sql/driver tests 2025-01-07 06:41:36 -05:00
Ed Minnix
3e65c8de36 database/sql tests 2025-01-07 06:41:34 -05:00
Ed Minnix
e9fdc8a34c database source tests 2025-01-07 06:41:33 -05:00
Ed Minnix
80ad349a48 database/sql summary models for Row types 2025-01-07 06:41:31 -05:00
Ed Minnix
8093d57781 database/sql and database/sql/driver source models 2025-01-07 06:41:30 -05:00
Edward Minnix III
27852ddd05 Merge pull request #18398 from egregius313/egregius313/go/add-postprocessing-to-storedxss-qlref
Go: Add post-processing to StoredXss.qlref test
2025-01-07 06:36:05 -05:00
Jeroen Ketema
0f5b70a802 C++: Add upgrade and downgrade scripts 2025-01-07 11:30:22 +01:00
Jeroen Ketema
2d7256862a C++: Update dbscheme stats file 2025-01-07 11:28:32 +01:00
Jeroen Ketema
3812ee463d C++: Add change note 2025-01-07 11:26:20 +01:00
Jeroen Ketema
a2d66ee155 C++: Extend the dbscheme with concept templates 2025-01-07 11:26:16 +01:00
Asger F
abea019751 Merge pull request #18412 from asgerf/jss/perf-fixes
JS: Fix a few perf issues
2025-01-07 11:20:57 +01:00
Asger F
f17cc5af15 JS: Move all hidden node definitions into DataFlowPrivate 2025-01-07 10:44:09 +01:00
Asger F
47cc3c09f5 JS: Deprecate an import 2025-01-07 10:43:40 +01:00
Tamás Vajk
e67f4be699 Merge pull request #18407 from tamasvajk/fix/razor-relative-path
C#: Change source generated razor file paths to be relative to csproj
2025-01-07 08:35:56 +01:00
dependabot[bot]
d7eaf9012f Bump golang.org/x/tools
Bumps the extractor-dependencies group in /go/extractor with 1 update: [golang.org/x/tools](https://github.com/golang/tools).


Updates `golang.org/x/tools` from 0.28.0 to 0.29.0
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.28.0...v0.29.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: extractor-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-07 03:20:27 +00:00
Chris Smowton
dd0012edcb ASCII 2025-01-06 23:28:02 +01:00
Chris Smowton
03c6529961 Spelling 2025-01-06 22:46:22 +01:00
Mathias Vorreiter Pedersen
7a9d341cb7 Merge pull request #18416 from MathiasVP/more-robust-param-name-matching-arrays
C++: Also resolve typedefs nested inside `ArrayType`s
2025-01-06 18:34:29 +00:00
Mathias Vorreiter Pedersen
d935e9fb0f C++: Also resolve typedefs nested inside arrays. 2025-01-06 14:50:37 +00:00
Mathias Vorreiter Pedersen
fdc305298d C++: Add testcase with missing MaD support for resolving typedefs inside arrays. 2025-01-06 14:46:55 +00:00
Chris Smowton
d0eab598b1 Change note 2025-01-06 14:44:12 +00:00
Chris Smowton
5c2df36786 Exclude classes with a writeReplace method from serializability checks 2025-01-06 14:42:44 +00:00
Geoffrey White
9d178ab8d6 Rust: Fix the failing integration tests. 2025-01-06 14:05:02 +00:00
Geoffrey White
f93aac07c2 Rust: Correct / clarify some QLDoc. 2025-01-06 13:50:41 +00:00
Asger F
0cdda87161 JS: Restrict AP length in prototype-polluting function 2025-01-06 14:33:41 +01:00
Asger F
7ccb476b1b JS: Restrict AP length in ExceptionXss 2025-01-06 14:28:58 +01:00
Asger F
23d7420cec JS: Hide default exceptional return node 2025-01-06 14:27:20 +01:00
Geoffrey White
e1e980c2e8 Rust: Add sensitive data to summary queries. 2025-01-06 13:26:27 +00:00
Geoffrey White
821eb4f3e6 Rust: Add sensitive data library. 2025-01-06 13:26:26 +00:00
Geoffrey White
c77bf2b4eb Rust: Add a test for sensitive data. 2025-01-06 13:26:25 +00:00
Ian Lynagh
c5ebc19a28 Java: Clarify supported langauge features 2025-01-06 12:31:46 +00:00
Tom Hvitved
1b31c90d26 Implement FlowSummaryImpl stubs 2025-01-06 13:26:51 +01:00
Tom Hvitved
8f6ae6274d Rust: Add support for MaD sources and sinks with access paths 2025-01-06 13:26:49 +01:00
Tom Hvitved
37212cc43f Ruby: Add change note 2025-01-06 13:26:13 +01:00
Tom Hvitved
978a816f11 Ruby: Track types in data flow 2025-01-06 13:26:10 +01:00
Tom Hvitved
06ba814929 Data flow: Prune parameter-self flow in stage 1 2025-01-06 13:23:03 +01:00
Asger F
e2af19b946 JS: Restrict "get" step to Map objects 2025-01-06 13:17:32 +01:00
Tamas Vajk
31dbadcbeb Add change note 2025-01-06 11:41:11 +01:00
Tamas Vajk
c9fab0b071 C#: Change source generated razor file paths to be relative to csproj 2025-01-06 11:10:28 +01:00
Asger F
4c9f406e34 JS: Exclude some sinks in UnvalidatedDynamicMethodCall 2025-01-06 10:32:11 +01:00
Paolo Tranquilli
10d8aa454b Merge branch 'main' into redsun82/rust-mute-warnings-in-uncompiled-blocks 2025-01-06 10:01:57 +01:00
Ed Minnix
c02430607a Add post-processing to StoredXss.qlref test 2025-01-03 13:26:29 -05:00
Ian Lynagh
78b277b46f Java/Kotlin: Add a changenote for CODEQL_PATH_TRANSFORMER support. 2025-01-03 16:02:36 +00:00
Ian Lynagh
dedb0cb11f Kotlin: Support CODEQL_PATH_TRANSFORMER 2025-01-03 16:02:36 +00:00
Michael Nebel
caaf29115c C#: Add change note. 2025-01-03 16:27:03 +01:00
Michael Nebel
ff32a382b0 C#: Update test expected output. 2025-01-03 16:27:02 +01:00
Michael Nebel
cac1e04de8 C#: Improve unification logic to handle ref structs. 2025-01-03 16:27:00 +01:00
Michael Nebel
5ddc37867e C#: Update test expected output. 2025-01-03 16:26:58 +01:00
Michael Nebel
c439beb4b4 C#: Introduce a class for ref structs. 2025-01-03 16:26:57 +01:00
Michael Nebel
33939a8041 C#: Update test expected output. 2025-01-03 15:36:08 +01:00
Michael Nebel
ef5ae3f1ae C#: Add some unification and viable callable test cases. 2025-01-03 15:36:07 +01:00
Michael Nebel
b9fce5eb9d C#: Update boxing conversion expected output. 2025-01-03 15:36:06 +01:00
Michael Nebel
ef9f09ebfc C#: Do not consider ref struct as being convertible to object, dynamic and valuetype. 2025-01-03 15:36:04 +01:00
Michael Nebel
9a2edc3d5c C#: Add ref struct boxing example (false positive). 2025-01-03 15:36:02 +01:00
Michael Nebel
41dc4a5503 C#: Add extractor support for the allows ref struct general type parameter constraint. 2025-01-03 15:36:00 +01:00
Michael Nebel
d9158c8cd5 Fixup of second commit. 2025-01-03 15:35:59 +01:00
Michael Nebel
958d8f1f01 C#: Add extractor support for the notnull general type parameter constraint. 2025-01-03 15:35:49 +01:00
Michael Nebel
c0974f364e C#: General type constraints tests. 2025-01-03 15:12:35 +01:00
Asger F
25f5ecba25 JS: Deprecate the Configuration.qll file 2025-01-03 11:41:41 +01:00
Asger F
0339bd0f3e JS: Deprecate forward/backward exploration modules 2025-01-03 11:41:39 +01:00
Asger F
7e4fbe2f14 Merge pull request #18326 from asgerf/js/shared-dataflow-bump
JS: Merge 'main' into shared dataflow branch
2025-01-03 11:24:37 +01:00
Asger F
942ba189f7 JS: Minor test output change in nodes/edges
I suspect this is due to some fixes in the DeduplicatePathGraph module
2024-12-19 15:25:49 +01:00
Asger F
f8dc7eb25b JS: Update output from tests that changed on main 2024-12-19 15:25:47 +01:00
Asger F
4a6030c592 JS: Update expected with some absent result sets 2024-12-19 15:25:46 +01:00
Asger F
cd6ebb103e JS: Make test not assume implicit through for maps 2024-12-19 15:25:45 +01:00
Asger F
dc2f39c399 JS: Add model of Map#groupBy 2024-12-19 15:25:43 +01:00
Asger F
de5e6ddeed JS: Update with changes in TaintTracking test 2024-12-19 15:25:42 +01:00
Asger F
c204527c08 JS: Update Array test output (new tests added on main) 2024-12-19 15:25:41 +01:00
Asger F
33e8bd5032 JS: Update testUtilities import 2024-12-19 15:25:39 +01:00
Asger F
3acd4814de Merge branch 'main' into js/shared-dataflow-merge-main 2024-12-19 10:14:38 +01:00
Paolo Tranquilli
218bc8069b Rust: exclude extraction of code excluded by cfg 2024-12-18 13:34:40 +01:00
Asger F
729efff6a4 Merge pull request #18265 from asgerf/jss/flow-labels2
JS: Migrate all queries to proper flow states and deprecate FlowLabel
2024-12-17 14:37:11 +01:00
Asger F
e5ae7e0231 JS: Fix bad join in isOptionallySanitizedEdgeInternal
This was previously called from isBarrier(node, state) but without restricting the state. The call was therefore moved to isBarrier(node), but this caused some optimisation changes resulting in a bad join.
2024-12-16 15:35:54 +01:00
Asger F
947b785d47 JS: Remove reference to deprecated step relation that's empty anyway 2024-12-16 15:35:53 +01:00
Asger F
0b2914ff13 JS: A few more deprecation updates 2024-12-16 15:35:50 +01:00
Asger F
db00dad033 JS: Avoid deprecation warnings in some tests 2024-12-16 15:35:49 +01:00
Asger F
cf6d166d29 JS: Also update tutorial code 2024-12-16 15:35:47 +01:00
Asger F
079294e55f JS: Mass rename to node1,state1,node2,state2 naming convention 2024-12-16 15:35:46 +01:00
Asger F
ac6da6c2b1 JS: Add some missing qldoc 2024-12-16 15:35:44 +01:00
Asger F
d993c888b1 JS: Deprecate the FlowLabel class 2024-12-16 15:35:43 +01:00
Asger F
69b361ae70 JS: Migrate a test to use flow state 2024-12-16 15:35:42 +01:00
Asger F
73af3f3536 JS: Migrate PrototypePollutingFunction 2024-12-16 15:35:40 +01:00
Asger F
ebe596f227 JS: Migrate CorsPermissiveConfiguration 2024-12-16 15:35:39 +01:00
Asger F
d83ddfabaa JS: Migrate an experimental CodeInjection query 2024-12-16 15:35:38 +01:00
Asger F
a398599bfb JS: Rename an experimental query
Having the same name as a standard query is just confusing
2024-12-16 15:35:36 +01:00
Asger F
c951a29e2a JS: Migrate UnvalidatedDynamicMethodCall 2024-12-16 15:35:34 +01:00
Asger F
820f81fc10 JS: Migrate UnsafeDynamicMethodAccess 2024-12-13 11:32:25 +01:00
Asger F
a9e89ed8e3 JS: Migrate PrototypePollutingAssignment 2024-12-13 11:23:31 +01:00
Asger F
bcc1669f4c JS: Migrate InsecureDownload 2024-12-13 11:10:14 +01:00
Asger F
4e25036cdc JS: Follow naming convention in InsecureModuleFlow module 2024-12-13 11:09:59 +01:00
Asger F
d381ab1260 JS: Migrate IncompleteHtmlAttributeSanitization 2024-12-13 10:55:00 +01:00
Asger F
2112ecc44d JS: Migrate HardcodedDataInterpretedAsCode 2024-12-13 10:48:43 +01:00
Asger F
dc3d7a0159 Update ExceptionXssCustomizations.qll 2024-12-13 10:47:04 +01:00
Asger F
42a7208704 JS: Migrate ExceptionXss 2024-12-13 10:29:32 +01:00
Asger F
d9a43dbd85 JS: Migrate UnsafeHtmlConstruction 2024-12-13 10:08:17 +01:00
Asger F
8907252814 JS: Migrate TemplateObjectInjection 2024-12-13 10:08:16 +01:00
Asger F
3573f0b065 JS: Migrate SecondOrderCommandInjection 2024-12-13 10:08:15 +01:00
Asger F
355f7cdd54 JS: Migrate PrototypePollutingMergeCall 2024-12-13 10:08:13 +01:00
Asger F
c38e3a23eb JS: Migrate NoSqlInjection 2024-12-13 10:08:12 +01:00
Asger F
8e8de5cf23 JS: Migrate LoopBoundInjection 2024-12-13 10:08:11 +01:00
Asger F
daddff0dc6 JS: Avoid deprecation warning in XssThroughDom 2024-12-13 10:08:10 +01:00
Asger F
15d999a9dc JS: Migrate DeepObjectResourceExhaustion 2024-12-13 10:08:09 +01:00
Asger F
5f42a715f6 JS: Migrate TaintedObject to a CommonFlowState 2024-12-13 10:08:08 +01:00
Asger F
14ca1c134b JS: Update TaintedUrlSuffix test 2024-12-13 10:08:07 +01:00
Asger F
12289d4c39 JS: Migrate DomBasedXssQuery to FlowState 2024-12-13 10:08:06 +01:00
Asger F
114d4a141a JS: Move FlowState definition into CommonFlowState
Needed for migrating the XSS query
2024-12-13 10:08:05 +01:00
Asger F
3cf14d8506 JS: Migrate ClientSideUrlRedirect to flow state 2024-12-13 10:08:03 +01:00
Asger F
cca980298f JS: Use flow state in barrier and step relations 2024-12-13 10:08:02 +01:00
Asger F
a8fdd759f9 JS: Add FlowState class to TaintedUrlSuffix 2024-12-13 10:08:01 +01:00
Joe Farebrother
dcbcf7e2bd Add additional tests demonstrating false negative flow 2024-12-12 15:55:36 +00:00
Asger F
a53d294d91 Merge pull request #18203 from asgerf/jss/document-url
JS: Use TaintedUrlSuffix in ClientSideUrlRedirect
2024-12-12 15:47:51 +01:00
Asger F
97b78e752b JS: Added more qldoc 2024-12-12 13:10:52 +01:00
Joe Farebrother
e6794a9af1 Add change note 2024-12-11 14:27:57 +00:00
Joe Farebrother
2019ddfa7f Qldoc improvements + add a few extra tests 2024-12-11 12:25:40 +00:00
Asger F
f8abc5afee Merge pull request #18204 from asgerf/jss/flow-labels
JS: Migrate away from FlowLabel class in TaintedPath
2024-12-11 13:20:48 +01:00
Joe Farebrother
5c8ef28d12 Add missing qldoc and revert accidentilly commited threat model change 2024-12-11 12:04:16 +00:00
Joe Farebrother
bcb08bbc7b Update test output 2024-12-10 19:24:05 +00:00
Joe Farebrother
29a90235e8 Improve tests and use API graphs 2024-12-10 19:09:45 +00:00
Joe Farebrother
d2ed92d6d0 Added tests 2024-12-10 19:09:20 +00:00
Joe Farebrother
d2b0d7a743 Add missing qldoc 2024-12-10 19:07:53 +00:00
Joe Farebrother
89167da177 Model flow steps for lxml 2024-12-10 19:01:14 +00:00
Asger F
77f8e8ef4e JS: Use FlowState::fromFlowLabel instead of Label::toFlowState
This works better for other queries where we don't already have a module named Label
2024-12-10 11:57:18 +01:00
Asger F
38c9023dd9 JS: FlowLabel -> FlowState in ZipSlip 2024-12-10 11:16:07 +01:00
Asger F
0cd01cb96f JS: Use node1,state1,node2,state2 naming convention in tainted path 2024-12-10 11:16:05 +01:00
Asger F
0802107d9a JS: Flow label -> flow state in TaintedPath 2024-12-10 11:16:04 +01:00
Asger F
66eb458134 JS: Handle match/matchAll and unknown regexps 2024-12-09 15:38:36 +01:00
Asger F
6e7c5a3707 JS: Slightly more general getRoot() 2024-12-09 15:05:45 +01:00
Asger F
be617cee4a JS: More precise handling of .exec() 2024-12-09 15:03:51 +01:00
Asger F
703cad9e95 Expand test case 2024-12-09 15:00:56 +01:00
Asger F
2a2a4d2b67 JS: Add TaintedUrlSuffixCustomizations
Importing TaintedUrlSuffix.qll causes the flow label to materialised in unrelated queries, so:

- Renames TaintedUrlSuffix.qll to TaintedUrlSuffixCustomizations.qll
- Make the flow label class abstract
- Adds a new TaintedUrlSuffix.qll that re-exports the above file and also materialises the flow label
- Import the *Customizations.qll file from contexts where we don't want to materialise the flow label
2024-12-09 14:59:29 +01:00
Asger F
d1694013ff JS: Update test showing accidental flow label materialisation
This wouldn't be an issue once FlowLabel is completely deprecated but it will cause perf issues in the interim, so this is fixed in the next commit
2024-12-09 14:59:28 +01:00
Asger F
8fe39bdd38 JS: Update query's own output after test changes 2024-12-09 14:59:27 +01:00
Asger F
71a6a47713 JS: Fix issue with new RegExp().exec() 2024-12-09 14:59:25 +01:00
Asger F
f6d0835c64 JS: Show problem with new RegExp().exec() 2024-12-09 14:59:24 +01:00
Asger F
ef833de60e JS: Replace DocumentUrl with TaintedUrlSuffix 2024-12-09 14:59:23 +01:00
Asger F
e2b2d1c9ab JS: Allow arbitrary comments in ConsistencyChecking
Because line comments cannot be used inside JSX elements
2024-12-09 14:59:21 +01:00
Asger F
712c69ebc8 JS: Fixup the test expectations 2024-12-09 14:59:19 +01:00
Asger F
f8ff504f5c JS: Add ClientSideUrlRedirect test consistency
Update Consistency.ql again
2024-12-09 14:59:18 +01:00
Asger F
b8d652c5b2 Merge pull request #18132 from asgerf/jss/deprecation
JS: Deprecations and related refactorings
2024-12-06 13:23:26 +01:00
Owen Mansel-Chan
5351f5b69d Update wording of alert (accepting review suggestion)
Co-authored-by: Chris Smowton <smowton@github.com>
2024-12-04 10:31:14 +00:00
Owen Mansel-Chan
95116eec51 Update recommendations 2024-12-04 00:42:23 +00:00
Asger F
3f0d0e3a05 JS: Deprecate DataFlow::BarrierGuardNode 2024-12-03 14:30:50 +01:00
Asger F
b3461989b1 JS: Remove use of SanitizerGuardNode in experimental SSRF query
Makes a quick effort attempt to restore the original behaviour, though
it is not exactly the same due to lack of recursion.
2024-12-03 14:30:36 +01:00
Asger F
0d79c7141c JS: Update two more uses of SanitizerGuardNode 2024-12-03 14:30:35 +01:00
Asger F
62c17d3f4e JS: Update SanitizerGuardNode use in BasicTaintTracking test 2024-12-03 14:30:34 +01:00
Asger F
f620191da4 JS: Deprecate SanitizerGuardNode 2024-12-03 14:30:33 +01:00
Asger F
2ae7386775 JS: Also apply new BarrierGuardLegacy pattern in Xss.qll 2024-12-03 14:30:32 +01:00
Asger F
2ef652da2c JS: Add more deprecation annotations in tests 2024-12-03 14:30:31 +01:00
Asger F
21494fbdff JS: Refactor BarrierGuardLegacy pattern to not depend on SanitizerGuardNode
Previously our barrier guard classes were direct descendents of SanitizerGuardNode which made it hard to deprecate that class.

Now our barrier guards are not descending from any shared class. Instead they are contributed to SanitizerGuardNode via a private helper class we can remove in the future.
2024-12-03 14:30:29 +01:00
Asger F
a574ff1669 JS: Remove use of MakeLegacyBarrierGuard in experimental SSRF 2024-12-03 14:30:28 +01:00
Asger F
08d25c122d JS: Deprecate more uses of ConsistencyConfiguration 2024-12-03 14:30:27 +01:00
Asger F
75ab4856b8 Remove unsupported features from PoI 2024-12-03 14:30:25 +01:00
Asger F
e6680dec8f JS: Avoid use of LabeledSanitizerGuardNode in TaintedObject
Drive-by bugfix: Rename sanitizes -> blocksExpr.
This fixes a bug that caused the sanitizer guard not to work in df2.

The test output reflects the fact that the barrier guard works now.
2024-12-03 14:30:24 +01:00
Asger F
0ce1fe767d JS: Deprecate ConsistencyChecking to avoid deprecation warnings 2024-12-03 14:30:23 +01:00
Asger F
04a3a6707f JS: Update a reference to AdditionalSanitizerGuardNode
Unlike most other references to this class, we're not subclassing it here, we're
just trying to reuse some standard barrier guards but with a different flow state.
2024-12-03 14:30:22 +01:00
Asger F
834d35bc42 JS: Port experimental DecompressionBombs to ConfigSig 2024-12-03 14:30:21 +01:00
Asger F
871bc3b84a JS: Port experimental CorsPermissiveConfiguration to ConfigSig
The tests show a new (source, sink) pair for an already-flagged sink.

Not sure why it was not flagged originally since the data flow path seems valid, given the steps provided by our models.
2024-12-03 14:30:20 +01:00
Asger F
f5a6485ef2 JS: Port experimental decodeJwtWithoutVerificationLocalSource 2024-12-03 14:30:19 +01:00
Asger F
72e522631d JS: Port experimental jwtDecodeWithoutVerification to ConfigSig 2024-12-03 14:30:18 +01:00
Asger F
7e162f5451 JS: Port experimental EnvValueInjection to ConfigSig 2024-12-03 14:30:17 +01:00
Asger F
4f839070a0 JS: Port experimental EnvValueAndKeyInjection to ConfigSig 2024-12-03 14:30:16 +01:00
Asger F
8887ca1722 JS: Port an experimental CodeInjection variant to ConfigSig 2024-12-03 14:30:15 +01:00
Asger F
1832e93766 JS: Port FormParsers test to ConfigSig 2024-12-03 14:30:14 +01:00
Asger F
4d7401a074 JS: Deprecate tests for deprecated APIs
Mainly adds 'deprecated' in front of a bunch of tests for deprecated APIs.
2024-12-03 14:30:12 +01:00
Asger F
3548544970 JS: Avoid some uses of deprecated guard classes in tests 2024-12-03 14:30:11 +01:00
Asger F
a568d8c086 JS: Port threat-model test to ConfigSig 2024-12-03 14:30:10 +01:00
Asger F
f758b67d30 JS: Openly recommend SummarizedCallable 2024-12-03 14:30:09 +01:00
Asger F
249104b8ae JS: Update comments referring to old Configuration style
Also avoid the term "analysis-specific" because it's not a term we use anywhere else.
2024-12-03 14:30:08 +01:00
Asger F
13ee597848 JS: Add some proper documentation to SummarizedCallable 2024-12-03 14:30:07 +01:00
Asger F
988fa9c0ef JS: Deprecate AdditionalSanitizerGuardNode
We're deprecating the class through an alias, but it is still the base class for a non-deprecated class, for backwards compatibility. For this reason we're also deprecating all of its member predicates so we can remove those in the future.
2024-12-03 14:30:06 +01:00
Asger F
0b1e859e70 JS: Remove uses of AdditionalSanitizerGuardNode 2024-12-03 14:30:05 +01:00
Asger F
c2abb0fbd0 JS: Remove reference to AdditionalSanitizerGuard from CachedStages 2024-12-03 14:30:04 +01:00
Asger F
82682d9a62 JS: Remove a non-deprecated reference to SanitizerGuardNode 2024-12-03 14:30:03 +01:00
Asger F
bc7753de29 JS: Remove non-deprecated reference to AdditionalBarrierGuardNode 2024-12-03 14:30:02 +01:00
Asger F
0cd2e3f9eb JS: Deprecate old data flow library, except some guard-related nodes 2024-12-03 14:30:01 +01:00
Asger F
071189a9e9 Merge pull request #18175 from asgerf/jss/documentation
JS: Update data flow documentation and tutorials for JavaScript
2024-12-03 14:23:29 +01:00
Asger F
e1aff15f29 Merge pull request #18125 from asgerf/jss/summary-type-tracker
JS: Derive type-tracking steps from flow summaries
2024-12-03 12:40:56 +01:00
Asger F
27e61a1f3d JS: Also update cheat sheet 2024-12-03 12:00:30 +01:00
Asger F
89463d73f5 JS: Remove mention of isAdditionalTaintStep 2024-12-03 11:51:46 +01:00
Asger F
935e1c065a Update docs/codeql/codeql-language-guides/using-flow-labels-for-precise-data-flow-analysis.rst
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2024-12-03 11:49:45 +01:00
Asger F
89849fae87 Update docs/codeql/codeql-language-guides/using-flow-labels-for-precise-data-flow-analysis.rst
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2024-12-03 11:49:34 +01:00
Asger F
5e27257405 Update docs/codeql/codeql-language-guides/analyzing-data-flow-in-javascript-and-typescript.rst
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2024-12-03 11:49:22 +01:00
Asger F
054558d7b5 JS: Include content properties in type-tracker properties
Reminder: we have two PropertyName classes because the one in Contents.qll can't depend on DataFlow::Node.
2024-12-03 09:58:54 +01:00
Asger F
8bca66493f JS: Add test showing lack of inclusion in PropertyName 2024-12-03 09:57:02 +01:00
Asger F
404b0f24f2 JS: Fix another stray reference to BarrierGuardNode/SanitizerGuardNode 2024-12-02 13:29:52 +01:00
Asger F
422c089a39 JS: Remove redundant base class in TruthinessCheck 2024-12-02 13:26:37 +01:00
Asger F
628f60d2e3 JS: Update flow label tutorial 2024-12-02 10:34:02 +01:00
Asger F
2db89c1b02 JS: Update query17 from intro tutorial 2024-12-02 10:04:09 +01:00
Asger F
2722c45737 JS: Update global data flow tutorial .rst file 2024-12-02 10:04:08 +01:00
Asger F
103a6ea8a6 JS: Port tutorial query5 2024-12-02 10:04:07 +01:00
Asger F
02c5e49de8 JS: Port tutorial query4 2024-12-02 10:04:05 +01:00
Asger F
1f6335f9ba JS: Port tutorial query3 2024-12-02 10:04:04 +01:00
Asger F
3319870d00 JS: Port tutorial query2 2024-12-02 10:04:02 +01:00
Asger F
32f020ee6f JS: Port tutorial query1 2024-12-02 10:04:00 +01:00
Owen Mansel-Chan
5c99c8cc37 Improve suggestion for ECB 2024-11-29 14:05:07 +00:00
Asger F
cab8a40d00 JS: Fix accidental recursion 2024-11-29 14:23:57 +01:00
Asger F
9c6b6981e2 JS: Add test to restrict dependencies 2024-11-29 14:23:56 +01:00
Asger F
2f0c80a98b JS: Include summary steps in type tracking 2024-11-29 14:23:55 +01:00
Asger F
440cbb7f0a JS: Add inline-expectation test for type tracking 2024-11-29 14:23:54 +01:00
Asger F
6349903110 JS: Move FlowSummary/Summaries.qll into testUtilities 2024-11-29 14:23:52 +01:00
Asger F
e34064e3b5 JS: Initial instantiation of sumamry type tracking
Instantiates the library without using it yet.
2024-11-29 14:23:50 +01:00
Asger F
df12f255ac JS: Rename propagatesFlowExt -> propagatesFlow 2024-11-29 14:23:49 +01:00
Owen Mansel-Chan
95d26d96d2 Add change note 2024-11-29 11:54:30 +00:00
Owen Mansel-Chan
09240e46f2 Refactor: use concat instead of hand-written version
This changes the order of the algorithms in the regex, but I don't think
that makes any difference.
2024-11-29 11:54:29 +00:00
Owen Mansel-Chan
e6409e159f Give reason why crypto algorithm is insecure 2024-11-29 11:54:27 +00:00
Asger F
66d6bda716 Merge pull request #18044 from asgerf/js/shared-dataflow-bump
JS: Merge 'main' and implement 'speculativeTaintStep'
2024-11-27 15:43:27 +01:00
Asger F
805fd0b46e JS: Refine speculative step definition 2024-11-26 15:56:56 +01:00
Asger F
8818fcc207 JS: Benign test output changes 2024-11-26 15:47:13 +01:00
Asger F
c94a01e6b6 JS: Remove reference to argsParseStep
This was removed as part of the PR that introduced threat models.
2024-11-26 15:36:47 +01:00
Asger F
bf62582f53 JS: Implement 'speculativeTaintStep'
It is a mandatory part of the interface now; just providing a bare-bones implementation for rather than 'none()'
2024-11-26 15:36:46 +01:00
Asger F
82d61e4194 Merge branch 'js/shared-dataflow-branch' into js/shared-dataflow-merge-main 2024-11-26 15:36:16 +01:00
Asger F
c2e9dca1de Merge pull request #18043 from asgerf/jss/jump-and-test-exclusion
JS: Fix jump steps generated by IIFEs and exception flow
2024-11-26 14:33:42 +01:00
Asger F
f073f3b791 JS: Rename file to foo.test.js 2024-11-26 13:44:00 +01:00
Asger F
65da9b41b5 JS: Add cross-file test in InsecureRandom 2024-11-26 13:43:24 +01:00
Asger F
b4bd8e701c JS: Add test for file classification change 2024-11-26 12:33:39 +01:00
Asger F
930a7b6e28 JS: Update output changes to nodes/edges/subpaths 2024-11-21 13:33:39 +01:00
Asger F
7a77432024 JS: Update lost result in insecure-download
The VariableCapture library consumes one component of the access path limit, which means we lose this result
2024-11-21 13:33:10 +01:00
Asger F
1ac7591faf JS: Update missed flow in capture-flow.js
We previously caught this flow because of a heuristic in capture flow. We'll have to fix it properly later.
2024-11-21 12:57:34 +01:00
Asger F
9dad2d62d7 JS: Update DataFlowConsistency 2024-11-21 12:54:11 +01:00
Asger F
ce00bd2cc9 JS: More docs 2024-11-21 11:06:43 +01:00
Asger F
4e62a512c5 JS: Only apply exception propagator when no other summary applies
Previously a few Promise-related methods were special-cased, which is no longer needed.
2024-11-21 11:01:05 +01:00
Asger F
84820adf3c Add test for exception flow out of finally() 2024-11-21 11:01:03 +01:00
Asger F
948d21ca07 JS: Propagate exceptions from summarized callables by default 2024-11-21 10:24:31 +01:00
Asger F
dcdb2e5133 JS: Fix callback check so it works without parameters 2024-11-21 10:24:29 +01:00
Asger F
b7dd455aff JS: Add test case 2024-11-21 09:21:36 +01:00
Asger F
d52bc971b8 Merge branch 'main' into js/shared-dataflow-merge-main 2024-11-20 14:05:03 +01:00
Asger F
d1c9e47d23 JS: More aggressive test file classification 2024-11-19 13:23:32 +01:00
Asger F
01669908f2 JS: Block InsecureRandomness flow into test files 2024-11-19 13:23:31 +01:00
Asger F
80a5a5909e JS: Use getUnderlyingValue() a few places in VariableCapture 2024-11-19 13:23:29 +01:00
Asger F
d2daec4c66 JS: Add tests explaining why the IIFE in f2 didn't work 2024-11-19 13:23:24 +01:00
Asger F
023dcce400 JS: Disable variable capture heuristic
Bailing out can be more expensive as the resulting jump steps themselves
cause perf issues. The limit of 100 variables per scope has also been
added in the interim, which handles the cases that this needed to cover.
2024-11-18 13:44:10 +01:00
Asger F
37676f41aa JS: Remove jump steps from IIFE steps 2024-11-18 13:38:34 +01:00
Asger F
7f2eae0966 JS: Add test case for false flow through IIFEs
We generate local flow steps into and out of IIFEs, but these come jump steps automatically, resulting in FPs.
2024-11-18 13:34:35 +01:00
Asger F
7acc5689cf JS: Port exception steps to a universal summary 2024-11-18 13:27:58 +01:00
Asger F
5ed362f7d6 JS: Add exception test case 2024-11-18 13:23:09 +01:00
Asger F
33b7ba41ca Merge pull request #17535 from asgerf/jss/use-use-flow
JS: Follow use-use flow after a post-update
2024-11-18 12:48:58 +01:00
Rasmus Lerchedahl Petersen
065f3d1d7a cpp: locations in range analysis 2024-11-15 14:10:51 +01:00
Rasmus Lerchedahl Petersen
cd5509a0f9 Java: locations for range analysis 2024-11-15 13:11:25 +01:00
Asger F
80ee372ddf JS: Replace an unused value with _ 2024-11-12 11:24:17 +01:00
Asger F
637baabe37 JS: Clarify why there are no SSA definitions 2024-11-12 11:23:35 +01:00
Asger F
2fb108419c JS: Only parameter-calls as lambda calls 2024-10-29 08:32:15 +01:00
Asger F
1e9e57e46e JS: Fix missing qldoc 2024-10-29 08:32:14 +01:00
Asger F
52ba91a7f8 JS: Updates to nodes/edges in tests
Only changes to nodes/edges for various reasons, no actual result changes
2024-10-29 08:32:13 +01:00
Asger F
1243188825 JS: Update CleartextLogging with fixed FP 2024-10-29 08:32:11 +01:00
Asger F
18b39460f5 JS: Add regained results in UnsafeJQueryPlugin
These were marked as 'NOT OK' in the test file, but weren't previously flagged for some reason
2024-10-29 08:32:10 +01:00
Asger F
d3e70c1e97 JS: Add in-barrier to XSS query
This is a bit of a bandaid to cover issues with the push() method on next/router being
treated as an array push, which causes it to flow into other taint sources.
2024-10-29 08:32:08 +01:00
Asger F
1b85feb1fa JS: Add imprecise post-update steps for when a captured var/this is not tracked precisely
With the capture library we sometimes bails out of handling certain functions for scalability reasons.

This means we have a notion of "captured but imprecisely-tracked" variables and 'this'. In these cases we go back to propagating flow from a post-update node to the local source.
2024-10-29 08:32:07 +01:00
Asger F
d557c7689c JS: Update a test that now has more precise output 2024-10-29 08:32:06 +01:00
Asger F
1efef2ca3c JS: Change rule for getPostUpdateForStore
This causes less wobbles in test outputs
2024-10-29 08:32:05 +01:00
Asger F
ad52b71922 JS: Update immutable.js test to clarify why it stopped working
The Immutable model uses the 'd' and 'f' properties to model Map content, but the test doesn't actually mention those properties, so they were missing from the PropertyName class.

The flow was previously found spuriously by the regular Map model, which also adds flow through the  get/set calls. This flow is however no longer found since it relied on a step from post-update back to getALocalSource which is no longer present.
2024-10-29 08:32:03 +01:00
Asger F
c0997c28cb JS: Reveal issue with immutable.js test
Fixed in the next commit
2024-10-29 08:32:02 +01:00
Asger F
4473e6d977 JS: Update test with some post-update consistency checks gone
For a constructor call, the return value acts as the post-update node for the 'this' argument. The fact that constructor calls are sometimes PostUpdateNodes causes some of these harmless alerts.

The warnings have disappeared in some cases because we no longer target getALocalSource() so the target is no longer the constructor call.
2024-10-29 08:32:01 +01:00
Asger F
cb874945bf Test updates from introduction of implicit 'this' 2024-10-29 08:31:59 +01:00
Asger F
bd94fe1574 JS: Explain false positive in test case 2024-10-29 08:31:58 +01:00
Asger F
e05e077b33 JS: Block jump steps through 'this' now that the capture lib handles 'this' 2024-10-29 08:31:57 +01:00
Asger F
16b08b74eb JS: Add test showing potential for FPs when handling refinement guards 2024-10-29 08:31:55 +01:00
Asger F
958602e43e JS: Cache getARead (as per instructions in the SSA library) 2024-10-22 12:46:20 +02:00
Asger F
e784813c3b JS: Make barrier guards work with use-use flow 2024-10-22 12:46:19 +02:00
Asger F
67fdd864c9 JS: Add TODO 2024-10-22 12:46:18 +02:00
Asger F
81af9a1658 Fix missing flow through super calls 2024-10-22 12:46:17 +02:00
Asger F
12370e9210 JS: Use VariableOrThis in variable capture as well 2024-10-22 12:46:16 +02:00
Asger F
0ebe8bdd91 JS: Add test for missing capture flow for 'this' 2024-10-22 12:46:15 +02:00
Asger F
d31499d727 JS: introduce implicit this uses in general 2024-10-22 12:46:14 +02:00
Asger F
8dc0505f84 JS: Add test for missing flow into 'this' in field initializers 2024-10-22 12:46:13 +02:00
Asger F
c3c003b275 JS: Fix post-update flow into 'this' 2024-10-22 12:46:11 +02:00
Asger F
9fc99d6f9d JS: Fix store into object literals that have a post-update node 2024-10-22 12:46:11 +02:00
Asger F
d626e79ed3 JS: Add two test cases for missing flow 2024-10-22 12:46:10 +02:00
Asger F
992c144559 JS: Add qldoc to file 2024-10-22 12:46:09 +02:00
Asger F
beaacf96b3 JS: Rename Internal -> Cached since whole file is internal now 2024-10-22 12:46:08 +02:00
Asger F
3fca27bee2 JS: Fix indentation
Only formatting changes
2024-10-22 12:46:07 +02:00
Asger F
ed0af958a9 JS: Add Public module and only expose that
Indentation will be fixed in next commit
2024-10-22 12:46:06 +02:00
Asger F
3b663bd2f6 JS: Remove BasicBlockInternal module and mark relevant predicates as public
This exposes the predicates publicly, but will be hidden again in the next commit.
2024-10-22 12:46:04 +02:00
Asger F
211b42d0ce JS: Move BasicBlocks.qll -> internal/BasicBlocksInternal.qll 2024-10-22 12:46:03 +02:00
Asger F
9e600424cc JS: Remove unused predicate 2024-10-22 12:46:02 +02:00
Asger F
78e961cef3 JS: Add use-use flow 2024-10-22 12:46:01 +02:00
Asger F
81e74d8bb5 JS: Add test case for spurious flow from lack of use-use 2024-10-22 12:46:00 +02:00
Asger F
7363b578b1 JS: Instantiate shared SSA library
JS: Remove with statement comment
2024-10-22 12:45:58 +02:00
Asger F
a258489551 JS: Refactor some internal methods to make them easier to alias
We need these to return the dominator instead of declaring it in the parameter list, so that we can use it directly to fulfill part of the signature for the SSA library.

We can't rewrite it with an inline predicate since the SSA module calls with a transitive closure '*', which does not permit inline predicates.
2024-10-22 12:45:57 +02:00
Asger F
443987b484 Merge branch 'main' into js/shared-dataflow-merge-main 2024-10-22 10:30:53 +02:00
yoff
e46722f3be Update python/ql/lib/semmle/python/dataflow/new/internal/TypeTrackingImpl.qll 2024-10-17 17:23:00 +02:00
Rasmus Lerchedahl Petersen
22d621c625 shared: add locations to typetracking nodes 2024-10-16 15:16:18 +02:00
Asger F
12e316b99d JS: Update test output after merging in 'main'
- Paths are now relative to the test case, not the qlpack
- Paths going through an implicit reads have changed slightly
2024-10-08 10:11:15 +02:00
Asger F
e2e91ac7d9 Merge branch 'main' into js/shared-dataflow-merge-main 2024-10-08 09:28:26 +02:00
Asger F
72daa980a0 Merge pull request #17643 from asgerf/jss/cached-barriers
JS: Fix bug causing re-evaluation of cached barriers
2024-10-03 12:59:53 +02:00
Asger F
5d2ce172eb JS: Update a test to handle AdditionalSanitizerGuardNode 2024-10-02 14:44:42 +02:00
Asger F
6cbe04dcb7 JS: Consistently use the shared XSS barrier guards in the XSS queries
Previously only reflected XSS used shared barrier guards.
2024-10-02 14:44:17 +02:00
Asger F
341bacfe55 JS: Fix bug causing re-evaluation of cached barriers 2024-10-02 14:43:18 +02:00
Asger F
1cd00a118c Merge branch 'main' into js/shared-dataflow-merge-main 2024-09-18 14:57:50 +02:00
Asger F
5e4c0906d8 Merge pull request #17412 from asgerf/jss/array-index-constant
JS: Fix handling of constant array index reads, and fix the fallout
2024-09-18 12:28:44 +02:00
Asger F
7ba6995854 JS: Clarify a comment 2024-09-17 15:59:04 +02:00
Asger F
1df69ec1d2 JS: Actually don't propagate into array element 0
Preserving tainted-url-suffix into array element 0 seemed like a good idea, but didn't work out so well.
2024-09-12 13:42:36 +02:00
Asger F
0e4e0f4fdd JS: Preverse tainted-url-suffix when stepping into prefix
A URL of form https://example.com?evil#bar will contain '?evil' after splitting out the '#' suffix, and vice versa.
2024-09-12 13:42:28 +02:00
Asger F
74ab346348 JS: Do not include taint steps in TaintedUrlSuffix::step
TaintedUrlSuffix is currently only used in TaintTracking configs meaning it is already propagated
by taint steps. The inclusion of these taint steps here however meant that implicit reads could appear prior to any of these steps.

This was is problematic for PropRead steps as an expression like x[0] could spuriously read from array element 1 via the path:

x [element 1]
x [empty access path] (after implicit read)
x[0] (taint step through PropRead)
2024-09-12 13:42:25 +02:00
Asger F
2712bf821a JS: Fix a bug in isSafeClientSideUrlProperty 2024-09-12 13:42:23 +02:00
Asger F
bc04131c72 JS: Disallow implicit reads before an optional step 2024-09-12 13:42:22 +02:00
Asger F
e1bed42481 JS: Add inline expectation test specifically for TaintedUrlSuffix 2024-09-12 13:42:20 +02:00
Asger F
cf90c83604 JS: Accept changes to nodes/edges results 2024-09-12 13:42:19 +02:00
Asger F
3b09bc548e JS: Add taint step for shift() 2024-09-12 13:42:17 +02:00
Asger F
3ea1134cc1 JS: Add inline test for .shift() method 2024-09-12 13:42:16 +02:00
Asger F
3fcf4ef7a1 JS: More precise model of .shift()
Array.prototype.shift only returns the first array element.

The mutation of Argument[this] is not yet modelled, and is better handled when we have use-use flow.
2024-09-12 13:42:15 +02:00
Asger F
e4f7560bcd JS: Add missing qldoc 2024-09-12 13:42:14 +02:00
Asger F
15fc450a9e JS: Add reminder to update ClientSideUrlRedirect 2024-09-12 13:42:13 +02:00
Asger F
da696817a3 JS: Convert 'split' taint step to legacy taint step 2024-09-12 13:42:05 +02:00
Asger F
133b016c7c JS: Remove old 'split' handling from TaintedUrlSuffix 2024-09-12 13:41:56 +02:00
Asger F
e87e543850 JS: Ensure optional steps/barriers are computed in the correct stage 2024-09-12 13:35:38 +02:00
Asger F
7790f68fe2 JS: Make the TaintedUrlSuffix library use optional steps/barriers 2024-09-12 13:35:36 +02:00
Asger F
3b34cd72f2 JS: Handle split() with '#' or '?' separator in a separate summary
This summary uses the notion of optional steps/barriers so it becomes configurable whether there is flow into the zero'th array element.

Also makes sure we handle the second-argument version of split().
2024-09-12 13:35:33 +02:00
Asger F
24983a5836 JS: Add OptionalStep and OptionalBarrier MaD tokens
OptionalStep[foo] and OptionalBarrier[foo] contribute steps/barriers that are not active by default, but can be opted into by specific queries or for specific flow states.

(Will be used in the following commits)
2024-09-12 13:30:39 +02:00
Asger F
87454a4f11 JS: Remove unused predicate 2024-09-10 14:44:49 +02:00
Asger F
0ddb1c87f5 JS: Test update indicating a problem with .split() 2024-09-10 13:14:37 +02:00
Asger F
e0ca1b0482 JS: Benign test updates 2024-09-10 13:07:24 +02:00
Asger F
3d4287b7cc JS: Remove ContentSet#asArrayIndex()
For ContentSet it is ambiguous whether asArrayIndex() should get a singleton content set, or the KnownArrayElement content set. The user will now have to choose between asSingleton().asArrayIndex() or ContentSet::arrayElementKnown.
2024-09-09 13:28:32 +02:00
Asger F
013d226ae3 JS: Update comment 2024-09-09 13:26:27 +02:00
Asger F
55d4e7e742 JS: Use ArrayElementKnown when reading a constant array index 2024-09-09 13:26:25 +02:00
Asger F
094112c905 Merge pull request #17213 from asgerf/jss/spread-argument
JS: Improve handling of spread arguments and rest parameters [shared data flow branch]
2024-09-09 13:15:22 +02:00
Asger F
fb9732a33f JS: Add another test and TODO about an issue with constant array indices 2024-09-06 08:43:11 +02:00
Asger F
1da68aac73 JS: Benign test output change
This happened as a result of the bugfix in the previous commit
2024-09-06 08:43:10 +02:00
Asger F
a9a8351cce JS: Fix one case of missing handling of unknown array index 2024-09-06 08:43:09 +02:00
Asger F
379c7ef20a JS: Add test to show lack of unknown array element being propagated 2024-09-06 08:43:08 +02:00
Asger F
92bb4b3da8 JS: Address some comments from hvitved 2024-09-05 11:32:07 +02:00
Asger F
4568967a76 JS: Do not use legacy taint steps in TaintedUrlSuffix
Tainted URL suffix steps are added as configuration-specific additional
steps, which means implicit reads may occur before any of these steps.

These steps accidentally included the legacy taint steps which include
a step from 'arguments' to all positional parameters. Combined with the
implicit read, arguments could escape their array index and flow to
any parameter while in the tainted-url flow state.
2024-08-29 13:48:30 +02:00
Asger F
65a36b0b3b JS: Add regression test for argument position confusion 2024-08-29 13:42:28 +02:00
Asger F
f65879eef1 JS: Update a test that no longer fails 2024-08-27 11:35:37 +02:00
Asger F
cb5dbb919d JS: Update test to reflect implicit read flow has been fixed
Shows the effect of https://github.com/github/codeql/pull/17262
2024-08-27 11:35:36 +02:00
Asger F
a2d53c261b JS: Update test output and add related TODO in model of 'async' 2024-08-27 11:35:35 +02:00
Asger F
837a8be1b8 JS: Update test output and add related TODO in 'markdown-table' model 2024-08-27 11:35:34 +02:00
Asger F
2e2181be2c JS: Update test output that only affects nodes/edges/subpaths 2024-08-27 11:35:33 +02:00
Asger F
3e196f83f1 JS: Update Promises/flow2 test 2024-08-27 11:35:32 +02:00
Asger F
aa8bd332bf JS: Add a few more tests 2024-08-27 11:35:31 +02:00
Asger F
371f7ef551 JS: Add implicit taint read of array elements 2024-08-27 11:35:31 +02:00
Asger F
df42e7c527 JS: Add test showing lack of implicit reads for ArrayElement 2024-08-27 11:35:30 +02:00
Asger F
4e7bd9ddd8 JS: Update Arrays test now that array elements do not taint the whole array 2024-08-27 11:35:29 +02:00
Asger F
4389b5c999 JS: Fix issue for .apply() calls 2024-08-27 11:35:28 +02:00
Asger F
34e6864fa3 JS: Note issue with .apply() calls 2024-08-27 11:35:27 +02:00
Asger F
ac1dd1850e JS: Remove taint step from array element to whole array 2024-08-27 11:35:26 +02:00
Asger F
5084d0260f Update tests.expected
The 'arguments' node is only materialised for functions that use 'arguments
2024-08-27 11:35:25 +02:00
Asger F
895cb872ad JS: Add taint into dynamic argument array 2024-08-27 11:35:24 +02:00
Asger F
079a622cf9 JS: Add tests showing missing taint flow
When the spread argument itself is tained and not
inside any content, the read steps currently fail
to propagate the data.
2024-08-27 11:35:23 +02:00
Asger F
6a083136d7 JS: Hide some nodes 2024-08-27 11:35:22 +02:00
Asger F
acdc896c04 JS: Support for dynamic args to flow summaries 2024-08-27 11:35:21 +02:00
Asger F
53a2a66dd0 Add new nodes to early stage 2024-08-27 11:35:20 +02:00
Asger F
5c7e623c47 JS: Add some tests for missing handling of dynamic args in flow summaries 2024-08-27 11:35:19 +02:00
Asger F
c04f0beb8a Update DataFlowConsistency.expected 2024-08-27 11:35:18 +02:00
Asger F
60c3d077b2 Update DataFlowImplConsistency.qll 2024-08-27 11:35:17 +02:00
Asger F
bbb1c8c374 Remove old arguments-array position 2024-08-27 11:35:16 +02:00
Asger F
ed33a6e91b JS: Add explicit model of .join() 2024-08-27 11:35:15 +02:00
Asger F
fa7ad03068 JS: Add store/load steps for the new argument arrays 2024-08-27 11:35:15 +02:00
Asger F
623dbda77d Do not pass regular positional args into the rest parameter 2024-08-27 11:35:14 +02:00
Asger F
a72f79576a JS: Add corresponding argument positions 2024-08-27 11:35:13 +02:00
Asger F
6c7d745a2b JS: Add nodes for static/dynamic argument/parameter arrays 2024-08-27 11:35:12 +02:00
Asger F
5d77c336fc Test case for spread and rest args/params 2024-08-27 11:35:11 +02:00
Asger F
4cdaccd22e JS: Add InlineFlowTest 2024-08-27 11:35:10 +02:00
Asger F
2adaf0f935 Merge pull request #17261 from asgerf/jss/dynamic-import-step
JS: Port step for dynamic imports
2024-08-27 08:27:16 +02:00
Asger F
47c519fc0a JS: Add test for flow through dynamic imports 2024-08-26 15:15:49 +02:00
Asger F
4b8ae2a4f3 Merge branch 'main' into js/shared-dataflow-merge-main 2024-08-26 12:43:16 +02:00
Asger F
7cfe3dae85 JS: Port step for dynamic imports 2024-08-23 10:07:28 +02:00
Asger F
379952febc Merge pull request #17285 from asgerf/js/shared-dataflow-bump
JS: Resolve conflicts after merging 'main' into shared data flow branch
2024-08-23 09:58:27 +02:00
Asger F
a2dd47aeb2 JS: Update test output
These files conflicted and have been regenerated.
2024-08-22 14:27:15 +02:00
Asger F
423fd04545 JS: Update new xsjs-specific code to respect TEarlyStageNode 2024-08-22 13:22:35 +02:00
Asger F
c54f5858b1 Merge branch 'main' into js/shared-dataflow-merge-main 2024-08-22 13:22:05 +02:00
Asger F
c66000d2fa Merge pull request #17136 from asgerf/js/shared-dataflow-bump
JS: Merge 'main' into shared dataflow branch
2024-08-06 14:14:47 +02:00
Asger F
2d814428d6 JS: Update expected output with provenance 2024-08-06 12:45:08 +02:00
Asger F
0a143a5f52 JS: Do not include type in path explanation 2024-08-06 12:45:07 +02:00
Asger F
1a532dac29 JS: Update VariableCapture instantiation after merge 2024-08-06 12:45:06 +02:00
Asger F
c8bbad6c4d Merge branch 'main' into js/shared-dataflow-merge-main 2024-08-06 12:43:13 +02:00
Asger F
df64388d79 Merge branch 'main' into js/shared-dataflow-merge-main 2024-08-02 13:18:38 +02:00
Asger F
5c222f7b05 Merge pull request #14412 from asgerf/js/shared-dataflow
[Feature branch] JS: Migrate to shared dataflow library
2024-08-02 12:48:01 +02:00
Asger F
1d267efb6b JS: Fix missing qldoc 2024-06-28 14:30:56 +02:00
Asger F
e5924c1f84 JS: Another messy test update 2024-06-28 13:08:38 +02:00
Asger F
14fc790617 Update DataFlowConsistency.expected 2024-06-28 13:08:09 +02:00
Asger F
1c730bc66e JS: Fix compilation error in DataFlowImplConsistency.qll 2024-06-27 12:47:15 +02:00
Asger F
c3806a2210 JS: Messy test output updates
These initially got messed up by a merge conflict where I couldn't rerun the tests due to breaking
changes in the data flow library. I wanted the breaking-change updates to live in their own commits,
not just eaten by a merge resolution commit, so the test output became broken for a while.

The '#select' result set is unchanged in all of these, so they should be safe to accept.
2024-06-27 11:59:56 +02:00
Asger F
90f0e07e49 JS: Benign update after fixing PropertyName charpred 2024-06-27 11:56:22 +02:00
Asger F
ee10702e73 JS: Another provanance test output update 2024-06-27 11:56:01 +02:00
Asger F
df0488a470 Ensure Member tokens from flow summaries are seen in PropertyName 2024-06-27 10:22:14 +02:00
Asger F
c52a4b0621 JS: Provide RenderSummarizedCallable 2024-06-27 09:44:45 +02:00
Asger F
e53c0cdce7 Fix unknown Parameter/Argument decoding 2024-06-27 09:39:06 +02:00
Asger F
2473274681 JS: Benign test output changes 2024-06-27 09:06:45 +02:00
Asger F
af7b4e3063 Accept flow difference due to added test cases
New library gets FN for spread arguments in a call to splice(), which
was added to the old version in this PR:
  https://github.com/github/codeql/pull/16739
2024-06-26 13:52:27 +02:00
Asger F
53efb5837b JS: Update some tests with provenance columns
Only includes the changes that purely contain the new provenance columns
2024-06-26 13:51:44 +02:00
Asger F
88edc06517 Avoid bad join in compatibleTypesCached
This is identical to the code in Ruby and seems to prevent a bad join ordering
in a cached version of this predicate in DataFlowCommon
2024-06-26 13:51:41 +02:00
Asger F
fc7c2c5b17 Remove unused code 2024-06-26 13:51:40 +02:00
Asger F
e67e89dd70 Implement decodeUnknownArgument/ParameterPosition 2024-06-26 13:51:39 +02:00
Asger F
3bebd709b3 Handle AnyMemberDeep and ArrayElementDeep in encodeContent 2024-06-26 13:51:38 +02:00
Asger F
6c0c67dce4 Implement encodeWith/WithoutContent 2024-06-26 13:51:37 +02:00
Asger F
b0ea81276b Implement encodeReturn 2024-06-26 13:51:36 +02:00
Asger F
5811a3c5a6 Port getMadStringFromContentSet -> encodeContent 2024-06-26 13:51:35 +02:00
Asger F
8c4e5e8876 Boilerplate implementation of default predicates from FlowSummaryImpl.qll 2024-06-26 13:51:34 +02:00
Asger F
6b35a766a6 Migrate to shared FlowSummary library 2024-06-25 14:43:29 +02:00
Asger F
dd7aff555d Instantiate shared FlowSummary library 2024-06-25 13:35:49 +02:00
Asger F
f0d7c3a7f0 Remove bindingsets 2024-06-25 13:33:06 +02:00
Asger F
6e32f27652 Rename predicates to be consistent with qlpack
In preparation for migrating to the FlowSummary module in the qlpack,
rename predicates to be consistent with the qlpack.
2024-06-25 13:30:33 +02:00
Asger F
6c8fb61f60 Js: Update FlowSummaryImpl.qll to make things compile 2024-06-25 13:10:24 +02:00
Asger F
64a9598b89 JS: Update interface for isUnreachableInCall 2024-06-25 13:01:23 +02:00
Asger F
505c532af7 JS: Implement totalorder() 2024-06-25 12:58:35 +02:00
Asger F
102ca77acf Switch to getLocation() in DataFlowCall 2024-06-25 11:49:19 +02:00
Asger F
ecf418b8f6 Merge branch 'main' into js/shared-dataflow 2024-06-25 11:48:41 +02:00
Asger F
bd3fccd1a8 JS: Update test output with provenance column 2024-06-25 10:30:56 +02:00
Asger F
20df5adbaa JS: Bugfix in DeduplicatePathGraph
This was introduced after a quick fix to handle the addition of
provenance.
2024-06-25 10:30:14 +02:00
Asger F
f43a189f06 JS: Make CaptureNode.toString() more explicit 2024-06-25 09:56:39 +02:00
Asger F
536c115c1c JS: Fix location override in CaptureNode 2024-05-06 13:51:25 +02:00
Asger F
23d28fc098 Shared: add location for 'this' nodes 2024-05-06 13:50:40 +02:00
Asger F
5a2260b481 JS: Update to match changes to API 2024-05-06 10:13:25 +02:00
Asger F
19f14622f3 JS: Update use of Locations 2024-05-06 10:13:24 +02:00
Asger F
2de9af2236 JS: Update to getLocation() in DeduplicatePathGraph 2024-05-06 10:13:07 +02:00
Asger F
c408ab9e6a Merge branch 'main' into js/shared-dataflow 2024-05-02 19:43:34 +02:00
Asger F
711a08b0d4 JS: Add TODO about switching to the shared library 2024-03-15 09:26:19 +01:00
Asger F
eff5f3b7d6 JS: Remove duplicate dependency from qlpack.yml 2024-03-13 20:43:44 +01:00
Asger F
ddf6eb3a04 JS: Quick fix to make DeduplicatePathGraph compile
There's an open PR for this where a real fix should be written
2024-03-13 15:24:53 +01:00
Asger F
8ecdb5cefe Update VariableCapture.qll 2024-03-13 15:24:20 +01:00
Asger F
82abd867a0 JS: Update uses of AccessPathSyntax
This doesn't yet migrate to the FlowSummaryImpl.qll in a qlpack, just trying to make things compile first
2024-03-13 15:17:58 +01:00
Asger F
e5bc8db2f0 JS: Fix conflicting default for visbleImplInCallContext 2024-03-13 15:17:08 +01:00
Asger F
bb1f729a3f Update VariableCapture.qll 2024-03-13 15:16:37 +01:00
Asger F
97567f412e JS: Update VariableCapture.qll after changes to API 2024-03-13 14:53:00 +01:00
Asger F
5e7d1d5c2c Merge branch 'main' into js/shared-dataflow-merged 2024-03-13 14:27:16 +01:00
Asger F
fa8933eb41 JS: Reduce duplication in UnsafeDynamicMethodAccessQuery 2024-03-13 12:30:05 +01:00
Asger F
ea4bc9cdbb JS: Comment about manually applying taint steps 2024-03-13 12:30:05 +01:00
Asger F
406b080ce3 JS: Add comment about allowImplicitRead in PostMessageStar 2024-03-13 11:30:52 +01:00
Asger F
0a2050bc42 JS: Deduplicate predicate in HostHeaderPoisoningQuery 2024-03-13 11:27:18 +01:00
Asger F
11983faccf JS: Remove out-commented code 2024-03-13 11:26:56 +01:00
Asger F
b31f20a64e JS: Explain why ObjetWrapperFlowLabel is deprecated 2024-03-13 11:08:25 +01:00
Asger F
e0aae53ac7 JS: Remove unnecessary BarrierGuardLegacy class 2024-03-13 11:05:23 +01:00
Asger F
fce2be0af3 JS: Use BarrierGuardLegacy in TaintedPath 2024-03-13 11:02:09 +01:00
Asger F
e640154048 JS: Be backwards compatible with AdditionalBarrierGuardNode
I've confirmed that the 'legacyBarrier' predicate does not occur in the DIL
2024-03-13 10:54:02 +01:00
Asger F
14e75be510 JS: Expand comments and synthetic node name in ForOfLoops 2024-03-13 09:27:00 +01:00
Asger F
e66f27cfe3 JS: Move hasWildcardReplaceRegExp to a shared place 2024-03-13 09:19:26 +01:00
Asger F
4043bc13ab JS: Explicit mark comment as a TODO 2024-03-13 09:19:03 +01:00
Asger F
858c79e395 JS: Add plain taint step through Promise.all() 2024-03-13 08:57:42 +01:00
Asger F
13a8e0fbf0 JS: Add failing test for Promise.all() 2024-03-13 08:54:06 +01:00
Asger F
2c1aa08f79 JS: Rename Strings2 -> Strings 2024-03-12 21:18:14 +01:00
Asger F
478dd25f3e JS: Rename Sets2 -> Sets 2024-03-12 21:17:29 +01:00
Asger F
433489478d JS: Rename Promise2 -> Promise 2024-03-12 21:16:43 +01:00
Asger F
e2f3565227 JS: Rename Maps2 -> Maps 2024-03-12 21:14:29 +01:00
Asger F
b3fad7a8dc JS: Rename Iterators2 -> Iterators 2024-03-12 15:12:07 +01:00
Asger F
5aafd33cec JS: Rename Arrays2 -> Arrays 2024-03-12 15:11:29 +01:00
Asger F
76e0445af0 JS: Be consistent about caching in PreCallGraphStep 2024-03-12 15:08:59 +01:00
Asger F
28fc8ba0c1 JS: Remove EmptyType 2024-03-12 14:59:04 +01:00
Asger F
f94aa2ceec Update javascript/ql/lib/semmle/javascript/dataflow/internal/DataFlowNode.qll 2024-03-12 14:41:11 +01:00
Asger F
a02ab2ad88 JS: Port heuristic versions of standard queries 2023-10-13 13:15:08 +02:00
Asger F
3c7c5377ec JS: Add content approximation
This seems to fix a performance issue for RegExpInjection in angular
2023-10-13 13:15:08 +02:00
Asger F
5775fe6d6e JS: Use TAnyType in FlowSummaryPrivate 2023-10-13 13:15:08 +02:00
Asger F
9faf300dd0 JS: Use type-pruning to restrict callback flow 2023-10-13 13:15:08 +02:00
Asger F
e738b5d125 JS: Expand callback test case
Type-based pruning is confused by the different tests being interleaved, so we additionally want to have a test that is independent from the other parts of this test.
2023-10-13 13:15:08 +02:00
Asger F
d3f5169e66 JS: Lower field-flow branch limit on Polynomial ReDoS 2023-10-13 13:15:08 +02:00
Asger F
51dec79401 JS: Lower access path limit to 2 2023-10-13 13:15:08 +02:00
Asger F
24bab27ffe JS: Add TODO for dynamic import step 2023-10-13 13:15:08 +02:00
Asger F
7c5eb89491 JS: Add tests for captured 'this' (genuine FN) 2023-10-13 13:15:08 +02:00
Asger F
98c79e7674 JS: Update test output showing lack of global flow (geniune FN) 2023-10-13 13:15:08 +02:00
Asger F
9b46c4596c JS: Update HeuristicSoruceCodeInjection test 2023-10-13 13:15:08 +02:00
Asger F
bab639f23c JS: Update ReflectedXssWithCustomSanitizer test 2023-10-13 13:15:08 +02:00
Asger F
85e8998067 JS: Update ImportEquals test 2023-10-13 13:15:08 +02:00
Asger F
2eff07f476 JS: Update TaintTracking test 2023-10-13 13:15:08 +02:00
Asger F
b5ad36686e JS: Block flow into window.location 2023-10-13 13:15:08 +02:00
Asger F
75c915b2a3 JS: Update Spife test 2023-10-13 13:15:07 +02:00
Asger F
c2f66c0f93 JS: Update Restify2 test 2023-10-13 13:15:07 +02:00
Asger F
b304fb4337 JS: Reorder result sets in ReactJS test output 2023-10-13 13:15:07 +02:00
Asger F
32eddd3c07 JS: Update ReactJS test output 2023-10-13 13:15:07 +02:00
Asger F
b8a0afbb9f JS: Make overriding ConsistencyChecking.getATestFile() optional 2023-10-13 13:15:07 +02:00
Asger F
6c9f4a10ac JS: Port TaintBarriers test 2023-10-13 13:15:07 +02:00
Asger F
e5946bf43b JS: Port HeuristicSource test 2023-10-13 13:15:07 +02:00
Asger F
771519bbc5 JS: Port Routing test 2023-10-13 13:15:07 +02:00
Asger F
2364bd84e0 JS: Fix whitespace in a test (trivial change) 2023-10-13 13:15:07 +02:00
Asger F
98d1bb3826 JS: Reorder result sets in a test (trivial change) 2023-10-13 13:15:07 +02:00
Asger F
81bd292a16 JS: Port Promises test
Result changes are benign
2023-10-13 13:15:07 +02:00
Asger F
dd8a24c6c0 JS: Port LabelledBarrierGuards test 2023-10-13 13:15:07 +02:00
Asger F
458f0a077c JS: Port InterProceduralFlow test
All the new results are benign
2023-10-13 13:15:07 +02:00
Asger F
0d10aba67d Revert "JS: Add global post-update steps"
This resulted in huge performance issues from too much global flow
2023-10-13 13:15:07 +02:00
Asger F
50aace3fa3 JS: Add global post-update steps 2023-10-13 13:15:07 +02:00
Asger F
9372f7993d JS: Update Generators test
Data flow difference is benign
2023-10-13 13:15:07 +02:00
Asger F
995df41532 JS: Update Vuex test 2023-10-13 13:15:07 +02:00
Asger F
3983530983 JS: Update Templating/Xss test 2023-10-13 13:15:07 +02:00
Asger F
b9344134d3 JS: Update Redux test 2023-10-13 13:15:07 +02:00
Asger F
d2053445a7 JS: Update frameworks/PropertyProjection test 2023-10-13 13:15:07 +02:00
Asger F
2eec47b52c JS: Update frameworks/Next test 2023-10-13 13:15:07 +02:00
Asger F
644f9683b1 JS: Update frameworks/immutable test 2023-10-13 13:15:07 +02:00
Asger F
a2d4a03c0e JS: Update framework/data test 2023-10-13 13:15:06 +02:00
Asger F
6600fe9d51 JS: Port ComposedFunctions test 2023-10-13 13:15:06 +02:00
Asger F
09892279e6 JS: Port Collections test 2023-10-13 13:15:06 +02:00
Asger F
466ffdf8f5 JS: Port AsyncTaintTracking test 2023-10-13 13:15:06 +02:00
Asger F
09b0ba0c1f JS: Port Angular2 test 2023-10-13 13:15:06 +02:00
Asger F
92812eee78 JS: Add test for flow summaries 2023-10-13 13:15:06 +02:00
Asger F
af05789cbf JS: Remove noise from data flow test 2023-10-13 13:15:06 +02:00
Asger F
c652470e2f JS: Do not port CustomLoadStoreStep test 2023-10-13 13:15:06 +02:00
Asger F
1a95961bac JS: Port Classes test 2023-10-13 13:15:06 +02:00
Asger F
9a15a557b4 JS: Port SimpleBarrierGuard test 2023-10-13 13:15:06 +02:00
Asger F
ff086377cb JS: Port Arrays test 2023-10-13 13:15:06 +02:00
Asger F
d35959a098 JS: Add utility for comparing results in tests 2023-10-13 13:15:06 +02:00
Asger F
43be45207d JS: Port meta queries 2023-10-13 13:15:06 +02:00
Asger F
c55300d4b0 JS: Port PolynomialReDoS 2023-10-13 13:15:06 +02:00
Asger F
b8847dbc5d JS: Port Xxe 2023-10-13 13:15:06 +02:00
Asger F
c2d170b4fd JS: Port XpathInjection 2023-10-13 13:15:06 +02:00
Asger F
03f8c0fc5e JS: Port XmlBomb 2023-10-13 13:15:06 +02:00
Asger F
83095535f9 JS: Port UnvalidatedDynamicMethodCall 2023-10-13 13:15:06 +02:00
Asger F
ba9edb4e54 JS: Port UnsafeShellCommandConstruction 2023-10-13 13:15:06 +02:00
Asger F
d08e4504ff JS: Port UnsafeJQueryPlugin 2023-10-13 13:15:06 +02:00
Asger F
6e3f4bd7d8 JS: Port UnsafeHtmlConstruction 2023-10-13 13:15:06 +02:00
Asger F
7f4d42ddcd JS: Port UnsafeDynamicMethodAccess 2023-10-13 13:15:06 +02:00
Asger F
758f42495c JS: Port UnsafeDeserialization 2023-10-13 13:15:05 +02:00
Asger F
32022ccbda JS: Port UnsafeCodeConstruction 2023-10-13 13:15:05 +02:00
Asger F
5af608c937 JS: Port TypeConfusionThroughParameterTampering 2023-10-13 13:15:05 +02:00
Asger F
25962a9ba6 JS: Port TemplateObjectInjection 2023-10-13 13:15:05 +02:00
Asger F
51624c02a2 JS: Port TaintedFormatString 2023-10-13 13:15:05 +02:00
Asger F
63343b1ba4 JS: Port StackTraceExposure 2023-10-13 13:15:05 +02:00
Asger F
d446444667 JS: Port ShellCommandInjectionFromEnvironment 2023-10-13 13:15:05 +02:00
Asger F
06835a800c JS: Port SecondOrderCommandInjection 2023-10-13 13:15:05 +02:00
Asger F
4af7694309 JS: Port ResourceExhaustion 2023-10-13 13:15:05 +02:00
Asger F
b9bd0520e2 JS: Port RemotePropertyInjection 2023-10-13 13:15:05 +02:00
Asger F
dcc73a7f90 JS: Port RegExpInjection 2023-10-13 13:15:05 +02:00
Asger F
2400af4bc3 JS: Port PostMessageStar 2023-10-13 13:15:05 +02:00
Asger F
e1fae3d16d JS: Port InsufficientPasswordHash 2023-10-13 13:15:05 +02:00
Asger F
fd98b2546d JS: Port InsecureTemporaryFile 2023-10-13 13:15:05 +02:00
Asger F
cd1a1e25ae JS: Port InsecureRandomness 2023-10-13 13:15:05 +02:00
Asger F
99f63b1cfa JS: Port InsecureDownload 2023-10-13 13:15:05 +02:00
Asger F
8c001916b6 JS: Port IndirectCommandInjection 2023-10-13 13:15:05 +02:00
Asger F
e3ab5bdd16 JS: Port IncompleteHtmlAttributeSanitization 2023-10-13 13:15:05 +02:00
Asger F
9128722627 JS: Port ImproperCodeSanitization 2023-10-13 13:15:05 +02:00
Asger F
8715c1b324 JS: Port HostHeaderPoisoningInEmailGeneration 2023-10-13 13:15:05 +02:00
Asger F
bc88f50a5f JS: Port HardcodedDataInterpretedAsCode 2023-10-13 13:15:04 +02:00
Asger F
4bac90252c JS: Port HardcodedCredentials 2023-10-13 13:15:04 +02:00
Asger F
f4d62c3225 JS: Port HttpToFileAccess 2023-10-13 13:15:04 +02:00
Asger F
2935aac559 JS: Port FileAccessToHttp 2023-10-13 13:15:04 +02:00
Asger F
8e95a90d03 JS: Port UntrustedDataToExternalAPI 2023-10-13 13:15:04 +02:00
Asger F
abd937a49d JS: Port DifferentKindsComparisonBypass 2023-10-13 13:15:04 +02:00
Asger F
d324e554f3 JS: Port DeepObjectResourceExhaustion 2023-10-13 13:15:04 +02:00
Asger F
30f1fbc10d JS: Port CorsMisconfigurationForCredentials 2023-10-13 13:15:04 +02:00
Asger F
f14303acea JS: Port ConditionalBypass 2023-10-13 13:15:04 +02:00
Asger F
2296a273c4 JS: Port BuildArtifactLeak 2023-10-13 13:15:04 +02:00
Asger F
85617c292e JS: Port BrokenCryptoAlgorithm 2023-10-13 13:15:04 +02:00
Asger F
395f52303c JS: Port barriers in UrlConcatenation.qll 2023-10-13 13:15:04 +02:00
Asger F
7a1aead831 JS: Port ZipSlip 2023-10-13 13:15:04 +02:00
Asger F
e9189f965f JS: Port LogInjection 2023-10-13 13:15:04 +02:00
Asger F
ae680e747b JS: Port LoopBoundInjection 2023-10-13 13:15:04 +02:00
Asger F
40d68cb4dc JS: Port CleartextStorage 2023-10-13 13:15:04 +02:00
Asger F
b8a6f81669 JS: Port CleartextLogging 2023-10-13 13:15:04 +02:00
Asger F
a5c221fcfc JS: Port PrototypePollutingMergeCall 2023-10-13 13:15:04 +02:00
Asger F
adf7d5409d JS: Port PrototypePollutingFunction 2023-10-13 13:15:04 +02:00
Asger F
f1f45927b1 JS: Port PrototypePollutingAssignment 2023-10-13 13:15:04 +02:00
Asger F
81d2721248 JS: Port ClientSideUrlRedirect 2023-10-13 13:15:04 +02:00
Asger F
46fd727a55 JS: Port ServerSideUrlRedirect 2023-10-13 13:15:04 +02:00
Asger F
92816b1c9a JS: Port ClientSideRequestForgery 2023-10-13 13:15:03 +02:00
Asger F
b2216627be JS: Port RequestForgery 2023-10-13 13:15:03 +02:00
Asger F
d7b4e0c206 JS: Port ExceptionXss 2023-10-13 13:15:03 +02:00
Asger F
cf5450dbd5 JS: Port XssThroughDom 2023-10-13 13:15:03 +02:00
Asger F
5f05232e02 JS: Port StoredXss 2023-10-13 13:15:03 +02:00
Asger F
46b90e51fc JS: Port ReflectedXss 2023-10-13 13:15:03 +02:00
Asger F
e091fdefa4 JS: Port DomBasedXss 2023-10-13 13:15:03 +02:00
Asger F
2818fa62d6 JS: Updates to shared Xss.qll 2023-10-13 13:15:03 +02:00
Asger F
547a8a958a JS: Port SqlInjection 2023-10-13 13:15:03 +02:00
Asger F
65e9706c8e JS: Port TaintedPath 2023-10-13 13:15:03 +02:00
Asger F
fcfab5238e JS: Port CodeInjection 2023-10-13 13:15:03 +02:00
Asger F
17233a6749 JS: Port CommandInjection 2023-10-13 13:15:03 +02:00
Asger F
ccd6d3dcd7 JS: Port example queries 2023-10-13 13:15:03 +02:00
Asger F
449ec72dbe JS: Port experimental queries 2023-10-13 13:15:03 +02:00
Asger F
aa5a2836f5 JS: Update barriers in TaintedObject 2023-10-13 13:15:03 +02:00
Asger F
bc68b6a7f8 JS: Add AdHocWhitelistSanitizer::getABarrierNode()
This sanitizer guard is opt-in, i.e. not an AdditionalSanitizerGuardNode.
2023-10-13 13:15:03 +02:00
Asger F
26f7f94246 JS: Expose default taint steps/sanitizers
We need access to these in order to port taint-tracking configurations
where only some flow labels should use taint steps. This isn't supported
by the shared data flow library.

Such queries must therefore be converted to plain data-flow
configurations that explicitly add taint steps to the relevant flow
states.
2023-10-13 13:15:03 +02:00
Asger F
c924b4a220 JS: Expose shared API in DataFlow/TaintTracking modules 2023-10-13 13:15:03 +02:00
Asger F
1ed3235639 JS: use BarrierGuards 2023-10-13 13:15:03 +02:00
Asger F
277292e3b9 JS: Improve performance of barrier guards without pruning 2023-10-13 13:15:03 +02:00
Asger F
06fd9c2359 JS: Add barrier guard library 2023-10-13 13:14:43 +02:00
Asger F
46e4cdc623 JS: Disallow consecutive captured contents 2023-10-13 13:14:43 +02:00
Asger F
7bcf8b858b JS: Capture flow 2023-10-13 13:14:43 +02:00
Asger F
16df2c31bb Create DataFlowImplConsistency.qll 2023-10-13 12:42:41 +02:00
Asger F
3ef478669b JS: Collapse some cached stages 2023-10-13 12:42:41 +02:00
Asger F
9fef8803ed JS: Avoid BarrierGuardNode's range from depending on Configuration 2023-10-13 12:42:41 +02:00
Asger F
e31ae3a1bf JS: Model JSON.stringify with "deep" read operators 2023-10-13 12:42:41 +02:00
Asger F
0c2e52baba JS: Summary/steps for iterators and generators 2023-10-13 12:42:41 +02:00
Asger F
da3a0de814 JS: Port String#replace to flow summary 2023-10-13 12:42:41 +02:00
Asger F
f0c2afe39e JS: Add flow summaries for maps and sets 2023-10-13 12:42:40 +02:00
Asger F
5054c43b18 JS: Add flow summaries/steps for promises and async/await 2023-10-13 12:42:40 +02:00
Asger F
4319b07798 JS: Add flow summaries for Arrays 2023-10-13 12:42:40 +02:00
Asger F
a31e251529 JS: Add flow summaries for core methods 2023-10-13 12:42:40 +02:00
Asger F
46fec8ea7e JS: Add AdditionalFlowInternal
This provides access to more features than we want to expose publicly at the moment, but is useful for modelling certain language features.
2023-10-13 12:42:40 +02:00
Asger F
3f20d71a9b JS: Add legacy post-update step
This is to ensure getALocalSource() can be replaced by getPostUpdateNode() as the base of a store
2023-10-13 12:42:40 +02:00
Asger F
6037ff553c JS: Add LegacyPreUpdateStep
This contributes to both LegacyFlowStep and SharedTypeTrackingStep.

That is, this is for steps that are used by type-tracking and the old data flow library, but not the new data flow library.
2023-10-13 12:42:40 +02:00
Asger F
27c7d5004a JS: Do the same for additional taint steps 2023-10-13 12:42:40 +02:00
Asger F
1afe06e3a5 JS: Add "additional" and "legacy" steps
See the comment at the top of AdditionalFlowSteps.qll
2023-10-13 12:42:40 +02:00
Asger F
c24a0e00f5 JS: Move SharedTaintStep to AdditionalTaintSteps.qll
NOTE that this commit only moves around code. There are no changes.
2023-10-13 12:42:40 +02:00
Asger F
5bccc652c8 JS: Move SharedFlowStep to AdditionalFlowSteps.qll
NOTE that this commit only moves around code. There are no changes.
2023-10-13 12:42:40 +02:00
Asger F
293899d648 JS: Add 'Awaited' token 2023-10-13 12:42:40 +02:00
Asger F
32070abb27 JS: Implicitly treat array steps as taint steps 2023-10-13 12:42:40 +02:00
Asger F
60101f5e6a JS: Instantiate flow summary library 2023-10-13 12:42:40 +02:00
Asger F
8dc0800526 JS: Add the shared FlowSummaryImpl.qll file 2023-10-13 12:42:40 +02:00
Asger F
f316da78d2 JS: Add FunctionSelfReferenceNode 2023-10-13 12:42:40 +02:00
Asger F
760873c01c JS: Basic instantiation of shared library 2023-10-13 12:42:40 +02:00
Asger F
3455463e71 JS: Add instantiation boilerplate
Note that this commit won't compile on its own, but putting the boilerplate in its own commit
2023-10-13 12:42:40 +02:00
Asger F
c839822eb9 JS: Add PostUpdateNode 2023-10-13 12:42:40 +02:00
Asger F
01952f17bf JS: Add some missing getContainer() predicates 2023-10-13 12:42:40 +02:00
Asger F
21300eef4c JS:Add ConstructorThisArgumentNode 2023-10-13 12:42:40 +02:00
Asger F
b499c6075a JS: Add Contents.qll 2023-10-13 12:42:40 +02:00
Asger F
79e7aae9f6 JS: Add TEarlyStageNode 2023-10-13 12:42:39 +02:00
Asger F
51ef0e5836 JS: Move TNode into a cached module 2023-10-13 12:42:39 +02:00
Asger F
60b179bda2 Shared: add DeduplicatePathGraph
Note that there is a separate PR open with this library
2023-10-13 12:42:39 +02:00
1372 changed files with 127601 additions and 63314 deletions

View File

@@ -1,4 +0,0 @@
---
category: majorAnalysis
---
* Added support for TypeScript 5.7.

335
Cargo.lock generated
View File

@@ -92,9 +92,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.94"
version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7"
checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04"
[[package]]
name = "argfile"
@@ -116,11 +116,14 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
name = "ast-generator"
version = "0.1.0"
dependencies = [
"anyhow",
"either",
"itertools 0.12.1",
"itertools 0.14.0",
"mustache",
"proc-macro2",
"quote",
"ra_ap_stdx",
"serde",
"ungrammar",
]
@@ -153,9 +156,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.6.0"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be"
[[package]]
name = "borsh"
@@ -168,9 +171,9 @@ dependencies = [
[[package]]
name = "bstr"
version = "1.11.1"
version = "1.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8"
checksum = "531a9155a481e2ee699d4f98f43c0ca4ff8ee1bfd55c31e9e98fb29d2b176fe0"
dependencies = [
"memchr",
"serde",
@@ -184,9 +187,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "bytemuck"
version = "1.20.0"
version = "1.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a"
checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3"
[[package]]
name = "byteorder"
@@ -228,9 +231,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.2.5"
version = "1.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c31a0499c1dc64f458ad13872de75c0eb7e3fdb0e67964610c914b034fc5956e"
checksum = "a012a0df96dd6d06ba9a1b29d6402d1a5d77c6befd2566afdc26e10603dc93d7"
dependencies = [
"shlex",
]
@@ -265,7 +268,7 @@ version = "0.98.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5f2eb1cd6054da221bd1ac0197fb2fe5e2caf3dcb93619398fc1433f8f09093"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.7.0",
"chalk-derive",
]
@@ -315,9 +318,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.23"
version = "4.5.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84"
checksum = "a8eb5e908ef3a6efbe1ed62520fb7287959888c88485abe072543190ecc66783"
dependencies = [
"clap_builder",
"clap_derive",
@@ -325,9 +328,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.23"
version = "4.5.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838"
checksum = "96b01801b5fc6a0a232407abc821660c9c6d25a1cafc0d4f85f29fb8d9afc121"
dependencies = [
"anstream",
"anstyle",
@@ -337,9 +340,9 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "4.5.18"
version = "4.5.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab"
checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c"
dependencies = [
"heck 0.5.0",
"proc-macro2",
@@ -411,8 +414,8 @@ dependencies = [
"dunce",
"figment",
"glob",
"itertools 0.13.0",
"log",
"itertools 0.14.0",
"log 0.4.22",
"num-traits",
"ra_ap_base_db",
"ra_ap_cfg",
@@ -433,6 +436,7 @@ dependencies = [
"serde_json",
"serde_with",
"stderrlog",
"toml",
"triomphe",
]
@@ -585,7 +589,7 @@ version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5"
dependencies = [
"log",
"log 0.4.22",
]
[[package]]
@@ -743,9 +747,9 @@ dependencies = [
[[package]]
name = "glob"
version = "0.3.1"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
[[package]]
name = "globset"
@@ -755,7 +759,7 @@ checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19"
dependencies = [
"aho-corasick",
"bstr",
"log",
"log 0.4.22",
"regex-automata 0.4.9",
"regex-syntax 0.8.5",
]
@@ -922,9 +926,9 @@ dependencies = [
[[package]]
name = "itertools"
version = "0.13.0"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
dependencies = [
"either",
]
@@ -995,7 +999,7 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.7.0",
"libc",
"redox_syscall",
]
@@ -1020,6 +1024,15 @@ dependencies = [
"scopeguard",
]
[[package]]
name = "log"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
dependencies = [
"log 0.4.22",
]
[[package]]
name = "log"
version = "0.4.22"
@@ -1072,7 +1085,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
dependencies = [
"libc",
"log",
"log 0.4.22",
"wasi",
"windows-sys 0.48.0",
]
@@ -1086,6 +1099,16 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "mustache"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51956ef1c5d20a1384524d91e616fb44dfc7d8f249bf696d49c97dd3289ecab5"
dependencies = [
"log 0.3.9",
"serde",
]
[[package]]
name = "nohash-hasher"
version = "0.2.0"
@@ -1098,14 +1121,14 @@ version = "6.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.7.0",
"crossbeam-channel",
"filetime",
"fsevent-sys",
"inotify",
"kqueue",
"libc",
"log",
"log 0.4.22",
"mio",
"walkdir",
"windows-sys 0.48.0",
@@ -1250,9 +1273,9 @@ dependencies = [
[[package]]
name = "pin-project-lite"
version = "0.2.15"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff"
checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
[[package]]
name = "powerfmt"
@@ -1271,9 +1294,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.92"
version = "1.0.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
dependencies = [
"unicode-ident",
]
@@ -1293,40 +1316,39 @@ dependencies = [
[[package]]
name = "quote"
version = "1.0.37"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
dependencies = [
"proc-macro2",
]
[[package]]
name = "ra-ap-rustc_abi"
version = "0.80.0"
version = "0.87.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613760a3071b25a67a8d7bc97b37c7fd4722562e9479137b83ae9cf8f8c1601a"
checksum = "28b782af0a7a8df16ddf43cd70da9f17bc3b1ce712c9e4992b6edb16f5f53632"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.7.0",
"ra-ap-rustc_index",
"tracing",
]
[[package]]
name = "ra-ap-rustc_index"
version = "0.80.0"
version = "0.87.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b2bc6b4ecede8ff28295041e22c2e66853f8e0125990c05135bad3c30bad12c"
checksum = "ce5742f134960482f543b35ecebec3cacc6d79a9a685713518b4d8d70c5f9aa8"
dependencies = [
"arrayvec",
"ra-ap-rustc_index_macros",
"smallvec",
]
[[package]]
name = "ra-ap-rustc_index_macros"
version = "0.80.0"
version = "0.87.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2374a39fb2d92d0509178c2b442eadca3cc10e403ef9729a040c1855b08ff261"
checksum = "d7ea011fcf68309a8835ad01d91c032cb18444617b00e2cab21d45b208164441"
dependencies = [
"proc-macro2",
"quote",
@@ -1335,9 +1357,9 @@ dependencies = [
[[package]]
name = "ra-ap-rustc_lexer"
version = "0.80.0"
version = "0.87.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a2cf8e48b69af3ecc29ed3449892e8a999111d2f75212a78aa242e117cf1711"
checksum = "eb76f0a4d4c20859e41f0a23bff0f37ab9ca9171c214a6c7dd72ea69434865dc"
dependencies = [
"unicode-properties",
"unicode-xid",
@@ -1345,9 +1367,9 @@ dependencies = [
[[package]]
name = "ra-ap-rustc_parse_format"
version = "0.80.0"
version = "0.87.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d6f59a22b559263c5c42747ae362cf5d4fb272293fa119a4623f8ec288f9656"
checksum = "06080bd35078305421a62da77f3c128482d8d44441b6da8ce9d146d1cd9cdb5b"
dependencies = [
"ra-ap-rustc_index",
"ra-ap-rustc_lexer",
@@ -1355,9 +1377,9 @@ dependencies = [
[[package]]
name = "ra-ap-rustc_pattern_analysis"
version = "0.80.0"
version = "0.87.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7d0575b54ffe09bc5d2f158454bc05f0c30c01d9992310965f854be50ae22b8"
checksum = "68a3154fe4c20c177d7b3c678a2d3a97aba0cca156ddef88959915041889daf0"
dependencies = [
"ra-ap-rustc_index",
"rustc-hash 2.1.0",
@@ -1368,9 +1390,9 @@ dependencies = [
[[package]]
name = "ra_ap_base_db"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "321b770750ff90b03af539ac6d47ca46208f6f747be97c0a4aaca3a428447c8f"
checksum = "548b95b278a8f6f888a0bb6cb7bf4201fe920d3800cd99770054e5eb72f3cd6a"
dependencies = [
"la-arena",
"lz4_flex",
@@ -1389,9 +1411,9 @@ dependencies = [
[[package]]
name = "ra_ap_cfg"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5023f50ebcf3656d85b96565dac56d50cc3e3d959c41592f457d2230d7be706a"
checksum = "921e2b0232d1e8352eb9f476bb55c1d8bcbed0531adc17c74aa711fef015c851"
dependencies = [
"ra_ap_intern",
"ra_ap_tt",
@@ -1400,10 +1422,16 @@ dependencies = [
]
[[package]]
name = "ra_ap_hir"
version = "0.0.248"
name = "ra_ap_edition"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d07a9a085cf581d5f503aa467d32bbd1e5e7f94a3e86f881ca9c19b379570c62"
checksum = "a7cc6633305d878cafb4a4482e7e7002d1a5d7b15fa837728b6613ff5336f8a4"
[[package]]
name = "ra_ap_hir"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e3f6b31381a297e5bb4fa76108a2cf7bf8d35067a130f932aa6fdfb733ba3a1"
dependencies = [
"arrayvec",
"either",
@@ -1426,12 +1454,12 @@ dependencies = [
[[package]]
name = "ra_ap_hir_def"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "825c47fec7aab22c38ad9eba1d76102a95a6eb089e85b4e58308089d056c3cdc"
checksum = "84144bdda7af170e660d312982889622f4a5361c1bb74df2afa2a6ce17d48644"
dependencies = [
"arrayvec",
"bitflags 2.6.0",
"bitflags 2.7.0",
"cov-mark",
"dashmap",
"drop_bomb",
@@ -1463,9 +1491,9 @@ dependencies = [
[[package]]
name = "ra_ap_hir_expand"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1084b708f90de31888deb6e7f9cda5ebb8e6a59484143a3df0a4007dcf496b17"
checksum = "441661b394acfa4f3ac4cb54386f8ee8b451504ec167b0bf0e4200da1bbca50d"
dependencies = [
"cov-mark",
"either",
@@ -1491,12 +1519,12 @@ dependencies = [
[[package]]
name = "ra_ap_hir_ty"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "400a42e442b6d8f64adea48a8c9e39f76a1b9ed9964fd40222bd2d7cfe0a5a79"
checksum = "6feea30dff289f33a8ed76172ff4cb299db22d224f88735aa2c7f49ba1e5e77f"
dependencies = [
"arrayvec",
"bitflags 2.6.0",
"bitflags 2.7.0",
"chalk-derive",
"chalk-ir",
"chalk-recursive",
@@ -1531,12 +1559,12 @@ dependencies = [
[[package]]
name = "ra_ap_ide_db"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4ced45b107a8f4c1a4cee68b270d08832327b34ad0bf7794879342ac280bc8b"
checksum = "7e33bd5a0139b6c74d34ed963494115abe3f9c95cf5936871ab3d9b548ccbbdf"
dependencies = [
"arrayvec",
"bitflags 2.6.0",
"bitflags 2.7.0",
"cov-mark",
"crossbeam-channel",
"either",
@@ -1562,9 +1590,9 @@ dependencies = [
[[package]]
name = "ra_ap_intern"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5432d6cf7382c06dab31b6c1772446c8576dd19fcbc007bc8a6fd8bca3d424d"
checksum = "faa7ee24ae9bf4d2536ef7fb6de35f30856edbf7b3d6ac02e5a2532118896569"
dependencies = [
"dashmap",
"hashbrown 0.14.5",
@@ -1575,15 +1603,15 @@ dependencies = [
[[package]]
name = "ra_ap_limit"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "822501c9f88830865ebedf944130dbe0603fa8d30a5da90f3224c1dcca2660de"
checksum = "90d8a2aecbd488cf79b430bd5abe6650da44ae58b31cd6052c909dbd3f5d5926"
[[package]]
name = "ra_ap_load-cargo"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d5b002bcda197a4e9442c827dc86305d8fc1820fbbcb9814ff9bbc2c50f4e9c"
checksum = "6e2372aadd32e85460de595891c8b3562126166bc94fdc24508d6784c9d93357"
dependencies = [
"anyhow",
"crossbeam-channel",
@@ -1603,9 +1631,9 @@ dependencies = [
[[package]]
name = "ra_ap_mbe"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4fce40b490b6bbca3d033f4cbf32ef07069423aa3edc1e00ec26ddabf503866"
checksum = "bf69ba82adb6e436617ecd09c0ff58006f376060dff437eb9fd383c2983f6d01"
dependencies = [
"arrayvec",
"cov-mark",
@@ -1624,34 +1652,33 @@ dependencies = [
[[package]]
name = "ra_ap_parser"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "573c14046174e3ef03a9d73841dbc52fd1d6224fffd1a0713aef95b45e024f75"
checksum = "8f499b6c33a588d60ed9722d057954a21ec01913b97a5693ff40ba4828ffa7b9"
dependencies = [
"drop_bomb",
"ra-ap-rustc_lexer",
"ra_ap_edition",
"ra_ap_limit",
"tracing",
]
[[package]]
name = "ra_ap_paths"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57aa6e3d7c45806434cdee09aa74b561723552732e8b089213fe821ae84404ec"
checksum = "b5a16df131fa641a4af4d9488152b7b332a6a30e93bc655fdbe88f555ba28825"
dependencies = [
"camino",
"serde",
]
[[package]]
name = "ra_ap_proc_macro_api"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79d9595e05b422f3258c51f9a529129c9a59f99037deac652ff2cdd0c97e0bda"
checksum = "3480e0d07197ebcc2db5836b0c39625e07b0d77c6471a2a748e5bdf54ce556e3"
dependencies = [
"indexmap 2.7.0",
"ra_ap_base_db",
"ra_ap_intern",
"ra_ap_paths",
"ra_ap_span",
@@ -1659,15 +1686,16 @@ dependencies = [
"ra_ap_tt",
"rustc-hash 2.1.0",
"serde",
"serde_derive",
"serde_json",
"tracing",
]
[[package]]
name = "ra_ap_profile"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "459551d7e5a6dda9204c3741215c1f6a97cf6f4553e3c29294f7f8ac0ec91f57"
checksum = "95b707dd9c92139030587d81b3333428f48af8f4728330ed12101ab0bb431d72"
dependencies = [
"cfg-if",
"libc",
@@ -1677,9 +1705,9 @@ dependencies = [
[[package]]
name = "ra_ap_project_model"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "171aacd6d1642f9d821f27fc318a503cfe10c5c6294193c401e991266e38a583"
checksum = "551a0de5a16f0538fbaf401a319d81d1a034f7aa014e46ac87c5bd74229a211b"
dependencies = [
"anyhow",
"cargo_metadata",
@@ -1695,6 +1723,7 @@ dependencies = [
"rustc-hash 2.1.0",
"semver",
"serde",
"serde_derive",
"serde_json",
"tracing",
"triomphe",
@@ -1702,9 +1731,9 @@ dependencies = [
[[package]]
name = "ra_ap_salsa"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "504314128b0998f54d8e253a328a53e2a697f579f8d1f194b52f77cd8a540e36"
checksum = "6ec0c82d9e5affbf7d582750b301d279589787a5ac729f95756f5a0b0bf2b4a4"
dependencies = [
"indexmap 2.7.0",
"itertools 0.12.1",
@@ -1720,9 +1749,9 @@ dependencies = [
[[package]]
name = "ra_ap_salsa-macros"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d957f6ec9a6f11cf9c8ce0f27711f4f9813bdd690b3efa6a280cb06a75b5a0fc"
checksum = "8440192eb549dda1cdefc95eaa1fc42ad13cfbd303add757517d77c81e7dc2e1"
dependencies = [
"heck 0.4.1",
"proc-macro2",
@@ -1732,9 +1761,9 @@ dependencies = [
[[package]]
name = "ra_ap_span"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c82fd3ff10c25958db0c254f8f4378cb75069017b675f4fe4c5e7d5f2827e71"
checksum = "18690685d10da2577d7821d46c0de5a884bf1755e59635cbb1a795451e2a4acc"
dependencies = [
"hashbrown 0.14.5",
"la-arena",
@@ -1748,9 +1777,9 @@ dependencies = [
[[package]]
name = "ra_ap_stdx"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0be113ed187f4bf5403ebd8256d3d4aead8d265f670d534c646edea68516ef86"
checksum = "4016934faae8413b4ad3f1bf063c7ffccdcfdf3f67ff32f4a79a197a3c1cb0da"
dependencies = [
"always-assert",
"crossbeam-channel",
@@ -1763,9 +1792,9 @@ dependencies = [
[[package]]
name = "ra_ap_syntax"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5af8d681a9fd408be1b17f3b150eb98907fb72b9b44000ada9c3e9b6c059188"
checksum = "e8e381d21d166d12b11906171f82382473d60abfead0c4acc6d7d07150f87f73"
dependencies = [
"cov-mark",
"either",
@@ -1783,9 +1812,9 @@ dependencies = [
[[package]]
name = "ra_ap_syntax-bridge"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f957885289e9789dffcd81ebfa4c2d49be3fad41f7718ffeacb3599f6d88678"
checksum = "65f1960218acd2ed8e486e7bd24f80a7eb89591906c6b0831296b2a75c556b2f"
dependencies = [
"ra_ap_intern",
"ra_ap_parser",
@@ -1799,9 +1828,9 @@ dependencies = [
[[package]]
name = "ra_ap_toolchain"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e067bd4107ec52a241b68398539632df0a850013907070002d4d403c3691e51c"
checksum = "c9195f69ff02f076f5a726c7fbafa2b4639d00235906cb44e52ca75cd8b33c30"
dependencies = [
"camino",
"home",
@@ -1809,9 +1838,9 @@ dependencies = [
[[package]]
name = "ra_ap_tt"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c38deb50d7a26663c28deb01e5611b3b92b5a87298940e0638589f03c3faf62"
checksum = "8ac261d79d3ec475a1f3b2a758d3e466f2b9d7d883fb72239b06979bf6880018"
dependencies = [
"arrayvec",
"ra-ap-rustc_lexer",
@@ -1822,9 +1851,9 @@ dependencies = [
[[package]]
name = "ra_ap_vfs"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "168a9378dd3f185ae94dda9c35e4d468a8ff105c8f4bb57e17f6e2312d84d1a8"
checksum = "ee35a171beccbb01b4ede1d9ad91dee487a3742d7cc39efd7aed6961027cbe78"
dependencies = [
"crossbeam-channel",
"fst",
@@ -1838,9 +1867,9 @@ dependencies = [
[[package]]
name = "ra_ap_vfs-notify"
version = "0.0.248"
version = "0.0.258"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a5e13d88bf8bbd8dd02c96dd8d89e6cebc2757a0edf13b3b85007024fcf216c"
checksum = "b234b7651eb5d61f18d4f4643590bb8b1fd59ef766a1059741c09c540ec8cd86"
dependencies = [
"crossbeam-channel",
"notify",
@@ -1909,7 +1938,7 @@ version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834"
dependencies = [
"bitflags 2.6.0",
"bitflags 2.7.0",
]
[[package]]
@@ -2036,18 +2065,18 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.216"
version = "1.0.217"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e"
checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.216"
version = "1.0.217"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e"
checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
dependencies = [
"proc-macro2",
"quote",
@@ -2056,9 +2085,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.133"
version = "1.0.135"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377"
checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9"
dependencies = [
"itoa",
"memchr",
@@ -2067,10 +2096,19 @@ dependencies = [
]
[[package]]
name = "serde_with"
version = "3.11.0"
name = "serde_spanned"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817"
checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
dependencies = [
"serde",
]
[[package]]
name = "serde_with"
version = "3.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa"
dependencies = [
"base64",
"chrono",
@@ -2086,9 +2124,9 @@ dependencies = [
[[package]]
name = "serde_with_macros"
version = "3.11.0"
version = "3.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d"
checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e"
dependencies = [
"darling",
"proc-macro2",
@@ -2160,7 +2198,7 @@ checksum = "61c910772f992ab17d32d6760e167d2353f4130ed50e796752689556af07dc6b"
dependencies = [
"chrono",
"is-terminal",
"log",
"log 0.4.22",
"termcolor",
"thread_local",
]
@@ -2179,9 +2217,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "syn"
version = "2.0.90"
version = "2.0.96"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31"
checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80"
dependencies = [
"proc-macro2",
"quote",
@@ -2275,6 +2313,40 @@ dependencies = [
"time-core",
]
[[package]]
name = "toml"
version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
]
[[package]]
name = "toml_datetime"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.22.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
dependencies = [
"indexmap 2.7.0",
"serde",
"serde_spanned",
"toml_datetime",
"winnow",
]
[[package]]
name = "tracing"
version = "0.1.41"
@@ -2313,7 +2385,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
dependencies = [
"log",
"log 0.4.22",
"once_cell",
"tracing-core",
]
@@ -2338,9 +2410,9 @@ dependencies = [
[[package]]
name = "tree-sitter"
version = "0.24.5"
version = "0.24.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ac95b18f0f727aaaa012bd5179a1916706ee3ed071920fdbda738750b0c0bf5"
checksum = "5f2434c86ba59ed15af56039cc5bf1acf8ba76ce301e32ef08827388ef285ec5"
dependencies = [
"cc",
"regex",
@@ -2502,7 +2574,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79"
dependencies = [
"bumpalo",
"log",
"log 0.4.22",
"proc-macro2",
"quote",
"syn",
@@ -2726,6 +2798,15 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "winnow"
version = "0.6.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8d71a593cc5c42ad7876e2c1fda56f314f3754c084128833e64f1345ff8a03a"
dependencies = [
"memchr",
]
[[package]]
name = "yansi"
version = "1.0.1"

View File

@@ -65,26 +65,93 @@ rust_host_tools.host_tools(
# deps for python extractor
# keep in sync by running `misc/bazel/3rdparty/update_cargo_deps.sh`
py_deps = use_extension("//misc/bazel/3rdparty:py_deps_extension.bzl", "p")
use_repo(py_deps, "vendor__anyhow-1.0.44", "vendor__cc-1.0.70", "vendor__clap-2.33.3", "vendor__regex-1.5.5", "vendor__smallvec-1.6.1", "vendor__string-interner-0.12.2", "vendor__thiserror-1.0.29", "vendor__tree-sitter-0.20.4", "vendor__tree-sitter-graph-0.7.0")
use_repo(
py_deps,
"vendor__anyhow-1.0.44",
"vendor__cc-1.0.70",
"vendor__clap-2.33.3",
"vendor__regex-1.5.5",
"vendor__smallvec-1.6.1",
"vendor__string-interner-0.12.2",
"vendor__thiserror-1.0.29",
"vendor__tree-sitter-0.20.4",
"vendor__tree-sitter-graph-0.7.0",
)
# deps for ruby+rust
# keep in sync by running `misc/bazel/3rdparty/update_cargo_deps.sh`
tree_sitter_extractors_deps = use_extension("//misc/bazel/3rdparty:tree_sitter_extractors_extension.bzl", "r")
use_repo(tree_sitter_extractors_deps, "vendor__anyhow-1.0.94", "vendor__argfile-0.2.1", "vendor__chrono-0.4.39", "vendor__clap-4.5.23", "vendor__dunce-1.0.5", "vendor__either-1.13.0", "vendor__encoding-0.2.33", "vendor__figment-0.10.19", "vendor__flate2-1.0.35", "vendor__glob-0.3.1", "vendor__globset-0.4.15", "vendor__itertools-0.12.1", "vendor__itertools-0.13.0", "vendor__lazy_static-1.5.0", "vendor__log-0.4.22", "vendor__num-traits-0.2.19", "vendor__num_cpus-1.16.0", "vendor__proc-macro2-1.0.92", "vendor__quote-1.0.37", "vendor__ra_ap_base_db-0.0.248", "vendor__ra_ap_cfg-0.0.248", "vendor__ra_ap_hir-0.0.248", "vendor__ra_ap_hir_def-0.0.248", "vendor__ra_ap_hir_expand-0.0.248", "vendor__ra_ap_ide_db-0.0.248", "vendor__ra_ap_intern-0.0.248", "vendor__ra_ap_load-cargo-0.0.248", "vendor__ra_ap_parser-0.0.248", "vendor__ra_ap_paths-0.0.248", "vendor__ra_ap_project_model-0.0.248", "vendor__ra_ap_span-0.0.248", "vendor__ra_ap_stdx-0.0.248", "vendor__ra_ap_syntax-0.0.248", "vendor__ra_ap_vfs-0.0.248", "vendor__rand-0.8.5", "vendor__rayon-1.10.0", "vendor__regex-1.11.1", "vendor__serde-1.0.216", "vendor__serde_json-1.0.133", "vendor__serde_with-3.11.0", "vendor__stderrlog-0.6.0", "vendor__syn-2.0.90", "vendor__tracing-0.1.41", "vendor__tracing-subscriber-0.3.19", "vendor__tree-sitter-0.24.5", "vendor__tree-sitter-embedded-template-0.23.2", "vendor__tree-sitter-json-0.24.8", "vendor__tree-sitter-ql-0.23.1", "vendor__tree-sitter-ruby-0.23.1", "vendor__triomphe-0.1.14", "vendor__ungrammar-1.16.1")
use_repo(
tree_sitter_extractors_deps,
"vendor__anyhow-1.0.95",
"vendor__argfile-0.2.1",
"vendor__chrono-0.4.39",
"vendor__clap-4.5.26",
"vendor__dunce-1.0.5",
"vendor__either-1.13.0",
"vendor__encoding-0.2.33",
"vendor__figment-0.10.19",
"vendor__flate2-1.0.35",
"vendor__glob-0.3.2",
"vendor__globset-0.4.15",
"vendor__itertools-0.14.0",
"vendor__lazy_static-1.5.0",
"vendor__log-0.4.22",
"vendor__mustache-0.9.0",
"vendor__num-traits-0.2.19",
"vendor__num_cpus-1.16.0",
"vendor__proc-macro2-1.0.93",
"vendor__quote-1.0.38",
"vendor__ra_ap_base_db-0.0.258",
"vendor__ra_ap_cfg-0.0.258",
"vendor__ra_ap_hir-0.0.258",
"vendor__ra_ap_hir_def-0.0.258",
"vendor__ra_ap_hir_expand-0.0.258",
"vendor__ra_ap_ide_db-0.0.258",
"vendor__ra_ap_intern-0.0.258",
"vendor__ra_ap_load-cargo-0.0.258",
"vendor__ra_ap_parser-0.0.258",
"vendor__ra_ap_paths-0.0.258",
"vendor__ra_ap_project_model-0.0.258",
"vendor__ra_ap_span-0.0.258",
"vendor__ra_ap_stdx-0.0.258",
"vendor__ra_ap_syntax-0.0.258",
"vendor__ra_ap_vfs-0.0.258",
"vendor__rand-0.8.5",
"vendor__rayon-1.10.0",
"vendor__regex-1.11.1",
"vendor__serde-1.0.217",
"vendor__serde_json-1.0.135",
"vendor__serde_with-3.12.0",
"vendor__stderrlog-0.6.0",
"vendor__syn-2.0.96",
"vendor__toml-0.8.19",
"vendor__tracing-0.1.41",
"vendor__tracing-subscriber-0.3.19",
"vendor__tree-sitter-0.24.6",
"vendor__tree-sitter-embedded-template-0.23.2",
"vendor__tree-sitter-json-0.24.8",
"vendor__tree-sitter-ql-0.23.1",
"vendor__tree-sitter-ruby-0.23.1",
"vendor__triomphe-0.1.14",
"vendor__ungrammar-1.16.1",
)
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# rust-analyzer sources needed by the rust ast-generator (see `rust/ast-generator/README.md`)
RUST_ANALYZER_SRC_TAG = "2025-01-07"
http_archive(
name = "rust-analyzer-src",
build_file = "//rust/ast-generator:BUILD.rust-analyzer-src.bazel",
integrity = "sha256-jl4KJmZku+ilMLnuX2NU+qa1v10IauSiDiz23sZo360=",
integrity = "sha256-eo8mIaUafZL8LOM65bDIIIXw1rNQ/P/x5RK/XUtgo5g=",
patch_args = ["-p1"],
patches = [
"//rust/ast-generator:patches/rust-analyzer.patch",
],
strip_prefix = "rust-analyzer-2024-12-16",
url = "https://github.com/rust-lang/rust-analyzer/archive/refs/tags/2024-12-16.tar.gz",
strip_prefix = "rust-analyzer-%s" % RUST_ANALYZER_SRC_TAG,
url = "https://github.com/rust-lang/rust-analyzer/archive/refs/tags/%s.tar.gz" % RUST_ANALYZER_SRC_TAG,
)
dotnet = use_extension("@rules_dotnet//dotnet:extensions.bzl", "dotnet")

View File

@@ -1,3 +1,7 @@
## 0.4.1
No user-facing changes.
## 0.4.0
### New Features

View File

@@ -0,0 +1,3 @@
## 0.4.1
No user-facing changes.

View File

@@ -1,2 +1,2 @@
---
lastReleaseVersion: 0.4.0
lastReleaseVersion: 0.4.1

View File

@@ -1,5 +1,5 @@
name: codeql/actions-all
version: 0.4.0
version: 0.4.1
library: true
warnOnImplicitThis: true
dependencies:

View File

@@ -1,3 +1,7 @@
## 0.4.1
No user-facing changes.
## 0.4.0
### New Queries

View File

@@ -0,0 +1,3 @@
## 0.4.1
No user-facing changes.

View File

@@ -1,2 +1,2 @@
---
lastReleaseVersion: 0.4.0
lastReleaseVersion: 0.4.1

View File

@@ -0,0 +1,2 @@
- description: Extended and experimental security queries for GitHub Actions
- import: codeql-suites/actions-code-scanning.qls

View File

@@ -1,5 +1,5 @@
name: codeql/actions-queries
version: 0.4.0
version: 0.4.1
library: false
warnOnImplicitThis: true
groups: [actions, queries]

View File

@@ -247,7 +247,8 @@
"javascript/ql/lib/semmle/javascript/security/internal/SensitiveDataHeuristics.qll",
"python/ql/lib/semmle/python/security/internal/SensitiveDataHeuristics.qll",
"ruby/ql/lib/codeql/ruby/security/internal/SensitiveDataHeuristics.qll",
"swift/ql/lib/codeql/swift/security/internal/SensitiveDataHeuristics.qll"
"swift/ql/lib/codeql/swift/security/internal/SensitiveDataHeuristics.qll",
"rust/ql/lib/codeql/rust/security/internal/SensitiveDataHeuristics.qll"
],
"IncompleteUrlSubstringSanitization": [
"javascript/ql/src/Security/CWE-020/IncompleteUrlSubstringSanitization.qll",

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
description: Support variable template specializations
compatibility: full
var_specialized.rel: delete

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
class Stmt extends @stmt {
string toString() { none() }
}
class Location extends @location_stmt {
string toString() { none() }
}
predicate isConstevalIf(Stmt stmt) {
exists(int kind | stmts(stmt, kind, _) | kind = 38 or kind = 39)
}
from Stmt stmt, int kind, int kind_new, Location location
where
stmts(stmt, kind, location) and
if isConstevalIf(stmt) then kind_new = 7 else kind_new = kind // Turns consteval if into a block with two block statements in it
select stmt, kind_new, location

View File

@@ -0,0 +1,5 @@
description: Support (not) consteval if
compatibility: full
consteval_if_then.rel: delete
consteval_if_else.rel: delete
stmts.rel: run stmts.qlo

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
description: Support concept id expressions
compatibility: full
concept_instantiation.rel: delete
is_type_constraint.rel: delete

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
description: Improve user types and proxy classes
compatibility: full
usertypes.rel: run usertypes.qlo

View File

@@ -0,0 +1,10 @@
class UserType extends @usertype {
string toString() { none() }
}
bindingset[kind]
int getKind(int kind) { if kind in [15, 16, 17] then result = 6 else result = kind }
from UserType usertype, string name, int kind
where usertypes(usertype, name, kind)
select usertype, name, getKind(kind)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
description: Support requires clauses and type constraints
compatibility: full
fun_requires.rel: delete
var_requires.rel: delete
type_requires.rel: delete
type_template_type_constraint.rel: delete

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
description: Support concept templates
compatibility: full
concept_templates.rel: delete
concept_template_argument.rel: delete
concept_template_argument_value.rel: delete

View File

@@ -1,3 +1,27 @@
## 3.2.0
### New Features
* Add a new predicate `getAnIndirectBarrier` to the parameterized module `InstructionBarrierGuard` in `semmle.code.cpp.dataflow.new.DataFlow` for computing indirect dataflow nodes that are guarded by a given instruction. This predicate is similar to the `getAnIndirectBarrier` predicate on the parameterized module `BarrierGuard`.
* A new predicate `getDecltype` was added to the `ProxyClass` class, which yields the decltype for the proxy class.
* Template classes that are of `struct` type are now also instances of the `Struct` class.
* Template classes that are of `union` type are now also instances of the `Union` class.
* A new abstract class `ConfigurationTestFile` (`semmle.code.cpp.ConfigurationTestFile.ConfigurationTestFile`) was introduced, which represents files created to test the build configuration. A subclass `CmakeTryCompileFile` of `ConfigurationTestFile` was also introduced, which represents files created by CMake to test the build configuration.
* New predicates `getARequiresClause`, `getTemplateRequiresClause` and `getFunctionRequiresClause` were added to the `FunctionDeclarationEntry` class, which yield the requires clauses when the entry represents a function template declaration with requires clauses.
* A new predicate `getRequiresClause` was added to the `TypeDeclarationEntry` class, which yields the requires clause when the entry represents a class template declaration with a requires clause.
* A new predicate `getRequiresClause` was added to the `VariableDeclarationEntry` class, which yields the requires clause when the entry represents a variable template declaration with a requires clause.
* A new predicate `getTypeConstraint` was added to the `TypeTemplateParameter` class, which yields the type constraint of the parameter if it exists.
* A new class `VariableTemplateSpecialization` was introduced, which represents explicit specializations of variable templates.
* A new predicate `isSpecialization` was added to the `Variable` class, which holds if the variable is a template specialization.
* A new class `ConceptIdExpr` was introduced, which represents C++20 concept id expressions.
* A new class `Concept` was introduced, which represents C++20 concepts.
* The `getTemplateArgumentType` and `getTemplateArgumentValue` predicates of the `Declaration` class now also yield template arguments of concepts.
* A new class `ConstevalIfStmt` was introduced, which represents the C++23 `if consteval` and `if ! consteval` statements.
### Minor Analysis Improvements
* `DefaultOptions::exits` now holds for C23 functions with the `_Noreturn` or `___Noreturn__` attribute.
## 3.1.0
### Deprecated APIs

View File

@@ -54,11 +54,11 @@ class Options extends string {
*
* By default, this holds for `exit`, `_exit`, `_Exit`, `abort`,
* `__assert_fail`, `longjmp`, `__builtin_unreachable` and any
* function with a `noreturn` or `__noreturn__` attribute or
* `noreturn` specifier.
* function with a `noreturn`, `__noreturn__`, or `_Noreturn`
* attribute or `noreturn` specifier.
*/
predicate exits(Function f) {
f.getAnAttribute().hasName(["noreturn", "__noreturn__"])
f.getAnAttribute().hasName(["noreturn", "__noreturn__", "_Noreturn"])
or
f.getASpecifier().hasName("noreturn")
or

View File

@@ -0,0 +1,23 @@
## 3.2.0
### New Features
* Add a new predicate `getAnIndirectBarrier` to the parameterized module `InstructionBarrierGuard` in `semmle.code.cpp.dataflow.new.DataFlow` for computing indirect dataflow nodes that are guarded by a given instruction. This predicate is similar to the `getAnIndirectBarrier` predicate on the parameterized module `BarrierGuard`.
* A new predicate `getDecltype` was added to the `ProxyClass` class, which yields the decltype for the proxy class.
* Template classes that are of `struct` type are now also instances of the `Struct` class.
* Template classes that are of `union` type are now also instances of the `Union` class.
* A new abstract class `ConfigurationTestFile` (`semmle.code.cpp.ConfigurationTestFile.ConfigurationTestFile`) was introduced, which represents files created to test the build configuration. A subclass `CmakeTryCompileFile` of `ConfigurationTestFile` was also introduced, which represents files created by CMake to test the build configuration.
* New predicates `getARequiresClause`, `getTemplateRequiresClause` and `getFunctionRequiresClause` were added to the `FunctionDeclarationEntry` class, which yield the requires clauses when the entry represents a function template declaration with requires clauses.
* A new predicate `getRequiresClause` was added to the `TypeDeclarationEntry` class, which yields the requires clause when the entry represents a class template declaration with a requires clause.
* A new predicate `getRequiresClause` was added to the `VariableDeclarationEntry` class, which yields the requires clause when the entry represents a variable template declaration with a requires clause.
* A new predicate `getTypeConstraint` was added to the `TypeTemplateParameter` class, which yields the type constraint of the parameter if it exists.
* A new class `VariableTemplateSpecialization` was introduced, which represents explicit specializations of variable templates.
* A new predicate `isSpecialization` was added to the `Variable` class, which holds if the variable is a template specialization.
* A new class `ConceptIdExpr` was introduced, which represents C++20 concept id expressions.
* A new class `Concept` was introduced, which represents C++20 concepts.
* The `getTemplateArgumentType` and `getTemplateArgumentValue` predicates of the `Declaration` class now also yield template arguments of concepts.
* A new class `ConstevalIfStmt` was introduced, which represents the C++23 `if consteval` and `if ! consteval` statements.
### Minor Analysis Improvements
* `DefaultOptions::exits` now holds for C23 functions with the `_Noreturn` or `___Noreturn__` attribute.

View File

@@ -1,2 +1,2 @@
---
lastReleaseVersion: 3.1.0
lastReleaseVersion: 3.2.0

View File

@@ -0,0 +1,8 @@
extensions:
- addsTo:
pack: codeql/cpp-all
extensible: summaryModel
data: # namespace, type, subtypes, name, signature, ext, input, output, kind, provenance
- ["", "", False, "SysAllocString", "", "", "Argument[*0]", "ReturnValue[*]", "value", "manual"]
- ["", "", False, "SysAllocStringByteLen", "", "", "Argument[*0]", "ReturnValue[*]", "value", "manual"]
- ["", "", False, "SysAllocStringLen", "", "", "Argument[*0]", "ReturnValue[*]", "value", "manual"]

View File

@@ -1,5 +1,5 @@
name: codeql/cpp-all
version: 3.1.0
version: 3.2.0
groups: cpp
dbscheme: semmlecode.cpp.dbscheme
extractor: cpp

View File

@@ -869,7 +869,7 @@ class AbstractClass extends Class {
* `FullClassTemplateSpecialization`.
*/
class TemplateClass extends Class {
TemplateClass() { usertypes(underlyingElement(this), _, 6) }
TemplateClass() { usertypes(underlyingElement(this), _, [15, 16, 17]) }
/**
* Gets a class instantiated from this template.
@@ -1076,13 +1076,19 @@ class VirtualBaseClass extends Class {
}
/**
* The proxy class (where needed) associated with a template parameter, as
* in the following code:
* ```
* The proxy class (where needed) associated with a template parameter or a
* decltype, as in the following code:
* ```cpp
* template <typename T>
* struct S : T { // the type of this T is a proxy class
* ...
* };
*
* template <typename T>
* concept C =
* decltype(std::span{std::declval<T&>()})::extent
* != std::dynamic_extent;
* // the type of decltype(std::span{std::declval<T&>()}) is a proxy class
* ```
*/
class ProxyClass extends UserType {
@@ -1093,10 +1099,13 @@ class ProxyClass extends UserType {
/** Gets the location of the proxy class. */
override Location getLocation() { result = this.getTemplateParameter().getDefinitionLocation() }
/** Gets the template parameter for which this is the proxy class. */
/** Gets the template parameter for which this is the proxy class, if any. */
TypeTemplateParameter getTemplateParameter() {
is_proxy_class_for(underlyingElement(this), unresolveElement(result))
}
/** Gets the decltype for which this is the proxy class, if any. */
Decltype getDecltype() { is_proxy_class_for(underlyingElement(this), unresolveElement(result)) }
}
// Unpacks "array of ... of array of t" into t.

View File

@@ -153,9 +153,139 @@ class NestedRequirementExpr extends Expr, @nested_requirement {
/**
* A C++ concept id expression.
*
* For example, if:
* ```cpp
* template<typename T, T X> concept C = ...;
* ...
* requires { C<int, 1>; };
* ```
* then `C<int, 1>` is a concept id expression that refers to
* the concept `C`.
*/
class ConceptIdExpr extends RequirementExpr, @concept_id {
override string toString() { result = "concept<...>" }
override string toString() {
result = this.getConcept().getName() + "<...>"
or
// The following is for backward compatibility with databases created with
// CodeQL 2.19.3, 2.19.4, and 2.20.0. Those databases include concept id
// expressions, but do not include concept template information.
not exists(this.getConcept()) and
result = "concept<...>"
}
override string getAPrimaryQlClass() { result = "ConceptIdExpr" }
/**
* Holds if the concept id is used as a type constraint.
*
* In this case, the first template argument is implicit.
*/
predicate isTypeConstraint() { is_type_constraint(underlyingElement(this)) }
/**
* Gets the concept this concept id refers to.
*/
Concept getConcept() { concept_instantiation(underlyingElement(this), unresolveElement(result)) }
/**
* Gets a template argument passed to the concept.
*/
final Locatable getATemplateArgument() { result = this.getTemplateArgument(_) }
/**
* Gets the kind of a non-type template argument passed to the concept.
*/
final Locatable getATemplateArgumentKind() { result = this.getTemplateArgumentKind(_) }
/**
* Gets the `i`th template argument passed to the concept.
*
* For example, if:
* ```cpp
* template<typename T, T X> concept C = ...;
* ...
* requires { C<int, 1>; };
* ```
* then `getTemplateArgument(0)` yields `int`, and `getTemplateArgument(1)`
* yields `1`.
*
* If the concept id is a type constraint, then `getTemplateArgument(0)`
* will not yield a result.
*/
final Locatable getTemplateArgument(int index) {
if exists(this.getTemplateArgumentValue(index))
then result = this.getTemplateArgumentValue(index)
else result = this.getTemplateArgumentType(index)
}
/**
* Gets the kind of the `i`th template argument value passed to the concept.
*
* For example, if:
* ```cpp
* template<typename T, T X> concept C = ...;
* ...
* requires { C<int, 1>; };
* ```
* then `getTemplateArgumentKind(1)` yields `int`, and there is no result for
* `getTemplateArgumentKind(0)`.
*/
final Locatable getTemplateArgumentKind(int index) {
exists(this.getTemplateArgumentValue(index)) and
result = this.getTemplateArgumentType(index)
}
/**
* Gets the number of template arguments passed to the concept.
*/
final int getNumberOfTemplateArguments() {
result = count(int i | exists(this.getTemplateArgument(i)))
}
private Type getTemplateArgumentType(int index) {
exists(int i | if this.isTypeConstraint() then i = index - 1 else i = index |
concept_template_argument(underlyingElement(this), i, unresolveElement(result))
)
}
private Expr getTemplateArgumentValue(int index) {
exists(int i | if this.isTypeConstraint() then i = index - 1 else i = index |
concept_template_argument_value(underlyingElement(this), i, unresolveElement(result))
)
}
}
/**
* A C++ concept.
*
* For example:
* ```cpp
* template<class T>
* concept C = std::is_same<T, int>::value;
* ```
*/
class Concept extends Declaration, @concept_template {
override string getAPrimaryQlClass() { result = "Concept" }
override Location getLocation() { concept_templates(underlyingElement(this), _, result) }
override string getName() { concept_templates(underlyingElement(this), result, _) }
/**
* Gets the constraint expression of the concept.
*
* For example, in
* ```cpp
* template<class T>
* concept C = std::is_same<T, int>::value;
* ```
* the constraint expression is `std::is_same<T, int>::value`.
*/
Expr getExpr() { result.getParent() = this }
/**
* Gets a concept id expression that refers to this concept
*/
ConceptIdExpr getAReferringConceptIdExpr() { this = result.getConcept() }
}

View File

@@ -0,0 +1,28 @@
/**
* Provides classes for identifying files that created to test the
* build configuration. It is often desirable to exclude these files
* from analysis.
*/
import File
/**
* A file created to test the system configuration.
*/
abstract class ConfigurationTestFile extends File { }
/**
* A file created by CMake to test the system configuration.
*/
class CmakeTryCompileFile extends ConfigurationTestFile {
CmakeTryCompileFile() {
exists(Folder folder, Folder parent |
folder = this.getParentContainer() and
parent = folder.getParentContainer()
|
folder.getBaseName().matches("TryCompile-%") and
parent.getBaseName() = "CMakeScratch" and
parent.getParentContainer().getBaseName() = "CMakeFiles"
)
}
}

View File

@@ -235,7 +235,7 @@ class Declaration extends Locatable, @declaration {
*
* `Foo<int, 1> bar;`
*
* Will have `getTemplateArgument())` return `int`, and
* Will have `getTemplateArgument(0)` return `int`, and
* `getTemplateArgument(1)` return `1`.
*/
final Locatable getTemplateArgument(int index) {
@@ -279,6 +279,8 @@ class Declaration extends Locatable, @declaration {
variable_template_argument(underlyingElement(this), index, unresolveElement(result))
or
template_template_argument(underlyingElement(this), index, unresolveElement(result))
or
concept_template_argument(underlyingElement(this), index, unresolveElement(result))
}
private Expr getTemplateArgumentValue(int index) {
@@ -289,6 +291,8 @@ class Declaration extends Locatable, @declaration {
variable_template_argument_value(underlyingElement(this), index, unresolveElement(result))
or
template_template_argument_value(underlyingElement(this), index, unresolveElement(result))
or
concept_template_argument_value(underlyingElement(this), index, unresolveElement(result))
}
}

View File

@@ -253,7 +253,7 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
*/
override Location getADeclarationLocation() { result = this.getADeclarationEntry().getLocation() }
/** Holds if this Function is a Template specialization. */
/** Holds if this function is a template specialization. */
predicate isSpecialization() {
exists(FunctionDeclarationEntry fde |
fun_decls(unresolveElement(fde), underlyingElement(this), _, _, _) and
@@ -665,7 +665,7 @@ class FunctionDeclarationEntry extends DeclarationEntry, @fun_decl {
/** Holds if this declaration is also a definition of its function. */
override predicate isDefinition() { fun_def(underlyingElement(this)) }
/** Holds if this declaration is a Template specialization. */
/** Holds if this declaration is a template specialization. */
predicate isSpecialization() { fun_specialized(underlyingElement(this)) }
/**
@@ -715,6 +715,27 @@ class FunctionDeclarationEntry extends DeclarationEntry, @fun_decl {
* specification.
*/
predicate isNoExcept() { fun_decl_empty_noexcept(underlyingElement(this)) }
/**
* Gets a requires clause if this declaration is a template with such a clause.
*/
Expr getARequiresClause() { fun_requires(underlyingElement(this), _, unresolveElement(result)) }
/**
* Gets the requires clause that appears after the template argument list if this
* declaration is a template with such a clause.
*/
Expr getTemplateRequiresClause() {
fun_requires(underlyingElement(this), 1, unresolveElement(result))
}
/**
* Gets the requires clause that appears after the declarator if this declaration
* is a template with such a clause.
*/
Expr getFunctionRequiresClause() {
fun_requires(underlyingElement(this), 2, unresolveElement(result))
}
}
/**

View File

@@ -88,6 +88,10 @@ private Declaration getAnEnclosingDeclaration(Locatable ast) {
or
result = ast.(Initializer).getDeclaration()
or
exists(ConceptIdExpr concept | ast = concept.getATemplateArgument() |
result = concept.getEnclosingFunction()
)
or
result = ast
}
@@ -107,6 +111,12 @@ private newtype TPrintAstNode =
TRequiresExprParametersNode(RequiresExpr req) {
shouldPrintDeclaration(getAnEnclosingDeclaration(req))
} or
TConceptIdExprArgumentsNode(ConceptIdExpr concept) {
shouldPrintDeclaration(getAnEnclosingDeclaration(concept))
} or
TConceptIdExprTypeArgumentNode(Type type, ConceptIdExpr concept, int childIndex) {
type = concept.getTemplateArgument(childIndex)
} or
TConstructorInitializersNode(Constructor ctor) {
ctor.hasEntryPoint() and
shouldPrintDeclaration(ctor)
@@ -357,6 +367,26 @@ class StringLiteralNode extends ExprNode {
override string getValue() { result = "\"" + escapeString(expr.getValue()) + "\"" }
}
/**
* A node representing a `ConceptIdExpr`.
*/
class ConceptIdExprNode extends ExprNode {
override ConceptIdExpr expr;
override PrintAstNode getChildInternal(int childIndex) {
result = super.getChildInternal(childIndex)
or
childIndex = -1 and
result.(ConceptIdExprArgumentsNode).getConceptIdExpr() = expr
}
override string getChildAccessorPredicateInternal(int childIndex) {
result = super.getChildAccessorPredicateInternal(childIndex)
or
childIndex = -1 and result = "<args>"
}
}
/**
* A node representing a `Conversion`.
*/
@@ -593,6 +623,63 @@ class InitializerNode extends AstNode {
}
}
/**
* A node representing the arguments of a `ConceptIdExpr`.
*/
class ConceptIdExprArgumentsNode extends PrintAstNode, TConceptIdExprArgumentsNode {
ConceptIdExpr concept;
ConceptIdExprArgumentsNode() { this = TConceptIdExprArgumentsNode(concept) }
final override string toString() { result = "" }
final override Location getLocation() { result = getRepresentativeLocation(concept) }
override PrintAstNode getChildInternal(int childIndex) {
exists(Locatable arg | arg = concept.getTemplateArgument(childIndex) |
result.(ConceptIdExprTypeArgumentNode).isArgumentNode(arg, concept, childIndex)
or
result.(ExprNode).getAst() = arg
)
}
override string getChildAccessorPredicateInternal(int childIndex) {
exists(this.getChildInternal(childIndex)) and
result = "getTemplateArgument(" + childIndex + ")"
}
/**
* Gets the `ConceptIdExpr` for which this node represents the parameters.
*/
final ConceptIdExpr getConceptIdExpr() { result = concept }
}
/**
* A node representing a type argument of a `ConceptIdExpr`.
*/
class ConceptIdExprTypeArgumentNode extends PrintAstNode, TConceptIdExprTypeArgumentNode {
Type type;
ConceptIdExpr concept;
int index;
ConceptIdExprTypeArgumentNode() { this = TConceptIdExprTypeArgumentNode(type, concept, index) }
final override string toString() { result = qlClass(type) + type.toString() }
final override Location getLocation() { result = getRepresentativeLocation(type) }
override AstNode getChildInternal(int childIndex) { none() }
override string getChildAccessorPredicateInternal(int childIndex) { none() }
/**
* Holds if `t` is the `i`th template argument of `c`.
*/
predicate isArgumentNode(Type t, ConceptIdExpr c, int i) {
type = t and concept = c and index = i
}
}
/**
* A node representing the parameters of a `Function`.
*/
@@ -611,7 +698,7 @@ class FunctionParametersNode extends PrintAstNode, TFunctionParametersNode {
override string getChildAccessorPredicateInternal(int childIndex) {
exists(this.getChildInternal(childIndex)) and
result = "getParameter(" + childIndex.toString() + ")"
result = "getParameter(" + childIndex + ")"
}
/**
@@ -638,7 +725,7 @@ class RequiresExprParametersNode extends PrintAstNode, TRequiresExprParametersNo
override string getChildAccessorPredicateInternal(int childIndex) {
exists(this.getChildInternal(childIndex)) and
result = "getParameter(" + childIndex.toString() + ")"
result = "getParameter(" + childIndex + ")"
}
/**
@@ -665,7 +752,7 @@ class ConstructorInitializersNode extends PrintAstNode, TConstructorInitializers
final override string getChildAccessorPredicateInternal(int childIndex) {
exists(this.getChildInternal(childIndex)) and
result = "getInitializer(" + childIndex.toString() + ")"
result = "getInitializer(" + childIndex + ")"
}
/**
@@ -692,7 +779,7 @@ class DestructorDestructionsNode extends PrintAstNode, TDestructorDestructionsNo
final override string getChildAccessorPredicateInternal(int childIndex) {
exists(this.getChildInternal(childIndex)) and
result = "getDestruction(" + childIndex.toString() + ")"
result = "getDestruction(" + childIndex + ")"
}
/**
@@ -825,6 +912,10 @@ private predicate namedStmtChildPredicates(Locatable s, Element e, string pred)
or
s.(ConstexprIfStmt).getElse() = e and pred = "getElse()"
or
s.(ConstevalIfStmt).getThen() = e and pred = "getThen()"
or
s.(ConstevalIfStmt).getElse() = e and pred = "getElse()"
or
s.(Handler).getParameter() = e and pred = "getParameter()"
or
s.(IfStmt).getInitialization() = e and pred = "getInitialization()"

View File

@@ -20,7 +20,7 @@ import semmle.code.cpp.Class
* ```
*/
class Struct extends Class {
Struct() { usertypes(underlyingElement(this), _, 1) or usertypes(underlyingElement(this), _, 3) }
Struct() { usertypes(underlyingElement(this), _, [1, 3, 15, 17]) }
override string getAPrimaryQlClass() { result = "Struct" }

View File

@@ -52,13 +52,18 @@ deprecated class TemplateParameter = TypeTemplateParameter;
* ```
*/
class TypeTemplateParameter extends UserType, TemplateParameterImpl {
TypeTemplateParameter() {
usertypes(underlyingElement(this), _, 7) or usertypes(underlyingElement(this), _, 8)
}
TypeTemplateParameter() { usertypes(underlyingElement(this), _, [7, 8]) }
override string getAPrimaryQlClass() { result = "TypeTemplateParameter" }
override predicate involvesTemplateParameter() { any() }
/**
* Get the type constraint of this type template parameter.
*/
Expr getTypeConstraint() {
type_template_type_constraint(underlyingElement(this), unresolveElement(result))
}
}
/**

View File

@@ -406,10 +406,7 @@ class IntegralOrEnumType extends Type {
isIntegralType(underlyingElement(this), _)
or
// Enum type
(
usertypes(underlyingElement(this), _, 4) or
usertypes(underlyingElement(this), _, 13)
)
usertypes(underlyingElement(this), _, [4, 13])
}
}

View File

@@ -13,10 +13,7 @@ private import semmle.code.cpp.internal.ResolveClass
* ```
*/
class TypedefType extends UserType {
TypedefType() {
usertypes(underlyingElement(this), _, 5) or
usertypes(underlyingElement(this), _, 14)
}
TypedefType() { usertypes(underlyingElement(this), _, [5, 14]) }
/**
* Gets the base type of this typedef type.

View File

@@ -15,7 +15,7 @@ import semmle.code.cpp.Struct
* ```
*/
class Union extends Struct {
Union() { usertypes(underlyingElement(this), _, 3) }
Union() { usertypes(underlyingElement(this), _, [3, 17]) }
override string getAPrimaryQlClass() { result = "Union" }

View File

@@ -129,4 +129,9 @@ class TypeDeclarationEntry extends DeclarationEntry, @type_decl {
* class or typedef.
*/
predicate isTopLevel() { type_decl_top(underlyingElement(this)) }
/**
* Gets the requires clause if this declaration is a template with such a clause.
*/
Expr getRequiresClause() { type_requires(underlyingElement(this), unresolveElement(result)) }
}

View File

@@ -187,6 +187,14 @@ class Variable extends Declaration, @variable {
* `for (char c : str) { ... }`
*/
predicate isCompilerGenerated() { compgenerated(underlyingElement(this)) }
/** Holds if this variable is a template specialization. */
predicate isSpecialization() {
exists(VariableDeclarationEntry vde |
var_decls(unresolveElement(vde), underlyingElement(this), _, _, _) and
vde.isSpecialization()
)
}
}
/**
@@ -267,6 +275,14 @@ class VariableDeclarationEntry extends DeclarationEntry, @var_decl {
override predicate isDefinition() { var_def(underlyingElement(this)) }
override string getASpecifier() { var_decl_specifiers(underlyingElement(this), result) }
/** Holds if this declaration is a template specialization. */
predicate isSpecialization() { var_specialized(underlyingElement(this)) }
/**
* Gets the requires clause if this declaration is a template with such a clause.
*/
Expr getRequiresClause() { var_requires(underlyingElement(this), unresolveElement(result)) }
}
/**
@@ -594,7 +610,10 @@ class TemplateVariable extends Variable {
/**
* Gets an instantiation of this variable template.
*/
Variable getAnInstantiation() { result.isConstructedFrom(this) }
Variable getAnInstantiation() {
result.isConstructedFrom(this) and
not result.isSpecialization()
}
}
/**
@@ -624,6 +643,21 @@ class VariableTemplateInstantiation extends Variable {
TemplateVariable getTemplate() { result = tv }
}
/**
* An explicit specialization of a C++ variable template.
*/
class VariableTemplateSpecialization extends Variable {
VariableTemplateSpecialization() { this.isSpecialization() }
override string getAPrimaryQlClass() { result = "VariableTemplateSpecialization" }
/**
* Gets the primary template for the specialization (the function template
* this specializes).
*/
TemplateVariable getPrimaryTemplate() { this.isConstructedFrom(result) }
}
/**
* A non-static local variable or parameter that is not part of an
* uninstantiated template. Uninstantiated templates are purely syntax, and

View File

@@ -233,6 +233,114 @@ private class GuardConditionFromBinaryLogicalOperator extends GuardConditionImpl
}
}
/**
* Holds if `ir` controls `block`, meaning that `block` is only
* entered if the value of this condition is `v`. This helper
* predicate does not necessarily hold for binary logical operations like
* `&&` and `||`. See the detailed explanation on predicate `controls`.
*/
private predicate controlsBlock(IRGuardCondition ir, BasicBlock controlled, AbstractValue v) {
exists(IRBlock irb |
ir.valueControls(irb, v) and
nonExcludedIRAndBasicBlock(irb, controlled) and
not isUnreachedBlock(irb)
)
}
private class GuardConditionFromNotExpr extends GuardConditionImpl {
IRGuardCondition ir;
GuardConditionFromNotExpr() {
// Users often expect the `x` in `!x` to also be a guard condition. But
// from the perspective of the IR the `x` is just the left-hand side of a
// comparison against 0 so it's not included as a normal
// `IRGuardCondition`. So to align with user expectations we make that `x`
// a `GuardCondition`.
exists(NotExpr notExpr |
this = notExpr.getOperand() and
ir.getUnconvertedResultExpression() = notExpr
)
}
override predicate valueControls(BasicBlock controlled, AbstractValue v) {
// This condition must determine the flow of control; that is, this
// node must be a top-level condition.
controlsBlock(ir, controlled, v.getDualValue())
}
pragma[inline]
override predicate comparesLt(Expr left, Expr right, int k, boolean isLessThan, boolean testIsTrue) {
exists(Instruction li, Instruction ri |
li.getUnconvertedResultExpression() = left and
ri.getUnconvertedResultExpression() = right and
ir.comparesLt(li.getAUse(), ri.getAUse(), k, isLessThan, testIsTrue.booleanNot())
)
}
pragma[inline]
override predicate comparesLt(Expr e, int k, boolean isLessThan, AbstractValue value) {
exists(Instruction i |
i.getUnconvertedResultExpression() = e and
ir.comparesLt(i.getAUse(), k, isLessThan, value.getDualValue())
)
}
pragma[inline]
override predicate ensuresLt(Expr left, Expr right, int k, BasicBlock block, boolean isLessThan) {
exists(Instruction li, Instruction ri, boolean testIsTrue |
li.getUnconvertedResultExpression() = left and
ri.getUnconvertedResultExpression() = right and
ir.comparesLt(li.getAUse(), ri.getAUse(), k, isLessThan, testIsTrue.booleanNot()) and
this.controls(block, testIsTrue)
)
}
pragma[inline]
override predicate ensuresLt(Expr e, int k, BasicBlock block, boolean isLessThan) {
exists(Instruction i, AbstractValue value |
i.getUnconvertedResultExpression() = e and
ir.comparesLt(i.getAUse(), k, isLessThan, value.getDualValue()) and
this.valueControls(block, value)
)
}
pragma[inline]
override predicate comparesEq(Expr left, Expr right, int k, boolean areEqual, boolean testIsTrue) {
exists(Instruction li, Instruction ri |
li.getUnconvertedResultExpression() = left and
ri.getUnconvertedResultExpression() = right and
ir.comparesEq(li.getAUse(), ri.getAUse(), k, areEqual, testIsTrue.booleanNot())
)
}
pragma[inline]
override predicate ensuresEq(Expr left, Expr right, int k, BasicBlock block, boolean areEqual) {
exists(Instruction li, Instruction ri, boolean testIsTrue |
li.getUnconvertedResultExpression() = left and
ri.getUnconvertedResultExpression() = right and
ir.comparesEq(li.getAUse(), ri.getAUse(), k, areEqual, testIsTrue.booleanNot()) and
this.controls(block, testIsTrue)
)
}
pragma[inline]
override predicate comparesEq(Expr e, int k, boolean areEqual, AbstractValue value) {
exists(Instruction i |
i.getUnconvertedResultExpression() = e and
ir.comparesEq(i.getAUse(), k, areEqual, value.getDualValue())
)
}
pragma[inline]
override predicate ensuresEq(Expr e, int k, BasicBlock block, boolean areEqual) {
exists(Instruction i, AbstractValue value |
i.getUnconvertedResultExpression() = e and
ir.comparesEq(i.getAUse(), k, areEqual, value.getDualValue()) and
this.valueControls(block, value)
)
}
}
/**
* A Boolean condition in the AST that guards one or more basic blocks and has a corresponding IR
* instruction.
@@ -245,7 +353,7 @@ private class GuardConditionFromIR extends GuardConditionImpl {
override predicate valueControls(BasicBlock controlled, AbstractValue v) {
// This condition must determine the flow of control; that is, this
// node must be a top-level condition.
this.controlsBlock(controlled, v)
controlsBlock(ir, controlled, v)
}
pragma[inline]
@@ -319,20 +427,6 @@ private class GuardConditionFromIR extends GuardConditionImpl {
this.valueControls(block, value)
)
}
/**
* Holds if this condition controls `block`, meaning that `block` is only
* entered if the value of this condition is `v`. This helper
* predicate does not necessarily hold for binary logical operations like
* `&&` and `||`. See the detailed explanation on predicate `controls`.
*/
private predicate controlsBlock(BasicBlock controlled, AbstractValue v) {
exists(IRBlock irb |
ir.valueControls(irb, v) and
nonExcludedIRAndBasicBlock(irb, controlled) and
not isUnreachedBlock(irb)
)
}
}
private predicate excludeAsControlledInstruction(Instruction instr) {
@@ -588,7 +682,7 @@ class IRGuardCondition extends Instruction {
/** Holds if (determined by this guard) `op == k` evaluates to `areEqual` if this expression evaluates to `value`. */
pragma[inline]
predicate comparesEq(Operand op, int k, boolean areEqual, AbstractValue value) {
unary_compares_eq(valueNumber(this), op, k, areEqual, false, value)
unary_compares_eq(valueNumber(this), op, k, areEqual, value)
}
/**
@@ -610,7 +704,7 @@ class IRGuardCondition extends Instruction {
pragma[inline]
predicate ensuresEq(Operand op, int k, IRBlock block, boolean areEqual) {
exists(AbstractValue value |
unary_compares_eq(valueNumber(this), op, k, areEqual, false, value) and
unary_compares_eq(valueNumber(this), op, k, areEqual, value) and
this.valueControls(block, value)
)
}
@@ -636,7 +730,7 @@ class IRGuardCondition extends Instruction {
pragma[inline]
predicate ensuresEqEdge(Operand op, int k, IRBlock pred, IRBlock succ, boolean areEqual) {
exists(AbstractValue value |
unary_compares_eq(valueNumber(this), op, k, areEqual, false, value) and
unary_compares_eq(valueNumber(this), op, k, areEqual, value) and
this.valueControlsEdge(pred, succ, value)
)
}
@@ -847,77 +941,71 @@ private module Cached {
compares_eq(test.(BuiltinExpectCallValueNumber).getCondition(), left, right, k, areEqual, value)
}
private predicate isConvertedBool(Instruction instr) {
instr.getResultIRType() instanceof IRBooleanType
or
isConvertedBool(instr.(ConvertInstruction).getUnary())
or
isConvertedBool(instr.(BuiltinExpectCallInstruction).getCondition())
}
/**
* Holds if `op == k` is `areEqual` given that `test` is equal to `value`.
*
* Many internal predicates in this file have a `inNonZeroCase` column.
* Ideally, the `k` column would be a type such as `Option<int>::Option`, to
* represent whether we have a concrete value `k` such that `op == k`, or whether
* we only know that `op != 0`.
* However, cannot instantiate `Option` with an infinite type. Thus the boolean
* `inNonZeroCase` is used to distinquish the `Some` (where we have a concrete
* value `k`) and `None` cases (where we only know that `op != 0`).
*
* Thus, if `inNonZeroCase = true` then `op != 0` and the value of `k` is
* meaningless.
*
* To see why `inNonZeroCase` is needed consider the following C program:
* ```c
* char* p = ...;
* if(p) {
* use(p);
* }
* ```
* in C++ there would be an int-to-bool conversion on `p`. However, since C
* does not have booleans there is no conversion. We want to be able to
* conclude that `p` is non-zero in the true branch, so we need to give `k`
* some value. However, simply setting `k = 1` would make the rest of the
* analysis think that `k == 1` holds inside the branch. So we distinquish
* between the above case and
* ```c
* if(p == 1) {
* use(p)
* }
* ```
* by setting `inNonZeroCase` to `true` in the former case, but not in the
* latter.
*/
cached
predicate unary_compares_eq(
ValueNumber test, Operand op, int k, boolean areEqual, boolean inNonZeroCase,
AbstractValue value
ValueNumber test, Operand op, int k, boolean areEqual, AbstractValue value
) {
/* The simple case where the test *is* the comparison so areEqual = testIsTrue xor eq. */
exists(AbstractValue v | unary_simple_comparison_eq(test, op, k, inNonZeroCase, v) |
exists(AbstractValue v | unary_simple_comparison_eq(test, op, k, v) |
areEqual = true and value = v
or
areEqual = false and value = v.getDualValue()
)
or
unary_complex_eq(test, op, k, areEqual, inNonZeroCase, value)
unary_complex_eq(test, op, k, areEqual, value)
or
/* (x is true => (op == k)) => (!x is false => (op == k)) */
exists(AbstractValue dual, boolean inNonZeroCase0 |
exists(AbstractValue dual |
value = dual.getDualValue() and
unary_compares_eq(test.(LogicalNotValueNumber).getUnary(), op, k, inNonZeroCase0, areEqual,
dual)
|
k = 0 and inNonZeroCase = inNonZeroCase0
or
k != 0 and inNonZeroCase = true
unary_compares_eq(test.(LogicalNotValueNumber).getUnary(), op, k, areEqual, dual)
)
or
// ((test is `areEqual` => op == const + k2) and const == `k1`) =>
// test is `areEqual` => op == k1 + k2
inNonZeroCase = false and
exists(int k1, int k2, Instruction const |
compares_eq(test, op, const.getAUse(), k2, areEqual, value) and
int_value(const) = k1 and
k = k1 + k2
)
or
unary_compares_eq(test.(BuiltinExpectCallValueNumber).getCondition(), op, k, areEqual,
inNonZeroCase, value)
exists(CompareValueNumber cmp, Operand left, Operand right, AbstractValue v |
test = cmp and
cmp.hasOperands(left, right) and
isConvertedBool(left.getDef()) and
int_value(right.getDef()) = 0 and
unary_compares_eq(valueNumberOfOperand(left), op, k, areEqual, v)
|
cmp instanceof CompareNEValueNumber and
v = value
or
cmp instanceof CompareEQValueNumber and
v.getDualValue() = value
)
or
unary_compares_eq(test.(BuiltinExpectCallValueNumber).getCondition(), op, k, areEqual, value)
or
exists(BinaryLogicalOperation logical, Expr operand, boolean b |
test.getAnInstruction().getUnconvertedResultExpression() = logical and
op.getDef().getUnconvertedResultExpression() = operand and
logical.impliesValue(operand, b, value.(BooleanValue).getValue())
|
k = 1 and
areEqual = b
or
k = 0 and
areEqual = b.booleanNot()
)
}
/** Rearrange various simple comparisons into `left == right + k` form. */
@@ -939,74 +1027,64 @@ private module Cached {
* Holds if `op` is an operand that is eventually used in a unary comparison
* with a constant.
*/
private predicate isRelevantUnaryComparisonOperand(Operand op) {
// Base case: `op` is an operand of a `CompareEQInstruction` or `CompareNEInstruction`,
// and the other operand is a constant.
exists(CompareInstruction eq, Instruction instr |
eq.hasOperands(op, instr.getAUse()) and
exists(int_value(instr))
|
eq instanceof CompareEQInstruction
or
eq instanceof CompareNEInstruction
)
or
// C doesn't have int-to-bool conversions, so `if(x)` will just generate:
// r2_1(glval<int>) = VariableAddress[x]
// r2_2(int) = Load[x] : &:r2_1, m1_6
// v2_3(void) = ConditionalBranch : r2_2
exists(ConditionalBranchInstruction branch | branch.getConditionOperand() = op)
private predicate mayBranchOn(Instruction instr) {
exists(ConditionalBranchInstruction branch | branch.getCondition() = instr)
or
// If `!x` is a relevant unary comparison then so is `x`.
exists(LogicalNotInstruction logicalNot |
isRelevantUnaryComparisonOperand(unique( | | logicalNot.getAUse())) and
logicalNot.getUnaryOperand() = op
mayBranchOn(logicalNot) and
logicalNot.getUnary() = instr
)
or
// If `y` is a relevant unary comparison and `y = x` then so is `x`.
not op.isDefinitionInexact() and
exists(CopyInstruction copy |
isRelevantUnaryComparisonOperand(unique( | | copy.getAUse())) and
op = copy.getSourceValueOperand()
mayBranchOn(copy) and
instr = copy.getSourceValue()
)
or
// If phi(x1, x2) is a relevant unary comparison then so are `x1` and `x2`.
not op.isDefinitionInexact() and
exists(PhiInstruction phi |
isRelevantUnaryComparisonOperand(unique( | | phi.getAUse())) and
op = phi.getAnInputOperand()
mayBranchOn(phi) and
instr = phi.getAnInput()
)
or
// If `__builtin_expect(x)` is a relevant unary comparison then so is `x`.
exists(BuiltinExpectCallInstruction call |
isRelevantUnaryComparisonOperand(unique( | | call.getAUse())) and
op = call.getConditionOperand()
mayBranchOn(call) and
instr = call.getCondition()
)
}
/** Rearrange various simple comparisons into `op == k` form. */
private predicate unary_simple_comparison_eq(
ValueNumber test, Operand op, int k, boolean inNonZeroCase, AbstractValue value
ValueNumber test, Operand op, int k, AbstractValue value
) {
exists(CaseEdge case, SwitchConditionValueNumber condition |
condition = test and
op = condition.getExpressionOperand() and
case = value.(MatchValue).getCase() and
exists(condition.getSuccessor(case)) and
case.getValue().toInt() = k and
inNonZeroCase = false
case.getValue().toInt() = k
)
or
isRelevantUnaryComparisonOperand(op) and
op.getDef() = test.getAnInstruction() and
(
k = 1 and
exists(Instruction const | int_value(const) = k |
value.(BooleanValue).getValue() = true and
inNonZeroCase = true
test.(CompareEQValueNumber).hasOperands(op, const.getAUse())
or
k = 0 and
value.(BooleanValue).getValue() = false and
inNonZeroCase = false
test.(CompareNEValueNumber).hasOperands(op, const.getAUse())
)
or
exists(BooleanValue bv |
bv = value and
mayBranchOn(op.getDef()) and
op = test.getAUse()
|
k = 0 and
bv.getValue() = false
or
k = 1 and
bv.getValue() = true
)
}
@@ -1061,13 +1139,12 @@ private module Cached {
* an instruction that compares the value of `__builtin_expect(op == k, _)` to `0`.
*/
private predicate unary_builtin_expect_eq(
CompareValueNumber cmp, Operand op, int k, boolean areEqual, boolean inNonZeroCase,
AbstractValue value
CompareValueNumber cmp, Operand op, int k, boolean areEqual, AbstractValue value
) {
exists(BuiltinExpectCallValueNumber call, Instruction const, AbstractValue innerValue |
int_value(const) = 0 and
cmp.hasOperands(call.getAUse(), const.getAUse()) and
unary_compares_eq(call.getCondition(), op, k, areEqual, inNonZeroCase, innerValue)
unary_compares_eq(call.getCondition(), op, k, areEqual, innerValue)
|
cmp instanceof CompareNEValueNumber and
value = innerValue
@@ -1078,14 +1155,13 @@ private module Cached {
}
private predicate unary_complex_eq(
ValueNumber test, Operand op, int k, boolean areEqual, boolean inNonZeroCase,
AbstractValue value
ValueNumber test, Operand op, int k, boolean areEqual, AbstractValue value
) {
unary_sub_eq(test, op, k, areEqual, inNonZeroCase, value)
unary_sub_eq(test, op, k, areEqual, value)
or
unary_add_eq(test, op, k, areEqual, inNonZeroCase, value)
unary_add_eq(test, op, k, areEqual, value)
or
unary_builtin_expect_eq(test, op, k, areEqual, inNonZeroCase, value)
unary_builtin_expect_eq(test, op, k, areEqual, value)
}
/*
@@ -1347,20 +1423,17 @@ private module Cached {
// op - x == c => op == (c+x)
private predicate unary_sub_eq(
ValueNumber test, Operand op, int k, boolean areEqual, boolean inNonZeroCase,
AbstractValue value
ValueNumber test, Operand op, int k, boolean areEqual, AbstractValue value
) {
inNonZeroCase = false and
exists(SubInstruction sub, int c, int x |
unary_compares_eq(test, sub.getAUse(), c, areEqual, inNonZeroCase, value) and
unary_compares_eq(test, sub.getAUse(), c, areEqual, value) and
op = sub.getLeftOperand() and
x = int_value(sub.getRight()) and
k = c + x
)
or
inNonZeroCase = false and
exists(PointerSubInstruction sub, int c, int x |
unary_compares_eq(test, sub.getAUse(), c, areEqual, inNonZeroCase, value) and
unary_compares_eq(test, sub.getAUse(), c, areEqual, value) and
op = sub.getLeftOperand() and
x = int_value(sub.getRight()) and
k = c + x
@@ -1415,12 +1488,10 @@ private module Cached {
// left + x == right + c => left == right + (c-x)
private predicate unary_add_eq(
ValueNumber test, Operand left, int k, boolean areEqual, boolean inNonZeroCase,
AbstractValue value
ValueNumber test, Operand left, int k, boolean areEqual, AbstractValue value
) {
inNonZeroCase = false and
exists(AddInstruction lhs, int c, int x |
unary_compares_eq(test, lhs.getAUse(), c, areEqual, inNonZeroCase, value) and
unary_compares_eq(test, lhs.getAUse(), c, areEqual, value) and
(
left = lhs.getLeftOperand() and x = int_value(lhs.getRight())
or
@@ -1429,9 +1500,8 @@ private module Cached {
k = c - x
)
or
inNonZeroCase = false and
exists(PointerAddInstruction lhs, int c, int x |
unary_compares_eq(test, lhs.getAUse(), c, areEqual, inNonZeroCase, value) and
unary_compares_eq(test, lhs.getAUse(), c, areEqual, value) and
(
left = lhs.getLeftOperand() and x = int_value(lhs.getRight())
or
@@ -1453,3 +1523,25 @@ private module Cached {
}
private import Cached
/**
* Holds if `left < right + k` evaluates to `isLt` given that some guard
* evaluates to `value`.
*
* To find the specific guard that performs the comparison
* use `IRGuards.comparesLt`.
*/
predicate comparesLt(Operand left, Operand right, int k, boolean isLt, AbstractValue value) {
compares_lt(_, left, right, k, isLt, value)
}
/**
* Holds if `left = right + k` evaluates to `isLt` given that some guard
* evaluates to `value`.
*
* To find the specific guard that performs the comparison
* use `IRGuards.comparesEq`.
*/
predicate comparesEq(Operand left, Operand right, int k, boolean isLt, AbstractValue value) {
compares_eq(_, left, right, k, isLt, value)
}

View File

@@ -876,6 +876,25 @@ private predicate subEdge(Pos p1, Node n1, Node n2, Pos p2) {
p2.nodeAfter(n2, s)
)
or
// NotConstevalIfStmt -> { then, else } ->
exists(ConstevalIfStmt s |
p1.nodeAt(n1, s) and
p2.nodeBefore(n2, s.getThen())
or
p1.nodeAt(n1, s) and
p2.nodeBefore(n2, s.getElse())
or
p1.nodeAt(n1, s) and
not exists(s.getElse()) and
p2.nodeAfter(n2, s)
or
p1.nodeAfter(n1, s.getThen()) and
p2.nodeAfter(n2, s)
or
p1.nodeAfter(n1, s.getElse()) and
p2.nodeAfter(n2, s)
)
or
// WhileStmt -> condition ; body -> condition ; after dtors -> after
exists(WhileStmt s |
p1.nodeAt(n1, s) and

View File

@@ -529,8 +529,21 @@ private string getTypeName(Type t, boolean needsSpace) {
needsSpace = false and
(if needsSpace0 = true then result = s + " *" else result = s + "*")
or
// We don't need to check for `needsSpace0` here because the type of
// `x` in `int x[1024]` is formatted without a space between the bracket
// and the `int` by `Type.getName`. That is, calling `Type.getName` on
// the type of `x` gives `int[1024]` and not `int [1024]`.
needsSpace = false and
exists(ArrayType array | array = dt |
result = s + "[" + array.getArraySize() + "]"
or
not array.hasArraySize() and
result = s + "[]"
)
or
not dt instanceof ReferenceType and
not dt instanceof PointerType and
not dt instanceof ArrayType and
result = s and
needsSpace = needsSpace0
)

View File

@@ -12,8 +12,14 @@ private import semmle.code.cpp.dataflow.ExternalFlow
private import semmle.code.cpp.ir.IR
module Input implements InputSig<Location, DataFlowImplSpecific::CppDataFlow> {
private import codeql.util.Void
class SummarizedCallableBase = Function;
class SourceBase = Void;
class SinkBase = Void;
ArgumentPosition callbackSelfParameterPosition() { result = TDirectPosition(-1) }
ReturnKind getStandardReturnValueKind() { result.(NormalReturnKind).getIndirectionIndex() = 0 }
@@ -93,6 +99,10 @@ private module StepsInput implements Impl::Private::StepsInputSig {
DataFlowCall getACall(Public::SummarizedCallable sc) {
result.getStaticCallTarget().getUnderlyingCallable() = sc
}
Node getSourceNode(Input::SourceBase source, Impl::Private::SummaryComponent sc) { none() }
Node getSinkNode(Input::SinkBase sink, Impl::Private::SummaryComponent sc) { none() }
}
module SourceSinkInterpretationInput implements

View File

@@ -227,11 +227,11 @@ class ProxyClass extends UserType {
}
class TypeTemplateParameter extends UserType {
TypeTemplateParameter() { usertypes(this, _, 7) or usertypes(this, _, 8) }
TypeTemplateParameter() { usertypes(this, _, [7, 8]) }
}
class TemplateClass extends UserType {
TemplateClass() { usertypes(this, _, 6) }
TemplateClass() { usertypes(this, _, [15, 16, 17]) }
UserType getAnInstantiation() {
class_instantiation(result, this) and

View File

@@ -114,15 +114,7 @@ private module Cached {
* Holds if `t` is a struct, class, union, or template.
*/
cached
predicate isClass(@usertype t) {
usertypes(t, _, 1) or
usertypes(t, _, 2) or
usertypes(t, _, 3) or
usertypes(t, _, 6) or
usertypes(t, _, 10) or
usertypes(t, _, 11) or
usertypes(t, _, 12)
}
predicate isClass(@usertype t) { usertypes(t, _, [1, 2, 3, 15, 16, 17]) }
cached
predicate isType(@type t) {

View File

@@ -382,7 +382,7 @@ private class SideEffectArgumentNode extends ArgumentNode, SideEffectOperandNode
exists(int indirectionIndex |
pos = TIndirectionPosition(argumentIndex, pragma[only_bind_into](indirectionIndex)) and
this.getCallInstruction() = dfCall.asCallInstruction() and
super.hasAddressOperandAndIndirectionIndex(_, pragma[only_bind_into](indirectionIndex))
super.hasAddressOperandAndIndirectionIndex(arg, pragma[only_bind_into](indirectionIndex))
)
}
}

View File

@@ -757,9 +757,11 @@ class SsaIteratorNode extends Node, TSsaIteratorNode {
class SideEffectOperandNode extends Node instanceof IndirectOperand {
CallInstruction call;
int argumentIndex;
ArgumentOperand arg;
SideEffectOperandNode() {
IndirectOperand.super.hasOperandAndIndirectionIndex(call.getArgumentOperand(argumentIndex), _)
arg = call.getArgumentOperand(argumentIndex) and
IndirectOperand.super.hasOperandAndIndirectionIndex(arg, _)
}
CallInstruction getCallInstruction() { result = call }
@@ -2494,6 +2496,36 @@ module InstructionBarrierGuard<instructionGuardChecksSig/3 instructionGuardCheck
result = TSsaPhiInputNode(phi, input)
)
}
bindingset[value, n]
pragma[inline_late]
private predicate indirectOperandHasValueNumber(ValueNumber value, int indirectionIndex, Node n) {
exists(Operand use |
use = value.getAnInstruction().getAUse() and
n.asIndirectOperand(indirectionIndex) = use
)
}
/**
* Gets an indirect node with indirection index `indirectionIndex` that is
* safely guarded by the given guard check.
*/
Node getAnIndirectBarrierNode(int indirectionIndex) {
exists(IRGuardCondition g, ValueNumber value, boolean edge |
instructionGuardChecks(g, pragma[only_bind_into](value.getAnInstruction()), edge) and
indirectOperandHasValueNumber(value, indirectionIndex, result) and
controls(g, result, edge)
)
or
exists(
IRGuardCondition g, boolean branch, Ssa::DefinitionExt def, IRBlock input, Ssa::PhiNode phi
|
instructionGuardChecks(g, def.getARead().asIndirectOperand(indirectionIndex).getDef(), branch) and
guardControlsPhiInput(g, branch, def, pragma[only_bind_into](input),
pragma[only_bind_into](phi)) and
result = TSsaPhiInputNode(phi, input)
)
}
}
/**

View File

@@ -899,6 +899,24 @@ class MemoryLocation extends FinalMemoryLocation {
MemoryLocation() { not useOverlapWithBusyDef(this) }
}
bindingset[fun]
pragma[inline_late]
private MemoryLocation getUnknownMemoryLocation(IRFunction fun, boolean isMayAccess) {
result = TUnknownMemoryLocation(fun, isMayAccess)
}
bindingset[fun]
pragma[inline_late]
private MemoryLocation getAllAliasedMemory(IRFunction fun, boolean isMayAccess) {
result = TAllAliasedMemory(fun, isMayAccess)
}
bindingset[fun]
pragma[inline_late]
private MemoryLocation getAllNonLocalMemory(IRFunction fun, boolean isMayAccess) {
result = TAllNonLocalMemory(fun, isMayAccess)
}
MemoryLocation getResultMemoryLocation(Instruction instr) {
not canReuseSsaForOldResult(instr) and
exists(MemoryAccessKind kind, boolean isMayAccess |
@@ -926,7 +944,7 @@ MemoryLocation getResultMemoryLocation(Instruction instr) {
// And otherwise we assign it a memory location that groups all the relevant memory locations into one.
result = getGroupedMemoryLocation(var, unbindBool(isMayAccess), false)
)
else result = TUnknownMemoryLocation(instr.getEnclosingIRFunction(), isMayAccess)
else result = getUnknownMemoryLocation(instr.getEnclosingIRFunction(), isMayAccess)
)
or
kind instanceof EntireAllocationMemoryAccess and
@@ -935,10 +953,10 @@ MemoryLocation getResultMemoryLocation(Instruction instr) {
unbindBool(isMayAccess))
or
kind instanceof EscapedMemoryAccess and
result = TAllAliasedMemory(instr.getEnclosingIRFunction(), isMayAccess)
result = getAllAliasedMemory(instr.getEnclosingIRFunction(), isMayAccess)
or
kind instanceof NonLocalMemoryAccess and
result = TAllNonLocalMemory(instr.getEnclosingIRFunction(), isMayAccess)
result = getAllNonLocalMemory(instr.getEnclosingIRFunction(), isMayAccess)
)
)
}

View File

@@ -171,6 +171,23 @@ module Raw {
// forwarded the result of another translated expression.
instruction = translatedExpr.getInstruction(_)
)
or
// Consider the snippet `if(x) { ... }` where `x` is an integer.
// In C++ there is a `BoolConversion` conversion on `x` which generates a
// `CompareNEInstruction` whose `getInstructionConvertedResultExpression`
// is the `BoolConversion` (by the logic in the disjunct above). Thus,
// calling `getInstructionUnconvertedResultExpression` on the
// `CompareNEInstruction` gives `x` in C++ code.
// However, in C there is no such conversion to return. So instead we have
// to map the result of `getInstructionConvertedResultExpression` on the
// `CompareNEInstruction` to `x` manually. This ensures that calling
// `getInstructionUnconvertedResultExpression` on the `CompareNEInstruction`
// gives `x` in both the C case and C++ case.
exists(TranslatedValueCondition translatedValueCondition |
translatedValueCondition = getTranslatedCondition(result) and
translatedValueCondition.shouldGenerateCompareNE() and
instruction = translatedValueCondition.getInstruction(ValueConditionCompareTag())
)
}
cached

View File

@@ -38,7 +38,11 @@ newtype TInstructionTag =
AllocationSizeTag() or
AllocationElementSizeTag() or
AllocationExtentConvertTag() or
ValueConditionCompareTag() or
ValueConditionConstantTag() or
ValueConditionConditionalBranchTag() or
ValueConditionConditionalConstantTag() or
ValueConditionConditionalCompareTag() or
ConditionValueTrueTempAddressTag() or
ConditionValueTrueConstantTag() or
ConditionValueTrueStoreTag() or
@@ -49,6 +53,8 @@ newtype TInstructionTag =
ConditionValueResultLoadTag() or
BoolConversionConstantTag() or
BoolConversionCompareTag() or
NotExprOperationTag() or
NotExprConstantTag() or
ResultCopyTag() or
LoadTag() or // Implicit load due to lvalue-to-rvalue conversion
CatchTag() or
@@ -167,6 +173,14 @@ string getInstructionTagId(TInstructionTag tag) {
or
tag = ValueConditionConditionalBranchTag() and result = "ValCondCondBranch"
or
tag = ValueConditionConditionalConstantTag() and result = "ValueConditionConditionalConstant"
or
tag = ValueConditionConditionalCompareTag() and result = "ValueConditionConditionalCompare"
or
tag = ValueConditionCompareTag() and result = "ValCondCondCompare"
or
tag = ValueConditionConstantTag() and result = "ValCondConstant"
or
tag = ConditionValueTrueTempAddressTag() and result = "CondValTrueTempAddr"
or
tag = ConditionValueTrueConstantTag() and result = "CondValTrueConst"
@@ -187,6 +201,10 @@ string getInstructionTagId(TInstructionTag tag) {
or
tag = BoolConversionCompareTag() and result = "BoolConvComp"
or
tag = NotExprOperationTag() and result = "NotExprOperation"
or
tag = NotExprConstantTag() and result = "NotExprWithBoolConversionConstant"
or
tag = ResultCopyTag() and result = "ResultCopy"
or
tag = LoadTag() and result = "Load" // Implicit load due to lvalue-to-rvalue conversion

View File

@@ -47,7 +47,7 @@ abstract class TranslatedFlexibleCondition extends TranslatedCondition, Conditio
{
TranslatedFlexibleCondition() { this = TTranslatedFlexibleCondition(expr) }
final override predicate handlesDestructorsExplicitly() { none() } // TODO: this needs to be revisted when we get unnamed destructors
final override predicate handlesDestructorsExplicitly() { none() } // TODO: this needs to be revisited when we get unnamed destructors
final override TranslatedElement getChild(int id) { id = 0 and result = this.getOperand() }
@@ -187,7 +187,24 @@ class TranslatedValueCondition extends TranslatedCondition, TTranslatedValueCond
final override predicate handlesDestructorsExplicitly() { none() } // TODO: this needs to be revisted when we get unnamed destructors
private Type getValueExprType() {
result = this.getValueExpr().getExprType().getUnspecifiedType()
}
predicate shouldGenerateCompareNE() { not this.getValueExprType() instanceof BoolType }
override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) {
this.shouldGenerateCompareNE() and
(
tag = ValueConditionCompareTag() and
opcode instanceof Opcode::CompareNE and
resultType = getBoolType()
or
tag = ValueConditionConstantTag() and
opcode instanceof Opcode::Constant and
resultType = getTypeForPRValue(this.getValueExprType())
)
or
tag = ValueConditionConditionalBranchTag() and
opcode instanceof Opcode::ConditionalBranch and
resultType = getVoidType()
@@ -195,11 +212,24 @@ class TranslatedValueCondition extends TranslatedCondition, TTranslatedValueCond
override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
child = this.getValueExpr() and
result = this.getInstruction(ValueConditionConditionalBranchTag()) and
kind instanceof GotoEdge
kind instanceof GotoEdge and
if this.shouldGenerateCompareNE()
then result = this.getInstruction(ValueConditionConstantTag())
else result = this.getInstruction(ValueConditionConditionalBranchTag())
}
override Instruction getInstructionSuccessorInternal(InstructionTag tag, EdgeKind kind) {
this.shouldGenerateCompareNE() and
(
tag = ValueConditionConstantTag() and
kind instanceof GotoEdge and
result = this.getInstruction(ValueConditionCompareTag())
or
tag = ValueConditionCompareTag() and
kind instanceof GotoEdge and
result = this.getInstruction(ValueConditionConditionalBranchTag())
)
or
tag = ValueConditionConditionalBranchTag() and
(
kind instanceof TrueEdge and
@@ -211,9 +241,26 @@ class TranslatedValueCondition extends TranslatedCondition, TTranslatedValueCond
}
override Instruction getInstructionRegisterOperand(InstructionTag tag, OperandTag operandTag) {
this.shouldGenerateCompareNE() and
tag = ValueConditionCompareTag() and
(
operandTag instanceof LeftOperandTag and
result = this.getValueExpr().getResult()
or
operandTag instanceof RightOperandTag and
result = this.getInstruction(ValueConditionConstantTag())
)
or
tag = ValueConditionConditionalBranchTag() and
operandTag instanceof ConditionOperandTag and
result = this.getValueExpr().getResult()
if this.shouldGenerateCompareNE()
then result = this.getInstruction(ValueConditionCompareTag())
else result = this.getValueExpr().getResult()
}
override string getInstructionConstantValue(InstructionTag tag) {
tag = ValueConditionConstantTag() and
result = "0"
}
private TranslatedExpr getValueExpr() { result = getTranslatedExpr(expr) }

View File

@@ -166,7 +166,7 @@ private predicate ignoreExpr(Expr expr) {
}
/**
* Holds if the side effects of `expr` should be ignoredf for the purposes of IR generation.
* Holds if the side effects of `expr` should be ignored for the purposes of IR generation.
*
* In cases involving `constexpr`, a call can wind up as a constant expression. `ignoreExpr()` will
* not hold for such a call, since we do need to translate the call (as a constant), but we need to

View File

@@ -59,10 +59,19 @@ abstract class TranslatedExpr extends TranslatedElement {
final CppType getResultType() {
if this.isResultGLValue()
then result = getTypeForGLValue(expr.getType())
else result = getTypeForPRValue(expr.getType())
then result = getTypeForGLValue(this.getExprType())
else result = getTypeForPRValue(this.getExprType())
}
/**
* Gets the type of `expr`.
*
* This predicate can be overwritten in subclasses to modify the result
* of `getResultType` which determines the type of the instruction that
* generates the result of `expr`.
*/
Type getExprType() { result = expr.getType() }
/**
* Holds if the result of this `TranslatedExpr` is a glvalue.
*/
@@ -1262,9 +1271,10 @@ abstract class TranslatedSingleInstructionExpr extends TranslatedNonConstantExpr
class TranslatedUnaryExpr extends TranslatedSingleInstructionExpr {
TranslatedUnaryExpr() {
expr instanceof NotExpr or
expr instanceof ComplementExpr or
expr instanceof UnaryPlusExpr or
expr instanceof ComplementExpr
or
expr instanceof UnaryPlusExpr
or
expr instanceof UnaryMinusExpr
}
@@ -1298,8 +1308,6 @@ class TranslatedUnaryExpr extends TranslatedSingleInstructionExpr {
}
final override Opcode getOpcode() {
expr instanceof NotExpr and result instanceof Opcode::LogicalNot
or
expr instanceof ComplementExpr and result instanceof Opcode::BitComplement
or
expr instanceof UnaryPlusExpr and result instanceof Opcode::CopyValue
@@ -1312,6 +1320,100 @@ class TranslatedUnaryExpr extends TranslatedSingleInstructionExpr {
}
}
/**
* The IR translation of a `NotExpr`.
*
* In C++ an operation such as `!x` where `x` is an `int` will generate
* ```
* r1(glval<int>) = VariableAddress[x] :
* r2(int) = Load : &r1
* r3(int) = Constant[0] :
* r4(bool) = CompareNE : r2, r3
* r5(bool) = LogicalNot : r4
* ```
* since C does not do implicit int-to-bool casts we need to generate the
* `Constant[0]`, `CompareNE`, and `LogicalNot` instructions manually, but
* we simplify this and generate `Constant[0]`, `CompareEQ` instead.
*/
class TranslatedNotExpr extends TranslatedNonConstantExpr {
override NotExpr expr;
override Type getExprType() { result instanceof BoolType }
private Type getOperandType() { result = this.getOperand().getExprType().getUnspecifiedType() }
predicate shouldGenerateEq() { not this.getOperandType() instanceof BoolType }
final override Instruction getFirstInstruction(EdgeKind kind) {
result = this.getOperand().getFirstInstruction(kind)
}
override Instruction getALastInstructionInternal() {
result = this.getInstruction(NotExprOperationTag())
}
final override TranslatedElement getChildInternal(int id) {
id = 0 and result = this.getOperand()
}
override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) {
this.shouldGenerateEq() and
tag = NotExprConstantTag() and
opcode instanceof Opcode::Constant and
resultType = getTypeForPRValue(this.getOperandType())
or
resultType = getBoolType() and
tag = NotExprOperationTag() and
if this.shouldGenerateEq()
then opcode instanceof Opcode::CompareEQ
else opcode instanceof Opcode::LogicalNot
}
final override Instruction getInstructionSuccessorInternal(InstructionTag tag, EdgeKind kind) {
tag = NotExprOperationTag() and
result = this.getParent().getChildSuccessor(this, kind)
or
tag = NotExprConstantTag() and
kind instanceof GotoEdge and
result = this.getInstruction(NotExprOperationTag())
}
final override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
child = this.getOperand() and
kind instanceof GotoEdge and
if this.shouldGenerateEq()
then result = this.getInstruction(NotExprConstantTag())
else result = this.getInstruction(NotExprOperationTag())
}
final override Instruction getInstructionRegisterOperand(InstructionTag tag, OperandTag operandTag) {
tag = NotExprOperationTag() and
if this.shouldGenerateEq()
then (
result = this.getOperand().getResult() and
operandTag instanceof LeftOperandTag
or
result = this.getInstruction(NotExprConstantTag()) and
operandTag instanceof RightOperandTag
) else (
operandTag instanceof UnaryOperandTag and
result = this.getOperand().getResult()
)
}
private TranslatedExpr getOperand() {
result = getTranslatedExpr(expr.getOperand().getFullyConverted())
}
final override Instruction getResult() { result = this.getInstruction(NotExprOperationTag()) }
override string getInstructionConstantValue(InstructionTag tag) {
this.shouldGenerateEq() and
tag = NotExprConstantTag() and
result = "0"
}
}
/**
* IR translation of a `co_await` or `co_yield` expression.
*
@@ -1754,6 +1856,12 @@ class TranslatedBinaryOperation extends TranslatedSingleInstructionExpr {
result = comparisonOpcode(expr)
}
override Type getExprType() {
if exists(comparisonOpcode(expr))
then result instanceof BoolType
else result = super.getExprType()
}
override int getInstructionElementSize(InstructionTag tag) {
tag = OnlyInstructionTag() and
exists(Opcode opcode |
@@ -2857,6 +2965,10 @@ class TranslatedBinaryConditionalExpr extends TranslatedConditionalExpr {
result = this.getCondition().getFirstInstruction(kind)
}
private Type getConditionType() {
result = this.getCondition().getExprType().getUnspecifiedType()
}
override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) {
super.hasInstruction(opcode, tag, resultType)
or
@@ -2864,11 +2976,35 @@ class TranslatedBinaryConditionalExpr extends TranslatedConditionalExpr {
tag = ValueConditionConditionalBranchTag() and
opcode instanceof Opcode::ConditionalBranch and
resultType = getVoidType()
or
exists(Type t |
t = this.getConditionType() and
not t instanceof BoolType
|
tag = ValueConditionConditionalConstantTag() and
opcode instanceof Opcode::Constant and
resultType = getTypeForPRValue(t)
or
tag = ValueConditionConditionalCompareTag() and
opcode instanceof Opcode::CompareNE and
resultType = getBoolType()
)
}
override Instruction getInstructionSuccessorInternal(InstructionTag tag, EdgeKind kind) {
result = super.getInstructionSuccessorInternal(tag, kind)
or
not this.getConditionType() instanceof BoolType and
(
tag = ValueConditionConditionalConstantTag() and
kind instanceof GotoEdge and
result = this.getInstruction(ValueConditionConditionalCompareTag())
or
tag = ValueConditionConditionalCompareTag() and
kind instanceof GotoEdge and
result = this.getInstruction(ValueConditionConditionalBranchTag())
)
or
tag = ValueConditionConditionalBranchTag() and
(
kind instanceof TrueEdge and
@@ -2884,7 +3020,19 @@ class TranslatedBinaryConditionalExpr extends TranslatedConditionalExpr {
or
tag = ValueConditionConditionalBranchTag() and
operandTag instanceof ConditionOperandTag and
result = this.getCondition().getResult()
if this.getConditionType() instanceof BoolType
then result = this.getCondition().getResult()
else result = this.getInstruction(ValueConditionConditionalCompareTag())
or
not this.getConditionType() instanceof BoolType and
tag = ValueConditionConditionalCompareTag() and
(
operandTag instanceof LeftOperandTag and
result = this.getCondition().getResult()
or
operandTag instanceof RightOperandTag and
result = this.getInstruction(ValueConditionConditionalConstantTag())
)
}
override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
@@ -2892,7 +3040,9 @@ class TranslatedBinaryConditionalExpr extends TranslatedConditionalExpr {
or
kind instanceof GotoEdge and
child = this.getCondition() and
result = this.getInstruction(ValueConditionConditionalBranchTag())
if this.getConditionType() instanceof BoolType
then result = this.getInstruction(ValueConditionConditionalBranchTag())
else result = this.getInstruction(ValueConditionConditionalConstantTag())
}
private TranslatedExpr getCondition() {
@@ -2909,6 +3059,11 @@ class TranslatedBinaryConditionalExpr extends TranslatedConditionalExpr {
// always converting the "then" operand to `bool`, which is almost always the wrong type.
result = getTranslatedExpr(expr.getThen().getExplicitlyConverted())
}
override string getInstructionConstantValue(InstructionTag tag) {
tag = ValueConditionConditionalConstantTag() and
result = "0"
}
}
/**

View File

@@ -1098,6 +1098,61 @@ class TranslatedConstExprIfStmt extends TranslatedIfLikeStmt {
override predicate hasElse() { exists(stmt.getElse()) }
}
class TranslatedConstevalIfStmt extends TranslatedStmt {
override ConstevalIfStmt stmt;
override Instruction getFirstInstruction(EdgeKind kind) {
if not this.hasEvaluatedBranch()
then
kind instanceof GotoEdge and
result = this.getInstruction(OnlyInstructionTag())
else result = this.getEvaluatedBranch().getFirstInstruction(kind)
}
override TranslatedElement getChildInternal(int id) {
id = 0 and
result = this.getThen()
or
id = 1 and
result = this.getElse()
}
override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) {
not this.hasEvaluatedBranch() and
opcode instanceof Opcode::NoOp and
tag = OnlyInstructionTag() and
resultType = getVoidType()
}
override Instruction getALastInstructionInternal() {
if not this.hasEvaluatedBranch()
then result = this.getInstruction(OnlyInstructionTag())
else result = this.getEvaluatedBranch().getALastInstruction()
}
override TranslatedElement getLastChild() { result = this.getEvaluatedBranch() }
override Instruction getInstructionSuccessorInternal(InstructionTag tag, EdgeKind kind) {
tag = OnlyInstructionTag() and
result = this.getParent().getChildSuccessor(this, kind)
}
override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
(child = this.getThen() or child = this.getElse()) and
result = this.getParent().getChildSuccessor(this, kind)
}
TranslatedStmt getEvaluatedBranch() {
result = getTranslatedStmt(stmt.getRuntimeEvaluatedBranch())
}
predicate hasEvaluatedBranch() { stmt.hasRuntimeEvaluatedBranch() }
TranslatedStmt getThen() { result = getTranslatedStmt(stmt.getThen()) }
TranslatedStmt getElse() { result = getTranslatedStmt(stmt.getElse()) }
}
abstract class TranslatedLoop extends TranslatedStmt, ConditionContext {
override Loop stmt;

View File

@@ -121,11 +121,11 @@ predicate relOpWithSwapAndNegate(
}
/**
* Holds if `cmp` is an equality operation (`==` or `!=`) with fully-converted
* Holds if `cmp` is an equality operation (`==` or `!=`) with fully-converted
* children `lhs` and `rhs`, and `isEQ` is true if `cmp` is an
* `==` operation and false if it is an `!=` operation.
*
* For example, if `rel` is `x == 5` then
* For example, if `cmp` is `x == 5` then
* `eqOpWithSwap(cmp, x, 5, true)` holds.
*/
private predicate eqOp(EqualityOperation cmp, Expr lhs, Expr rhs, boolean isEQ) {

View File

@@ -769,26 +769,32 @@ private float getLowerBoundsImpl(Expr expr) {
exists(float x, float y |
x = getFullyConvertedLowerBounds(maxExpr.getLeftOperand()) and
y = getFullyConvertedLowerBounds(maxExpr.getRightOperand()) and
if x >= y then result = x else result = y
result = x.maximum(y)
)
)
or
// ConditionalExpr (true branch)
exists(ConditionalExpr condExpr |
exists(ConditionalExpr condExpr, Expr conv, float ub, float lb |
expr = condExpr and
conv = condExpr.getCondition().getFullyConverted() and
// Use `boolConversionUpperBound` to determine whether the condition
// might evaluate to `true`.
boolConversionUpperBound(condExpr.getCondition().getFullyConverted()) = 1 and
result = getFullyConvertedLowerBounds(condExpr.getThen())
)
or
// ConditionalExpr (false branch)
exists(ConditionalExpr condExpr |
expr = condExpr and
// Use `boolConversionLowerBound` to determine whether the condition
// might evaluate to `false`.
boolConversionLowerBound(condExpr.getCondition().getFullyConverted()) = 0 and
result = getFullyConvertedLowerBounds(condExpr.getElse())
lb = boolConversionLowerBound(conv) and
ub = boolConversionUpperBound(conv)
|
// Both branches can be taken
ub = 1 and
lb = 0 and
exists(float thenLb, float elseLb |
thenLb = getFullyConvertedLowerBounds(condExpr.getThen()) and
elseLb = getFullyConvertedLowerBounds(condExpr.getElse()) and
result = thenLb.minimum(elseLb)
)
or
// Only the `true` branch can be taken
ub = 1 and lb != 0 and result = getFullyConvertedLowerBounds(condExpr.getThen())
or
// Only the `false` branch can be taken
ub != 1 and lb = 0 and result = getFullyConvertedLowerBounds(condExpr.getElse())
)
or
exists(AddExpr addExpr, float xLow, float yLow |
@@ -973,26 +979,32 @@ private float getUpperBoundsImpl(Expr expr) {
exists(float x, float y |
x = getFullyConvertedUpperBounds(minExpr.getLeftOperand()) and
y = getFullyConvertedUpperBounds(minExpr.getRightOperand()) and
if x <= y then result = x else result = y
result = x.minimum(y)
)
)
or
// ConditionalExpr (true branch)
exists(ConditionalExpr condExpr |
exists(ConditionalExpr condExpr, Expr conv, float ub, float lb |
expr = condExpr and
conv = condExpr.getCondition().getFullyConverted() and
// Use `boolConversionUpperBound` to determine whether the condition
// might evaluate to `true`.
boolConversionUpperBound(condExpr.getCondition().getFullyConverted()) = 1 and
result = getFullyConvertedUpperBounds(condExpr.getThen())
)
or
// ConditionalExpr (false branch)
exists(ConditionalExpr condExpr |
expr = condExpr and
// Use `boolConversionLowerBound` to determine whether the condition
// might evaluate to `false`.
boolConversionLowerBound(condExpr.getCondition().getFullyConverted()) = 0 and
result = getFullyConvertedUpperBounds(condExpr.getElse())
lb = boolConversionLowerBound(conv) and
ub = boolConversionUpperBound(conv)
|
// Both branches can be taken
ub = 1 and
lb = 0 and
exists(float thenLb, float elseLb |
thenLb = getFullyConvertedUpperBounds(condExpr.getThen()) and
elseLb = getFullyConvertedUpperBounds(condExpr.getElse()) and
result = thenLb.maximum(elseLb)
)
or
// Only the `true` branch can be taken
ub = 1 and lb != 0 and result = getFullyConvertedUpperBounds(condExpr.getThen())
or
// Only the `false` branch can be taken
ub != 1 and lb = 0 and result = getFullyConvertedUpperBounds(condExpr.getElse())
)
or
exists(AddExpr addExpr, float xHigh, float yHigh |
@@ -1140,10 +1152,7 @@ private float getUpperBoundsImpl(Expr expr) {
not expr instanceof SimpleRangeAnalysisExpr
or
// A modeled expression for range analysis
exists(SimpleRangeAnalysisExpr rangeAnalysisExpr |
rangeAnalysisExpr = expr and
result = rangeAnalysisExpr.getUpperBounds()
)
result = expr.(SimpleRangeAnalysisExpr).getUpperBounds()
}
/**
@@ -1594,7 +1603,7 @@ private module SimpleRangeAnalysisCached {
* the lower bound of the expression after all the casts have been applied,
* call `lowerBound` like this:
*
* `lowerBound(expr.getFullyConverted())`
* lowerBound(expr.getFullyConverted())
*/
cached
float lowerBound(Expr expr) {
@@ -1613,7 +1622,7 @@ private module SimpleRangeAnalysisCached {
* the upper bound of the expression after all the casts have been applied,
* call `upperBound` like this:
*
* `upperBound(expr.getFullyConverted())`
* upperBound(expr.getFullyConverted())
*/
cached
float upperBound(Expr expr) {

View File

@@ -3,6 +3,7 @@
*/
private import Semantic
private import SemanticLocation
private import SemanticExprSpecific::SemanticExprConfig as Specific
private import SemanticType
@@ -15,7 +16,7 @@ private import SemanticType
class SemExpr instanceof Specific::Expr {
final string toString() { result = super.toString() }
final Specific::Location getLocation() { result = super.getLocation() }
SemLocation getLocation() { result = super.getLocation() }
Opcode getOpcode() { result instanceof Opcode::Unknown }

View File

@@ -2,6 +2,7 @@ private import RangeAnalysisImpl
private import codeql.rangeanalysis.RangeAnalysis
private import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticExpr
private import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticType
private import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticLocation
module FloatDelta implements DeltaSig {
class Delta = float;
@@ -22,7 +23,7 @@ module FloatDelta implements DeltaSig {
Delta fromFloat(float f) { result = f }
}
module FloatOverflow implements OverflowSig<Sem, FloatDelta> {
module FloatOverflow implements OverflowSig<SemLocation, Sem, FloatDelta> {
predicate semExprDoesNotOverflow(boolean positively, SemExpr expr) {
exists(float lb, float ub, float delta |
typeBounds(expr.getSemType(), lb, ub) and

View File

@@ -3,11 +3,12 @@
*/
private import semmle.code.cpp.rangeanalysis.new.internal.semantic.Semantic
private import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticLocation
private import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.FloatDelta
private import RangeAnalysisImpl
private import codeql.rangeanalysis.RangeAnalysis
module CppLangImplConstant implements LangSig<Sem, FloatDelta> {
module CppLangImplConstant implements LangSig<SemLocation, Sem, FloatDelta> {
/**
* Ignore the bound on this expression.
*

View File

@@ -12,7 +12,7 @@ private import SemanticType
private import codeql.rangeanalysis.RangeAnalysis
private import ConstantAnalysis as ConstantAnalysis
module Sem implements Semantic {
module Sem implements Semantic<SemLocation> {
class Expr = SemExpr;
class ConstantIntegerExpr = ConstantAnalysis::SemConstantIntegerExpr;
@@ -104,7 +104,7 @@ module Sem implements Semantic {
}
}
module SignAnalysis implements SignAnalysisSig<Sem> {
module SignAnalysis implements SignAnalysisSig<SemLocation, Sem> {
private import SignAnalysisCommon as SA
import SA::SignAnalysis<FloatDelta>
}
@@ -165,7 +165,7 @@ module AllBounds implements BoundSig<SemLocation, Sem, FloatDelta> {
}
}
private module ModulusAnalysisInstantiated implements ModulusAnalysisSig<Sem> {
private module ModulusAnalysisInstantiated implements ModulusAnalysisSig<SemLocation, Sem> {
class ModBound = AllBounds::SemBound;
private import codeql.rangeanalysis.ModulusAnalysis as MA

View File

@@ -3,12 +3,13 @@
*/
private import semmle.code.cpp.rangeanalysis.new.internal.semantic.Semantic
private import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticLocation
private import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.FloatDelta
private import RangeAnalysisImpl
private import semmle.code.cpp.rangeanalysis.RangeAnalysisUtils
private import codeql.rangeanalysis.RangeAnalysis
module CppLangImplRelative implements LangSig<Sem, FloatDelta> {
module CppLangImplRelative implements LangSig<SemLocation, Sem, FloatDelta> {
/**
* Ignore the bound on this expression.
*

View File

@@ -10,11 +10,12 @@ private import codeql.rangeanalysis.RangeAnalysis
private import RangeAnalysisImpl
private import SignAnalysisSpecific as Specific
private import semmle.code.cpp.rangeanalysis.new.internal.semantic.Semantic
private import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticLocation
private import ConstantAnalysis
private import Sign
module SignAnalysis<DeltaSig D> {
private import codeql.rangeanalysis.internal.RangeUtils::MakeUtils<Sem, D>
private import codeql.rangeanalysis.internal.RangeUtils::MakeUtils<SemLocation, Sem, D>
/**
* An SSA definition for which the analysis can compute the sign.

View File

@@ -437,6 +437,154 @@ class ConstexprIfStmt extends ConditionalStmt, @stmt_constexpr_if {
}
}
/**
* A C/C++ '(not) consteval if'. For example, the `if consteval` statement
* in the following code:
* ```cpp
* if consteval {
* ...
* }
* ```
*/
class ConstevalIfStmt extends Stmt, @stmt_consteval_or_not_consteval_if {
override string getAPrimaryQlClass() { result = "ConstevalIfStmt" }
override string toString() {
if this.isNot() then result = "if ! consteval ..." else result = "if consteval ..."
}
/**
* Holds if this is a 'not consteval if' statement.
*
* For example, this holds for
* ```cpp
* if ! consteval { return true; }
* ```
* but not for
* ```cpp
* if consteval { return true; }
* ```
*/
predicate isNot() { this instanceof @stmt_not_consteval_if }
/**
* Gets the 'then' statement of this '(not) consteval if' statement.
*
* For example, for
* ```cpp
* if consteval { return true; }
* ```
* the result is the `BlockStmt` `{ return true; }`.
*/
Stmt getThen() { consteval_if_then(underlyingElement(this), unresolveElement(result)) }
/**
* Gets the 'else' statement of this '(not) constexpr if' statement, if any.
*
* For example, for
* ```cpp
* if consteval { return true; } else { return false; }
* ```
* the result is the `BlockStmt` `{ return false; }`, and for
* ```cpp
* if consteval { return true; }
* ```
* there is no result.
*/
Stmt getElse() { consteval_if_else(underlyingElement(this), unresolveElement(result)) }
/**
* Holds if this '(not) constexpr if' statement has an 'else' statement.
*
* For example, this holds for
* ```cpp
* if consteval { return true; } else { return false; }
* ```
* but not for
* ```cpp
* if consteval { return true; }
* ```
*/
predicate hasElse() { exists(this.getElse()) }
override predicate mayBeImpure() {
this.getThen().mayBeImpure() or
this.getElse().mayBeImpure()
}
override predicate mayBeGloballyImpure() {
this.getThen().mayBeGloballyImpure() or
this.getElse().mayBeGloballyImpure()
}
override MacroInvocation getGeneratingMacro() {
this.getThen().getGeneratingMacro() = result and
(this.hasElse() implies this.getElse().getGeneratingMacro() = result)
}
/**
* Gets the statement of this '(not) consteval if' statement evaluated during compile time, if any.
*
* For example, for
* ```cpp
* if ! consteval { return true; } else { return false; }
* ```
* the result is the `BlockStmt` `{ return false; }`, and for
* ```cpp
* if ! consteval { return true; }
* ```
* there is no result.
*/
Stmt getCompileTimeEvaluatedBranch() {
if this.isNot() then result = this.getElse() else result = this.getThen()
}
/**
* Holds if this '(not) constexpr if' statement has a compile time evaluated statement.
*
* For example, this holds for
* ```cpp
* if ! consteval { return true; } else { return false; }
* ```
* but not for
* ```cpp
* if ! consteval { return true; }
* ```
*/
predicate hasCompileTimeEvaluatedBranch() { exists(this.getCompileTimeEvaluatedBranch()) }
/**
* Gets the statement of this '(not) consteval if' statement evaluated during runtime, if any.
*
* For example, for
* ```cpp
* if consteval { return true; } else { return false; }
* ```
* the result is the `BlockStmt` `{ return false; }`, and for
* ```cpp
* if consteval { return true; }
* ```
* there is no result.
*/
Stmt getRuntimeEvaluatedBranch() {
if this.isNot() then result = this.getThen() else result = this.getElse()
}
/**
* Holds if this '(not) constexpr if' statement has a runtime evaluated statement.
*
* For example, this holds for
* ```cpp
* if consteval { return true; } else { return false; }
* ```
* but not for
* ```cpp
* if consteval { return true; }
* ```
*/
predicate hasRuntimeEvaluatedBranch() { exists(this.getRuntimeEvaluatedBranch()) }
}
private class TLoop = @stmt_while or @stmt_end_test_while or @stmt_range_based_for or @stmt_for;
/**

View File

@@ -480,6 +480,19 @@ fun_decl_typedef_type(
int typedeftype_id: @usertype ref
);
/*
case @fun_requires.kind of
1 = @template_attached
| 2 = @function_attached
;
*/
fun_requires(
int id: @fun_decl ref,
int kind: int ref,
int constraint: @expr ref
);
param_decl_bind(
unique int id: @var_decl ref,
int index: int ref,
@@ -495,11 +508,16 @@ var_decls(
int location: @location_default ref
);
var_def(unique int id: @var_decl ref);
var_specialized(int id: @var_decl ref);
var_decl_specifiers(
int id: @var_decl ref,
string name: string ref
)
is_structured_binding(unique int id: @variable ref);
var_requires(
int id: @var_decl ref,
int constraint: @expr ref
);
type_decls(
unique int id: @type_decl,
@@ -510,6 +528,10 @@ type_def(unique int id: @type_decl ref);
type_decl_top(
unique int type_decl: @type_decl ref
);
type_requires(
int id: @type_decl ref,
int constraint: @expr ref
);
namespace_decls(
unique int id: @namespace_decl,
@@ -749,12 +771,13 @@ decltypes(
/*
case @usertype.kind of
1 = @struct
| 0 = @unknown_usertype
| 1 = @struct
| 2 = @class
| 3 = @union
| 4 = @enum
| 5 = @typedef // classic C: typedef typedef type name
| 6 = @template
// ... 6 = @template deprecated
| 7 = @template_parameter
| 8 = @template_template_parameter
| 9 = @proxy_class // a proxy class associated with a template parameter
@@ -763,6 +786,9 @@ case @usertype.kind of
// ... 12 objc_category deprecated
| 13 = @scoped_enum
| 14 = @using_alias // a using name = type style typedef
| 15 = @template_struct
| 16 = @template_class
| 17 = @template_union
;
*/
@@ -789,6 +815,11 @@ nontype_template_parameters(
int id: @expr ref
);
type_template_type_constraint(
int id: @usertype ref,
int constraint: @expr ref
);
mangled_name(
unique int id: @declaration ref,
int mangled_name : @mangledname,
@@ -816,9 +847,11 @@ class_template_argument_value(
int arg_value: @expr ref
);
@user_or_decltype = @usertype | @decltype;
is_proxy_class_for(
unique int id: @usertype ref,
unique int templ_param_id: @usertype ref
int templ_param_id: @user_or_decltype ref
);
type_mentions(
@@ -876,6 +909,29 @@ template_template_argument_value(
int arg_value: @expr ref
);
@concept = @concept_template | @concept_id;
concept_templates(
unique int concept_id: @concept_template,
string name: string ref,
int location: @location_default ref
);
concept_instantiation(
unique int to: @concept_id ref,
int from: @concept_template ref
);
is_type_constraint(int concept_id: @concept_id ref);
concept_template_argument(
int concept_id: @concept ref,
int index: int ref,
int arg_type: @type ref
);
concept_template_argument_value(
int concept_id: @concept ref,
int index: int ref,
int arg_value: @expr ref
);
routinetypes(
unique int id: @routinetype,
int return_type: @type ref
@@ -1106,7 +1162,8 @@ frienddecls(
| @declaredtype
| @variable
| @enumconstant
| @frienddecl;
| @frienddecl
| @concept_template;
@member = @membervariable
| @function
@@ -2095,6 +2152,8 @@ case @stmt.kind of
// ... 34 @stmt_finally_end deprecated
| 35 = @stmt_constexpr_if
| 37 = @stmt_co_return
| 38 = @stmt_consteval_if
| 39 = @stmt_not_consteval_if
;
type_vla(
@@ -2137,6 +2196,18 @@ constexpr_if_else(
int else_id: @stmt ref
);
@stmt_consteval_or_not_consteval_if = @stmt_consteval_if | @stmt_not_consteval_if;
consteval_if_then(
unique int constexpr_if_stmt: @stmt_consteval_or_not_consteval_if ref,
int then_id: @stmt ref
);
consteval_if_else(
unique int constexpr_if_stmt: @stmt_consteval_or_not_consteval_if ref,
int else_id: @stmt ref
);
while_body(
unique int while_stmt: @stmt_while ref,
int body_id: @stmt ref

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: Support requires clauses and type constraints
compatibility: partial

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: Support concept templates
compatibility: partial

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: Support variable template specializations
compatibility: partial

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: Support (not) consteval if
compatibility: partial

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
description: Improve user types and proxy classes
compatibility: partial
usertypes.rel: run usertypes.qlo

View File

@@ -0,0 +1,17 @@
class UserType extends @usertype {
string toString() { none() }
}
bindingset[kind]
int getKind(int kind) {
if kind in [10, 11, 12]
then result = 0
else
if kind = 6
then result = 16
else result = kind
}
from UserType usertype, string name, int kind
where usertypes(usertype, name, kind)
select usertype, name, getKind(kind)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: Support concept id expressions
compatibility: partial

View File

@@ -21,7 +21,7 @@ string kindstr(Class c) {
or
kind = 2 and result = "Class"
or
kind = 6 and result = "Template class"
kind = [15, 16] and result = "Template class"
)
}
@@ -168,12 +168,7 @@ where
strictcount(string fieldName |
exists(Field f |
f.getDeclaringType() = c and
fieldName = f.getName() and
// IBOutlet's are a way of building GUIs
// automatically out of ObjC properties.
// We don't want to count those for the
// purposes of this query.
not f.getType().getAnAttribute().hasName("iboutlet")
fieldName = f.getName()
)
) and
n > 15 and

View File

@@ -9,11 +9,13 @@
*/
import cpp
import semmle.code.cpp.ConfigurationTestFile
from GlobalVariable gv
where
gv.getName().length() <= 3 and
not gv.isStatic()
not gv.isStatic() and
not gv.getFile() instanceof ConfigurationTestFile // variables in files generated during configuration are likely false positives
select gv,
"Poor global variable name '" + gv.getName() +
"'. Prefer longer, descriptive names for globals (eg. kMyGlobalConstant, not foo)."

View File

@@ -1,3 +1,10 @@
## 1.3.2
### Minor Analysis Improvements
* Added dataflow models for `SysAllocString` and related functions.
* The `cpp/badly-bounded-write`, `cpp/equality-on-floats`, `cpp/short-global-name`, `cpp/static-buffer-overflow`, `cpp/too-few-arguments`, `cpp/useless-expression`, `cpp/world-writable-file-creation` queries no longer produce alerts on files created by CMake to test the build configuration.
## 1.3.1
### Minor Analysis Improvements

Some files were not shown because too many files have changed in this diff Show More