Compare commits

..

249 Commits

Author SHA1 Message Date
Nick Rolfe
005a27bff9 Merge pull request #19436 from adityasharad/actions/ga-change-note
Actions: Retroactively add GA changenote
2025-05-01 09:21:15 +01:00
Aditya Sharad
6285c2e502 Actions: Retroactively add GA changenote
This was manually added in the docs site at the time of 2.21.1 release and GA.
Include the change note in the relevant places so it remains
in future docs updates:
- codeql/actions-queries@0.5.4
- codeql/actions-all@0.4.7
- 2.21.1 changelog
2025-04-30 16:24:22 -07:00
Nick Rolfe
a46f8fb0d9 Merge pull request #19398 from github/nickrolfe/rm-erroneous-query
Java: Remove erroneously-committed query
2025-04-28 14:06:52 +01:00
Nick Rolfe
e3f33f192f Remove erroneously-committed query 2025-04-28 13:55:34 +01:00
Nick Rolfe
ded3865722 Merge pull request #19395 from github/release-prep/2.21.2
Release preparation for version 2.21.2
2025-04-28 12:57:36 +01:00
Nick Rolfe
ca7f8f21cd Tweak change-note for MaD model generation 2025-04-28 12:50:58 +01:00
github-actions[bot]
625354c46e Release preparation for version 2.21.2 2025-04-28 10:55:22 +00:00
Nick Rolfe
35939ec3b1 Merge pull request #19394 from github/nickrolfe/actions-change-note
Follow-up fixes to #19376
2025-04-28 11:46:14 +01:00
Nick Rolfe
b61a87a2a3 Update integration test to match update to security-and-quality suite 2025-04-28 11:26:07 +01:00
Nick Rolfe
70a3fe3e33 Add YAML front matter to change note 2025-04-28 10:09:33 +01:00
Michael Nebel
8857f0d0f2 Merge pull request #19311 from michaelnebel/csharp/generatorcleanup
Shared: Model generator cleanup.
2025-04-28 10:36:05 +02:00
Paolo Tranquilli
bcc65e13b0 Merge pull request #19381 from jketema/swift-doc
Swift: Clarify how the LFS artifacts should be updated
2025-04-28 09:42:52 +02:00
Tom Hvitved
14445a3d46 Merge pull request #19380 from hvitved/csharp/cfg/switch-fall-through
C#: Fix CFG for fall-through switch statements
2025-04-28 08:42:36 +02:00
Michael B. Gale
987af4ce1d Merge pull request #19248 from github/mbg/go/private-registries
Go: Support private registries via `GOPROXY`
2025-04-25 16:40:00 +01:00
Paolo Tranquilli
46fb041c50 Merge pull request #19384 from github/redsun82/swift-add-logs
Swift: add more debug logs
2025-04-25 17:24:11 +02:00
Michael B. Gale
7592ce47e3 Go: Restore parseRegistryConfigsFail test for the empty string 2025-04-25 15:45:12 +01:00
Michael B. Gale
91a794433a Go: Change "Unable" to "Failed" for consistency 2025-04-25 15:42:29 +01:00
Michael B. Gale
5172a4d6ec Go: Remove check from getEnvVars 2025-04-25 15:41:57 +01:00
Michael B. Gale
9cfa451477 Go: Fix/improve comment about environment variable preservation 2025-04-25 15:41:35 +01:00
Aditya Sharad
d4b083b5c0 Merge pull request #19376 from adityasharad/actions/exclude-model-generator-queries
Actions: Exclude model-generator queries from query suites
2025-04-25 20:03:32 +05:30
Michael Nebel
de122225e8 C#/Rust: Update integration test expected output. 2025-04-25 15:52:36 +02:00
Michael Nebel
a589014243 C++: Update model generator tests. 2025-04-25 15:50:10 +02:00
Michael Nebel
d05f604390 C++: Adjust the model generator queries to the new shared implementation. 2025-04-25 15:50:08 +02:00
Michael Nebel
f6135d507b Shared: Address review comments. 2025-04-25 15:50:06 +02:00
Michael Nebel
d187a7d144 Java: Update integration test that tracks queries not included in a query suite. 2025-04-25 15:50:04 +02:00
Michael Nebel
32125d2291 C#/Java/Rust: Add change notes. 2025-04-25 15:50:03 +02:00
Michael Nebel
21553960b0 Rust: Adjust tests. 2025-04-25 15:50:01 +02:00
Michael Nebel
71d0409bb7 Java: Convert the model generator neutral test to use the combined neutral generator. 2025-04-25 15:50:00 +02:00
Michael Nebel
7e51dae743 Java: Change the heuristic summary test tag to heuristic-summary. 2025-04-25 15:49:58 +02:00
Michael Nebel
08f7caaf39 Java: Adjust model generator test cases to the new implementation. 2025-04-25 15:49:56 +02:00
Michael Nebel
1d6c367049 C#: Change the capture neutral model test to use the content/heuristic version instead. 2025-04-25 15:49:55 +02:00
Michael Nebel
539a06dcb4 C#: Re-factor the heuristic summary test to use heuristic-summary tag in tests. 2025-04-25 15:49:53 +02:00
Michael Nebel
da99c75a13 C#: Rename some of the model generator tests. 2025-04-25 15:49:51 +02:00
Michael Nebel
7801fc321d C#: Re-factor tests to use the new implementations. 2025-04-25 15:49:49 +02:00
Michael Nebel
2a0097ea56 C#/Java/Rust: Use Mixed flow from capture summary models queries and adjust other queries to the re-factored implementation. 2025-04-25 15:49:47 +02:00
Michael Nebel
f78be91af2 Shared: Re-factor the model generator and put the heuristic queries in its own module. 2025-04-25 15:49:45 +02:00
Michael Nebel
2357a69d55 Shared: Remove the --with-mixed-neutrals logic. 2025-04-25 15:49:44 +02:00
Michael Nebel
ae70c76a07 Shared: Use the CaptureSummaryModels instead of CaptureMixedSummaryModels. 2025-04-25 15:49:42 +02:00
Michael Nebel
fa5162fb13 Shared: Remove the backwards compatbility flag. 2025-04-25 15:49:41 +02:00
Michael Nebel
2a8fe53b04 Shared: Remove --with-mixed-summaries logic. 2025-04-25 15:49:38 +02:00
Tamás Vajk
3437210d32 Merge pull request #19355 from tamasvajk/test/add-query-suite-tests
Add query suite integration tests for swift, actions, csharp, go, javascript, ruby, rust
2025-04-25 15:37:51 +02:00
Paolo Tranquilli
d9a6a630e5 Swift: fix log compilation 2025-04-25 15:37:08 +02:00
Chuan-kai Lin
ed690972d4 Merge pull request #19379 from github/cklin/python-polynomial-redos
Python: disable diff-informed PolynomialReDoS.ql
2025-04-25 06:21:47 -07:00
Paolo Tranquilli
e71e7a08bb Swift: add more debug logs 2025-04-25 15:20:20 +02:00
Tamas Vajk
998e64baf3 Fix failing C# test 2025-04-25 14:06:18 +02:00
Tamás Vajk
c54b684132 Apply suggestions from code review - code quality improvements
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
2025-04-25 14:06:17 +02:00
Tamas Vajk
a4a24470c8 Add query suite inclusion tests for actions, csharp, go, javascript, ruby, rust 2025-04-25 14:06:17 +02:00
Tamas Vajk
522dd51416 Improve query suite test based on feedback 2025-04-25 14:06:16 +02:00
Tamas Vajk
4c9aee2cc7 Add query suite tests for swift with shared logic 2025-04-25 14:06:15 +02:00
Tom Hvitved
432435f1a6 Merge pull request #19358 from hvitved/rust/path-resolution-perf-tweaks
Rust: Path resolution performance tweaks
2025-04-25 14:01:47 +02:00
Michael B. Gale
e805d1ee90 Merge remote-tracking branch 'origin/main' into mbg/go/private-registries 2025-04-25 12:55:36 +01:00
Michael B. Gale
cafe1efefa Go: Refactor ApplyProxyEnvVars 2025-04-25 12:30:48 +01:00
Jeroen Ketema
0b5a4a9133 Swift: Clarify how the LFS artifacts should be updated 2025-04-25 12:44:38 +02:00
Jeroen Ketema
8b95e0ee4a Merge pull request #19315 from github/redsun82/swift-6.1
Swift: make extractor compile again after 6.1 upgrade
2025-04-25 12:34:39 +02:00
Jeroen Ketema
e8eac810b4 Swift: Commit external sources to git LFS 2025-04-25 11:56:28 +02:00
Tom Hvitved
e79a906426 C#: Fix CFG for fall-through switch statements 2025-04-25 11:48:30 +02:00
Tom Hvitved
a991ef0f87 C#: Add a CFG test for switch fall-through 2025-04-25 10:32:48 +02:00
Chuan-kai Lin
6c1e80df3a Python: disable diff-informed PolynomialReDoS.ql
This commit disabled diff-informed for PolynomialReDoS.ql because it
could miss some alerts within diff ranges.
2025-04-24 14:57:06 -07:00
Aditya Sharad
b197de8db4 Actions: Add change note for removing model ggenerator queries 2025-04-24 14:21:04 -07:00
Aditya Sharad
05243bd855 Actions: Fix query ID for reusable workflow sinks query 2025-04-24 14:20:47 -07:00
Aditya Sharad
aabbfce010 Actions: Exclude model-generator queries from query suites
This change removes the model generator queries for Actions
sources/sinks/summaries from being run as part of the
`actions-security-and-quality.qls` query suite,
where they were accidentally included.

All languages will now exclude both `modelgenerator`
and `model-generator` tagged queries from their suites.
2025-04-24 13:25:38 -07:00
Ian Lynagh
f9172ff493 Merge pull request #19368 from igfoo/igfoo/add-check-for-buildmode-none
C++: Add exception for build-mode-none in various queries
2025-04-24 20:30:09 +01:00
Jeroen Ketema
5920925041 Merge pull request #19363 from jketema/platform
Update list of supported platforms
2025-04-24 19:11:31 +02:00
Jeroen Ketema
a5a21b1ddd Swift: Guard 'getCaptures' in fillClosureExpr 2025-04-24 17:42:59 +02:00
Paolo Tranquilli
21170a1f6d Merge pull request #19370 from github/redsun82/go-remove-invalid-toolchain-diagnostic
Go: remove invalid toolchain version diagnostics
2025-04-24 17:32:34 +02:00
Jeroen Ketema
21c97085a1 Merge pull request #19361 from jketema/fieldflow
Dataflow: Make default field flow branch limit configurable per language
2025-04-24 16:45:49 +02:00
Jeroen Ketema
55a8a4444d Merge pull request #19365 from jketema/c23
C++: Claim beta support for C23 and C++23
2025-04-24 16:13:39 +02:00
Paolo Tranquilli
69b87a63b8 Go: remove invalid toolchain version diagnostics
This diagnostic was introduced by https://github.com/github/codeql/pull/15979.
However in the meantime the Go team [has backtracked](https://github.com/golang/go/issues/62278#issuecomment-2062002018)
on their decision, which leads to confusing alerts for user (e.g. https://github.com/github/codeql-action/issues/2868).
Even using Go toolchains from 1.21 to 1.22 we weren't immediately able
to reproduce the problem that this diagnostics was meant to guard
against. Therefore it was deemed simpler to just remove it.

_En passant_ the `Makefile` now accepts `rtjo` not being set.
2025-04-24 14:41:05 +02:00
Ian Lynagh
0cd859c559 C++: qlformat 2025-04-24 12:48:21 +01:00
Alexander Eyers-Taylor
ea83ecf802 Merge pull request #19327 from d10c/d10c/rtjo-csharp-jo-fix
C#: Join order fix
2025-04-24 12:34:22 +01:00
Ian Lynagh
063bff073b C++: Add checks for build mode in various queries
Adds a check for the absence of build-mode-none in
    cpp/wrong-type-format-argument
    cpp/comparison-with-wider-type
    cpp/integer-multiplication-cast-to-long
    cpp/implicit-function-declaration
    cpp/suspicious-add-sizeof
2025-04-24 12:15:31 +01:00
Jeroen Ketema
42c4252a3d C++: Claim beta support for C23 and C++23
All features we can support, we currently do support.
2025-04-24 11:44:16 +02:00
Jeroen Ketema
0357f3959b Update list of supported platforms
I've effectively sync'ed this with the list of runners that are publicly
available. I did not yet add Windows 2025, as it is my understanding is that
we haven't really done any testing on that yet.
2025-04-24 11:28:09 +02:00
Jeroen Ketema
46b21af3ef Dataflow: Make default field flow branch limit configurable per language 2025-04-24 11:02:49 +02:00
Jeroen Ketema
4093afbaab Merge pull request #19290 from jketema/typeof
C++: Support C23 `typeof` and `typeof_unqual`
2025-04-24 10:12:46 +02:00
Michael Nebel
17f58c90bd Merge pull request #19148 from michaelnebel/csharp/invalid-string-format
C#: Improve `cs/invalid-string-formatting` and add to the Code Quality suite.
2025-04-24 10:03:06 +02:00
Michael Nebel
65ac951964 C#: Remove all Sink tags after rebase. 2025-04-24 08:54:53 +02:00
Michael Nebel
dcf11c2d4b C#: Match up sources, alerts and sinks in the tests. 2025-04-24 08:54:51 +02:00
Michael Nebel
b6d2f14b9b C#: Add change note. 2025-04-24 08:54:49 +02:00
Michael Nebel
22ae3e7992 C#: Update string format item parameter expected test case. 2025-04-24 08:54:48 +02:00
Michael Nebel
f2dddd6d5c C#: Hide the abstract FormatMethod class. 2025-04-24 08:54:47 +02:00
Michael Nebel
6de5920172 C#: Update test expected output. 2025-04-24 08:54:45 +02:00
Michael Nebel
042c7e5186 C#: Generalize array logic to params collection like types. 2025-04-24 08:54:43 +02:00
Michael Nebel
930bb6b515 C#: Add FP for string.Format using params collection. 2025-04-24 08:54:42 +02:00
Michael Nebel
39abd5c004 C#: Update test expected output. 2025-04-24 08:54:40 +02:00
Michael Nebel
f31235db43 C#: Improve format logic to take CompositeFormat and generics into account. 2025-04-24 08:54:39 +02:00
Michael Nebel
11dffc6647 C#: Add more invalid-string-formatting testcases. 2025-04-24 08:54:37 +02:00
Michael Nebel
8fb5fe97aa C#: Update test expected output. 2025-04-24 08:54:36 +02:00
Michael Nebel
1d9d8780b3 C#: Remove some false positives and add more true positives for cs/invalid-string-format. 2025-04-24 08:54:34 +02:00
Michael Nebel
f73b7429c6 C#: Remove false positive example. 2025-04-24 08:54:33 +02:00
Michael Nebel
175e4ecb74 C#: Add more format testcases. 2025-04-24 08:54:31 +02:00
Michael Nebel
327ddb07a1 C#: Re-factor FormatMethod. 2025-04-24 08:54:30 +02:00
Michael Nebel
9cfd6e30b9 C#: Convert testing of cs/invalid-string-formatting to inline expectations and adjust some of the testcases. 2025-04-24 08:54:28 +02:00
Michael Nebel
68f93492b1 C#: Add cs/invalid-string-formatting to the codeql quality suite. 2025-04-24 08:54:27 +02:00
Michael Nebel
91f1183dfd Merge pull request #19354 from michaelnebel/csharp/matchlinenumbersonsinks
Shared: Match line information on Alert and Sink locations.
2025-04-24 08:53:01 +02:00
Tom Hvitved
e72aba76f6 Rust: Path resolution performance tweaks 2025-04-23 19:49:20 +02:00
Jeroen Ketema
cad695868d C++: Add change note 2025-04-23 17:51:06 +02:00
Jeroen Ketema
8086ef48c7 Swift: Add change note 2025-04-23 17:10:57 +02:00
Jeroen Ketema
eea963e3f4 Swift: Add upgrade and downgrade scripts 2025-04-23 17:10:57 +02:00
Jeroen Ketema
a74b38c0ec Swift: Replace deprecated @_moveOnly in test by ~Copyable 2025-04-23 17:10:57 +02:00
Jeroen Ketema
59faf9fbdf Swift: Update errors test
The representation of the errors seems to have changed somewhat in Swift 6.1.
2025-04-23 17:10:57 +02:00
Jeroen Ketema
10d86c9708 Swift: Disable parts of tests that crash with Swift 6.1 2025-04-23 17:10:56 +02:00
Jeroen Ketema
9a21b0dc5c Swift: Update SuccessfullyExtractedLines for external code being extracted 2025-04-23 17:10:56 +02:00
Jeroen Ketema
e135f5ddf6 Swift: Update ObjectLiteralExpr test
The entities now have proper error types instead of missing types.
2025-04-23 17:10:56 +02:00
Jeroen Ketema
b6076c0481 Swift: Update test results for ParenType no longer being extracted 2025-04-23 17:10:55 +02:00
Jeroen Ketema
1b21e4c667 Swift: Update test results for IfConfigDecl no longer being extracted 2025-04-23 17:10:55 +02:00
Jeroen Ketema
36672f44b9 Swift: Take inverses into account when mangling ProtocolCompositionTypes 2025-04-23 17:10:55 +02:00
Paolo Tranquilli
7834a3d9e4 Swift: expand mangling of ExistentialMetatypeType 2025-04-23 17:10:55 +02:00
Jeroen Ketema
30242ed6fb Swift: Remove "to do" comment 2025-04-23 17:10:54 +02:00
Jeroen Ketema
4fc5a73bac Swift: Update mangling of OpenedArchetypeType 2025-04-23 17:10:54 +02:00
Paolo Tranquilli
1ac47a892b Swift: make extractor compile again after 6.1 upgrade 2025-04-23 17:10:54 +02:00
Jeroen Ketema
0c313463b4 C++: Update stats file 2025-04-23 16:56:59 +02:00
Jeroen Ketema
a3e0c15c10 C++: Add upgrade and downgrade scripts 2025-04-23 16:56:57 +02:00
Jeroen Ketema
e97f9495d0 C++: Update expected test results 2025-04-23 16:56:56 +02:00
Jeroen Ketema
df3282c204 C++: Support C23 typeof and typeof_unqual 2025-04-23 16:56:47 +02:00
Michael Nebel
2e0ce44fde Javascript: Update test files. 2025-04-23 15:41:41 +02:00
Geoffrey White
37bcedcf11 Merge pull request #19353 from geoffw0/modelnoise2
Rust: Remove unnecessary predicate.
2025-04-23 12:34:40 +01:00
Tom Hvitved
4abdc13f79 Merge pull request #19193 from hvitved/rust/path-resolution-where-clause
Rust: Take `where` clauses into account in path resolution
2025-04-23 13:00:58 +02:00
Michael Nebel
617f4729d8 Shared: Match line information on Alert and Sink locations. 2025-04-23 12:35:17 +02:00
Mathias Vorreiter Pedersen
808141f7e8 Merge pull request #19295 from MathiasVP/cpp-add-mad-generation-library
C++: Instantiate model generation library
2025-04-23 11:32:16 +01:00
Geoffrey White
d6f1bd9792 Rust: Remove unnecessary predicate. 2025-04-23 11:24:29 +01:00
Mathias Vorreiter Pedersen
9e9a580d02 C++: Add MaD generation test with union content. 2025-04-23 11:11:17 +01:00
Mathias Vorreiter Pedersen
07d8f8dd0d C++: Add an empty model to prevent a warning. 2025-04-23 10:24:17 +01:00
Tom Hvitved
008dd3f4e3 Merge pull request #19272 from hvitved/ql4ql/qlref-inline-exp-kind-restrict
QL4QL: Restrict `ql/qlref-inline-expectations` to `(path-)problem` queries
2025-04-23 09:11:24 +02:00
Michael Nebel
62cb4bfd02 Merge pull request #19302 from michaelnebel/csharp/missing-access-control
C#: Relax condition for authorize attributes on `cs/web/missing-function-level-access-control`.
2025-04-23 09:09:32 +02:00
Tom Hvitved
959a79f995 Merge pull request #19345 from hvitved/shared/file-system-append-join-fix
Shared: Fix join in `FileSystem.qll`
2025-04-23 09:01:40 +02:00
Pierre
97ca2afa7a Merge pull request #19348 from github/changedocs-2.21.1
changedocs from 2.21.1 release
2025-04-22 22:14:43 +02:00
Pierre
2439b1e89a Merge branch 'main' into changedocs-2.21.1 2025-04-22 22:04:28 +02:00
Jon Janego
1cf10d8f9f changedocs from 2.21.1 release 2025-04-22 14:51:11 -05:00
Jami
4483a24133 Merge pull request #19075 from jcogs33/jcogs33/java/do-not-use-finalizers
Java: Add new quality query to detect `finalize` calls
2025-04-22 14:11:14 -04:00
Jami
ed99088c2b Merge pull request #19094 from jcogs33/jcogs33/java/junit5-missing-nested-annotation
Java: Add new quality query to detect missing `@Nested` annotation in JUnit5 tests
2025-04-22 13:10:00 -04:00
Jeroen Ketema
7ee862a3af Merge pull request #19347 from jketema/swift-files-2
Swift: Make file checking in tests more strict
2025-04-22 17:15:11 +02:00
Jeroen Ketema
adb58e304d Swift: Make file checking in tests more strict
With Swift 6.1 the extractor will start to extract files outside of the test
directory. These files and their elements we do not want to see in our tests.

Test forgotten in https://github.com/github/codeql/pull/19344
2025-04-22 16:51:36 +02:00
Jeroen Ketema
03ce2b0867 Merge pull request #19346 from jketema/swift-files-2
Swift: Make file checking in integration tests more strict
2025-04-22 15:33:33 +02:00
Jeroen Ketema
375ec8f948 Merge pull request #19344 from jketema/swift-files
Swift: Make file checking in tests more strict
2025-04-22 15:33:15 +02:00
Tom Hvitved
40390d1ada Address review comment 2025-04-22 15:08:39 +02:00
Jeroen Ketema
a211998bc9 Swift: Make file checking in integration tests more strict
With Swift 6.1 the extractor will start to extract files outside of the test
directory. These files and their elements we do not want to see in our tests.
2025-04-22 13:52:15 +02:00
Alexander Eyers-Taylor
c11ed6d119 Merge pull request #19116 from github/alexet/ruby-deterministic
Ruby: Make module graph queries avoid relying on evalaution order.
2025-04-22 11:27:03 +01:00
Tom Hvitved
ae5ac11387 Shared: Fix join in FileSystem.qll
Before
```
Evaluated relational algebra for predicate FileSystem::Folder::Append<PathResolution::shouldAppend>::appendStep/3#bed54f6d@d2a7eeoa on iteration 2 running pipeline standard with tuple counts:
         120   ~2%    {4} r1 = SCAN `FileSystem::Folder::Append<PathResolution::shouldAppend>::appendStep/3#bed54f6d#prev_delta` OUTPUT In.1, In.0, In.2, In.3

           0   ~0%    {6} r2 = JOIN r1 WITH `_FileSystem::Folder::Append<PathResolution::shouldAppend>::getComponent/2#a6e36a04#join_rhs#1` ON FIRST 1 OUTPUT Lhs.0, Rhs.1, Lhs.1, Lhs.2, Lhs.3, _
                      {6}    | REWRITE WITH Tmp.5 := 1, Out.5 := (InOut.1 - Tmp.5), TEST Out.5 = InOut.3
           0   ~0%    {4}    | SCAN OUTPUT In.2, In.0, In.1, In.4

          91   ~3%    {6} r3 = JOIN r1 WITH `_FileSystem::Folder::Append<PathResolution::shouldAppend>::getComponent/2#a6e36a04#join_rhs` ON FIRST 1 OUTPUT Lhs.0, Rhs.1, Lhs.1, Lhs.2, Lhs.3, _
                      {6}    | REWRITE WITH Tmp.5 := 1, Out.5 := (InOut.1 - Tmp.5), TEST Out.5 = InOut.3
          81   ~0%    {4}    | SCAN OUTPUT In.4, In.0, In.1, In.2
          81   ~3%    {4}    | JOIN WITH containerparent_10#join_rhs ON FIRST 1 OUTPUT Lhs.3, Lhs.1, Lhs.2, Rhs.1

         269   ~0%    {7} r4 = JOIN r1 WITH `_FileSystem::Folder::Append<PathResolution::shouldAppend>::getComponent/2#a6e36a04#join_rhs#2` ON FIRST 1 OUTPUT Lhs.0, Rhs.1, Rhs.2, Lhs.1, Lhs.2, Lhs.3, _
                      {7}    | REWRITE WITH Tmp.6 := 1, Out.6 := (InOut.1 - Tmp.6), TEST Out.6 = InOut.4
          39   ~1%    {5}    | SCAN OUTPUT In.5, In.0, In.1, In.2, In.3
        1295   ~0%    {6}    | JOIN WITH containerparent ON FIRST 1 OUTPUT Rhs.1, Lhs.3, _, Lhs.1, Lhs.2, Lhs.4
        1295   ~0%    {6}    | REWRITE WITH Out.2 := 1
          34   ~1%    {4}    | JOIN WITH `cached_FileSystem::Container.splitAbsolutePath/2#dispred#dc97b0cc` ON FIRST 3 OUTPUT Lhs.5, Lhs.3, Lhs.4, Lhs.0

         115   ~0%    {4} r5 = r2 UNION r3 UNION r4
         115   ~0%    {4}    | AND NOT `FileSystem::Folder::Append<PathResolution::shouldAppend>::appendStep/3#bed54f6d#prev`(FIRST 4)
                      return r5
```

After
```
Evaluated relational algebra for predicate FileSystem::Folder::Append<PathResolution::shouldAppend>::appendStep/3#bed54f6d@4fb6e6v7 on iteration 2 running pipeline standard with tuple counts:
        120   ~0%    {4} r1 = SCAN `FileSystem::Folder::Append<PathResolution::shouldAppend>::appendStep/3#bed54f6d#prev_delta` OUTPUT In.1, In.0, In.2, In.3

          0   ~0%    {6} r2 = JOIN r1 WITH `_FileSystem::Folder::Append<PathResolution::shouldAppend>::getComponent/2#a6e36a04#join_rhs#1` ON FIRST 1 OUTPUT Lhs.0, Rhs.1, Lhs.1, Lhs.2, Lhs.3, _
                     {6}    | REWRITE WITH Tmp.5 := 1, Out.5 := (InOut.1 - Tmp.5), TEST Out.5 = InOut.3
          0   ~0%    {4}    | SCAN OUTPUT In.2, In.0, In.1, In.4

         91   ~0%    {6} r3 = JOIN r1 WITH `_FileSystem::Folder::Append<PathResolution::shouldAppend>::getComponent/2#a6e36a04#join_rhs` ON FIRST 1 OUTPUT Lhs.0, Rhs.1, Lhs.1, Lhs.2, Lhs.3, _
                     {6}    | REWRITE WITH Tmp.5 := 1, Out.5 := (InOut.1 - Tmp.5), TEST Out.5 = InOut.3
         81   ~0%    {4}    | SCAN OUTPUT In.4, In.0, In.1, In.2
         81   ~5%    {4}    | JOIN WITH containerparent_10#join_rhs ON FIRST 1 OUTPUT Lhs.3, Lhs.1, Lhs.2, Rhs.1

        269   ~0%    {7} r4 = JOIN r1 WITH `_FileSystem::Folder::Append<PathResolution::shouldAppend>::getComponent/2#a6e36a04#join_rhs#2` ON FIRST 1 OUTPUT Lhs.0, Rhs.1, Rhs.2, Lhs.1, Lhs.2, Lhs.3, _
                     {7}    | REWRITE WITH Tmp.6 := 1, Out.6 := (InOut.1 - Tmp.6), TEST Out.6 = InOut.4
         39   ~3%    {5}    | SCAN OUTPUT In.5, In.2, In.0, In.1, In.3
         34   ~0%    {4}    | JOIN WITH `FileSystem::Folder::Append<PathResolution::shouldAppend>::getAChildContainer/2#2e91feca` ON FIRST 2 OUTPUT Lhs.4, Lhs.2, Lhs.3, Rhs.2

        115   ~2%    {4} r5 = r2 UNION r3 UNION r4
        115   ~2%    {4}    | AND NOT `FileSystem::Folder::Append<PathResolution::shouldAppend>::appendStep/3#bed54f6d#prev`(FIRST 4)
                     return r5
```
2025-04-22 12:16:59 +02:00
Anders Schack-Mulligen
d05e90518c Merge pull request #19296 from Marcono1234/patch-1
Docs: Fix typo in code sample
2025-04-22 11:08:17 +02:00
Jeroen Ketema
ce5c48192e Swift: Make file checking in tests more strict
With Swift 6.1 the extractor will start to extract files outside of the test
directory. These files and their elements we do not want to see in our tests.
2025-04-22 10:41:12 +02:00
Asger F
c2cab184ac Merge pull request #19283 from asgerf/js/rest-pattern-fix
JS: Fix missing flow into rest pattern lvalue
2025-04-22 10:37:36 +02:00
Jami Cogswell
3aa6b49204 Java: Add new query to java-code-quality.qls.expected 2025-04-21 10:02:08 -04:00
Jami
72d49f21ee Merge branch 'main' into jcogs33/java/do-not-use-finalizers 2025-04-21 09:57:53 -04:00
Jami Cogswell
07a694e804 Java: add new query to java-code-quality.qls.expected 2025-04-21 09:52:52 -04:00
Jami
02ded89d84 Merge branch 'main' into jcogs33/java/junit5-missing-nested-annotation 2025-04-21 09:46:49 -04:00
Jami
2b9160526a Apply docs review suggestion
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
2025-04-20 21:47:25 -04:00
Mathias Vorreiter Pedersen
3fd760c632 C++: Move 'InlineMadTest.qll' out of 'lib/utils/test' and into 'test' since C++ has no external packs depending on MaD testing. 2025-04-20 16:49:02 +01:00
Mathias Vorreiter Pedersen
6fcf56e6e1 C++: Add more tests. 2025-04-20 16:49:00 +01:00
Mathias Vorreiter Pedersen
f6f5f97109 C++: Also make protected members irrelevant. 2025-04-20 16:48:58 +01:00
Mathias Vorreiter Pedersen
e55f94c364 C++: Move contents of 'isUninterestingForDataFlowModels' to 'relevant' 2025-04-20 16:48:56 +01:00
Mathias Vorreiter Pedersen
9cba91c682 C++: Add another entry to 'qlpack' for external models. 2025-04-20 16:48:54 +01:00
Mathias Vorreiter Pedersen
0ce6ab5444 Remove an unnecessary if. 2025-04-20 16:48:53 +01:00
Mathias Vorreiter Pedersen
5462dcdf75 C++: Make final member functions not extensible. 2025-04-20 16:48:51 +01:00
Mathias Vorreiter Pedersen
1f43e51be4 C++: Fix ql-for-ql findings. 2025-04-20 16:48:49 +01:00
Mathias Vorreiter Pedersen
1465058da0 C++: Add copy-pasted files from C#. 2025-04-20 16:48:47 +01:00
Mathias Vorreiter Pedersen
09ebd6e87d C++: Instantiate inline expectation test framework to test model generation. 2025-04-20 16:48:45 +01:00
Mathias Vorreiter Pedersen
f241e4b537 C++: Add tests that will soon succeed. 2025-04-20 16:48:43 +01:00
Mathias Vorreiter Pedersen
3d48b23428 C++: Instantiate model generation library. 2025-04-20 16:48:41 +01:00
Nora Dimitrijević
7f5b48d485 C#: Fix join order in ExternalFlow::interpretElement/6 (only affects RTJO mode) 2025-04-17 15:52:13 +02:00
Geoffrey White
254789c89a Merge pull request #19305 from geoffw0/modelnoise
Rust: Remove the noisy models output from the dataflow/local test.
2025-04-17 13:16:45 +01:00
Geoffrey White
22b3ef7f20 Merge pull request #19333 from geoffw0/consistency
Rust: Make source kinds consistent with other languages
2025-04-17 13:15:00 +01:00
Jeroen Ketema
53bd2361af Merge pull request #19329 from github/idrissrio/designated-initializer
C++: add predicate to distinguish designator-based initializations
2025-04-17 13:15:42 +02:00
Arthur Baars
48f9e5a96d Merge pull request #19237 from github/aibaars/crate-graph-type-variables
Rust: extract generic parameters, arguments and resolve bound type variables
2025-04-17 13:02:41 +02:00
Geoffrey White
8d60e82ec0 Merge branch 'main' into modelnoise 2025-04-17 10:43:15 +01:00
Geoffrey White
43069f139d Rust: command-line-source -> commandargs. 2025-04-17 10:15:04 +01:00
Geoffrey White
ed2d06bcd7 Rust: environment-source -> environment. 2025-04-17 09:57:59 +01:00
Geoffrey White
7e108a8a29 Merge pull request #19310 from geoffw0/trim
Rust: Add model for str.trim
2025-04-17 09:48:45 +01:00
Geoffrey White
e1bddb6152 Merge pull request #19304 from geoffw0/rustio
Rust: Model sources for std::io
2025-04-17 09:47:21 +01:00
Geoffrey White
372ba5c9a5 Merge branch 'main' into modelnoise 2025-04-17 09:42:43 +01:00
Geoffrey White
9da6d9435e Rust: More tests affected. 2025-04-16 17:41:27 +01:00
Geoffrey White
77d3c95d6e Merge branch 'main' into trim 2025-04-16 15:33:30 +01:00
Arthur Baars
7bfd5f161e Rust: crate graph: extract associated types 2025-04-15 17:21:04 +02:00
Arthur Baars
2f87630ded Rust: update expected output 2025-04-15 17:18:51 +02:00
Arthur Baars
a4b1c2bbdc Rust: crate graph: resolve bound type variablesp 2025-04-15 17:18:49 +02:00
Arthur Baars
db4306d0c1 Rust: avoid duplication for functions and methods 2025-04-15 17:18:48 +02:00
Arthur Baars
0545f782e0 Rust: get rid of const_or_function 2025-04-15 17:18:46 +02:00
Arthur Baars
5cfbedc114 Rust: replace singleton vectors with Option 2025-04-15 17:18:45 +02:00
Arthur Baars
b24fbe8db9 Rust: remove unreachable case
Enum variants cannot be declared as a module item, they can only be imported
2025-04-15 17:18:44 +02:00
Arthur Baars
cec95ae875 Rust: crate graph: generic parameters 2025-04-15 17:18:42 +02:00
Arthur Baars
a7ccba9aeb Rust: crate graph: type variables 2025-04-15 17:18:28 +02:00
Arthur Baars
2c31363680 Partially revert "Rust: fix compilation errors"
This reverts commit 260322b669.
2025-04-15 17:16:23 +02:00
Geoffrey White
432d4b0eca Merge branch 'main' into trim 2025-04-15 16:05:02 +01:00
Geoffrey White
39a875e751 Rust: Make some summaries value type. 2025-04-15 14:46:57 +01:00
Geoffrey White
c561da4536 Merge branch 'main' into rustio 2025-04-15 12:29:55 +01:00
Geoffrey White
fea82d4d6a Merge branch 'main' into trim 2025-04-15 12:21:48 +01:00
Geoffrey White
40a5db6736 Rust: Other tests affected. 2025-04-15 11:52:23 +01:00
Geoffrey White
c06f340bd8 Rust: Make str / String models consistent. 2025-04-15 11:47:29 +01:00
Geoffrey White
bfe9cdfed5 Rust: Add model for str.trim and as_bytes. 2025-04-15 11:26:52 +01:00
Michael Nebel
0b10d34cae C#: Add change note. 2025-04-15 10:53:40 +02:00
Geoffrey White
bdd5717c09 Rust: Remove the models output from the dataflow/local test. 2025-04-14 16:42:20 +01:00
Geoffrey White
a8b552200a Rust: Impact on dataflow/local test. 2025-04-14 15:03:04 +01:00
Geoffrey White
24bcd041b8 Rust: Add flow models for io. 2025-04-14 14:20:45 +01:00
Michael Nebel
f11aec3592 C#: Update test expected output. 2025-04-14 14:26:51 +02:00
Michael Nebel
c15d1ab3bd C#: Consider an attribute to be authorization like, if it extends an attribute that has an authorization like name. 2025-04-14 14:25:31 +02:00
Michael Nebel
2e7e276806 C#: Add test case for authorization attribute that extends Authorize. 2025-04-14 14:18:30 +02:00
Michael Nebel
8d571672e9 C#: Convert cs/missing-access-control to inline expectations test. 2025-04-14 13:54:43 +02:00
Geoffrey White
7a9ea52bc7 Rust: Add source models for io. 2025-04-14 10:47:30 +01:00
Geoffrey White
4f9f550ba6 Rust: Add source models for fs. 2025-04-14 10:47:26 +01:00
Geoffrey White
258c1afe27 Rust: Add tests for std::fs sources. 2025-04-14 10:47:21 +01:00
Geoffrey White
cef3cd9b54 Rust: Add tests for std::io sources. 2025-04-14 10:47:17 +01:00
Marcono1234
64f37ea24c Docs: Fix typo in code sample 2025-04-12 16:01:55 +02:00
Asger F
6c01709048 JS: Update more test output 2025-04-11 15:15:22 +02:00
Tom Hvitved
e26695fc51 Rust: Take where clauses into account in path resolution 2025-04-11 09:28:08 +02:00
Tom Hvitved
cc85a09b39 Rust: Add AI-generated test for path resolution of where clauses 2025-04-11 09:24:09 +02:00
Asger F
719456e27d JS: Fix missing flow into rest pattern lvalue 2025-04-11 08:37:09 +02:00
Asger F
7703b1fab5 JS: Add test for missing getALocalSource flow for rest pattern 2025-04-11 08:37:07 +02:00
Tom Hvitved
a578f44af4 QL4QL: Restrict ql/qlref-inline-expectations to (path-)problem queries 2025-04-10 15:03:57 +02:00
Michael B. Gale
e210be7bb2 Go: Preserve environment variables in ApplyProxyEnvVars 2025-04-08 12:38:38 +01:00
Michael B. Gale
0f78e11376 Go: Detect and apply proxy settings (WIP) 2025-04-08 12:02:15 +01:00
Michael B. Gale
ded27bcee4 Go: Replace exec.Command("go" with toolchain.GoCommand( 2025-04-08 11:19:42 +01:00
Jami Cogswell
798907dc50 Java: remove change note 2025-04-04 14:01:35 -04:00
Jami Cogswell
77eeab33a6 Java: remove change note 2025-04-04 13:57:34 -04:00
Jami Cogswell
fc21abc7e4 Java: update qhelp implementation notes to say 'method declarations' 2025-04-03 16:05:23 -04:00
Jami Cogswell
0380279c39 Java: update qhelp implementation notes for more clarity 2025-04-02 19:43:33 -04:00
Jami Cogswell
05d7b9a19a Java: add reliability tag 2025-04-02 19:11:26 -04:00
Jami Cogswell
6ade97892f Java: update maintainability tag to reliability instead 2025-04-02 19:06:02 -04:00
Jami Cogswell
1a2c34dd28 Java: update qhelp implementation notes for clarity 2025-04-01 16:24:13 -04:00
Jami
c4b8396333 fix typo in query description
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2025-04-01 15:52:57 -04:00
Jami Cogswell
e621f9fd49 Java: update comments in tests 2025-04-01 15:48:52 -04:00
Jami Cogswell
faeb7ab890 Java: add blank lines to qldocs 2025-04-01 14:54:46 -04:00
Alex Eyers-Taylor
0ccbe3ef7f Ruby: Make module graph queries avoid relying on evalaution order. 2025-04-01 16:18:45 +01:00
Jami Cogswell
416643ce39 Java: update qhelp recommendation and example 2025-03-31 21:09:21 -04:00
Jami
e458aca806 Merge branch 'main' into jcogs33/java/junit5-missing-nested-annotation 2025-03-27 21:31:09 -04:00
Jami Cogswell
92cdddf604 Java: resolve filename conflict 2025-03-27 21:29:20 -04:00
Jami Cogswell
caf21a8202 Java: update qhelp and add 'performace' tag 2025-03-27 20:20:48 -04:00
Jami Cogswell
3631df03c7 Java: add to code-quality suite 2025-03-27 19:38:10 -04:00
Jami Cogswell
ed22a16f32 Java: exclude overloads of finalize 2025-03-27 19:35:46 -04:00
Jami Cogswell
f73eda0c38 Java: add previous-id and change 'use' to 'call' 2025-03-27 19:35:44 -04:00
Jami Cogswell
2e25498143 Java: add change note 2025-03-27 19:35:42 -04:00
Jami Cogswell
44445dbeb8 Java: minor refactor 2025-03-27 19:35:41 -04:00
Jami Cogswell
dd57d1aec6 Java: add quality tag 2025-03-27 19:35:39 -04:00
Jami Cogswell
c689a0e9b7 Java: add more test cases 2025-03-27 19:35:37 -04:00
Jami Cogswell
d9482ae334 Java: update tests to use inline expectations 2025-03-27 19:35:35 -04:00
Jami Cogswell
9a6e241f54 Java: update to only find 'finalize' calls and add 'super.finalize' exclusion 2025-03-27 19:35:34 -04:00
Jami Cogswell
56ea9b6523 Java: move original files 2025-03-27 19:35:32 -04:00
Jami
e169c21f8b Apply suggestions from docs review
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
2025-03-25 07:19:39 -04:00
Jami Cogswell
b9bf192c09 Java: previous-id property instead of tag, see #19097 2025-03-24 14:37:05 -04:00
Jami Cogswell
0f002624d6 Java: remove mention of abstract classes from qhelp 2025-03-23 19:51:37 -04:00
Jami Cogswell
dca4c58b29 Java: add to ccr/quality suite 2025-03-23 19:51:35 -04:00
Jami Cogswell
37092f4411 Java: add 'testability' and 'frameworks/junit' tags 2025-03-23 19:51:26 -04:00
Jami Cogswell
35b647839c Java: include RepeatedTest, ParameterizedTest, TestFactory, and TestTemplate when identifying JUnit 5 test methods 2025-03-23 19:49:55 -04:00
Jami Cogswell
4d7bed6181 Java: exclude anonymous, local, and private classes 2025-03-23 19:49:53 -04:00
Jami Cogswell
3e13f0ed41 Java: remove redundant 'non-static' wording and update qhelp 2025-03-23 19:49:41 -04:00
Jami Cogswell
640096c822 Java: change note 2025-03-23 19:48:20 -04:00
Jami Cogswell
ed57bc7858 Java: exclude abstract classes 2025-03-23 19:48:18 -04:00
Jami Cogswell
b08c8d020d Java: tests to inline expectations 2025-03-23 19:48:17 -04:00
Jami Cogswell
f17e7266cf Java: refactor QL 2025-03-23 19:48:15 -04:00
Jami Cogswell
ccbe77eb09 Java: move original files 2025-03-23 19:48:13 -04:00
976 changed files with 32115 additions and 7172 deletions

View File

@@ -0,0 +1,17 @@
ql/actions/ql/src/Security/CWE-077/EnvPathInjectionCritical.ql
ql/actions/ql/src/Security/CWE-077/EnvVarInjectionCritical.ql
ql/actions/ql/src/Security/CWE-094/CodeInjectionCritical.ql
ql/actions/ql/src/Security/CWE-1395/UseOfKnownVulnerableAction.ql
ql/actions/ql/src/Security/CWE-275/MissingActionsPermissions.ql
ql/actions/ql/src/Security/CWE-285/ImproperAccessControl.ql
ql/actions/ql/src/Security/CWE-312/ExcessiveSecretsExposure.ql
ql/actions/ql/src/Security/CWE-312/SecretsInArtifacts.ql
ql/actions/ql/src/Security/CWE-312/UnmaskedSecretExposure.ql
ql/actions/ql/src/Security/CWE-349/CachePoisoningViaCodeInjection.ql
ql/actions/ql/src/Security/CWE-349/CachePoisoningViaDirectCache.ql
ql/actions/ql/src/Security/CWE-349/CachePoisoningViaPoisonableStep.ql
ql/actions/ql/src/Security/CWE-367/UntrustedCheckoutTOCTOUCritical.ql
ql/actions/ql/src/Security/CWE-367/UntrustedCheckoutTOCTOUHigh.ql
ql/actions/ql/src/Security/CWE-829/ArtifactPoisoningCritical.ql
ql/actions/ql/src/Security/CWE-829/UntrustedCheckoutCritical.ql
ql/actions/ql/src/Security/CWE-829/UntrustedCheckoutHigh.ql

View File

@@ -0,0 +1,27 @@
ql/actions/ql/src/Debug/SyntaxError.ql
ql/actions/ql/src/Security/CWE-077/EnvPathInjectionCritical.ql
ql/actions/ql/src/Security/CWE-077/EnvPathInjectionMedium.ql
ql/actions/ql/src/Security/CWE-077/EnvVarInjectionCritical.ql
ql/actions/ql/src/Security/CWE-077/EnvVarInjectionMedium.ql
ql/actions/ql/src/Security/CWE-094/CodeInjectionCritical.ql
ql/actions/ql/src/Security/CWE-094/CodeInjectionMedium.ql
ql/actions/ql/src/Security/CWE-1395/UseOfKnownVulnerableAction.ql
ql/actions/ql/src/Security/CWE-275/MissingActionsPermissions.ql
ql/actions/ql/src/Security/CWE-285/ImproperAccessControl.ql
ql/actions/ql/src/Security/CWE-312/ExcessiveSecretsExposure.ql
ql/actions/ql/src/Security/CWE-312/SecretsInArtifacts.ql
ql/actions/ql/src/Security/CWE-312/UnmaskedSecretExposure.ql
ql/actions/ql/src/Security/CWE-349/CachePoisoningViaCodeInjection.ql
ql/actions/ql/src/Security/CWE-349/CachePoisoningViaDirectCache.ql
ql/actions/ql/src/Security/CWE-349/CachePoisoningViaPoisonableStep.ql
ql/actions/ql/src/Security/CWE-367/UntrustedCheckoutTOCTOUCritical.ql
ql/actions/ql/src/Security/CWE-367/UntrustedCheckoutTOCTOUHigh.ql
ql/actions/ql/src/Security/CWE-571/ExpressionIsAlwaysTrueCritical.ql
ql/actions/ql/src/Security/CWE-571/ExpressionIsAlwaysTrueHigh.ql
ql/actions/ql/src/Security/CWE-829/ArtifactPoisoningCritical.ql
ql/actions/ql/src/Security/CWE-829/ArtifactPoisoningMedium.ql
ql/actions/ql/src/Security/CWE-829/UnpinnedActionsTag.ql
ql/actions/ql/src/Security/CWE-829/UntrustedCheckoutCritical.ql
ql/actions/ql/src/Security/CWE-829/UntrustedCheckoutHigh.ql
ql/actions/ql/src/Security/CWE-829/UntrustedCheckoutMedium.ql
ql/actions/ql/src/Violations Of Best Practice/CodeQL/UnnecessaryUseOfAdvancedConfig.ql

View File

@@ -0,0 +1,23 @@
ql/actions/ql/src/Security/CWE-077/EnvPathInjectionCritical.ql
ql/actions/ql/src/Security/CWE-077/EnvPathInjectionMedium.ql
ql/actions/ql/src/Security/CWE-077/EnvVarInjectionCritical.ql
ql/actions/ql/src/Security/CWE-077/EnvVarInjectionMedium.ql
ql/actions/ql/src/Security/CWE-094/CodeInjectionCritical.ql
ql/actions/ql/src/Security/CWE-094/CodeInjectionMedium.ql
ql/actions/ql/src/Security/CWE-1395/UseOfKnownVulnerableAction.ql
ql/actions/ql/src/Security/CWE-275/MissingActionsPermissions.ql
ql/actions/ql/src/Security/CWE-285/ImproperAccessControl.ql
ql/actions/ql/src/Security/CWE-312/ExcessiveSecretsExposure.ql
ql/actions/ql/src/Security/CWE-312/SecretsInArtifacts.ql
ql/actions/ql/src/Security/CWE-312/UnmaskedSecretExposure.ql
ql/actions/ql/src/Security/CWE-349/CachePoisoningViaCodeInjection.ql
ql/actions/ql/src/Security/CWE-349/CachePoisoningViaDirectCache.ql
ql/actions/ql/src/Security/CWE-349/CachePoisoningViaPoisonableStep.ql
ql/actions/ql/src/Security/CWE-367/UntrustedCheckoutTOCTOUCritical.ql
ql/actions/ql/src/Security/CWE-367/UntrustedCheckoutTOCTOUHigh.ql
ql/actions/ql/src/Security/CWE-829/ArtifactPoisoningCritical.ql
ql/actions/ql/src/Security/CWE-829/ArtifactPoisoningMedium.ql
ql/actions/ql/src/Security/CWE-829/UnpinnedActionsTag.ql
ql/actions/ql/src/Security/CWE-829/UntrustedCheckoutCritical.ql
ql/actions/ql/src/Security/CWE-829/UntrustedCheckoutHigh.ql
ql/actions/ql/src/Security/CWE-829/UntrustedCheckoutMedium.ql

View File

@@ -0,0 +1,17 @@
ql/actions/ql/src/Debug/partial.ql
ql/actions/ql/src/Models/CompositeActionsSinks.ql
ql/actions/ql/src/Models/CompositeActionsSources.ql
ql/actions/ql/src/Models/CompositeActionsSummaries.ql
ql/actions/ql/src/Models/ReusableWorkflowsSinks.ql
ql/actions/ql/src/Models/ReusableWorkflowsSources.ql
ql/actions/ql/src/Models/ReusableWorkflowsSummaries.ql
ql/actions/ql/src/experimental/Security/CWE-074/OutputClobberingHigh.ql
ql/actions/ql/src/experimental/Security/CWE-078/CommandInjectionCritical.ql
ql/actions/ql/src/experimental/Security/CWE-078/CommandInjectionMedium.ql
ql/actions/ql/src/experimental/Security/CWE-088/ArgumentInjectionCritical.ql
ql/actions/ql/src/experimental/Security/CWE-088/ArgumentInjectionMedium.ql
ql/actions/ql/src/experimental/Security/CWE-200/SecretExfiltration.ql
ql/actions/ql/src/experimental/Security/CWE-284/CodeExecutionOnSelfHostedRunner.ql
ql/actions/ql/src/experimental/Security/CWE-829/ArtifactPoisoningPathTraversal.ql
ql/actions/ql/src/experimental/Security/CWE-829/UnversionedImmutableAction.ql
ql/actions/ql/src/experimental/Security/CWE-918/RequestForgery.ql

View File

@@ -0,0 +1,14 @@
import runs_on
import pytest
from query_suites import *
well_known_query_suites = ['actions-code-quality.qls', 'actions-security-and-quality.qls', 'actions-security-extended.qls', 'actions-code-scanning.qls']
@runs_on.posix
@pytest.mark.parametrize("query_suite", well_known_query_suites)
def test(codeql, actions, check_query_suite, query_suite):
check_query_suite(query_suite)
@runs_on.posix
def test_not_included_queries(codeql, actions, check_queries_not_included):
check_queries_not_included('actions', well_known_query_suites)

View File

@@ -1,7 +1,13 @@
## 0.4.7
## 0.4.8
No user-facing changes.
## 0.4.7
### New Features
* CodeQL and Copilot Autofix support for GitHub Actions is now Generally Available.
## 0.4.6
### Bug Fixes

View File

@@ -1,3 +1,5 @@
## 0.4.7
No user-facing changes.
### New Features
* CodeQL and Copilot Autofix support for GitHub Actions is now Generally Available.

View File

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

View File

@@ -1,2 +1,2 @@
---
lastReleaseVersion: 0.4.7
lastReleaseVersion: 0.4.8

View File

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

View File

@@ -1,5 +1,29 @@
## 0.6.0
### Breaking Changes
* The following queries have been removed from the `security-and-quality` suite.
They are not intended to produce user-facing
alerts describing vulnerabilities.
Any existing alerts for these queries will be closed automatically.
* `actions/composite-action-sinks`
* `actions/composite-action-sources`
* `actions/composite-action-summaries`
* `actions/reusable-workflow-sinks`
(renamed from `actions/reusable-wokflow-sinks`)
* `actions/reusable-workflow-sources`
* `actions/reusable-workflow-summaries`
### Bug Fixes
* Assigned a `security-severity` to the query `actions/excessive-secrets-exposure`.
## 0.5.4
### New Features
* CodeQL and Copilot Autofix support for GitHub Actions is now Generally Available.
### Bug Fixes
* Alerts produced by the query `actions/missing-workflow-permissions` now include a minimal set of recommended permissions in the alert message, based on well-known actions seen within the workflow file.

View File

@@ -5,7 +5,7 @@
* @problem.severity warning
* @security-severity 9.3
* @precision high
* @id actions/reusable-wokflow-sinks
* @id actions/reusable-workflow-sinks
* @tags actions
* model-generator
* external/cwe/cwe-020

View File

@@ -1,4 +0,0 @@
---
category: fix
---
* Assigned a `security-severity` to the query `actions/excessive-secrets-exposure`.

View File

@@ -1,5 +1,9 @@
## 0.5.4
### New Features
* CodeQL and Copilot Autofix support for GitHub Actions is now Generally Available.
### Bug Fixes
* Alerts produced by the query `actions/missing-workflow-permissions` now include a minimal set of recommended permissions in the alert message, based on well-known actions seen within the workflow file.

View File

@@ -0,0 +1,19 @@
## 0.6.0
### Breaking Changes
* The following queries have been removed from the `security-and-quality` suite.
They are not intended to produce user-facing
alerts describing vulnerabilities.
Any existing alerts for these queries will be closed automatically.
* `actions/composite-action-sinks`
* `actions/composite-action-sources`
* `actions/composite-action-summaries`
* `actions/reusable-workflow-sinks`
(renamed from `actions/reusable-wokflow-sinks`)
* `actions/reusable-workflow-sources`
* `actions/reusable-workflow-summaries`
### Bug Fixes
* Assigned a `security-severity` to the query `actions/excessive-secrets-exposure`.

View File

@@ -1,2 +1,2 @@
---
lastReleaseVersion: 0.5.4
lastReleaseVersion: 0.6.0

View File

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

View File

@@ -1,123 +0,0 @@
#!/usr/bin/python
import os
def process_single_file(filename):
if not filename.endswith(".qll"):
return
with open(filename, 'r') as file_in:
lines = [line for line in file_in]
configuresDataflow = any(
"implements DataFlow::ConfigSig" in line for line in lines)
moduleAnnotations = ""
if any(line for line in lines if line.rstrip().endswith("module;")):
for line in lines:
moduleAnnotations += line
if line.rstrip().endswith("module;"):
break
moduleAnnotations = strip_comments(moduleAnnotations)
isFileLevelAnnotated = ("overlay[local]" in moduleAnnotations or
"overlay[local?]" in moduleAnnotations)
if configuresDataflow or isFileLevelAnnotated or filename.endswith("Query.qll"):
if isFileLevelAnnotated and configuresDataflow:
print("WARNING: file \""+filename +
"\" configures dataflow, but is annotated local")
elif configuresDataflow and not filename.endswith("Query.qll"):
print("WARNING: file \""+filename +
"\" configures dataflow but is not a [...]Query.qll file")
elif filename.endswith("Query.qll") and not configuresDataflow:
print("WARNING: file \""+filename +
"\" is a [...]Query.qll file that does not configure dataflow")
elif isFileLevelAnnotated and filename.endswith("Query.qll"):
print("WARNING: file \""+filename +
"\" is a [...]Query.qll file, but is annotated local")
elif any(line for line in lines if line.rstrip().endswith("module;")):
print("file \""+filename +
" was annotated using an existing file-level module statment")
with open(filename, "w") as file_out:
for line in lines:
if line.rstrip().endswith("module;"):
file_out.write("overlay[local?]\n")
file_out.write(line)
elif (lines[0].startswith("import ") or lines[0].startswith("private ") or
lines[0].startswith("newtype ") or lines[0].startswith("module ") or
lines[0].startswith("signature ")):
print("file \""+filename+" was annotated at the very start of the file")
with open(filename, "w") as file_out:
file_out.write("overlay[local?]\nmodule;\n\n")
for line in lines:
file_out.write(line)
elif (strip_comments("".join(lines)).lstrip().startswith("import") or
strip_comments("".join(lines)).lstrip().startswith("private import")):
print("file \""+filename+" was annotated at the first import statement")
with open(filename, "w") as file_out:
firstImport = True
addEmptyLine = ""
for line in lines:
if not line.strip():
if addEmptyLine:
file_out.write(addEmptyLine)
addEmptyLine = line
else:
if firstImport and (line.startswith("import") or line.startswith("private")):
file_out.write("overlay[local?]\nmodule;\n")
firstImport = False
if addEmptyLine:
file_out.write(addEmptyLine)
addEmptyLine = ""
file_out.write(line)
elif (len(lines) > 2 and lines[0].startswith("/** ") and lines[0].endswith(" */\n") and
not lines[1].strip() and lines[2].startswith("/**")):
print("file \""+filename+" was annotated after single-line file module qldoc")
with open(filename, "w") as file_out:
file_out.write(lines[0])
file_out.write("overlay[local?]\nmodule;\n")
for line in lines[1:]:
file_out.write(line)
else:
print("ERROR: failure to annotate file \""+filename+"\"")
def strip_comments(str):
prev = ""
in_multiline = False
in_singleline = False
result = ""
for c in str:
if c == '*' and prev == '/':
in_multiline = True
prev = ""
elif c == '/' and prev == '/':
in_singleline = True
prev = ""
elif in_multiline and c == '/' and prev == '*':
in_multiline = False
prev = ""
elif in_singleline and c == '\n':
in_singleline = False
result += '\n'
prev = ""
else:
if not in_multiline and not in_singleline:
if prev == '/':
result += '/'
if c != '/':
result += c
prev = c
return result
for roots in ["java/ql/lib/semmle/code", "shared"]:
for dirpath, dirnames, filenames in os.walk(roots):
for filename in filenames:
if filename.endswith(".qll"):
process_single_file(os.path.join(dirpath, filename))

View File

@@ -0,0 +1,11 @@
class Type extends @type {
string toString() { none() }
}
class Expr extends @expr {
string toString() { none() }
}
from Type decltype, Expr expr, Type basetype, boolean parentheses
where decltypes(decltype, expr, _, basetype, parentheses)
select decltype, expr, basetype, parentheses

View File

@@ -0,0 +1,19 @@
class Type extends @type {
string toString() { none() }
}
predicate derivedType(Type type, string name, int kind, Type type_id) {
derivedtypes(type, name, kind, type_id)
}
predicate typeTransformation(Type type, string name, int kind, Type type_id) {
type_operators(type, _, _, type_id) and
name = "" and
kind = 3 // @type_with_specifiers
}
from Type type, string name, int kind, Type type_id
where
derivedType(type, name, kind, type_id) or
typeTransformation(type, name, kind, type_id)
select type, name, kind, type_id

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 C23 typeof and typeof_unqual
compatibility: backwards
decltypes.rel: run decltypes.qlo
derivedtypes.rel: run derivedtypes.qlo
type_operators.rel: delete

View File

@@ -1,3 +1,12 @@
## 4.3.0
### New Features
* New classes `TypeofType`, `TypeofExprType`, and `TypeofTypeType` were introduced, which represent the C23 `typeof` and `typeof_unqual` operators. The `TypeofExprType` class represents the variant taking an expression as its argument. The `TypeofTypeType` class represents the variant taking a type as its argument.
* A new class `IntrinsicTransformedType` was introduced, which represents the type transforming intrinsics supported by clang, gcc, and MSVC.
* Introduced `hasDesignator()` predicates to distinguish between designated and positional initializations for both struct/union fields and array elements.
* Added the `isVla()` predicate to the `ArrayType` class. This allows queries to identify variable-length arrays (VLAs).
## 4.2.0
### New Features

View File

@@ -1,4 +0,0 @@
---
category: feature
---
* Added the `isVla()` predicate to the `ArrayType` class. This allows queries to identify variable-length arrays (VLAs).

View File

@@ -1,4 +0,0 @@
---
category: feature
---
* Introduced `hasDesignator()` predicates to distinguish between designated and positional initializations for both struct/union fields and array elements.

View File

@@ -0,0 +1,8 @@
## 4.3.0
### New Features
* New classes `TypeofType`, `TypeofExprType`, and `TypeofTypeType` were introduced, which represent the C23 `typeof` and `typeof_unqual` operators. The `TypeofExprType` class represents the variant taking an expression as its argument. The `TypeofTypeType` class represents the variant taking a type as its argument.
* A new class `IntrinsicTransformedType` was introduced, which represents the type transforming intrinsics supported by clang, gcc, and MSVC.
* Introduced `hasDesignator()` predicates to distinguish between designated and positional initializations for both struct/union fields and array elements.
* Added the `isVla()` predicate to the `ArrayType` class. This allows queries to identify variable-length arrays (VLAs).

View File

@@ -1,2 +1,2 @@
---
lastReleaseVersion: 4.2.0
lastReleaseVersion: 4.3.0

View File

@@ -0,0 +1,5 @@
extensions:
- addsTo:
pack: codeql/cpp-all
extensible: summaryModel
data: []

View File

@@ -1,5 +1,5 @@
name: codeql/cpp-all
version: 4.2.1-dev
version: 4.3.0
groups: cpp
dbscheme: semmlecode.cpp.dbscheme
extractor: cpp
@@ -16,6 +16,7 @@ dependencies:
codeql/xml: ${workspace}
dataExtensions:
- ext/*.model.yml
- ext/generated/*.model.yml
- ext/deallocation/*.model.yml
- ext/allocation/*.model.yml
warnOnImplicitThis: true

View File

@@ -176,6 +176,30 @@ private class DecltypeDumpType extends DumpType, Decltype {
}
}
private class TypeofDumpType extends DumpType, TypeofType {
override string getTypeSpecifier() { result = this.getBaseType().(DumpType).getTypeSpecifier() }
override string getDeclaratorPrefix() {
result = this.getBaseType().(DumpType).getDeclaratorPrefix()
}
override string getDeclaratorSuffix() {
result = this.getBaseType().(DumpType).getDeclaratorSuffix()
}
}
private class IntrinsicTransformedDumpType extends DumpType, IntrinsicTransformedType {
override string getTypeSpecifier() { result = this.getBaseType().(DumpType).getTypeSpecifier() }
override string getDeclaratorPrefix() {
result = this.getBaseType().(DumpType).getDeclaratorPrefix()
}
override string getDeclaratorSuffix() {
result = this.getBaseType().(DumpType).getDeclaratorSuffix()
}
}
private class PointerIshDumpType extends DerivedDumpType {
PointerIshDumpType() {
this instanceof PointerType or

View File

@@ -92,8 +92,9 @@ class Type extends Locatable, @type {
/**
* Gets this type after typedefs have been resolved.
*
* The result of this predicate will be the type itself, except in the case of a TypedefType or a Decltype,
* in which case the result will be type which results from (possibly recursively) resolving typedefs.
* The result of this predicate will be the type itself, except in the case of a TypedefType, a Decltype,
* or a TypeofType, in which case the result will be type which results from (possibly recursively)
* resolving typedefs.
*/
pragma[nomagic]
Type getUnderlyingType() { result = this }
@@ -1117,18 +1118,20 @@ class DerivedType extends Type, @derivedtype {
* decltype(a) b;
* ```
*/
class Decltype extends Type, @decltype {
class Decltype extends Type {
Decltype() { decltypes(underlyingElement(this), _, 0, _, _) }
override string getAPrimaryQlClass() { result = "Decltype" }
/**
* The expression whose type is being obtained by this decltype.
* Gets the expression whose type is being obtained by this decltype.
*/
Expr getExpr() { decltypes(underlyingElement(this), unresolveElement(result), _, _) }
Expr getExpr() { decltypes(underlyingElement(this), unresolveElement(result), _, _, _) }
/**
* The type immediately yielded by this decltype.
* Gets the type immediately yielded by this decltype.
*/
Type getBaseType() { decltypes(underlyingElement(this), _, unresolveElement(result), _) }
Type getBaseType() { decltypes(underlyingElement(this), _, _, unresolveElement(result), _) }
/**
* Whether an extra pair of parentheses around the expression would change the semantics of this decltype.
@@ -1142,7 +1145,7 @@ class Decltype extends Type, @decltype {
* ```
* Please consult the C++11 standard for more details.
*/
predicate parenthesesWouldChangeMeaning() { decltypes(underlyingElement(this), _, _, true) }
predicate parenthesesWouldChangeMeaning() { decltypes(underlyingElement(this), _, _, _, true) }
override Type getUnderlyingType() { result = this.getBaseType().getUnderlyingType() }
@@ -1183,6 +1186,215 @@ class Decltype extends Type, @decltype {
}
}
/**
* An instance of the C23 `typeof` or `typeof_unqual` operator. For example:
* ```
* int a;
* typeof(a) b;
* typeof_unqual(const int) b;
* ```
*/
class TypeofType extends Type {
TypeofType() {
decltypes(underlyingElement(this), _, 1, _, _) or
type_operators(underlyingElement(this), _, 0, _)
}
/**
* Gets the type immediately yielded by this typeof.
*/
Type getBaseType() {
decltypes(underlyingElement(this), _, _, unresolveElement(result), _)
or
type_operators(underlyingElement(this), _, _, unresolveElement(result))
}
override Type getUnderlyingType() { result = this.getBaseType().getUnderlyingType() }
override Type stripTopLevelSpecifiers() { result = this.getBaseType().stripTopLevelSpecifiers() }
override Type stripType() { result = this.getBaseType().stripType() }
override Type resolveTypedefs() { result = this.getBaseType().resolveTypedefs() }
override string toString() { result = "typeof(...)" }
override string getName() { none() }
override int getSize() { result = this.getBaseType().getSize() }
override int getAlignment() { result = this.getBaseType().getAlignment() }
override int getPointerIndirectionLevel() {
result = this.getBaseType().getPointerIndirectionLevel()
}
override string explain() {
result = "typeof resulting in {" + this.getBaseType().explain() + "}"
}
override predicate involvesReference() { this.getBaseType().involvesReference() }
override predicate involvesTemplateParameter() { this.getBaseType().involvesTemplateParameter() }
override predicate isDeeplyConst() { this.getBaseType().isDeeplyConst() }
override predicate isDeeplyConstBelow() { this.getBaseType().isDeeplyConstBelow() }
override Specifier internal_getAnAdditionalSpecifier() {
result = this.getBaseType().getASpecifier()
}
}
/**
* An instance of the C23 `typeof` or `typeof_unqual` operator taking an expression
* as its argument. For example:
* ```
* int a;
* typeof(a) b;
* ```
*/
class TypeofExprType extends TypeofType {
TypeofExprType() { decltypes(underlyingElement(this), _, 1, _, _) }
override string getAPrimaryQlClass() { result = "TypeofExprType" }
/**
* Gets the expression whose type is being obtained by this typeof.
*/
Expr getExpr() { decltypes(underlyingElement(this), unresolveElement(result), _, _, _) }
override Location getLocation() { result = this.getExpr().getLocation() }
}
/**
* A type obtained by C23 `typeof` or `typeof_unqual` operator taking a type as its
* argument. For example:
* ```
* typeof_unqual(const int) b;
* ```
*/
class TypeofTypeType extends TypeofType {
TypeofTypeType() { type_operators(underlyingElement(this), _, 0, _) }
/**
* Gets the expression whose type is being obtained by this typeof.
*/
Type getType() { type_operators(underlyingElement(this), unresolveElement(result), _, _) }
override string getAPrimaryQlClass() { result = "TypeofTypeType" }
override string toString() { result = "typeof(...)" }
}
/**
* A type obtained by applying a type transforming intrinsic. For example:
* ```
* __make_unsigned(int) x;
* ```
*/
class IntrinsicTransformedType extends Type {
int intrinsic;
IntrinsicTransformedType() {
type_operators(underlyingElement(this), _, intrinsic, _) and
intrinsic in [1 .. 19]
}
override string getAPrimaryQlClass() { result = "IntrinsicTransformedType" }
override string toString() { result = this.getIntrinsicName() + "(...)" }
/**
* Gets the type immediately yielded by this transformation.
*/
Type getBaseType() { type_operators(underlyingElement(this), _, _, unresolveElement(result)) }
/**
* Gets the type that is transformed.
*/
Type getType() { type_operators(underlyingElement(this), unresolveElement(result), _, _) }
/**
* Gets the name of the intrinsic used to transform the type.
*/
string getIntrinsicName() {
intrinsic = 1 and result = "__underlying_type"
or
intrinsic = 2 and result = "__bases"
or
intrinsic = 3 and result = "__direct_bases"
or
intrinsic = 4 and result = "__add_lvalue_reference"
or
intrinsic = 5 and result = "__add_pointer"
or
intrinsic = 6 and result = "__add_rvalue_reference"
or
intrinsic = 7 and result = "__decay"
or
intrinsic = 8 and result = "__make_signed"
or
intrinsic = 9 and result = "__make_unsigned"
or
intrinsic = 10 and result = "__remove_all_extents"
or
intrinsic = 11 and result = "__remove_const"
or
intrinsic = 12 and result = "__remove_cv"
or
intrinsic = 13 and result = "__remove_cvref"
or
intrinsic = 14 and result = "__remove_extent"
or
intrinsic = 15 and result = "__remove_pointer"
or
intrinsic = 16 and result = "__remove_reference_t"
or
intrinsic = 17 and result = "__remove_restrict"
or
intrinsic = 18 and result = "__remove_volatile"
or
intrinsic = 19 and result = "__remove_reference"
}
override Type getUnderlyingType() { result = this.getBaseType().getUnderlyingType() }
override Type stripTopLevelSpecifiers() { result = this.getBaseType().stripTopLevelSpecifiers() }
override Type stripType() { result = this.getBaseType().stripType() }
override Type resolveTypedefs() { result = this.getBaseType().resolveTypedefs() }
override string getName() { none() }
override int getSize() { result = this.getBaseType().getSize() }
override int getAlignment() { result = this.getBaseType().getAlignment() }
override int getPointerIndirectionLevel() {
result = this.getBaseType().getPointerIndirectionLevel()
}
override string explain() {
result =
"application of " + this.getIntrinsicName() + " resulting in {" + this.getBaseType().explain()
+ "}"
}
override predicate involvesReference() { this.getBaseType().involvesReference() }
override predicate involvesTemplateParameter() { this.getBaseType().involvesTemplateParameter() }
override predicate isDeeplyConst() { this.getBaseType().isDeeplyConst() }
override predicate isDeeplyConstBelow() { this.getBaseType().isDeeplyConstBelow() }
override Specifier internal_getAnAdditionalSpecifier() {
result = this.getBaseType().getASpecifier()
}
}
/**
* A C/C++ pointer type. See 4.9.1.
* ```

View File

@@ -310,6 +310,8 @@ class Expr extends StmtParent, @expr {
or
exists(Decltype d | d.getExpr() = this.getParentWithConversions*())
or
exists(TypeofExprType t | t.getExpr() = this.getParentWithConversions*())
or
exists(ConstexprIfStmt constIf |
constIf.getControllingExpr() = this.getParentWithConversions*()
)

View File

@@ -16,6 +16,10 @@ private predicate isDeeplyConst(Type t) {
or
isDeeplyConst(t.(Decltype).getBaseType())
or
isDeeplyConst(t.(TypeofType).getBaseType())
or
isDeeplyConst(t.(IntrinsicTransformedType).getBaseType())
or
isDeeplyConst(t.(ReferenceType).getBaseType())
or
exists(SpecifiedType specType | specType = t |
@@ -36,6 +40,10 @@ private predicate isDeeplyConstBelow(Type t) {
or
isDeeplyConstBelow(t.(Decltype).getBaseType())
or
isDeeplyConstBelow(t.(TypeofType).getBaseType())
or
isDeeplyConstBelow(t.(IntrinsicTransformedType).getBaseType())
or
isDeeplyConst(t.(PointerType).getBaseType())
or
isDeeplyConst(t.(ReferenceType).getBaseType())

View File

@@ -743,15 +743,17 @@ typedefbase(
);
/**
* An instance of the C++11 `decltype` operator. For example:
* An instance of the C++11 `decltype` operator or C23 `typeof`/`typeof_unqual`
* operator taking an expression as its argument. For example:
* ```
* int a;
* decltype(1+a) b;
* typeof(1+a) c;
* ```
* Here `expr` is `1+a`.
*
* Sometimes an additional pair of parentheses around the expression
* would change the semantics of this decltype, e.g.
* changes the semantics of the decltype, e.g.
* ```
* struct A { double x; };
* const A* a = new A();
@@ -761,14 +763,55 @@ typedefbase(
* (Please consult the C++11 standard for more details).
* `parentheses_would_change_meaning` is `true` iff that is the case.
*/
/*
case @decltype.kind of
| 0 = @decltype
| 1 = @typeof // The frontend does not differentiate between typeof and typeof_unqual
;
*/
#keyset[id, expr]
decltypes(
int id: @decltype,
int expr: @expr ref,
int kind: int ref,
int base_type: @type ref,
boolean parentheses_would_change_meaning: boolean ref
);
/*
case @type_operator.kind of
| 0 = @typeof // The frontend does not differentiate between typeof and typeof_unqual
| 1 = @underlying_type
| 2 = @bases
| 3 = @direct_bases
| 4 = @add_lvalue_reference
| 5 = @add_pointer
| 6 = @add_rvalue_reference
| 7 = @decay
| 8 = @make_signed
| 9 = @make_unsigned
| 10 = @remove_all_extents
| 11 = @remove_const
| 12 = @remove_cv
| 13 = @remove_cvref
| 14 = @remove_extent
| 15 = @remove_pointer
| 16 = @remove_reference_t
| 17 = @remove_restrict
| 18 = @remove_volatile
| 19 = @remove_reference
;
*/
type_operators(
unique int id: @type_operator,
int arg_type: @type ref,
int kind: int ref,
int base_type: @type ref
)
/*
case @usertype.kind of
| 0 = @unknown_usertype
@@ -1103,10 +1146,10 @@ stmtattributes(
@type = @builtintype
| @derivedtype
| @usertype
/* TODO | @fixedpointtype */
| @routinetype
| @ptrtomember
| @decltype;
| @decltype
| @type_operator;
unspecifiedtype(
unique int type_id: @type ref,

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
class Type extends @type {
string toString() { none() }
}
class Expr extends @expr {
string toString() { none() }
}
from Type decltype, Expr expr, Type basetype, boolean parentheses
where decltypes(decltype, expr, basetype, parentheses)
select decltype, expr, 0, basetype, parentheses

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
description: Support C23 typeof and typeof_unqual
compatibility: partial
decltypes.rel: run decltypes.qlo

View File

@@ -1,3 +1,7 @@
## 1.3.9
No user-facing changes.
## 1.3.8
No user-facing changes.

View File

@@ -179,6 +179,7 @@ predicate overflows(MulExpr me, Type t) {
from MulExpr me, Type t1, Type t2
where
not any(Compilation c).buildModeNone() and
t1 = me.getType().getUnderlyingType() and
t2 = me.getConversion().getType().getUnderlyingType() and
t1.getSize() < t2.getSize() and

View File

@@ -154,6 +154,7 @@ int sizeof_IntType() { exists(IntType it | result = it.getSize()) }
from FormattingFunctionCall ffc, int n, Expr arg, Type expected, Type actual
where
not any(Compilation c).buildModeNone() and
(
formattingFunctionCallExpectedType(ffc, n, expected) and
formattingFunctionCallActualType(ffc, n, arg, actual) and

View File

@@ -47,11 +47,17 @@ Type stripType(Type t) {
or
result = stripType(t.(Decltype).getBaseType())
or
result = stripType(t.(TypeofType).getBaseType())
or
result = stripType(t.(IntrinsicTransformedType).getBaseType())
or
not t instanceof TypedefType and
not t instanceof ArrayType and
not t instanceof ReferenceType and
not t instanceof SpecifiedType and
not t instanceof Decltype and
not t instanceof TypeofType and
not t instanceof IntrinsicTransformedType and
result = t
}

View File

@@ -38,6 +38,7 @@ predicate isCompiledAsC(File f) {
from FunctionDeclarationEntry fdeIm, FunctionCall fc
where
not any(Compilation c).buildModeNone() and
isCompiledAsC(fdeIm.getFile()) and
not isFromMacroDefinition(fc) and
fdeIm.isImplicit() and

View File

@@ -51,6 +51,7 @@ int getComparisonSizeAdjustment(Expr e) {
from Loop l, RelationalOperation rel, VariableAccess small, Expr large
where
not any(Compilation c).buildModeNone() and
small = rel.getLesserOperand() and
large = rel.getGreaterOperand() and
rel = l.getCondition().getAChild*() and

View File

@@ -24,10 +24,12 @@ private predicate isCharSzPtrExpr(Expr e) {
from Expr sizeofExpr, Expr e
where
not any(Compilation c).buildModeNone() and
// If we see an addWithSizeof then we expect the type of
// the pointer expression to be `char*` or `void*`. Otherwise it
// is probably a mistake.
addWithSizeof(e, sizeofExpr, _) and not isCharSzPtrExpr(e)
addWithSizeof(e, sizeofExpr, _) and
not isCharSzPtrExpr(e)
select sizeofExpr,
"Suspicious sizeof offset in a pointer arithmetic expression. The type of the pointer is $@.",
e.getFullyConverted().getType() as t, t.toString()

View File

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

View File

@@ -1,2 +1,2 @@
---
lastReleaseVersion: 1.3.8
lastReleaseVersion: 1.3.9

View File

@@ -1,5 +1,5 @@
name: codeql/cpp-queries
version: 1.3.9-dev
version: 1.3.9
groups:
- cpp
- queries

View File

@@ -0,0 +1,13 @@
/**
* @name Capture content based summary models.
* @description Finds applicable content based summary models to be used by other queries.
* @kind diagnostic
* @id cpp/utils/modelgenerator/contentbased-summary-models
* @tags modelgenerator
*/
import internal.CaptureModels
from DataFlowSummaryTargetApi api, string flow
where flow = ContentSensitive::captureFlow(api, _)
select flow order by flow

View File

@@ -1,13 +1,13 @@
/**
* @name Capture mixed neutral models.
* @name Capture neutral models.
* @description Finds neutral models to be used by other queries.
* @kind diagnostic
* @id cs/utils/modelgenerator/mixed-neutral-models
* @id cpp/utils/modelgenerator/neutral-models
* @tags modelgenerator
*/
import internal.CaptureModels
from DataFlowSummaryTargetApi api, string noflow
where noflow = captureMixedNeutral(api)
where noflow = captureNeutral(api)
select noflow order by noflow

View File

@@ -0,0 +1,14 @@
/**
* @name Capture sink models.
* @description Finds public methods that act as sinks as they flow into a known sink.
* @kind diagnostic
* @id cpp/utils/modelgenerator/sink-models
* @tags modelgenerator
*/
import internal.CaptureModels
import Heuristic
from DataFlowSinkTargetApi api, string sink
where sink = captureSink(api)
select sink order by sink

View File

@@ -0,0 +1,14 @@
/**
* @name Capture source models.
* @description Finds APIs that act as sources as they expose already known sources.
* @kind diagnostic
* @id cpp/utils/modelgenerator/source-models
* @tags modelgenerator
*/
import internal.CaptureModels
import Heuristic
from DataFlowSourceTargetApi api, string source
where source = captureSource(api)
select source order by source

View File

@@ -1,13 +1,13 @@
/**
* @name Capture mixed summary models.
* @name Capture summary models.
* @description Finds applicable summary models to be used by other queries.
* @kind diagnostic
* @id cs/utils/modelgenerator/mixed-summary-models
* @id cpp/utils/modelgenerator/summary-models
* @tags modelgenerator
*/
import internal.CaptureModels
from DataFlowSummaryTargetApi api, string flow
where flow = captureMixedFlow(api, _)
where flow = captureFlow(api, _)
select flow order by flow

View File

@@ -0,0 +1,15 @@
#!/usr/bin/python3
import sys
import os.path
import subprocess
# Add Model as Data script directory to sys.path.
gitroot = subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).decode("utf-8").strip()
madpath = os.path.join(gitroot, "misc/scripts/models-as-data/")
sys.path.append(madpath)
import generate_flow_model as model
language = "cpp"
model.Generator.make(language).run()

View File

@@ -0,0 +1,404 @@
/**
* Provides predicates related to capturing summary models of the Standard or a 3rd party library.
*/
private import cpp
private import semmle.code.cpp.ir.IR
private import semmle.code.cpp.dataflow.ExternalFlow as ExternalFlow
private import semmle.code.cpp.ir.dataflow.internal.DataFlowImplCommon as DataFlowImplCommon
private import semmle.code.cpp.ir.dataflow.internal.DataFlowImplSpecific
private import semmle.code.cpp.ir.dataflow.internal.DataFlowPrivate as DataFlowPrivate
private import semmle.code.cpp.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
private import semmle.code.cpp.ir.dataflow.internal.TaintTrackingImplSpecific
private import semmle.code.cpp.dataflow.new.TaintTracking
private import codeql.mad.modelgenerator.internal.ModelGeneratorImpl
module ModelGeneratorInput implements ModelGeneratorInputSig<Location, CppDataFlow> {
class Type = DataFlowPrivate::DataFlowType;
// Note: This also includes `this`
class Parameter = DataFlow::ParameterNode;
class Callable = Declaration;
class NodeExtended extends DataFlow::Node {
Callable getAsExprEnclosingCallable() { result = this.asExpr().getEnclosingDeclaration() }
}
Parameter asParameter(NodeExtended n) { result = n }
Callable getEnclosingCallable(NodeExtended n) {
result = n.getEnclosingCallable().asSourceCallable()
}
Callable getAsExprEnclosingCallable(NodeExtended n) {
result = n.asExpr().getEnclosingDeclaration()
}
/** Gets `api` if it is relevant. */
private Callable liftedImpl(Callable api) { result = api and relevant(api) }
private predicate hasManualSummaryModel(Callable api) {
api = any(FlowSummaryImpl::Public::SummarizedCallable sc | sc.applyManualModel()) or
api = any(FlowSummaryImpl::Public::NeutralSummaryCallable sc | sc.hasManualModel())
}
private predicate hasManualSourceModel(Callable api) {
api = any(FlowSummaryImpl::Public::NeutralSourceCallable sc | sc.hasManualModel())
}
private predicate hasManualSinkModel(Callable api) {
api = any(FlowSummaryImpl::Public::NeutralSinkCallable sc | sc.hasManualModel())
}
/**
* Holds if `f` is a "private" function.
*
* A "private" function does not contribute any models as it is assumed
* to be an implementation detail of some other "public" function for which
* we will generate a summary.
*/
private predicate isPrivateOrProtected(Function f) {
f.getNamespace().getParentNamespace*().isAnonymous()
or
exists(MemberFunction mf | mf = f |
mf.isPrivate()
or
mf.isProtected()
)
or
f.isStatic()
}
private predicate isUninterestingForModels(Callable api) {
// Note: This also makes all global/static-local variables
// not relevant (which is good!)
not api.(Function).hasDefinition()
or
isPrivateOrProtected(api)
or
api instanceof Destructor
or
api = any(LambdaExpression lambda).getLambdaFunction()
or
api.isFromUninstantiatedTemplate(_)
}
private predicate relevant(Callable api) {
api.fromSource() and
not isUninterestingForModels(api)
}
class SummaryTargetApi extends Callable {
private Callable lift;
SummaryTargetApi() {
lift = liftedImpl(this) and
not hasManualSummaryModel(lift)
}
Callable lift() { result = lift }
predicate isRelevant() {
relevant(this) and
not hasManualSummaryModel(this)
}
}
class SourceOrSinkTargetApi extends Callable {
SourceOrSinkTargetApi() { relevant(this) }
}
class SinkTargetApi extends SourceOrSinkTargetApi {
SinkTargetApi() { not hasManualSinkModel(this) }
}
class SourceTargetApi extends SourceOrSinkTargetApi {
SourceTargetApi() { not hasManualSourceModel(this) }
}
class InstanceParameterNode extends DataFlow::ParameterNode {
InstanceParameterNode() {
DataFlowPrivate::nodeHasInstruction(this,
any(InitializeParameterInstruction i | i.hasIndex(-1)), 1)
}
}
private predicate isFinalMemberFunction(MemberFunction mf) {
mf.isFinal()
or
mf.getDeclaringType().isFinal()
}
/**
* Holds if the summary generated for `c` should also apply to overrides
* of `c`.
*/
private string isExtensible(Callable c) {
if isFinalMemberFunction(c) then result = "false" else result = "true"
}
/**
* Gets the string representing the list of template parameters declared
* by `template`.
*
* `template` must either be:
* - An uninstantiated template, or
* - A declaration that is not from a template instantiation.
*/
private string templateParams(Declaration template) {
exists(string params |
params =
concat(int i |
|
template.getTemplateArgument(i).(TypeTemplateParameter).getName(), "," order by i
)
|
if params = "" then result = "" else result = "<" + params + ">"
)
}
/**
* Gets the string representing the list of parameters declared
* by `functionTemplate`.
*
* `functionTemplate` must either be:
* - An uninstantiated template, or
* - A declaration that is not from a template instantiation.
*/
private string params(Function functionTemplate) {
exists(string params |
params =
concat(int i |
|
ExternalFlow::getParameterTypeWithoutTemplateArguments(functionTemplate, i, true), ","
order by
i
) and
result = "(" + params + ")"
)
}
/**
* Holds if the callable `c` is:
* - In the namespace represented by `namespace`, and
* - Has a declaring type represented by `type`, and
* - Has the name `name`, and
* - Has a list of parameters represented by `params`
*
* This is the predicate that computes the columns that it put into the MaD
* row for `callable`.
*/
private predicate qualifiedName(
Callable callable, string namespace, string type, string name, string params
) {
exists(
Function functionTemplate, string typeWithoutTemplateArgs, string nameWithoutTemplateArgs
|
functionTemplate = ExternalFlow::getFullyTemplatedFunction(callable) and
functionTemplate.hasQualifiedName(namespace, typeWithoutTemplateArgs, nameWithoutTemplateArgs) and
nameWithoutTemplateArgs = functionTemplate.getName() and
name = nameWithoutTemplateArgs + templateParams(functionTemplate) and
params = params(functionTemplate)
|
exists(Class classTemplate |
classTemplate = functionTemplate.getDeclaringType() and
type = typeWithoutTemplateArgs + templateParams(classTemplate)
)
or
not exists(functionTemplate.getDeclaringType()) and
type = ""
)
}
predicate isRelevantType(Type t) { any() }
Type getUnderlyingContentType(DataFlow::ContentSet c) {
result = c.(DataFlow::FieldContent).getField().getUnspecifiedType() or
result = c.(DataFlow::UnionContent).getUnion().getUnspecifiedType()
}
string qualifierString() { result = "Argument[-1]" }
private predicate parameterContentAccessImpl(Parameter p, string argument) {
exists(int indirectionIndex, int argumentIndex, DataFlowPrivate::Position pos |
p.isSourceParameterOf(_, pos) and
pos.getArgumentIndex() = argumentIndex and
argumentIndex != -1 and // handled elsewhere
pos.getIndirectionIndex() = indirectionIndex
|
indirectionIndex = 0 and
argument = "Argument[" + argumentIndex + "]"
or
indirectionIndex > 0 and
argument = "Argument[" + DataFlow::repeatStars(indirectionIndex) + argumentIndex + "]"
)
}
string parameterAccess(Parameter p) { parameterContentAccessImpl(p, result) }
string parameterContentAccess(Parameter p) { parameterContentAccessImpl(p, result) }
bindingset[c]
string paramReturnNodeAsOutput(Callable c, DataFlowPrivate::Position pos) {
exists(Parameter p |
p.isSourceParameterOf(c, pos) and
result = parameterAccess(p)
)
or
pos.getArgumentIndex() = -1 and
result = qualifierString() and
pos.getIndirectionIndex() = 1
}
bindingset[c]
string paramReturnNodeAsContentOutput(Callable c, DataFlowPrivate::ParameterPosition pos) {
result = paramReturnNodeAsOutput(c, pos)
}
pragma[nomagic]
Callable returnNodeEnclosingCallable(DataFlow::Node ret) {
result = DataFlowImplCommon::getNodeEnclosingCallable(ret).asSourceCallable()
}
/** Holds if this instance access is to an enclosing instance of type `t`. */
pragma[nomagic]
private predicate isEnclosingInstanceAccess(DataFlowPrivate::ReturnNode n, Class t) {
n.getKind().isIndirectReturn(-1) and
t = n.getType().stripType() and
t != n.getEnclosingCallable().asSourceCallable().(Function).getDeclaringType()
}
pragma[nomagic]
predicate isOwnInstanceAccessNode(DataFlowPrivate::ReturnNode node) {
node.getKind().isIndirectReturn(-1) and
not isEnclosingInstanceAccess(node, _)
}
predicate sinkModelSanitizer(DataFlow::Node node) { none() }
predicate apiSource(DataFlow::Node source) {
DataFlowPrivate::nodeHasOperand(source, any(DataFlow::FieldAddress fa), 1)
or
source instanceof DataFlow::ParameterNode
}
string getInputArgument(DataFlow::Node source) {
exists(DataFlowPrivate::Position pos, int argumentIndex, int indirectionIndex |
source.(DataFlow::ParameterNode).isParameterOf(_, pos) and
argumentIndex = pos.getArgumentIndex() and
indirectionIndex = pos.getIndirectionIndex() and
result = "Argument[" + DataFlow::repeatStars(indirectionIndex) + argumentIndex + "]"
)
or
DataFlowPrivate::nodeHasOperand(source, any(DataFlow::FieldAddress fa), 1) and
result = qualifierString()
}
string getReturnValueString(DataFlowPrivate::ReturnKind k) {
k.isNormalReturn() and
exists(int indirectionIndex | indirectionIndex = k.getIndirectionIndex() |
indirectionIndex = 0 and
result = "ReturnValue"
or
indirectionIndex > 0 and
result = "ReturnValue[" + DataFlow::repeatStars(indirectionIndex) + "]"
)
}
predicate irrelevantSourceSinkApi(Callable source, SourceTargetApi api) { none() }
bindingset[kind]
predicate isRelevantSourceKind(string kind) { any() }
bindingset[kind]
predicate isRelevantSinkKind(string kind) { any() }
predicate containerContent(DataFlow::ContentSet cs) { cs instanceof DataFlow::ElementContent }
predicate isAdditionalContentFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
TaintTracking::defaultAdditionalTaintStep(node1, node2, _) and
not exists(DataFlow::Content f |
DataFlowPrivate::readStep(node1, f, node2) and containerContent(f)
)
}
predicate isField(DataFlow::ContentSet cs) {
exists(DataFlow::Content c | cs.isSingleton(c) |
c instanceof DataFlow::FieldContent or
c instanceof DataFlow::UnionContent
)
}
predicate isCallback(DataFlow::ContentSet c) { none() }
string getSyntheticName(DataFlow::ContentSet c) {
exists(Field f |
not f.isPublic() and
f = c.(DataFlow::FieldContent).getField() and
result = f.getName()
)
}
string printContent(DataFlow::ContentSet c) {
exists(int indirectionIndex, string name, string kind |
exists(DataFlow::UnionContent uc |
c.isSingleton(uc) and
name = uc.getUnion().getName() and
indirectionIndex = uc.getIndirectionIndex() and
// Note: We don't actually support the union string in MaD, but we should do that eventually
kind = "Union["
)
or
exists(DataFlow::FieldContent fc |
c.isSingleton(fc) and
name = fc.getField().getName() and
indirectionIndex = fc.getIndirectionIndex() and
kind = "Field["
)
|
result = kind + DataFlow::repeatStars(indirectionIndex) + name + "]"
)
or
exists(DataFlow::ElementContent ec |
c.isSingleton(ec) and
result = "Element[" + ec.getIndirectionIndex() + "]"
)
}
predicate isUninterestingForDataFlowModels(Callable api) { none() }
predicate isUninterestingForHeuristicDataFlowModels(Callable api) {
isUninterestingForDataFlowModels(api)
}
string partialModelRow(Callable api, int i) {
i = 0 and qualifiedName(api, result, _, _, _) // namespace
or
i = 1 and qualifiedName(api, _, result, _, _) // type
or
i = 2 and result = isExtensible(api) // extensible
or
i = 3 and qualifiedName(api, _, _, result, _) // name
or
i = 4 and qualifiedName(api, _, _, _, result) // parameters
or
i = 5 and result = "" and exists(api) // ext
}
string partialNeutralModelRow(Callable api, int i) {
i = 0 and qualifiedName(api, result, _, _, _) // namespace
or
i = 1 and qualifiedName(api, _, result, _, _) // type
or
i = 2 and qualifiedName(api, _, _, result, _) // name
or
i = 3 and qualifiedName(api, _, _, _, result) // parameters
}
predicate sourceNode = ExternalFlow::sourceNode/2;
predicate sinkNode = ExternalFlow::sinkNode/2;
}
import MakeModelGenerator<Location, CppDataFlow, CppTaintTracking, ModelGeneratorInput>

View File

@@ -0,0 +1,13 @@
private import cpp as Cpp
private import codeql.mad.modelgenerator.internal.ModelPrinting
private import CaptureModels::ModelGeneratorInput as ModelGeneratorInput
private module ModelPrintingLang implements ModelPrintingLangSig {
class Callable = Cpp::Declaration;
predicate partialModelRow = ModelGeneratorInput::partialModelRow/2;
predicate partialNeutralModelRow = ModelGeneratorInput::partialNeutralModelRow/2;
}
import ModelPrintingImpl<ModelPrintingLang>

View File

@@ -0,0 +1,6 @@
extensions:
- addsTo:
pack: codeql/cpp-all
extensible: summaryModel
data:
- [ "models", "ManuallyModelled", False, "hasSummary", "(void *)", "", "Argument[0]", "ReturnValue", "value", "manual"]

View File

@@ -0,0 +1,11 @@
import cpp
import utils.modelgenerator.internal.CaptureModels
import InlineModelsAsDataTest
module InlineMadTestConfig implements InlineMadTestConfigSig {
string getCapturedModel(MadRelevantFunction c) { result = ContentSensitive::captureFlow(c, _) }
string getKind() { result = "contentbased-summary" }
}
import InlineMadTest<InlineMadTestConfig>

View File

@@ -0,0 +1,6 @@
extensions:
- addsTo:
pack: codeql/cpp-all
extensible: summaryModel
data:
- [ "Models", "ManuallyModelled", False, "hasSummary", "(void *)", "", "Argument[0]", "ReturnValue", "value", "manual"]

View File

@@ -0,0 +1,11 @@
import cpp
import utils.modelgenerator.internal.CaptureModels
import InlineModelsAsDataTest
module InlineMadTestConfig implements InlineMadTestConfigSig {
string getCapturedModel(MadRelevantFunction c) { result = Heuristic::captureFlow(c) }
string getKind() { result = "heuristic-summary" }
}
import InlineMadTest<InlineMadTestConfig>

View File

@@ -0,0 +1,34 @@
private import cpp
private import codeql.mad.test.InlineMadTest
class MadRelevantFunction extends Function {
MadRelevantFunction() { not this.isFromUninstantiatedTemplate(_) }
}
private module InlineMadTestLang implements InlineMadTestLangSig {
class Callable = MadRelevantFunction;
/**
* Holds if `c` is the closest `Callable` that succeeds `comment` in the file.
*/
private predicate hasClosestCallable(CppStyleComment comment, Callable c) {
c =
min(Callable cand, int dist |
// This has no good join order, but should hopefully be good enough for tests.
cand.getFile() = comment.getFile() and
dist = cand.getLocation().getStartLine() - comment.getLocation().getStartLine() and
dist > 0
|
cand order by dist
)
}
string getComment(Callable c) {
exists(CppStyleComment comment |
hasClosestCallable(comment, c) and
result = comment.getContents().suffix(2)
)
}
}
import InlineMadTestImpl<InlineMadTestLang>

View File

@@ -0,0 +1,201 @@
using size_t = decltype(sizeof(int));
size_t strlen(const char* str);
char* strcpy(char* dest, const char* src);
namespace Models {
struct BasicFlow {
int* tainted;
//No model as destructors are excluded from model generation.
~BasicFlow() = default;
//heuristic-summary=Models;BasicFlow;true;returnThis;(int *);;Argument[-1];ReturnValue[*];taint;df-generated
//contentbased-summary=Models;BasicFlow;true;returnThis;(int *);;Argument[-1];ReturnValue[*];value;dfc-generated
BasicFlow* returnThis(int* input) {
return this;
}
//heuristic-summary=Models;BasicFlow;true;returnParam0;(int *,int *);;Argument[0];ReturnValue;taint;df-generated
//heuristic-summary=Models;BasicFlow;true;returnParam0;(int *,int *);;Argument[*0];ReturnValue[*];taint;df-generated
//contentbased-summary=Models;BasicFlow;true;returnParam0;(int *,int *);;Argument[0];ReturnValue;value;dfc-generated
//contentbased-summary=Models;BasicFlow;true;returnParam0;(int *,int *);;Argument[*0];ReturnValue[*];value;dfc-generated
int* returnParam0(int* input0, int* input1) {
return input0;
}
//heuristic-summary=Models;BasicFlow;true;returnParam1;(int *,int *);;Argument[1];ReturnValue;taint;df-generated
//heuristic-summary=Models;BasicFlow;true;returnParam1;(int *,int *);;Argument[*1];ReturnValue[*];taint;df-generated
//contentbased-summary=Models;BasicFlow;true;returnParam1;(int *,int *);;Argument[1];ReturnValue;value;dfc-generated
//contentbased-summary=Models;BasicFlow;true;returnParam1;(int *,int *);;Argument[*1];ReturnValue[*];value;dfc-generated
int* returnParam1(int* input0, int* input1) {
return input1;
}
//heuristic-summary=Models;BasicFlow;true;returnParamMultiple;(bool,int *,int *);;Argument[1];ReturnValue;taint;df-generated
//heuristic-summary=Models;BasicFlow;true;returnParamMultiple;(bool,int *,int *);;Argument[*1];ReturnValue[*];taint;df-generated
//heuristic-summary=Models;BasicFlow;true;returnParamMultiple;(bool,int *,int *);;Argument[2];ReturnValue;taint;df-generated
//heuristic-summary=Models;BasicFlow;true;returnParamMultiple;(bool,int *,int *);;Argument[*2];ReturnValue[*];taint;df-generated
//contentbased-summary=Models;BasicFlow;true;returnParamMultiple;(bool,int *,int *);;Argument[1];ReturnValue;value;dfc-generated
//contentbased-summary=Models;BasicFlow;true;returnParamMultiple;(bool,int *,int *);;Argument[*1];ReturnValue[*];value;dfc-generated
//contentbased-summary=Models;BasicFlow;true;returnParamMultiple;(bool,int *,int *);;Argument[2];ReturnValue;value;dfc-generated
//contentbased-summary=Models;BasicFlow;true;returnParamMultiple;(bool,int *,int *);;Argument[*2];ReturnValue[*];value;dfc-generated
int* returnParamMultiple(bool b, int* input0, int* input1) {
return b ? input0 : input1;
}
//heuristic-summary=Models;BasicFlow;true;returnSubstring;(const char *,char *);;Argument[0];Argument[*1];taint;df-generated
//heuristic-summary=Models;BasicFlow;true;returnSubstring;(const char *,char *);;Argument[0];ReturnValue[*];taint;df-generated
//heuristic-summary=Models;BasicFlow;true;returnSubstring;(const char *,char *);;Argument[*0];ReturnValue[*];taint;df-generated
//heuristic-summary=Models;BasicFlow;true;returnSubstring;(const char *,char *);;Argument[1];ReturnValue;taint;df-generated
//heuristic-summary=Models;BasicFlow;true;returnSubstring;(const char *,char *);;Argument[*0];Argument[*1];taint;df-generated
//contentbased-summary=Models;BasicFlow;true;returnSubstring;(const char *,char *);;Argument[0];Argument[*1];taint;dfc-generated
//contentbased-summary=Models;BasicFlow;true;returnSubstring;(const char *,char *);;Argument[0];ReturnValue[*];taint;dfc-generated
//contentbased-summary=Models;BasicFlow;true;returnSubstring;(const char *,char *);;Argument[*0];ReturnValue[*];value;dfc-generated
//contentbased-summary=Models;BasicFlow;true;returnSubstring;(const char *,char *);;Argument[1];ReturnValue;value;dfc-generated
//contentbased-summary=Models;BasicFlow;true;returnSubstring;(const char *,char *);;Argument[*0];Argument[*1];value;dfc-generated
char* returnSubstring(const char* source, char* dest) {
return strcpy(dest, source + 1);
}
//heuristic-summary=Models;BasicFlow;true;setField;(int *);;Argument[0];Argument[-1];taint;df-generated
//heuristic-summary=Models;BasicFlow;true;setField;(int *);;Argument[*0];Argument[-1];taint;df-generated
//contentbased-summary=Models;BasicFlow;true;setField;(int *);;Argument[0];Argument[-1].Field[*tainted];value;dfc-generated
//contentbased-summary=Models;BasicFlow;true;setField;(int *);;Argument[*0];Argument[-1].Field[**tainted];value;dfc-generated
void setField(int* s) {
tainted = s;
}
//heuristic-summary=Models;BasicFlow;true;returnField;();;Argument[-1];ReturnValue;taint;df-generated
//heuristic-summary=Models;BasicFlow;true;returnField;();;Argument[-1];ReturnValue[*];taint;df-generated
//contentbased-summary=Models;BasicFlow;true;returnField;();;Argument[-1].Field[*tainted];ReturnValue;value;dfc-generated
//contentbased-summary=Models;BasicFlow;true;returnField;();;Argument[-1].Field[**tainted];ReturnValue[*];value;dfc-generated
int* returnField() {
return tainted;
}
};
template<typename T>
struct TemplatedFlow {
T tainted;
//heuristic-summary=Models;TemplatedFlow<T>;true;template_returnThis;(T);;Argument[-1];ReturnValue[*];taint;df-generated
//contentbased-summary=Models;TemplatedFlow<T>;true;template_returnThis;(T);;Argument[-1];ReturnValue[*];value;dfc-generated
TemplatedFlow<T>* template_returnThis(T input) {
return this;
}
//heuristic-summary=Models;TemplatedFlow<T>;true;template_returnParam0;(T *,T *);;Argument[0];ReturnValue;taint;df-generated
//heuristic-summary=Models;TemplatedFlow<T>;true;template_returnParam0;(T *,T *);;Argument[*0];ReturnValue[*];taint;df-generated
//contentbased-summary=Models;TemplatedFlow<T>;true;template_returnParam0;(T *,T *);;Argument[0];ReturnValue;value;dfc-generated
//contentbased-summary=Models;TemplatedFlow<T>;true;template_returnParam0;(T *,T *);;Argument[*0];ReturnValue[*];value;dfc-generated
T* template_returnParam0(T* input0, T* input1) {
return input0;
}
//heuristic-summary=Models;TemplatedFlow<T>;true;template_setField;(T);;Argument[0];Argument[-1];taint;df-generated
//contentbased-summary=Models;TemplatedFlow<T>;true;template_setField;(T);;Argument[0];Argument[-1].Field[*tainted];value;dfc-generated
void template_setField(T s) {
tainted = s;
}
//heuristic-summary=Models;TemplatedFlow<T>;true;template_returnField;();;Argument[-1];ReturnValue[*];taint;df-generated
//contentbased-summary=Models;TemplatedFlow<T>;true;template_returnField;();;Argument[-1].Field[*tainted];ReturnValue[*];value;dfc-generated
T& template_returnField() {
return tainted;
}
//heuristic-summary=Models;TemplatedFlow<T>;true;templated_function<U>;(U *,T *);;Argument[0];ReturnValue;taint;df-generated
//heuristic-summary=Models;TemplatedFlow<T>;true;templated_function<U>;(U *,T *);;Argument[*0];ReturnValue[*];taint;df-generated
//contentbased-summary=Models;TemplatedFlow<T>;true;templated_function<U>;(U *,T *);;Argument[0];ReturnValue;value;dfc-generated
//contentbased-summary=Models;TemplatedFlow<T>;true;templated_function<U>;(U *,T *);;Argument[*0];ReturnValue[*];value;dfc-generated
template<typename U>
U* templated_function(U* u, T* t) {
return u;
}
};
void test_templated_flow() {
// Ensure that we have an instantiation of the templated class
TemplatedFlow<int> intFlow;
intFlow.template_returnThis(0);
intFlow.template_returnParam0(nullptr, nullptr);
intFlow.template_setField(0);
intFlow.template_returnField();
intFlow.templated_function<int>(nullptr, nullptr);
}
}
//heuristic-summary=;;true;toplevel_function;(int *);;Argument[0];ReturnValue;taint;df-generated
//heuristic-summary=;;true;toplevel_function;(int *);;Argument[*0];ReturnValue;taint;df-generated
//contentbased-summary=;;true;toplevel_function;(int *);;Argument[0];ReturnValue;taint;dfc-generated
//contentbased-summary=;;true;toplevel_function;(int *);;Argument[*0];ReturnValue;value;dfc-generated
int toplevel_function(int* p) {
return *p;
}
//No model as static functions are excluded from model generation.
static int static_toplevel_function(int* p) {
return *p;
}
struct NonFinalStruct {
//heuristic-summary=;NonFinalStruct;true;public_not_final_member_function;(int);;Argument[0];ReturnValue;taint;df-generated
//contentbased-summary=;NonFinalStruct;true;public_not_final_member_function;(int);;Argument[0];ReturnValue;value;dfc-generated
virtual int public_not_final_member_function(int x) {
return x;
}
//heuristic-summary=;NonFinalStruct;false;public_final_member_function;(int);;Argument[0];ReturnValue;taint;df-generated
//contentbased-summary=;NonFinalStruct;false;public_final_member_function;(int);;Argument[0];ReturnValue;value;dfc-generated
virtual int public_final_member_function(int x) final {
return x;
}
private:
//No model as private members are excluded from model generation.
int private_member_function(int x) {
return x;
}
protected:
//No model as protected members are excluded from model generation.
int protected_member_function(int x) {
return x;
}
};
struct FinalStruct final {
//heuristic-summary=;FinalStruct;false;public_not_final_member_function_2;(int);;Argument[0];ReturnValue;taint;df-generated
//contentbased-summary=;FinalStruct;false;public_not_final_member_function_2;(int);;Argument[0];ReturnValue;value;dfc-generated
virtual int public_not_final_member_function_2(int x) {
return x;
}
//heuristic-summary=;FinalStruct;false;public_final_member_function_2;(int);;Argument[0];ReturnValue;taint;df-generated
//contentbased-summary=;FinalStruct;false;public_final_member_function_2;(int);;Argument[0];ReturnValue;value;dfc-generated
virtual int public_final_member_function_2(int x) final {
return x;
}
};
union U {
int x, y;
};
//heuristic-summary=;;true;get_x_from_union;(U *);;Argument[0];ReturnValue;taint;df-generated
//heuristic-summary=;;true;get_x_from_union;(U *);;Argument[*0];ReturnValue;taint;df-generated
//contentbased-summary=;;true;get_x_from_union;(U *);;Argument[0];ReturnValue;taint;dfc-generated
//contentbased-summary=;;true;get_x_from_union;(U *);;Argument[*0].Union[*U];ReturnValue;value;dfc-generated
int get_x_from_union(U* u) {
return u->x;
}
//heuristic-summary=;;true;set_x_in_union;(U *,int);;Argument[1];Argument[*0];taint;df-generated
//contentbased-summary=;;true;set_x_in_union;(U *,int);;Argument[1];Argument[*0].Union[*U];value;dfc-generated
void set_x_in_union(U* u, int x) {
u->x = x;
}

View File

@@ -1,5 +1,7 @@
| cpp.cpp:3:5:3:51 | declaration | 0 | cpp.cpp:3:19:3:24 | twisty |
| cpp.cpp:3:5:3:51 | declaration | 0 | cpp.cpp:3:43:3:48 | twisty |
| cpp.cpp:3:15:3:27 | declaration | 0 | cpp.cpp:3:19:3:24 | twisty |
| cpp.cpp:3:15:3:27 | declaration | 0 | cpp.cpp:3:43:3:48 | twisty |
| cpp.cpp:5:5:5:62 | declaration | 0 | cpp.cpp:5:61:5:61 | i |
| cpp.cpp:5:38:5:51 | declaration | 0 | cpp.cpp:5:44:5:44 | t |
| declstmt.c:7:5:7:19 | declaration | 0 | declstmt.c:7:9:7:12 | fun1 |

View File

@@ -1,4 +1,5 @@
| cpp.cpp:3:5:3:51 | declaration | 0 | cpp.cpp:3:43:3:48 | declaration of twisty |
| cpp.cpp:3:15:3:27 | declaration | 0 | cpp.cpp:3:19:3:24 | declaration of twisty |
| cpp.cpp:5:5:5:62 | declaration | 0 | cpp.cpp:5:61:5:61 | definition of i |
| cpp.cpp:5:38:5:51 | declaration | 0 | cpp.cpp:5:44:5:44 | declaration of t |
| declstmt.c:7:5:7:19 | declaration | 0 | declstmt.c:7:9:7:12 | definition of fun1 |

View File

@@ -1,2 +1,3 @@
| file://:0:0:0:0 | 0 | file://:0:0:0:0 | int |
| test.c:7:20:7:21 | E | file://:0:0:0:0 | int |
| test.c:7:14:7:14 | E | file://:0:0:0:0 | int |
| test.c:7:20:7:21 | E | test.c:7:14:7:14 | typeof(...) |

View File

@@ -8,7 +8,10 @@ uniqueEnclosingCallable
| misc.c:210:24:210:24 | 0 | Node should have one enclosing callable but has 0. |
| misc.c:210:24:210:28 | ... + ... | Node should have one enclosing callable but has 0. |
| misc.c:210:28:210:28 | 1 | Node should have one enclosing callable but has 0. |
| stmt_in_type.cpp:3:12:3:40 | (statement expression) | Node should have one enclosing callable but has 0. |
| stmt_in_type.cpp:3:29:3:34 | call to twisty | Node should have one enclosing callable but has 0. |
uniqueCallEnclosingCallable
| stmt_in_type.cpp:3:29:3:34 | call to twisty | Call should have one enclosing callable but has 0. |
uniqueType
uniqueNodeLocation
| file://:0:0:0:0 | (unnamed parameter 2) | Node should have one location but has 0. |

View File

@@ -1,3 +1,7 @@
## 1.7.39
No user-facing changes.
## 1.7.38
No user-facing changes.

View File

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

View File

@@ -1,2 +1,2 @@
---
lastReleaseVersion: 1.7.38
lastReleaseVersion: 1.7.39

View File

@@ -1,5 +1,5 @@
name: codeql/csharp-solorigate-all
version: 1.7.39-dev
version: 1.7.39
groups:
- csharp
- solorigate

View File

@@ -1,3 +1,7 @@
## 1.7.39
No user-facing changes.
## 1.7.38
No user-facing changes.

View File

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

View File

@@ -1,2 +1,2 @@
---
lastReleaseVersion: 1.7.38
lastReleaseVersion: 1.7.39

View File

@@ -1,5 +1,5 @@
name: codeql/csharp-solorigate-queries
version: 1.7.39-dev
version: 1.7.39
groups:
- csharp
- solorigate

View File

@@ -0,0 +1,13 @@
ql/csharp/ql/src/API Abuse/FormatInvalid.ql
ql/csharp/ql/src/API Abuse/NoDisposeCallOnLocalIDisposable.ql
ql/csharp/ql/src/Bad Practices/Control-Flow/ConstantCondition.ql
ql/csharp/ql/src/Dead Code/DeadStoreOfLocal.ql
ql/csharp/ql/src/Likely Bugs/Collections/ContainerLengthCmpOffByOne.ql
ql/csharp/ql/src/Likely Bugs/Collections/ContainerSizeCmpZero.ql
ql/csharp/ql/src/Likely Bugs/DangerousNonShortCircuitLogic.ql
ql/csharp/ql/src/Likely Bugs/ReferenceEqualsOnValueTypes.ql
ql/csharp/ql/src/Likely Bugs/SelfAssignment.ql
ql/csharp/ql/src/Likely Bugs/UncheckedCastInEquals.ql
ql/csharp/ql/src/Performance/UseTryGetValue.ql
ql/csharp/ql/src/Useless code/DefaultToString.ql
ql/csharp/ql/src/Useless code/IntGetHashCode.ql

View File

@@ -0,0 +1,57 @@
ql/csharp/ql/src/Diagnostics/CompilerError.ql
ql/csharp/ql/src/Diagnostics/CompilerMessage.ql
ql/csharp/ql/src/Diagnostics/DiagnosticExtractionErrors.ql
ql/csharp/ql/src/Diagnostics/ExtractedFiles.ql
ql/csharp/ql/src/Diagnostics/ExtractorError.ql
ql/csharp/ql/src/Diagnostics/ExtractorMessage.ql
ql/csharp/ql/src/Metrics/Summaries/LinesOfCode.ql
ql/csharp/ql/src/Security Features/CWE-011/ASPNetDebug.ql
ql/csharp/ql/src/Security Features/CWE-016/ASPNetPagesValidateRequest.ql
ql/csharp/ql/src/Security Features/CWE-022/TaintedPath.ql
ql/csharp/ql/src/Security Features/CWE-022/ZipSlip.ql
ql/csharp/ql/src/Security Features/CWE-078/CommandInjection.ql
ql/csharp/ql/src/Security Features/CWE-079/XSS.ql
ql/csharp/ql/src/Security Features/CWE-089/SqlInjection.ql
ql/csharp/ql/src/Security Features/CWE-090/LDAPInjection.ql
ql/csharp/ql/src/Security Features/CWE-091/XMLInjection.ql
ql/csharp/ql/src/Security Features/CWE-094/CodeInjection.ql
ql/csharp/ql/src/Security Features/CWE-099/ResourceInjection.ql
ql/csharp/ql/src/Security Features/CWE-114/AssemblyPathInjection.ql
ql/csharp/ql/src/Security Features/CWE-117/LogForging.ql
ql/csharp/ql/src/Security Features/CWE-119/LocalUnvalidatedArithmetic.ql
ql/csharp/ql/src/Security Features/CWE-134/UncontrolledFormatString.ql
ql/csharp/ql/src/Security Features/CWE-201/ExposureInTransmittedData.ql
ql/csharp/ql/src/Security Features/CWE-209/ExceptionInformationExposure.ql
ql/csharp/ql/src/Security Features/CWE-248/MissingASPNETGlobalErrorHandler.ql
ql/csharp/ql/src/Security Features/CWE-312/CleartextStorage.ql
ql/csharp/ql/src/Security Features/CWE-352/MissingAntiForgeryTokenValidation.ql
ql/csharp/ql/src/Security Features/CWE-359/ExposureOfPrivateInformation.ql
ql/csharp/ql/src/Security Features/CWE-384/AbandonSession.ql
ql/csharp/ql/src/Security Features/CWE-451/MissingXFrameOptions.ql
ql/csharp/ql/src/Security Features/CWE-502/DeserializedDelegate.ql
ql/csharp/ql/src/Security Features/CWE-502/UnsafeDeserializationUntrustedInput.ql
ql/csharp/ql/src/Security Features/CWE-548/ASPNetDirectoryListing.ql
ql/csharp/ql/src/Security Features/CWE-601/UrlRedirect.ql
ql/csharp/ql/src/Security Features/CWE-611/UntrustedDataInsecureXml.ql
ql/csharp/ql/src/Security Features/CWE-614/RequireSSL.ql
ql/csharp/ql/src/Security Features/CWE-643/XPathInjection.ql
ql/csharp/ql/src/Security Features/CWE-730/ReDoS.ql
ql/csharp/ql/src/Security Features/CWE-730/RegexInjection.ql
ql/csharp/ql/src/Security Features/CWE-807/ConditionalBypass.ql
ql/csharp/ql/src/Security Features/CookieWithOverlyBroadDomain.ql
ql/csharp/ql/src/Security Features/CookieWithOverlyBroadPath.ql
ql/csharp/ql/src/Security Features/Encryption using ECB.ql
ql/csharp/ql/src/Security Features/HeaderCheckingDisabled.ql
ql/csharp/ql/src/Security Features/InadequateRSAPadding.ql
ql/csharp/ql/src/Security Features/InsecureRandomness.ql
ql/csharp/ql/src/Security Features/InsufficientKeySize.ql
ql/csharp/ql/src/Security Features/PersistentCookie.ql
ql/csharp/ql/src/Security Features/WeakEncryption.ql
ql/csharp/ql/src/Telemetry/DatabaseQualityDiagnostics.ql
ql/csharp/ql/src/Telemetry/ExternalLibraryUsage.ql
ql/csharp/ql/src/Telemetry/ExtractorInformation.ql
ql/csharp/ql/src/Telemetry/SupportedExternalApis.ql
ql/csharp/ql/src/Telemetry/SupportedExternalSinks.ql
ql/csharp/ql/src/Telemetry/SupportedExternalSources.ql
ql/csharp/ql/src/Telemetry/SupportedExternalTaint.ql
ql/csharp/ql/src/Telemetry/UnsupportedExternalAPIs.ql

View File

@@ -0,0 +1,173 @@
ql/csharp/ql/src/API Abuse/CallToGCCollect.ql
ql/csharp/ql/src/API Abuse/CallToObsoleteMethod.ql
ql/csharp/ql/src/API Abuse/ClassDoesNotImplementEquals.ql
ql/csharp/ql/src/API Abuse/ClassImplementsICloneable.ql
ql/csharp/ql/src/API Abuse/DisposeNotCalledOnException.ql
ql/csharp/ql/src/API Abuse/FormatInvalid.ql
ql/csharp/ql/src/API Abuse/InconsistentEqualsGetHashCode.ql
ql/csharp/ql/src/API Abuse/IncorrectCompareToSignature.ql
ql/csharp/ql/src/API Abuse/IncorrectEqualsSignature.ql
ql/csharp/ql/src/API Abuse/NoDisposeCallOnLocalIDisposable.ql
ql/csharp/ql/src/API Abuse/NullArgumentToEquals.ql
ql/csharp/ql/src/ASP/BlockCodeResponseWrite.ql
ql/csharp/ql/src/Architecture/Refactoring Opportunities/InappropriateIntimacy.ql
ql/csharp/ql/src/Bad Practices/CallsUnmanagedCode.ql
ql/csharp/ql/src/Bad Practices/CatchOfNullReferenceException.ql
ql/csharp/ql/src/Bad Practices/Control-Flow/ConstantCondition.ql
ql/csharp/ql/src/Bad Practices/Declarations/LocalScopeVariableShadowsMember.ql
ql/csharp/ql/src/Bad Practices/Declarations/TooManyRefParameters.ql
ql/csharp/ql/src/Bad Practices/EmptyCatchBlock.ql
ql/csharp/ql/src/Bad Practices/ErroneousClassCompare.ql
ql/csharp/ql/src/Bad Practices/Implementation Hiding/AbstractToConcreteCollection.ql
ql/csharp/ql/src/Bad Practices/Implementation Hiding/ExposeRepresentation.ql
ql/csharp/ql/src/Bad Practices/Naming Conventions/FieldMasksSuperField.ql
ql/csharp/ql/src/Bad Practices/Naming Conventions/SameNameAsSuper.ql
ql/csharp/ql/src/Bad Practices/PathCombine.ql
ql/csharp/ql/src/Bad Practices/UnmanagedCodeCheck.ql
ql/csharp/ql/src/Bad Practices/VirtualCallInConstructorOrDestructor.ql
ql/csharp/ql/src/CSI/CompareIdenticalValues.ql
ql/csharp/ql/src/CSI/NullAlways.ql
ql/csharp/ql/src/CSI/NullMaybe.ql
ql/csharp/ql/src/Complexity/BlockWithTooManyStatements.ql
ql/csharp/ql/src/Complexity/ComplexCondition.ql
ql/csharp/ql/src/Concurrency/FutileSyncOnField.ql
ql/csharp/ql/src/Concurrency/LockOrder.ql
ql/csharp/ql/src/Concurrency/LockThis.ql
ql/csharp/ql/src/Concurrency/LockedWait.ql
ql/csharp/ql/src/Concurrency/SynchSetUnsynchGet.ql
ql/csharp/ql/src/Concurrency/UnsafeLazyInitialization.ql
ql/csharp/ql/src/Concurrency/UnsynchronizedStaticAccess.ql
ql/csharp/ql/src/Configuration/EmptyPasswordInConfigurationFile.ql
ql/csharp/ql/src/Configuration/PasswordInConfigurationFile.ql
ql/csharp/ql/src/Dead Code/DeadStoreOfLocal.ql
ql/csharp/ql/src/Diagnostics/CompilerError.ql
ql/csharp/ql/src/Diagnostics/CompilerMessage.ql
ql/csharp/ql/src/Diagnostics/DiagnosticExtractionErrors.ql
ql/csharp/ql/src/Diagnostics/ExtractedFiles.ql
ql/csharp/ql/src/Diagnostics/ExtractorError.ql
ql/csharp/ql/src/Diagnostics/ExtractorMessage.ql
ql/csharp/ql/src/Documentation/XmldocMissingSummary.ql
ql/csharp/ql/src/Input Validation/UseOfFileUpload.ql
ql/csharp/ql/src/Input Validation/ValueShadowing.ql
ql/csharp/ql/src/Input Validation/ValueShadowingServerVariable.ql
ql/csharp/ql/src/Language Abuse/CastThisToTypeParameter.ql
ql/csharp/ql/src/Language Abuse/CatchOfGenericException.ql
ql/csharp/ql/src/Language Abuse/ChainedIs.ql
ql/csharp/ql/src/Language Abuse/DubiousDowncastOfThis.ql
ql/csharp/ql/src/Language Abuse/DubiousTypeTestOfThis.ql
ql/csharp/ql/src/Language Abuse/MissedReadonlyOpportunity.ql
ql/csharp/ql/src/Language Abuse/MissedTernaryOpportunity.ql
ql/csharp/ql/src/Language Abuse/MissedUsingOpportunity.ql
ql/csharp/ql/src/Language Abuse/NestedIf.ql
ql/csharp/ql/src/Language Abuse/RethrowException.ql
ql/csharp/ql/src/Language Abuse/SimplifyBoolExpr.ql
ql/csharp/ql/src/Language Abuse/UnusedPropertyValue.ql
ql/csharp/ql/src/Language Abuse/UselessCastToSelf.ql
ql/csharp/ql/src/Language Abuse/UselessNullCoalescingExpression.ql
ql/csharp/ql/src/Language Abuse/UselessTypeTest.ql
ql/csharp/ql/src/Language Abuse/UselessUpcast.ql
ql/csharp/ql/src/Likely Bugs/Collections/ContainerLengthCmpOffByOne.ql
ql/csharp/ql/src/Likely Bugs/Collections/ContainerSizeCmpZero.ql
ql/csharp/ql/src/Likely Bugs/Collections/ReadOnlyContainer.ql
ql/csharp/ql/src/Likely Bugs/Collections/WriteOnlyContainer.ql
ql/csharp/ql/src/Likely Bugs/ConstantComparison.ql
ql/csharp/ql/src/Likely Bugs/DangerousNonShortCircuitLogic.ql
ql/csharp/ql/src/Likely Bugs/Dynamic/BadDynamicCall.ql
ql/csharp/ql/src/Likely Bugs/EqualityCheckOnFloats.ql
ql/csharp/ql/src/Likely Bugs/EqualsArray.ql
ql/csharp/ql/src/Likely Bugs/EqualsUsesAs.ql
ql/csharp/ql/src/Likely Bugs/EqualsUsesIs.ql
ql/csharp/ql/src/Likely Bugs/HashedButNoHash.ql
ql/csharp/ql/src/Likely Bugs/ImpossibleArrayCast.ql
ql/csharp/ql/src/Likely Bugs/IncomparableEquals.ql
ql/csharp/ql/src/Likely Bugs/InconsistentCompareTo.ql
ql/csharp/ql/src/Likely Bugs/LeapYear/UnsafeYearConstruction.ql
ql/csharp/ql/src/Likely Bugs/MishandlingJapaneseEra.ql
ql/csharp/ql/src/Likely Bugs/NestedLoopsSameVariable.ql
ql/csharp/ql/src/Likely Bugs/ObjectComparison.ql
ql/csharp/ql/src/Likely Bugs/PossibleLossOfPrecision.ql
ql/csharp/ql/src/Likely Bugs/RecursiveEquals.ql
ql/csharp/ql/src/Likely Bugs/RecursiveOperatorEquals.ql
ql/csharp/ql/src/Likely Bugs/ReferenceEqualsOnValueTypes.ql
ql/csharp/ql/src/Likely Bugs/SelfAssignment.ql
ql/csharp/ql/src/Likely Bugs/Statements/EmptyBlock.ql
ql/csharp/ql/src/Likely Bugs/Statements/EmptyLockStatement.ql
ql/csharp/ql/src/Likely Bugs/Statements/UseBraces.ql
ql/csharp/ql/src/Likely Bugs/StaticFieldWrittenByInstance.ql
ql/csharp/ql/src/Likely Bugs/StringBuilderCharInit.ql
ql/csharp/ql/src/Likely Bugs/ThreadUnsafeICryptoTransform.ql
ql/csharp/ql/src/Likely Bugs/ThreadUnsafeICryptoTransformLambda.ql
ql/csharp/ql/src/Likely Bugs/UncheckedCastInEquals.ql
ql/csharp/ql/src/Linq/BadMultipleIteration.ql
ql/csharp/ql/src/Linq/MissedAllOpportunity.ql
ql/csharp/ql/src/Linq/MissedCastOpportunity.ql
ql/csharp/ql/src/Linq/MissedOfTypeOpportunity.ql
ql/csharp/ql/src/Linq/MissedSelectOpportunity.ql
ql/csharp/ql/src/Linq/MissedWhereOpportunity.ql
ql/csharp/ql/src/Linq/RedundantSelect.ql
ql/csharp/ql/src/Metrics/Summaries/LinesOfCode.ql
ql/csharp/ql/src/Performance/StringBuilderInLoop.ql
ql/csharp/ql/src/Performance/StringConcatenationInLoop.ql
ql/csharp/ql/src/Performance/UseTryGetValue.ql
ql/csharp/ql/src/Security Features/CWE-011/ASPNetDebug.ql
ql/csharp/ql/src/Security Features/CWE-016/ASPNetPagesValidateRequest.ql
ql/csharp/ql/src/Security Features/CWE-020/RuntimeChecksBypass.ql
ql/csharp/ql/src/Security Features/CWE-022/TaintedPath.ql
ql/csharp/ql/src/Security Features/CWE-022/ZipSlip.ql
ql/csharp/ql/src/Security Features/CWE-078/CommandInjection.ql
ql/csharp/ql/src/Security Features/CWE-079/XSS.ql
ql/csharp/ql/src/Security Features/CWE-089/SqlInjection.ql
ql/csharp/ql/src/Security Features/CWE-090/LDAPInjection.ql
ql/csharp/ql/src/Security Features/CWE-091/XMLInjection.ql
ql/csharp/ql/src/Security Features/CWE-094/CodeInjection.ql
ql/csharp/ql/src/Security Features/CWE-099/ResourceInjection.ql
ql/csharp/ql/src/Security Features/CWE-112/MissingXMLValidation.ql
ql/csharp/ql/src/Security Features/CWE-114/AssemblyPathInjection.ql
ql/csharp/ql/src/Security Features/CWE-117/LogForging.ql
ql/csharp/ql/src/Security Features/CWE-119/LocalUnvalidatedArithmetic.ql
ql/csharp/ql/src/Security Features/CWE-134/UncontrolledFormatString.ql
ql/csharp/ql/src/Security Features/CWE-201/ExposureInTransmittedData.ql
ql/csharp/ql/src/Security Features/CWE-209/ExceptionInformationExposure.ql
ql/csharp/ql/src/Security Features/CWE-248/MissingASPNETGlobalErrorHandler.ql
ql/csharp/ql/src/Security Features/CWE-285/MissingAccessControl.ql
ql/csharp/ql/src/Security Features/CWE-312/CleartextStorage.ql
ql/csharp/ql/src/Security Features/CWE-327/InsecureSQLConnection.ql
ql/csharp/ql/src/Security Features/CWE-352/MissingAntiForgeryTokenValidation.ql
ql/csharp/ql/src/Security Features/CWE-359/ExposureOfPrivateInformation.ql
ql/csharp/ql/src/Security Features/CWE-384/AbandonSession.ql
ql/csharp/ql/src/Security Features/CWE-451/MissingXFrameOptions.ql
ql/csharp/ql/src/Security Features/CWE-502/DeserializedDelegate.ql
ql/csharp/ql/src/Security Features/CWE-502/UnsafeDeserializationUntrustedInput.ql
ql/csharp/ql/src/Security Features/CWE-548/ASPNetDirectoryListing.ql
ql/csharp/ql/src/Security Features/CWE-601/UrlRedirect.ql
ql/csharp/ql/src/Security Features/CWE-611/UntrustedDataInsecureXml.ql
ql/csharp/ql/src/Security Features/CWE-614/RequireSSL.ql
ql/csharp/ql/src/Security Features/CWE-639/InsecureDirectObjectReference.ql
ql/csharp/ql/src/Security Features/CWE-643/XPathInjection.ql
ql/csharp/ql/src/Security Features/CWE-730/ReDoS.ql
ql/csharp/ql/src/Security Features/CWE-730/RegexInjection.ql
ql/csharp/ql/src/Security Features/CWE-798/HardcodedConnectionString.ql
ql/csharp/ql/src/Security Features/CWE-798/HardcodedCredentials.ql
ql/csharp/ql/src/Security Features/CWE-807/ConditionalBypass.ql
ql/csharp/ql/src/Security Features/CookieWithOverlyBroadDomain.ql
ql/csharp/ql/src/Security Features/CookieWithOverlyBroadPath.ql
ql/csharp/ql/src/Security Features/Encryption using ECB.ql
ql/csharp/ql/src/Security Features/HeaderCheckingDisabled.ql
ql/csharp/ql/src/Security Features/InadequateRSAPadding.ql
ql/csharp/ql/src/Security Features/InsecureRandomness.ql
ql/csharp/ql/src/Security Features/InsufficientKeySize.ql
ql/csharp/ql/src/Security Features/PersistentCookie.ql
ql/csharp/ql/src/Security Features/WeakEncryption.ql
ql/csharp/ql/src/Telemetry/DatabaseQualityDiagnostics.ql
ql/csharp/ql/src/Telemetry/ExternalLibraryUsage.ql
ql/csharp/ql/src/Telemetry/ExtractorInformation.ql
ql/csharp/ql/src/Telemetry/SupportedExternalApis.ql
ql/csharp/ql/src/Telemetry/SupportedExternalSinks.ql
ql/csharp/ql/src/Telemetry/SupportedExternalSources.ql
ql/csharp/ql/src/Telemetry/SupportedExternalTaint.ql
ql/csharp/ql/src/Telemetry/UnsupportedExternalAPIs.ql
ql/csharp/ql/src/Useless code/DefaultToString.ql
ql/csharp/ql/src/Useless code/FutileConditional.ql
ql/csharp/ql/src/Useless code/IntGetHashCode.ql
ql/csharp/ql/src/Useless code/RedundantToStringCall.ql
ql/csharp/ql/src/Useless code/UnusedLabel.ql

View File

@@ -0,0 +1,71 @@
ql/csharp/ql/src/Configuration/EmptyPasswordInConfigurationFile.ql
ql/csharp/ql/src/Configuration/PasswordInConfigurationFile.ql
ql/csharp/ql/src/Diagnostics/CompilerError.ql
ql/csharp/ql/src/Diagnostics/CompilerMessage.ql
ql/csharp/ql/src/Diagnostics/DiagnosticExtractionErrors.ql
ql/csharp/ql/src/Diagnostics/ExtractedFiles.ql
ql/csharp/ql/src/Diagnostics/ExtractorError.ql
ql/csharp/ql/src/Diagnostics/ExtractorMessage.ql
ql/csharp/ql/src/Input Validation/UseOfFileUpload.ql
ql/csharp/ql/src/Input Validation/ValueShadowing.ql
ql/csharp/ql/src/Input Validation/ValueShadowingServerVariable.ql
ql/csharp/ql/src/Likely Bugs/ThreadUnsafeICryptoTransform.ql
ql/csharp/ql/src/Likely Bugs/ThreadUnsafeICryptoTransformLambda.ql
ql/csharp/ql/src/Metrics/Summaries/LinesOfCode.ql
ql/csharp/ql/src/Security Features/CWE-011/ASPNetDebug.ql
ql/csharp/ql/src/Security Features/CWE-016/ASPNetPagesValidateRequest.ql
ql/csharp/ql/src/Security Features/CWE-020/RuntimeChecksBypass.ql
ql/csharp/ql/src/Security Features/CWE-022/TaintedPath.ql
ql/csharp/ql/src/Security Features/CWE-022/ZipSlip.ql
ql/csharp/ql/src/Security Features/CWE-078/CommandInjection.ql
ql/csharp/ql/src/Security Features/CWE-079/XSS.ql
ql/csharp/ql/src/Security Features/CWE-089/SqlInjection.ql
ql/csharp/ql/src/Security Features/CWE-090/LDAPInjection.ql
ql/csharp/ql/src/Security Features/CWE-091/XMLInjection.ql
ql/csharp/ql/src/Security Features/CWE-094/CodeInjection.ql
ql/csharp/ql/src/Security Features/CWE-099/ResourceInjection.ql
ql/csharp/ql/src/Security Features/CWE-112/MissingXMLValidation.ql
ql/csharp/ql/src/Security Features/CWE-114/AssemblyPathInjection.ql
ql/csharp/ql/src/Security Features/CWE-117/LogForging.ql
ql/csharp/ql/src/Security Features/CWE-119/LocalUnvalidatedArithmetic.ql
ql/csharp/ql/src/Security Features/CWE-134/UncontrolledFormatString.ql
ql/csharp/ql/src/Security Features/CWE-201/ExposureInTransmittedData.ql
ql/csharp/ql/src/Security Features/CWE-209/ExceptionInformationExposure.ql
ql/csharp/ql/src/Security Features/CWE-248/MissingASPNETGlobalErrorHandler.ql
ql/csharp/ql/src/Security Features/CWE-285/MissingAccessControl.ql
ql/csharp/ql/src/Security Features/CWE-312/CleartextStorage.ql
ql/csharp/ql/src/Security Features/CWE-327/InsecureSQLConnection.ql
ql/csharp/ql/src/Security Features/CWE-352/MissingAntiForgeryTokenValidation.ql
ql/csharp/ql/src/Security Features/CWE-359/ExposureOfPrivateInformation.ql
ql/csharp/ql/src/Security Features/CWE-384/AbandonSession.ql
ql/csharp/ql/src/Security Features/CWE-451/MissingXFrameOptions.ql
ql/csharp/ql/src/Security Features/CWE-502/DeserializedDelegate.ql
ql/csharp/ql/src/Security Features/CWE-502/UnsafeDeserializationUntrustedInput.ql
ql/csharp/ql/src/Security Features/CWE-548/ASPNetDirectoryListing.ql
ql/csharp/ql/src/Security Features/CWE-601/UrlRedirect.ql
ql/csharp/ql/src/Security Features/CWE-611/UntrustedDataInsecureXml.ql
ql/csharp/ql/src/Security Features/CWE-614/RequireSSL.ql
ql/csharp/ql/src/Security Features/CWE-639/InsecureDirectObjectReference.ql
ql/csharp/ql/src/Security Features/CWE-643/XPathInjection.ql
ql/csharp/ql/src/Security Features/CWE-730/ReDoS.ql
ql/csharp/ql/src/Security Features/CWE-730/RegexInjection.ql
ql/csharp/ql/src/Security Features/CWE-798/HardcodedConnectionString.ql
ql/csharp/ql/src/Security Features/CWE-798/HardcodedCredentials.ql
ql/csharp/ql/src/Security Features/CWE-807/ConditionalBypass.ql
ql/csharp/ql/src/Security Features/CookieWithOverlyBroadDomain.ql
ql/csharp/ql/src/Security Features/CookieWithOverlyBroadPath.ql
ql/csharp/ql/src/Security Features/Encryption using ECB.ql
ql/csharp/ql/src/Security Features/HeaderCheckingDisabled.ql
ql/csharp/ql/src/Security Features/InadequateRSAPadding.ql
ql/csharp/ql/src/Security Features/InsecureRandomness.ql
ql/csharp/ql/src/Security Features/InsufficientKeySize.ql
ql/csharp/ql/src/Security Features/PersistentCookie.ql
ql/csharp/ql/src/Security Features/WeakEncryption.ql
ql/csharp/ql/src/Telemetry/DatabaseQualityDiagnostics.ql
ql/csharp/ql/src/Telemetry/ExternalLibraryUsage.ql
ql/csharp/ql/src/Telemetry/ExtractorInformation.ql
ql/csharp/ql/src/Telemetry/SupportedExternalApis.ql
ql/csharp/ql/src/Telemetry/SupportedExternalSinks.ql
ql/csharp/ql/src/Telemetry/SupportedExternalSources.ql
ql/csharp/ql/src/Telemetry/SupportedExternalTaint.ql
ql/csharp/ql/src/Telemetry/UnsupportedExternalAPIs.ql

View File

@@ -0,0 +1,126 @@
ql/csharp/ql/src/API Abuse/MissingDisposeCall.ql
ql/csharp/ql/src/API Abuse/MissingDisposeMethod.ql
ql/csharp/ql/src/API Abuse/NonOverridingMethod.ql
ql/csharp/ql/src/API Abuse/UncheckedReturnValue.ql
ql/csharp/ql/src/ASP/ComplexInlineCode.ql
ql/csharp/ql/src/ASP/NonInternationalizedText.ql
ql/csharp/ql/src/ASP/SplitControlStructure.ql
ql/csharp/ql/src/AlertSuppression.ql
ql/csharp/ql/src/Architecture/Dependencies/MutualDependency.ql
ql/csharp/ql/src/Architecture/Refactoring Opportunities/FeatureEnvy.ql
ql/csharp/ql/src/Bad Practices/Comments/CommentedOutCode.ql
ql/csharp/ql/src/Bad Practices/Comments/TodoComments.ql
ql/csharp/ql/src/Bad Practices/Declarations/EmptyInterface.ql
ql/csharp/ql/src/Bad Practices/Declarations/NoConstantsOnly.ql
ql/csharp/ql/src/Bad Practices/Implementation Hiding/StaticArray.ql
ql/csharp/ql/src/Bad Practices/LeftoverDebugCode.ql
ql/csharp/ql/src/Bad Practices/Magic Constants/MagicConstantsNumbers.ql
ql/csharp/ql/src/Bad Practices/Magic Constants/MagicConstantsString.ql
ql/csharp/ql/src/Bad Practices/Magic Constants/MagicNumbersUseConstant.ql
ql/csharp/ql/src/Bad Practices/Magic Constants/MagicStringsUseConstant.ql
ql/csharp/ql/src/Bad Practices/Naming Conventions/ConfusingMethodNames.ql
ql/csharp/ql/src/Bad Practices/Naming Conventions/ConfusingOverridesNames.ql
ql/csharp/ql/src/Bad Practices/Naming Conventions/ConstantNaming.ql
ql/csharp/ql/src/Bad Practices/Naming Conventions/ControlNamePrefixes.ql
ql/csharp/ql/src/Bad Practices/Naming Conventions/DefaultControlNames.ql
ql/csharp/ql/src/Bad Practices/Naming Conventions/VariableNameTooShort.ql
ql/csharp/ql/src/Bad Practices/UseOfHtmlInputHidden.ql
ql/csharp/ql/src/Bad Practices/UseOfSystemOutputStream.ql
ql/csharp/ql/src/Dead Code/DeadRefTypes.ql
ql/csharp/ql/src/Dead Code/NonAssignedFields.ql
ql/csharp/ql/src/Dead Code/UnusedField.ql
ql/csharp/ql/src/Dead Code/UnusedMethod.ql
ql/csharp/ql/src/Documentation/XmldocExtraParam.ql
ql/csharp/ql/src/Documentation/XmldocExtraTypeParam.ql
ql/csharp/ql/src/Documentation/XmldocMissing.ql
ql/csharp/ql/src/Documentation/XmldocMissingException.ql
ql/csharp/ql/src/Documentation/XmldocMissingParam.ql
ql/csharp/ql/src/Documentation/XmldocMissingReturn.ql
ql/csharp/ql/src/Documentation/XmldocMissingTypeParam.ql
ql/csharp/ql/src/Language Abuse/ForeachCapture.ql
ql/csharp/ql/src/Language Abuse/UselessIsBeforeAs.ql
ql/csharp/ql/src/Likely Bugs/BadCheckOdd.ql
ql/csharp/ql/src/Likely Bugs/RandomUsedOnce.ql
ql/csharp/ql/src/Metrics/Callables/CCyclomaticComplexity.ql
ql/csharp/ql/src/Metrics/Callables/CLinesOfCode.ql
ql/csharp/ql/src/Metrics/Callables/CLinesOfComment.ql
ql/csharp/ql/src/Metrics/Callables/CNumberOfParameters.ql
ql/csharp/ql/src/Metrics/Callables/CNumberOfStatements.ql
ql/csharp/ql/src/Metrics/Callables/CPercentageOfComments.ql
ql/csharp/ql/src/Metrics/Callables/StatementNestingDepth.ql
ql/csharp/ql/src/Metrics/Dependencies/ExternalDependencies.ql
ql/csharp/ql/src/Metrics/Dependencies/ExternalDependenciesSourceLinks.ql
ql/csharp/ql/src/Metrics/Files/FCommentRatio.ql
ql/csharp/ql/src/Metrics/Files/FCyclomaticComplexity.ql
ql/csharp/ql/src/Metrics/Files/FLines.ql
ql/csharp/ql/src/Metrics/Files/FLinesOfCode.ql
ql/csharp/ql/src/Metrics/Files/FLinesOfComment.ql
ql/csharp/ql/src/Metrics/Files/FLinesOfCommentedCode.ql
ql/csharp/ql/src/Metrics/Files/FNumberOfClasses.ql
ql/csharp/ql/src/Metrics/Files/FNumberOfInterfaces.ql
ql/csharp/ql/src/Metrics/Files/FNumberOfStructs.ql
ql/csharp/ql/src/Metrics/Files/FNumberOfTests.ql
ql/csharp/ql/src/Metrics/Files/FNumberOfUsingNamespaces.ql
ql/csharp/ql/src/Metrics/Files/FSelfContainedness.ql
ql/csharp/ql/src/Metrics/RefTypes/TAfferentCoupling.ql
ql/csharp/ql/src/Metrics/RefTypes/TEfferentCoupling.ql
ql/csharp/ql/src/Metrics/RefTypes/TInheritanceDepth.ql
ql/csharp/ql/src/Metrics/RefTypes/TLackOfCohesionCK.ql
ql/csharp/ql/src/Metrics/RefTypes/TLackOfCohesionHS.ql
ql/csharp/ql/src/Metrics/RefTypes/TNumberOfCallables.ql
ql/csharp/ql/src/Metrics/RefTypes/TNumberOfEvents.ql
ql/csharp/ql/src/Metrics/RefTypes/TNumberOfFields.ql
ql/csharp/ql/src/Metrics/RefTypes/TNumberOfIndexers.ql
ql/csharp/ql/src/Metrics/RefTypes/TNumberOfNonConstFields.ql
ql/csharp/ql/src/Metrics/RefTypes/TNumberOfProperties.ql
ql/csharp/ql/src/Metrics/RefTypes/TNumberOfStatements.ql
ql/csharp/ql/src/Metrics/RefTypes/TResponse.ql
ql/csharp/ql/src/Metrics/RefTypes/TSizeOfAPI.ql
ql/csharp/ql/src/Metrics/RefTypes/TSpecialisationIndex.ql
ql/csharp/ql/src/Metrics/RefTypes/TUnmanagedCode.ql
ql/csharp/ql/src/Metrics/Summaries/FrameworkCoverage.ql
ql/csharp/ql/src/Metrics/internal/ExtractorDiagnostics.ql
ql/csharp/ql/src/Security Features/CWE-016/ASPNetMaxRequestLength.ql
ql/csharp/ql/src/Security Features/CWE-016/ASPNetRequestValidationMode.ql
ql/csharp/ql/src/Security Features/CWE-020/ExternalAPIsUsedWithUntrustedData.ql
ql/csharp/ql/src/Security Features/CWE-020/UntrustedDataToExternalAPI.ql
ql/csharp/ql/src/Security Features/CWE-321/HardcodedEncryptionKey.ql
ql/csharp/ql/src/Security Features/CWE-321/HardcodedSymmetricEncryptionKey.ql
ql/csharp/ql/src/Security Features/CWE-327/DontInstallRootCert.ql
ql/csharp/ql/src/Security Features/CWE-502/UnsafeDeserialization.ql
ql/csharp/ql/src/Security Features/CWE-611/UseXmlSecureResolver.ql
ql/csharp/ql/src/Security Features/CWE-838/InappropriateEncoding.ql
ql/csharp/ql/src/Useless code/PointlessForwardingMethod.ql
ql/csharp/ql/src/definitions.ql
ql/csharp/ql/src/experimental/CWE-099/TaintedWebClient.ql
ql/csharp/ql/src/experimental/CWE-918/RequestForgery.ql
ql/csharp/ql/src/experimental/Security Features/CWE-1004/CookieWithoutHttpOnly.ql
ql/csharp/ql/src/experimental/Security Features/CWE-327/Azure/UnsafeUsageOfClientSideEncryptionVersion.ql
ql/csharp/ql/src/experimental/Security Features/CWE-614/CookieWithoutSecure.ql
ql/csharp/ql/src/experimental/Security Features/CWE-759/HashWithoutSalt.ql
ql/csharp/ql/src/experimental/Security Features/JsonWebTokenHandler/delegated-security-validations-always-return-true.ql
ql/csharp/ql/src/experimental/Security Features/JsonWebTokenHandler/security-validation-disabled.ql
ql/csharp/ql/src/experimental/Security Features/Serialization/DefiningDatasetRelatedType.ql
ql/csharp/ql/src/experimental/Security Features/Serialization/DefiningPotentiallyUnsafeXmlSerializer.ql
ql/csharp/ql/src/experimental/Security Features/Serialization/UnsafeTypeUsedDataContractSerializer.ql
ql/csharp/ql/src/experimental/Security Features/Serialization/XmlDeserializationWithDataSet.ql
ql/csharp/ql/src/experimental/Security Features/backdoor/DangerousNativeFunctionCall.ql
ql/csharp/ql/src/experimental/Security Features/backdoor/PotentialTimeBomb.ql
ql/csharp/ql/src/experimental/Security Features/backdoor/ProcessNameToHashTaintFlow.ql
ql/csharp/ql/src/filters/ClassifyFiles.ql
ql/csharp/ql/src/meta/frameworks/Coverage.ql
ql/csharp/ql/src/meta/frameworks/UnsupportedExternalAPIs.ql
ql/csharp/ql/src/utils/modelconverter/ExtractNeutrals.ql
ql/csharp/ql/src/utils/modelconverter/ExtractSinks.ql
ql/csharp/ql/src/utils/modelconverter/ExtractSources.ql
ql/csharp/ql/src/utils/modelconverter/ExtractSummaries.ql
ql/csharp/ql/src/utils/modeleditor/ApplicationModeEndpoints.ql
ql/csharp/ql/src/utils/modeleditor/FrameworkModeEndpoints.ql
ql/csharp/ql/src/utils/modelgenerator/CaptureContentSummaryModels.ql
ql/csharp/ql/src/utils/modelgenerator/CaptureNeutralModels.ql
ql/csharp/ql/src/utils/modelgenerator/CaptureSinkModels.ql
ql/csharp/ql/src/utils/modelgenerator/CaptureSourceModels.ql
ql/csharp/ql/src/utils/modelgenerator/CaptureSummaryModels.ql
ql/csharp/ql/src/utils/modelgenerator/CaptureTypeBasedSummaryModels.ql
ql/csharp/ql/src/utils/modelgenerator/debug/CaptureSummaryModelsPartialPath.ql
ql/csharp/ql/src/utils/modelgenerator/debug/CaptureSummaryModelsPath.ql

View File

@@ -0,0 +1,14 @@
import runs_on
import pytest
from query_suites import *
well_known_query_suites = ['csharp-code-quality.qls', 'csharp-security-and-quality.qls', 'csharp-security-extended.qls', 'csharp-code-scanning.qls']
@runs_on.posix
@pytest.mark.parametrize("query_suite", well_known_query_suites)
def test(codeql, csharp, check_query_suite, query_suite):
check_query_suite(query_suite)
@runs_on.posix
def test_not_included_queries(codeql, csharp, check_queries_not_included):
check_queries_not_included('csharp', well_known_query_suites)

View File

@@ -1,3 +1,9 @@
## 5.1.5
### Minor Analysis Improvements
* Improved autobuilder logic for detecting whether a project references a SDK (and should be built using `dotnet`).
## 5.1.4
### Minor Analysis Improvements

View File

@@ -1,4 +1,5 @@
---
category: minorAnalysis
---
## 5.1.5
### Minor Analysis Improvements
* Improved autobuilder logic for detecting whether a project references a SDK (and should be built using `dotnet`).

View File

@@ -1,2 +1,2 @@
---
lastReleaseVersion: 5.1.4
lastReleaseVersion: 5.1.5

View File

@@ -1,5 +1,5 @@
name: codeql/csharp-all
version: 5.1.5-dev
version: 5.1.5
groups: csharp
dbscheme: semmlecode.csharp.dbscheme
extractor: csharp

View File

@@ -278,9 +278,14 @@ class CaseStmt extends Case, @case_stmt {
override PatternExpr getPattern() { result = this.getChild(0) }
override Stmt getBody() {
exists(int i |
exists(int i, Stmt next |
this = this.getParent().getChild(i) and
result = this.getParent().getChild(i + 1)
next = this.getParent().getChild(i + 1)
|
result = next and
not result instanceof CaseStmt
or
result = next.(CaseStmt).getBody()
)
}

View File

@@ -97,7 +97,8 @@ private class ParamsConstructedCollectionTypes extends ParamsCollectionTypeImpl
unboundbase instanceof SystemCollectionsGenericIReadOnlyListTInterface or
unboundbase instanceof SystemSpanStruct or
unboundbase instanceof SystemReadOnlySpanStruct
)
) and
not this instanceof SystemStringClass
}
override Type getElementType() { result = base.getTypeArgument(0) }

View File

@@ -1153,7 +1153,13 @@ module Statements {
)
or
// Flow from last element of `case` statement `i` to first element of statement `i+1`
exists(int i | last(super.getStmt(i).(CaseStmt).getBody(), pred, c) |
exists(int i, Stmt body |
body = super.getStmt(i).(CaseStmt).getBody() and
// in case of fall-through cases, make sure to not jump from their shared body back
// to one of the fall-through cases
not body = super.getStmt(i + 1).(CaseStmt).getBody() and
last(body, pred, c)
|
c instanceof NormalCompletion and
first(super.getStmt(i + 1), succ)
)

View File

@@ -1,8 +1,6 @@
/**
* Provides classes for representing abstract bounds for use in, for example, range analysis.
*/
overlay[local?]
module;
private import internal.rangeanalysis.BoundSpecific

View File

@@ -3,8 +3,6 @@
* an expression, `b` is a `Bound` (typically zero or the value of an SSA
* variable), and `v` is an integer in the range `[0 .. m-1]`.
*/
overlay[local?]
module;
private import internal.rangeanalysis.ModulusAnalysisSpecific::Private
private import Bound

View File

@@ -408,7 +408,8 @@ Declaration interpretBaseDeclaration(string namespace, string type, string name,
)
}
pragma[inline]
bindingset[d, ext]
pragma[inline_late]
private Declaration interpretExt(Declaration d, ExtPath ext) {
ext = "" and result = d
or

View File

@@ -1,6 +1,3 @@
overlay[local?]
module;
newtype TSign =
TNeg() or
TZero() or

View File

@@ -5,8 +5,6 @@
* The analysis is implemented as an abstract interpretation over the
* three-valued domain `{negative, zero, positive}`.
*/
overlay[local?]
module;
private import SignAnalysisSpecific::Private
private import SsaReadPositionCommon

View File

@@ -1,8 +1,6 @@
/**
* Provides classes for representing a position at which an SSA variable is read.
*/
overlay[local?]
module;
private import SsaReadPositionSpecific
import SsaReadPositionSpecific::Public

View File

@@ -8,69 +8,122 @@ private import semmle.code.csharp.frameworks.System
private import semmle.code.csharp.frameworks.system.Text
/** A method that formats a string, for example `string.Format()`. */
class FormatMethod extends Method {
FormatMethod() {
exists(Class declType | declType = this.getDeclaringType() |
this.getParameter(0).getType() instanceof SystemIFormatProviderInterface and
this.getParameter(1).getType() instanceof StringType and
(
this = any(SystemStringClass c).getFormatMethod()
or
this = any(SystemTextStringBuilderClass c).getAppendFormatMethod()
)
or
this.getParameter(0).getType() instanceof StringType and
(
this = any(SystemStringClass c).getFormatMethod()
or
this = any(SystemTextStringBuilderClass c).getAppendFormatMethod()
or
(this.hasName("Write") or this.hasName("WriteLine")) and
(
declType.hasFullyQualifiedName("System", "Console")
or
declType.hasFullyQualifiedName("System.IO", "TextWriter")
or
declType.hasFullyQualifiedName("System.Diagnostics", "Debug") and
this.getParameter(1).getType() instanceof ArrayType
)
or
declType.hasFullyQualifiedName("System.Diagnostics", "Trace") and
(
this.hasName("TraceError") or
this.hasName("TraceInformation") or
this.hasName("TraceWarning")
)
or
this.hasName("TraceInformation") and
declType.hasFullyQualifiedName("System.Diagnostics", "TraceSource")
or
this.hasName("Print") and
declType.hasFullyQualifiedName("System.Diagnostics", "Debug")
)
or
this.hasName("Assert") and
declType.hasFullyQualifiedName("System.Diagnostics", "Debug") and
this.getNumberOfParameters() = 4
)
}
abstract private class FormatMethodImpl extends Method {
/**
* Gets the argument containing the format string. For example, the argument of
* `string.Format(IFormatProvider, String, Object)` is `1`.
*/
int getFormatArgument() {
abstract int getFormatArgument();
/**
* Gets the argument number of the first supplied insert.
*/
int getFirstArgument() { result = this.getFormatArgument() + 1 }
}
final class FormatMethod = FormatMethodImpl;
/** A class of types used for formatting. */
private class FormatType extends Type {
FormatType() {
this instanceof StringType or
this instanceof SystemTextCompositeFormatClass
}
}
private class StringAndStringBuilderFormatMethods extends FormatMethodImpl {
StringAndStringBuilderFormatMethods() {
(
this.getParameter(0).getType() instanceof SystemIFormatProviderInterface and
this.getParameter(1).getType() instanceof FormatType
or
this.getParameter(0).getType() instanceof StringType
) and
(
this = any(SystemStringClass c).getFormatMethod()
or
this = any(SystemTextStringBuilderClass c).getAppendFormatMethod()
)
}
override int getFormatArgument() {
if this.getParameter(0).getType() instanceof SystemIFormatProviderInterface
then result = 1
else
if
this.hasName("Assert") and
this.getDeclaringType().hasFullyQualifiedName("System.Diagnostics", "Debug")
then result = 2
else result = 0
else result = 0
}
}
private class SystemMemoryExtensionsFormatMethods extends FormatMethodImpl {
SystemMemoryExtensionsFormatMethods() {
this = any(SystemMemoryExtensionsClass c).getTryWriteMethod() and
this.getParameter(1).getType() instanceof SystemIFormatProviderInterface and
this.getParameter(2).getType() instanceof SystemTextCompositeFormatClass
}
override int getFormatArgument() { result = 2 }
override int getFirstArgument() { result = this.getFormatArgument() + 2 }
}
private class SystemConsoleAndSystemIoTextWriterFormatMethods extends FormatMethodImpl {
SystemConsoleAndSystemIoTextWriterFormatMethods() {
this.getParameter(0).getType() instanceof StringType and
this.getNumberOfParameters() > 1 and
exists(Class declType | declType = this.getDeclaringType() |
this.hasName(["Write", "WriteLine"]) and
(
declType.hasFullyQualifiedName("System", "Console")
or
declType.hasFullyQualifiedName("System.IO", "TextWriter")
)
)
}
override int getFormatArgument() { result = 0 }
}
private class SystemDiagnosticsDebugAssert extends FormatMethodImpl {
SystemDiagnosticsDebugAssert() {
this.hasName("Assert") and
this.getDeclaringType().hasFullyQualifiedName("System.Diagnostics", "Debug") and
this.getNumberOfParameters() = 4
}
override int getFormatArgument() { result = 2 }
}
private class SystemDiagnosticsFormatMethods extends FormatMethodImpl {
SystemDiagnosticsFormatMethods() {
this.getParameter(0).getType() instanceof StringType and
this.getNumberOfParameters() > 1 and
exists(Class declType |
declType = this.getDeclaringType() and
declType.getNamespace().getFullName() = "System.Diagnostics"
|
declType.hasName("Trace") and
(
this.hasName("TraceError")
or
this.hasName("TraceInformation")
or
this.hasName("TraceWarning")
)
or
declType.hasName("TraceSource") and this.hasName("TraceInformation")
or
declType.hasName("Debug") and
(
this.hasName("Print")
or
this.hasName(["Write", "WriteLine"]) and
this.getParameter(1).getType() instanceof ArrayType
)
)
}
override int getFormatArgument() { result = 0 }
}
pragma[nomagic]
private predicate parameterReadPostDominatesEntry(ParameterRead pr) {
pr.getAControlFlowNode().postDominates(pr.getEnclosingCallable().getEntryPoint()) and
@@ -194,24 +247,36 @@ class FormatCall extends MethodCall {
int getFormatArgument() { result = this.getTarget().(FormatMethod).getFormatArgument() }
/** Gets the argument number of the first supplied insert. */
int getFirstArgument() { result = this.getFormatArgument() + 1 }
int getFirstArgument() { result = this.getTarget().(FormatMethod).getFirstArgument() }
/** Holds if this call has one or more insertions. */
predicate hasInsertions() { exists(this.getArgument(this.getFirstArgument())) }
/** Holds if the arguments are supplied in an array, not individually. */
predicate hasArrayExpr() {
/**
* DEPRECATED: use `hasCollectionExpr` instead.
*
* Holds if the arguments are supplied in an array, not individually.
*/
deprecated predicate hasArrayExpr() {
this.getNumberOfArguments() = this.getFirstArgument() + 1 and
this.getArgument(this.getFirstArgument()).getType() instanceof ArrayType
}
/**
* Holds if the arguments are supplied in a collection, not individually.
*/
predicate hasCollectionExpr() {
this.getNumberOfArguments() = this.getFirstArgument() + 1 and
this.getArgument(this.getFirstArgument()).getType() instanceof ParamsCollectionType
}
/**
* Gets the number of supplied arguments (excluding the format string and format
* provider). Does not return a value if the arguments are supplied in an array,
* in which case we generally can't assess the size of the array.
*/
int getSuppliedArguments() {
not this.hasArrayExpr() and
not this.hasCollectionExpr() and
result = this.getNumberOfArguments() - this.getFirstArgument()
}

View File

@@ -365,7 +365,7 @@ class SystemStringClass extends StringType {
/** Gets a `Format(...)` method. */
Method getFormatMethod() {
result.getDeclaringType() = this and
result.hasName("Format") and
result.getName().regexpMatch("Format(<.*>)?") and
result.getNumberOfParameters() in [2 .. 5] and
result.getReturnType() instanceof StringType
}
@@ -751,6 +751,18 @@ class SystemNotImplementedExceptionClass extends SystemClass {
SystemNotImplementedExceptionClass() { this.hasName("NotImplementedException") }
}
/** The `System.MemoryExtensions` class. */
class SystemMemoryExtensionsClass extends SystemClass {
SystemMemoryExtensionsClass() { this.hasName("MemoryExtensions") }
/** Gets a `TryWrite` method. */
Method getTryWriteMethod() {
result.getDeclaringType() = this and
result.getName().regexpMatch("TryWrite(<.*>)?") and
result.getParameter(0).getType().getUnboundDeclaration() instanceof SystemSpanStruct
}
}
/** The `System.DateTime` struct. */
class SystemDateTimeStruct extends SystemStruct {
SystemDateTimeStruct() { this.hasName("DateTime") }

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