Compare commits

..

670 Commits

Author SHA1 Message Date
Chris Smowton
4bb829ebec Merge pull request #19488 from github/release-prep/2.21.3
Release preparation for version 2.21.3
2025-05-13 22:22:20 +01:00
github-actions[bot]
2de4a01c86 Release preparation for version 2.21.3 2025-05-13 21:14:27 +00:00
Chris Smowton
c6cc4c0e13 Merge pull request #19402 from smowton/smowton/admin/kotlin-2.2.0-support
Add support for Kotlin 2.2.0; drop Kotlin 1.5.x
2025-05-13 21:11:31 +01:00
Chris Smowton
fecad025de Fix handling of X/jvm-default intermediate modes such as 'compatibility', the new default as of 2.2.0 2025-05-13 18:10:21 +01:00
Mathias Vorreiter Pedersen
fa7942393d Merge pull request #19477 from MathiasVP/fix-infinite-range-analysis-on-incomplete-ssa
C++: Fix infinite range analysis loop on invalid SSA
2025-05-13 16:59:11 +01:00
Paolo Tranquilli
3001d0bd1c Bazel: remove 2.0.0 rules_kotlin patching 2025-05-13 15:57:37 +01:00
Florin Coada
c608a9056b Merge pull request #19462 from github/changedocs/2.21.2
Update changelogs for CodeQL CLI 2.21.2
2025-05-13 15:23:35 +01:00
Tom Hvitved
3fc9da7466 Merge pull request #19475 from hvitved/rust/literal-sub-classes
Rust: Add `LiteralExpr` sub classes
2025-05-13 16:06:53 +02:00
Asger F
169ae19015 Merge pull request #19391 from asgerf/js/typescript-path-resolution
JS: Overhaul import resolution
2025-05-13 15:46:38 +02:00
Chris Smowton
a2836f5aab Adjust integration test expectations 2025-05-13 14:42:19 +01:00
Chris Smowton
27222499d4 Update test expectation 2025-05-13 14:42:18 +01:00
Chris Smowton
fc1fd263df Fix plugin test to work with Kotlin 2.1.20 2025-05-13 14:42:17 +01:00
Chris Smowton
0d34837eaf Bump unit tests to use latest stable Kotlin 2025-05-13 14:42:16 +01:00
Chris Smowton
1afe67ab13 Accept Kotlin 2.1.20 test changes
These are mainly small changes in how source-locations are ascribed to synthetic expressions, plus three real changes:

- The comment extractor is performing better presumably due to improvements in the underlying representation
- *= /= and %= operations are once again extracted correctly; presumably their origin information has been fixed
- Reference to a static final Java field can lead to more constant propagation than before

The last one might be a minor nuisance to someone trying to find references to such a field.
2025-05-13 14:42:15 +01:00
Chris Smowton
34e0a7b23a Bump Kotlin version to keep integration test working 2025-05-13 14:42:13 +01:00
Chris Smowton
29d369f22f Don't try to decode a class from a .java file 2025-05-13 14:42:12 +01:00
Chris Smowton
0d21fa51f2 Change default version 2025-05-13 14:42:11 +01:00
Chris Smowton
3f23212d4e Update test expectation 2025-05-13 14:42:10 +01:00
Chris Smowton
2ad5e20e79 Change note 2025-05-13 14:42:09 +01:00
Chris Smowton
4cb1e7840f Update Kotlin doc table 2025-05-13 14:42:07 +01:00
Chris Smowton
a36fc30d44 Fix build for Kotlin 2.2.0 2025-05-13 14:42:06 +01:00
Chris Smowton
24feb51661 Fix Gradle config 2025-05-13 14:42:05 +01:00
Chris Smowton
163a403065 Add Kotlin 2.2.0-Beta1; drop Kotlin 1.5 2025-05-13 14:42:04 +01:00
Paolo Tranquilli
abea647bb1 Bazel: update rules_kotlin to 2.1.3 2025-05-13 14:42:03 +01:00
Chris Smowton
08aad90346 Add 2.2.0-Beta1 deps 2025-05-13 14:42:02 +01:00
Mathias Vorreiter Pedersen
f255fc2fd5 C++: Drive-by join order fix. Before:
```
Evaluated relational algebra for predicate SsaInternals::getDefImpl/1#1ed4f567@65628fbv with tuple counts:
          4935102  ~5%    {4} r1 = SCAN `SsaInternals::SsaImpl::Definition.definesAt/3#dispred#7eea4c8f` OUTPUT In.2, In.3, In.0, In.1
        104274503  ~1%    {3}    | JOIN WITH `SsaInternals::DefImpl.hasIndexInBlock/2#dispred#30a6c29f_120#join_rhs` ON FIRST 2 OUTPUT Rhs.2, Lhs.3, Lhs.2
          4921319  ~2%    {2}    | JOIN WITH `SsaInternals::DefImpl.getSourceVariable/0#dispred#72437659` ON FIRST 2 OUTPUT Lhs.2, Lhs.0
                          return r1
```
After:
```
Evaluated relational algebra for predicate SsaInternals::SsaImpl::Definition.definesAt/3#dispred#7eea4c8f_1230#join_rhs@b280fb5h with tuple counts:
        4935102  ~3%    {4} r1 = SCAN `SsaInternals::SsaImpl::Definition.definesAt/3#dispred#7eea4c8f` OUTPUT In.1, In.2, In.3, In.0
                        return r1

Evaluated relational algebra for predicate SsaInternals::DefImpl.hasIndexInBlock/3#dispred#31d295aa_1230#join_rhs@2be655s4 with tuple counts:
        5634706  ~1%    {4} r1 = SCAN `SsaInternals::DefImpl.hasIndexInBlock/3#dispred#31d295aa` OUTPUT In.1, In.2, In.3, In.0
                        return r1

Evaluated relational algebra for predicate SsaInternals::getDefImpl/1#1ed4f567@8afa36uu with tuple counts:
        4921319  ~2%    {2} r1 = JOIN `SsaInternals::SsaImpl::Definition.definesAt/3#dispred#7eea4c8f_1230#join_rhs` WITH `SsaInternals::DefImpl.hasIndexInBlock/3#dispred#31d295aa_1230#join_rhs` ON FIRST 3 OUTPUT Lhs.3, Rhs.3
                        return r1
```
2025-05-13 14:21:28 +01:00
Tom Hvitved
ae54c62001 Simplify using non-capturing groups 2025-05-13 15:06:43 +02:00
Asger F
aea676df3c Merge pull request #19445 from asgerf/js/summaries-with-fallback
JS: Generate flow summaries from summaryModels; only generate steps as a fallback
2025-05-13 14:49:38 +02:00
Mathias Vorreiter Pedersen
0836f0b413 C++: Cache and fix join order in 'hasIncompleteSsa'. 2025-05-13 13:41:15 +01:00
Tom Hvitved
7494eac35c Address review comments 2025-05-13 14:26:09 +02:00
Geoffrey White
20a012d5f1 Merge pull request #19454 from geoffw0/deref
Rust: Add Operation class
2025-05-13 13:17:14 +01:00
yoff
1c863b1bd4 Merge pull request #19476 from yoff/ruby/DeadStoreOfLocal-precision-high
ruby: adjust precision of `rb/useless-assignment-to-local`
2025-05-13 13:56:22 +02:00
Mathias Vorreiter Pedersen
c3c18bdbd2 C++: Add change note. 2025-05-13 11:28:25 +01:00
Mathias Vorreiter Pedersen
9d2eb3d9b8 C++: Filter out instructions with incomplete SSA in range analysis. 2025-05-13 10:54:22 +01:00
Mathias Vorreiter Pedersen
510df38da2 C++: Add an 'hasIncompleteSsa' predicate to check whether a function has correctly modelled SSA information. 2025-05-13 10:54:20 +01:00
Simon Friis Vindum
4cc9c24940 Merge pull request #19452 from paldepind/shared-model-generator-script
Shared: Remove the language-specific model generator scripts
2025-05-13 10:17:37 +02:00
Geoffrey White
b3dc7a21b3 Apply suggestions from code review
Co-authored-by: Simon Friis Vindum <paldepind@github.com>
2025-05-13 09:06:25 +01:00
Geoffrey White
2b6e428c37 Merge pull request #19466 from geoffw0/web
Rust: Add tests for web frameworks as taint sources
2025-05-13 09:02:46 +01:00
Simon Friis Vindum
014e7dc4bc Shared: Remove change note for internal MaD generator 2025-05-13 09:50:07 +02:00
Simon Friis Vindum
14bdc1ab22 Shared: Minor tweaks to model generator script
Co-authored-by: Michael Nebel <michaelnebel@github.com>
2025-05-13 09:31:50 +02:00
Michael Nebel
0c0e1d0c46 Merge pull request #19456 from 5idg5/5idg5-update-cs-stubs
Add new stubs definitions to System.Web
2025-05-13 08:56:06 +02:00
Sid Gawri
eb4711e884 Merge branch '5idg5-update-cs-stubs' of https://github.com/5idg5/codeql into 5idg5-update-cs-stubs 2025-05-12 17:41:32 -04:00
5idg5
6a5ce39930 Merge branch 'github:main' into 5idg5-update-cs-stubs 2025-05-12 17:39:33 -04:00
Michael Nebel
5faaa4f0f3 C#: Cleanup test options files. 2025-05-12 17:36:52 -04:00
Michael Nebel
05dc9b6d34 C#: Remove dependency to ASP.NET in the System.Web.cs stub file. 2025-05-12 17:36:10 -04:00
Michael Nebel
60d26e522e C#: Cleanup test options files. 2025-05-12 17:36:08 -04:00
Michael Nebel
82cf472f8a C#: Fix ASP tests. 2025-05-12 17:33:22 -04:00
Michael Nebel
ffd6b2677c C#: Cleanup test options files. 2025-05-12 17:33:21 -04:00
yoff
a50167812d ruby: adjust precision of rb/useless-assignment-to-local
from `medium` to `high`
2025-05-12 23:26:21 +02:00
Mathias Vorreiter Pedersen
f1b4e05579 C++: Expose 'isBusyDef'. 2025-05-12 19:45:19 +01:00
Mathias Vorreiter Pedersen
e51cb478af C++: Expose 'MemoryLocation0'. 2025-05-12 19:43:19 +01:00
Tom Hvitved
cd01bd0e07 Rust: Add LiteralExpr sub classes 2025-05-12 20:35:00 +02:00
Nicolas Will
d3282a9470 Merge pull request #19469 from nicolaswill/quantum-experimental
Add CodeQL Quantum models and queries (Java, C++) to experimental
2025-05-12 19:25:34 +02:00
Geoffrey White
a2944cdb61 Rust: Make usage of Impl more consistent with other Impl modules. 2025-05-12 16:48:06 +01:00
Geoffrey White
9160036e41 Rust: Rename OperationImpl -> Impl. 2025-05-12 16:45:41 +01:00
Geoffrey White
7c98fa87da Rust: One more bit of cleanup. 2025-05-12 16:34:08 +01:00
Geoffrey White
402a84f755 Update rust/ql/test/library-tests/dataflow/sources/web_frameworks.rs
Co-authored-by: Simon Friis Vindum <paldepind@github.com>
2025-05-12 16:17:26 +01:00
Geoffrey White
bf8cdffffa Update rust/ql/test/library-tests/dataflow/sources/web_frameworks.rs
Co-authored-by: Simon Friis Vindum <paldepind@github.com>
2025-05-12 16:06:33 +01:00
Geoffrey White
08fcf6114f Apply suggestions from code review
Co-authored-by: Simon Friis Vindum <paldepind@github.com>
2025-05-12 16:01:52 +01:00
Geoffrey White
6678dc490a Merge pull request #19449 from geoffw0/alloc-size-sev
Rust: Update query severities
2025-05-12 15:57:02 +01:00
Geoffrey White
a69a56122f Merge pull request #19455 from geoffw0/quality
Rust: Use the new 'quality' tag.
2025-05-12 15:56:12 +01:00
Nicolas Will
5334e90717 Make FlowAwareElement private 2025-05-12 14:58:04 +02:00
Nicolas Will
c66ec63333 Fix query compilation errors 2025-05-12 14:48:58 +02:00
Nicolas Will
8f36624171 Add AsymmetricAlgorithmNode, refactor and address feedback 2025-05-12 14:37:44 +02:00
Nicolas Will
ab3f62eed1 Add missing tags to PrintCBOMGraph.ql queries 2025-05-12 14:34:16 +02:00
Asger F
891b2b8335 DataFlow: Support a bare Argument[n] as a valid output stack 2025-05-12 09:42:45 +02:00
Asger F
8fab235d66 DataFlow: Fix typo in a comment 2025-05-12 09:41:49 +02:00
Simon Friis Vindum
14ede4e0c5 Merge pull request #19440 from paldepind/rust-update-stdlib-models
Rust: Update generated models for core and std
2025-05-12 08:11:18 +02:00
Sid Gawri
4e3ac93f70 fix unit tests part 2 2025-05-09 16:24:42 -04:00
Sid Gawri
089ef1cae1 Merge branch 'main' of https://github.com/5idg5/codeql into 5idg5-update-cs-stubs 2025-05-09 15:35:11 -04:00
Geoffrey White
48b95f3a4e Rust: Move OperationImpl to internal/OperationImpl.qll. 2025-05-09 17:01:49 +01:00
Nicolas Will
fbf3d7c195 Update CODEOWNERS to specify shared pack directory 2025-05-09 14:36:55 +02:00
Nicolas Will
cd59ce5b04 Rename shared pack to quantum from experimental 2025-05-09 14:36:12 +02:00
Nicolas Will
64e40715ee Merge branch 'quantum-experimental' of https://github.com/nicolaswill/codeql into quantum-experimental 2025-05-08 16:11:15 +02:00
Nicolas Will
c6077947a7 Update cpp and java not_included_in_qls.expected 2025-05-08 16:10:28 +02:00
Nicolas Will
d0510bc672 Merge branch 'main' into quantum-experimental 2025-05-08 04:37:37 +02:00
Nicolas Will
529128cbde Add problem.severity for java analysis queries 2025-05-08 04:20:49 +02:00
Nicolas Will
a57f4a1022 Update Java analysis query metadata 2025-05-08 04:13:57 +02:00
Nicolas Will
e03f57da9b Update type name in experimental BrokenCrypto.ql 2025-05-08 04:03:10 +02:00
Nicolas Will
b8c3b43cc4 Fix KnownAsymmetricAlgorithm query id 2025-05-08 03:58:06 +02:00
Nicolas Will
b558e844ff Update slice query metadata and output tables 2025-05-08 03:56:20 +02:00
Nicolas Will
986c8e1aec Change Java inventory slices to @kind table 2025-05-08 03:24:04 +02:00
Nicolas Will
0c6e124b01 Delete development test query 2025-05-08 03:02:59 +02:00
Nicolas Will
1135fbe950 Fix EVP_Hash_Initializer typo 2025-05-08 02:58:43 +02:00
Nicolas Will
1d8a57e7da Fix EVP Cipher class, predicate, and comment typos 2025-05-08 02:56:52 +02:00
Nicolas Will
e956d041dc Format LibraryDetector.qll 2025-05-08 02:51:53 +02:00
Nicolas Will
a7ebe4a51a Fix typo in asymmetric inventory slice query id 2025-05-08 02:43:29 +02:00
Nicolas Will
0066f74d3f Delete development scripts 2025-05-08 02:40:56 +02:00
Nicolas Will
7339dd0077 Rename "Quantum" to "quantum" in dir structure 2025-05-08 02:39:40 +02:00
Nicolas Will
ac72abd3a6 Refactor directory structure (shared experimental) 2025-05-08 02:35:09 +02:00
Nicolas Will
c19291be88 Refactor 'cryptography' and 'Quantum' to 'quantum' 2025-05-08 01:38:53 +02:00
Nicolas Will
314f1ff93f Refactor Java directory structure 2025-05-08 00:28:32 +02:00
Nicolas Will
56670c66f1 Revert Python changes and delete implementation 2025-05-08 00:26:13 +02:00
Nicolas Will
f5a36566d1 Merge pull request #11 from nicolaswill/brodes/openssl_refactor
Brodes/openssl refactor
2025-05-07 23:10:53 +02:00
Geoffrey White
19f86fd67f Rust: Address confusing / typo'd paths. 2025-05-07 10:46:16 +01:00
Geoffrey White
49ff967465 Rust: Add a dataflow sources test for the Axum web fraemework. 2025-05-07 10:17:58 +01:00
Geoffrey White
e56519d959 Rust: Add a dataflow sources test for the Actix web fraemework. 2025-05-07 10:17:57 +01:00
Geoffrey White
310c02f1fb Rust: Add a dataflow sources test for the Poem web fraemework. 2025-05-07 10:17:56 +01:00
Owen Mansel-Chan
a857069345 Merge pull request #19464 from owen-mc/go/fix/extract-recv-alias-type
Go: fix database inconsistency when receiver has alias type
2025-05-06 15:08:42 -04:00
Owen Mansel-Chan
55efb113c2 Merge pull request #19463 from github/dependabot/go_modules/go/extractor/extractor-dependencies-e95546ca81
Bump golang.org/x/tools from 0.32.0 to 0.33.0 in /go/extractor in the extractor-dependencies group
2025-05-06 11:05:48 +01:00
Owen Mansel-Chan
c781f98bdc (unrelated tidy up) resolveTypeAlias not needed
`types.Unalias` already does the same thing
2025-05-06 05:45:06 -04:00
Owen Mansel-Chan
228c45aaf8 Look through aliases when identifying method receivers 2025-05-06 05:45:04 -04:00
dependabot[bot]
824271a84a Bump golang.org/x/tools
Bumps the extractor-dependencies group in /go/extractor with 1 update: [golang.org/x/tools](https://github.com/golang/tools).


Updates `golang.org/x/tools` from 0.32.0 to 0.33.0
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.32.0...v0.33.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-06 03:58:02 +00:00
Sid Gawri
7231f53b6e revert system.net stubs 2025-05-05 21:59:37 -04:00
Sid Gawri
0691cd3e9a Merge branch 'main' of https://github.com/5idg5/codeql into 5idg5-update-cs-stubs 2025-05-05 21:55:29 -04:00
Florin Coada
1533d7a4cc Update codeql-cli-2.21.2.rst 2025-05-05 11:30:15 -04:00
Florin Coada
c7026c03df Update changelogs for CodeQL CLI 2.21.2 and adjust query reporting for unversioned immutable actions 2025-05-05 11:13:42 -04:00
Arthur Baars
9b0854edb1 Merge pull request #19335 from github/aibaars/macro-stmts
Rust: make MacroStmts expressions
2025-05-03 11:22:15 +02:00
Sid Gawri
d600eb42cf add new stubs 2025-05-02 17:25:02 -04:00
REDMOND\brodes
4042081539 Missing files, should have been part of last commit. 2025-05-02 16:35:27 -04:00
REDMOND\brodes
0a0be41527 Intermediate progress towards getting hashing upgraded. Still need to handle the final and update mechanics, matching the JCA. Similarly need to update cipher to follow the JCA for update/final as well. 2025-05-02 16:33:52 -04:00
Jeroen Ketema
aa80b83874 Merge pull request #19420 from github/jketema/swift-6.1-contructs
Swift: Support new Swift 6.1 AST elements
2025-05-02 20:13:20 +02:00
REDMOND\brodes
94632931ba Clean up 2025-05-02 14:11:10 -04:00
REDMOND\brodes
09d473674b Working refactor for cipher, padding, block mode. Still haven't completed connecting padding to algorithm instances if through a set padding interface. 2025-05-02 14:10:38 -04:00
REDMOND\brodes
7481de75cb Updating the model to infer implicit cipher key sizes. 2025-05-02 14:07:38 -04:00
REDMOND\brodes
c08525ad81 Additional cleanup 2025-05-02 14:07:13 -04:00
REDMOND\brodes
5694f029de Misc. cleanup 2025-05-02 14:03:50 -04:00
Geoffrey White
f59ef58c1f Rust: Update query suite list. 2025-05-02 17:47:48 +01:00
Geoffrey White
16ed8476ce Rust: Use the new 'quality' tag. 2025-05-02 17:24:13 +01:00
Geoffrey White
566b3dd8d9 Rust: Update code scanning queries list. 2025-05-02 17:13:14 +01:00
Geoffrey White
d0287e9496 Merge branch 'main' into alloc-size-sev 2025-05-02 17:08:05 +01:00
Geoffrey White
09dc7fc5c4 Rust: Autoformat. 2025-05-02 16:58:43 +01:00
Geoffrey White
dc1b4fcf7a Rust: Unify getOperatorName() methods into Operation. 2025-05-02 16:46:51 +01:00
Geoffrey White
be2017621f Rust: Unify getAnOperand() methods into Operation. 2025-05-02 16:46:50 +01:00
Geoffrey White
060d5152c4 Rust: Add an Operation class above LogicalOperation, AssignmentOperation etc. 2025-05-02 16:46:44 +01:00
Arthur Baars
6bf50d8f86 Rust: add upgrade/downgrade scripts 2025-05-02 16:36:51 +02:00
Jeroen Ketema
5c4ca64264 Swift: Add change note 2025-05-02 16:29:42 +02:00
Arthur Baars
bc35599f1a Rust: rename MacroStmts to MacroBlockExpr 2025-05-02 16:23:02 +02:00
Arthur Baars
869af58c9d Rust: add flow step for MacroStmts 2025-05-02 16:23:00 +02:00
Arthur Baars
9ca6706550 Rust: make MacroStmts a CFG Expr 2025-05-02 16:22:59 +02:00
Arthur Baars
4ca98ba816 Rust: test with format! macro in a block 2025-05-02 16:22:57 +02:00
Jeroen Ketema
95ac458d2a Swift: Add upgrade and downgrade scripts 2025-05-02 16:04:49 +02:00
Jeroen Ketema
98384bf4c2 Swift: Support BuiltinFixedArrayType 2025-05-02 14:47:58 +02:00
Jeroen Ketema
c74fca929a Swift: Support TypeValueExpr and IntegerType 2025-05-02 14:47:56 +02:00
Jeroen Ketema
97d2ed8b3b Swift: Support UnsafeCastExpr 2025-05-02 14:47:55 +02:00
Tom Hvitved
ae2fd52543 Merge pull request #19431 from hvitved/rust/path-resolution-remove-visibility-check
Rust: Remove visibility check in path resolution
2025-05-02 14:44:14 +02:00
Tom Hvitved
07829e5231 Merge pull request #19421 from github/aibaars/rust-builtin-types
Rust: extract declarations of  builtin types
2025-05-02 14:43:47 +02:00
Napalys Klicius
d1e769ba54 Merge pull request #19422 from Napalys/js/shelljs
JS: Modeling of `ShellJS` functions
2025-05-02 14:18:44 +02:00
Napalys Klicius
871e93d9fe Update javascript/ql/lib/semmle/javascript/frameworks/ShellJS.qll
Co-authored-by: Asger F <asgerf@github.com>
2025-05-02 13:39:46 +02:00
Asger F
1f308ee47a JS: Explain use of monotonicAggregates 2025-05-02 13:22:27 +02:00
Asger F
5c9218fe5a JS: Add comment about 'path' heuristic 2025-05-02 13:22:25 +02:00
Simon Friis Vindum
c6d95ceeb0 Shared: Remove the language-specific model generator scripts 2025-05-02 13:21:10 +02:00
Simon Friis Vindum
3aed1c8696 Merge branch 'main' into rust-update-stdlib-models 2025-05-02 12:54:43 +02:00
Asger F
f3e0cfd947 Apply suggestions from code review
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2025-05-02 12:41:29 +02:00
Geoffrey White
f64e86fe2e Rust: Add a library test for Operations. 2025-05-02 11:22:48 +01:00
Asger F
16fc8c3d9e JS: Benign test updates 2025-05-02 11:09:19 +02:00
Michael Nebel
74669cb0cb Merge pull request #19382 from michaelnebel/shared/modelgenrefactor
Shared: Re-factor summary, source and sink model generators into separate modules.
2025-05-02 09:38:24 +02:00
Tamás Vajk
cb1c3736fe Merge pull request #19413 from tamasvajk/quality/query-suite-selector
Add code quality suite selector and use that in the code quality suites
2025-05-02 08:18:48 +02:00
Arthur Baars
778f46d5be Rust: adjust unit tests and expected output 2025-05-01 22:21:48 +02:00
Geoffrey White
93f8cea884 Rust: Add + clean up some QLDoc. 2025-05-01 17:11:34 +01:00
Napalys Klicius
f652686607 Merge pull request #19444 from Napalys/python/hdbcli
Python: modeling of `hdbcli`
2025-05-01 17:58:31 +02:00
Geoffrey White
c9ce6c0fb6 Rust: Demote rust/cleartext-logging to warning. 2025-05-01 16:42:41 +01:00
Geoffrey White
bd3155ef0c Rust: Promote rust/uncontrolled-allocation-size to warning. 2025-05-01 16:42:13 +01:00
Tom Hvitved
73fa381dbc Rust: Remove visibility check in path resolution 2025-05-01 17:14:49 +02:00
Tom Hvitved
40f80ff4e7 Merge pull request #19442 from hvitved/rust/clone-modeling
Rust: Strengthen modeling of the `Clone` trait
2025-05-01 17:11:42 +02:00
Jeroen Ketema
8ad6938a82 Merge pull request #19434 from jketema/array-barrier
C++: Limit flow through sinks and sources in `cpp/upcast-array-pointer-arithmetic`
2025-05-01 16:42:53 +02:00
yoff
d7e6e1dd66 Merge pull request #19432 from yoff/python/model-http-server-header-write
python: model `send_header` from `http.server`
2025-05-01 15:34:05 +02:00
Asger F
a44bdf3be2 JS: Generate summaries from summaryModel, and only generate steps as a fallback 2025-05-01 15:22:47 +02:00
Asger F
0fc1ae272e DataFlow: expose from FlowSummaries whether a summary is supported 2025-05-01 15:22:12 +02:00
Arthur Baars
8e8efedb42 Rust: adjust integration tests and expected output 2025-05-01 15:20:36 +02:00
Taus
481adcea0a Merge pull request #18449 from github/tausbn/misc-add-script-for-calculating-mrva-totals
Misc: Add script for calculating totals for a MRVA run
2025-05-01 15:17:19 +02:00
Asger F
ca5f8b0c1d JS: Move some code into ModelsAsData.qll 2025-05-01 15:17:07 +02:00
Owen Mansel-Chan
e0549483fd Merge pull request #19429 from owen-mc/fix-cwe-tags-missing-leading-zero
Fix cwe tags to include leading zero
2025-05-01 14:09:54 +01:00
Arthur Baars
53b2e9708c Rust: extract declarations of builtin types 2025-05-01 14:27:21 +02:00
Napalys Klicius
da7c0931b8 Added hdbcli to be part of supported-framework as well as change note 2025-05-01 14:18:08 +02:00
Napalys Klicius
e1fc0ca051 Added implementation hdbcli as part of PEP249::PEP249ModuleApiNode 2025-05-01 14:18:02 +02:00
Napalys Klicius
0325f368fe Added test case for hdbcli 2025-05-01 13:57:14 +02:00
Nick Rolfe
817237ce54 Merge pull request #19441 from github/nickrolfe/mergeback-2.21.2
Merge back 2.21.2 release branch
2025-05-01 11:55:29 +01:00
Napalys Klicius
6ba0dc20a3 Merge pull request #19439 from Napalys/js/fastify-all
JS: Modeling of `fastify`
2025-05-01 12:11:52 +02:00
Owen Mansel-Chan
0863c87572 Add change notes 2025-05-01 10:33:24 +01:00
Napalys Klicius
68a9dd9f9e Address comments 2025-05-01 11:19:41 +02:00
Napalys Klicius
d4b5ef6a66 Refactor process.env handling in CleartextLogging and IndirectCommandInjection modules to use ThreatModelSource 2025-05-01 11:14:15 +02:00
Napalys Klicius
33d8ffa83e Added test cases for shelljs.env 2025-05-01 11:11:29 +02:00
Napalys Klicius
602500e280 Added change note 2025-05-01 11:09:56 +02:00
Napalys Klicius
40d176a770 Added model for shelljs.env 2025-05-01 11:09:47 +02:00
Tom Hvitved
423e2dac91 Rust: Strenghten the modeling of the Clone trait 2025-05-01 10:54:52 +02:00
Simon Friis Vindum
499d224c2b Rust: Update generated models for core and std 2025-05-01 10:54:05 +02:00
Tom Hvitved
1770f568a2 Merge pull request #19367 from hvitved/rust/type-inference-try-expr
Rust: Type inference for `?` expressions
2025-05-01 10:27:49 +02:00
Nick Rolfe
20f7781d9f Merge pull request #19437 from adityasharad/docs/fix/2.21.0-escaping
Docs: Fix escaping in 2.21.0 changelog
2025-05-01 09:27:41 +01:00
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
Simon Friis Vindum
bab84d03d1 Merge pull request #19419 from paldepind/rust-precise-implicit-deref-borrow
Rust: Use type inference to insert implicit borrows and derefs
2025-05-01 08:41:37 +02:00
Aditya Sharad
36199b3f06 Docs: Fix escaping in 2.21.0 changelog
These break when the RST is processed.
Escape the backslashes and consistently add
inline code blocks.
2025-04-30 16:40:36 -07: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
Jeroen Ketema
2ed48ae571 C++: Update expected test results after barrier introduction 2025-04-30 20:51:27 +02:00
Tom Hvitved
a3c26b4bfe Rust: Type inference for ? expressions 2025-04-30 20:35:11 +02:00
Tom Hvitved
88075c4c8c Rust: Make manual tweaks to Copilot generated code 2025-04-30 20:35:10 +02:00
Tom Hvitved
51e70d0c3b Rust: Add Copilot generated test for ? operator expressions 2025-04-30 20:35:09 +02:00
Jeroen Ketema
723778fa82 C++: Limit flow through sinks and sources in cpp/upcast-array-pointer-arithmetic 2025-04-30 20:31:12 +02:00
Jeroen Ketema
359aa02602 Merge pull request #19410 from jketema/header-variant
C++: Turn header variant tests that use PCH files into integration tests
2025-04-30 20:10:30 +02:00
yoff
e63b38c515 python: add change note 2025-04-30 20:05:55 +02:00
yoff
cf45e771f3 python: remove copied comment 2025-04-30 20:01:43 +02:00
yoff
531f2a15a4 python: model send_header from http.server 2025-04-30 19:58:14 +02:00
Jeroen Ketema
3423a1072a C++: Address review comments 2025-04-30 19:10:35 +02:00
Owen Mansel-Chan
a9132c43d0 Fix incorrect CWE tags 2025-04-30 16:47:35 +01:00
Owen Mansel-Chan
cf614a596d Fix cwe tags to include leading zero 2025-04-30 16:43:03 +01:00
REDMOND\brodes
c80588cda1 Adding content to KnownSymmetricCipherAlgorithmql. 2025-04-30 11:41:28 -04:00
Simon Friis Vindum
c263d3faf9 Rust: Remove predicates unused after refactor 2025-04-30 17:39:22 +02:00
Tom Hvitved
302680cfb2 Merge pull request #19425 from hvitved/rust/type-inference-debug-predicates
Rust: Add type inference debug predicates
2025-04-30 17:03:05 +02:00
Nicolas Will
83617e099f Merge pull request #2 from nicolaswill/knewbury01/JCA-sample
Implement first stage cryptography modelling and queries
2025-04-30 16:39:56 +02:00
Nicolas Will
27c7bf3047 Merge branch 'github:main' into crypto-test 2025-04-30 16:35:26 +02:00
Nicolas Will
2b1b90ccc4 Merge pull request #4 from nicolaswill/brodes/cipher_operation
Adding a sketch for a CipherOperation concept to model encryption/dec…
2025-04-30 16:32:20 +02:00
Nicolas Will
dd2f53f42e Merge pull request #10 from nicolaswill/brodes/key_agreement
Initial progress on key agreement.
2025-04-30 16:31:42 +02:00
Nicolas Will
9c87ad8293 Merge branch 'brodes/key_agreement' of https://github.com/nicolaswill/codeql into brodes/key_agreement 2025-04-30 16:28:35 +02:00
Nicolas Will
7f24a2557d Add modelling for JCA key gen cipher algorithm 2025-04-30 16:28:31 +02:00
Jeroen Ketema
edd18dc052 C++: Address review comment 2025-04-30 16:23:06 +02:00
Jonas Jensen
c8e564b2ba Merge pull request #19416 from jbj/ruby-no-diff-informed-regex
Ruby: disable diff-informed mode on regex queries
2025-04-30 15:17:20 +02:00
Tom Hvitved
4f5b340278 Rust: Add type inference debug predicates 2025-04-30 15:12:58 +02:00
Tom Hvitved
389f15e670 Merge pull request #19362 from hvitved/rust/crate-extraction-workarounds
Rust: Crate graph extraction workarounds
2025-04-30 15:11:26 +02:00
Napalys Klicius
9624a413e4 Added change note 2025-04-30 14:57:00 +02:00
Napalys Klicius
71f1b82a56 Added support for fastify.all 2025-04-30 14:54:09 +02:00
Napalys Klicius
6d61766366 Added test case for fastify.all 2025-04-30 14:50:35 +02:00
Simon Friis Vindum
f584d22b53 Rust: Use type inference to insert implicit borrows and derefs 2025-04-30 14:43:51 +02:00
Asger F
8ebbfb198e Merge pull request #19412 from asgerf/js/promise-all
JS: Better type-tracking through Promise.all()
2025-04-30 14:19:12 +02:00
Jeroen Ketema
c7e4853c38 Merge pull request #19269 from jketema/non-second-level-limits
C++: Do not limit second level scopes to the top-level
2025-04-30 13:50:36 +02:00
Napalys Klicius
18cea2d6a5 Added support for shelljs.cmd and async-shelljs.asyncExec 2025-04-30 13:37:02 +02:00
Napalys Klicius
25d04f1cdd Added support for shelljs.which 2025-04-30 13:35:17 +02:00
Napalys Klicius
f6fae7ad60 Added test cases for cmd, which and asyncExec 2025-04-30 13:33:31 +02:00
Paolo Tranquilli
1c1ccdacb8 Merge pull request #19418 from github/redsun82/improve-codegen-codeql-requirement-message
Codegen: make missing `codeql` error clearer
2025-04-30 12:14:37 +02:00
Asger F
da5d799152 JS: Change note 2025-04-30 11:59:47 +02:00
Paolo Tranquilli
9958cc7784 Codegen: consider windows paths in local codeql binary heuristic 2025-04-30 11:43:03 +02:00
Paolo Tranquilli
ba89a5de6f Codegen: make missing codeql error clearer 2025-04-30 11:38:52 +02:00
Tom Hvitved
52bd99b852 Address review comments 2025-04-30 11:04:12 +02:00
Tom Hvitved
97532525d8 Rust: Crate graph extraction workarounds 2025-04-30 11:01:43 +02:00
Joe Farebrother
7106475033 Merge pull request #19411 from joefarebrother/python-qual-file-not-closed
Python: Improve performance of FileNotClosed query by using an explicit fastTC
2025-04-30 09:51:48 +01:00
Jonas Jensen
eb7cd3d221 Ruby: disable diff-informed mode on regex queries
These queries were failing in `codeql test run --check-diff-informed`
because they can select locations inside the regex. Until that can be
fixed, diff-informed mode is disabled for these queries.
2025-04-30 08:54:57 +02:00
Paolo Tranquilli
2c95f00432 Merge pull request #19414 from github/revert-19385-redsun82/update-rules-kotlin
Revert "Bazel: update `rules_kotlin` to 2.1.3"
2025-04-29 22:02:04 +02:00
Tom Hvitved
64145ab98a Merge pull request #19369 from hvitved/rust/crate-graph-self-param
Rust: Extract `SelfParam`s from crate graph
2025-04-29 21:23:27 +02:00
Napalys Klicius
6de38b1827 Merge pull request #19300 from Napalys/js/fastify
JS: Added support for `fastify.addHook`
2025-04-29 18:32:25 +02:00
Paolo Tranquilli
280ce058a9 Revert "Bazel: update rules_kotlin to 2.1.3" 2025-04-29 17:38:33 +02:00
Paolo Tranquilli
abbf753a09 Merge pull request #19385 from github/redsun82/update-rules-kotlin
Bazel: update `rules_kotlin` to 2.1.3
2025-04-29 16:54:28 +02:00
Tamas Vajk
e9e6d68a6e Use code-quality-selectors in Ruby suite 2025-04-29 16:23:33 +02:00
Tamas Vajk
fdeac95714 Use code-quality-selectors in Python suite 2025-04-29 16:23:22 +02:00
Tamas Vajk
d56c5225f6 Use code-quality-selectors in JS suite 2025-04-29 16:23:08 +02:00
Tamas Vajk
2515b06b2a Use code-quality-selectors in Go suite 2025-04-29 16:22:57 +02:00
Tamas Vajk
bb46ca7a64 Modify quality query suite selector for actions, cpp, rust and swift 2025-04-29 16:22:37 +02:00
Tamas Vajk
425e020d6c Use code-quality-selectors in Java suite 2025-04-29 16:09:51 +02:00
Asger F
b0f73f1cbd JS: Update test output now that we import .d.ts files more liberally 2025-04-29 16:06:39 +02:00
Asger F
70a5ec5607 JS: Add package.json files in tests relying on node_modules
We don't extract node_modules folders by default so these tests aren't
that relevant anymore, and we no longer follow node_modules resolution
rules directly.

Instead, these imports are resolved based on the monorepo support which
simply requires a package.json file to exist. There is not a good enough
reason to support node_modules directly, so we're accepting some
minor regression in these tests.
2025-04-29 16:06:38 +02:00
Asger F
5de2c938d8 JS: Rename getTargetFile to getImportedFile and remove its deprecated name clash
'getTargetFile' was originally named to avoid the clash with 'getImportedFile' from a subclass. But we now just merge the two predicates.
2025-04-29 16:06:36 +02:00
Asger F
be5de9c080 JS: Update test output
path.resolve() and template expressions are now working.

Previously they could not be resolved because Import.getImportedPath() returned a PathExpr,
and these were not instances of PathExpr.
2025-04-29 16:06:35 +02:00
Tamas Vajk
ea9b95790b Use code-quality-selectors in C# suite 2025-04-29 16:02:46 +02:00
Tamas Vajk
e3a6681182 Add code quality suite selector 2025-04-29 16:02:21 +02:00
Michael Nebel
c9d01bc607 Shared: Sprinkle some predicate defaults and clean up. 2025-04-29 15:22:13 +02:00
Michael Nebel
a6b5645b13 Rust: Re-factor implementation to use the new model generator interface. 2025-04-29 15:22:11 +02:00
Michael Nebel
c16d913f8a C++: Re-factor implementation to use the new model generator interface. 2025-04-29 15:22:09 +02:00
Michael Nebel
2535055de0 Java: Re-factor implementation to use the new model generator interface. 2025-04-29 15:22:07 +02:00
Michael Nebel
0016fbfa21 C#: Re-factor implementation to use the new model generator interface. 2025-04-29 15:22:05 +02:00
Michael Nebel
bb6530fcf8 Shared: Make the summary, source and sink model generation a parameterized module. 2025-04-29 15:22:03 +02:00
Michael Nebel
b5c596b2ce Shared: Split model printing of summaries and sources/sinks into separate param modules. 2025-04-29 15:21:59 +02:00
Michael Nebel
f5a295c24e Merge pull request #19408 from michaelnebel/debug/removemodelgentag
C#/Java/Rust: Change the tag for the model generator debugging queries.
2025-04-29 15:21:18 +02:00
Asger F
eae1e1cb02 JS: Make API graphs rely on type-tracking steps in general 2025-04-29 15:08:19 +02:00
Asger F
e40b93b8a3 JS: Add type-tracking step through simple Promise.all() calls 2025-04-29 15:08:18 +02:00
Jeroen Ketema
7f9020282d C++: Turn header variant tests that use PCH files into integration tests
These tests currently test a code path in the extractor that only exists for
these tests. By turning them into integration tests, we actually use the
code path that normal database creation uses.
2025-04-29 14:51:34 +02:00
Joe Farebrother
299b3f7af4 Merge pull request #19325 from joefarebrother/python-qual-loop-var-capture
Python: Tweak LoopVariableCapture for performance
2025-04-29 13:49:09 +01:00
Joe Farebrother
acb9c20a76 Use explicit fastTC 2025-04-29 13:22:11 +01:00
Asger F
ed2a832a55 JS: Deprecate PathExpr and related classes 2025-04-29 13:23:47 +02:00
Asger F
fe055ad603 JS: Use PackageJsonEx instead of resolveMainModule 2025-04-29 13:23:45 +02:00
Asger F
c293f03b9e JS: Remove a dependency on getImportedPath()
To avoid negative recursion in some upcoming changes, we want to make sure the modeling of createRequire does not depend on getImportedPath().
2025-04-29 13:23:43 +02:00
Asger F
a195d074c9 JS: Resolve Angular2 templateUrl with ResolveExpr instead of PathExpr 2025-04-29 13:23:42 +02:00
Asger F
d724874969 JS: Implement babel-plugin-root-import as a PathMapping 2025-04-29 13:23:40 +02:00
Asger F
e4420f63fb JS: Move babel-root-import test
This moves the test for the babel `root-import` plugin into the new
unit test for import resolution, so we only have one set of tests to
maintain.

The actual implementation is added in the next commit.
2025-04-29 13:23:38 +02:00
Asger F
6725cb5b8c JS: Implement import resolution 2025-04-29 13:23:37 +02:00
Asger F
ed4864edf7 JS: Add two more helpers to FilePath class 2025-04-29 13:07:21 +02:00
Asger F
f542956f66 JS: Add internal extension of PackageJson class 2025-04-29 13:07:19 +02:00
Asger F
bb91df8145 JS: Add helper for doing path resolution with JS rules 2025-04-29 13:07:18 +02:00
Asger F
59e1cbcc7b JS: Add tsconfig class 2025-04-29 13:07:16 +02:00
Asger F
ef32a036b1 JS: Extract from methods from PathString into a non-abstract base class
The new class 'FilePath' has bindingset[this] so one just has to cast a string to that type and you can use its methods.
2025-04-29 13:07:15 +02:00
Asger F
17aa5220a6 JS: Add some helpers 2025-04-29 13:07:14 +02:00
Asger F
565cb434fc JS: Add test 2025-04-29 13:07:10 +02:00
Asger F
359525b65a JS: Extract more tsconfig.json patterns 2025-04-29 12:46:49 +02:00
Asger F
8c0b0c4800 JS: Ensure json files are extracted properly in tests 2025-04-29 12:46:20 +02:00
Michael Nebel
89fd9a4dd5 C#/Java/Rust: Change the tag for the model generator debugging queries. 2025-04-29 12:02:37 +02:00
Michael Nebel
e5d296180b Merge pull request #19396 from michaelnebel/csharp/equality-on-floats
C#: Add `cs/equality-on-floats` to the Code Quality suite.
2025-04-29 11:47:18 +02:00
Mathias Vorreiter Pedersen
daf953fabe Merge pull request #19404 from MathiasVP/cleanup-PropagateFlowConfig
Shared: Use `isSink/1` in `PropagateFlowConfig`
2025-04-29 10:30:01 +01:00
Nick Rolfe
d784473dcd Merge pull request #19400 from github/nickrolfe/rb-qhelp-tweak
Fix spelling/wording in qhelp for `rb/uninitialized-local-variable`
2025-04-29 09:43:58 +01:00
Tamás Vajk
1694050f37 Merge pull request #19390 from tamasvajk/test/cpp-python-query-suites
Add query suite inclusion tests for cpp, python
2025-04-29 10:26:40 +02:00
Asger F
ec9d15bb79 JS: Make shared Folder module visible 2025-04-29 09:42:25 +02:00
Asger F
2ce01bfb9a Add Folder::Resolve as a generalisation of Folder::Append 2025-04-29 09:42:23 +02:00
Asger F
eb059969e3 Move getAChildContainer one scope up 2025-04-29 09:42:22 +02:00
Asger F
6e64a22579 Merge pull request #19393 from asgerf/js/json-extractor-trailing-commas2
JS: Tolerate trailing commas in JSON objects
2025-04-29 09:40:38 +02:00
Tamás Vajk
e73031c688 Update cpp/ql/integration-tests/query-suite/not_included_in_qls.expected
Co-authored-by: Michael Nebel <michaelnebel@github.com>
2025-04-29 08:45:02 +02:00
Tamas Vajk
a408e216ae Add query suite inclusion tests for cpp, python 2025-04-29 08:45:01 +02:00
Jeroen Ketema
966b7463ee Merge pull request #19397 from jketema/use-after-free
C++: Add use-after-free FP tests
2025-04-29 08:32:44 +02:00
REDMOND\brodes
ac798f2bc6 Cipher Algorithm Slices 2025-04-28 16:03:41 -04:00
REDMOND\brodes
ac3675bdac Typo fix 2025-04-28 16:00:41 -04:00
REDMOND\brodes
219476cee0 Adding KDF iteration count inventory filters. 2025-04-28 15:47:58 -04:00
REDMOND\brodes
ce3eabf05a Updating model to support slicing. 2025-04-28 14:56:28 -04:00
REDMOND\brodes
5a8bffac11 Removing old asymmetric algorithm slice 2025-04-28 14:56:08 -04:00
REDMOND\brodes
1fd7643ab3 Adding example slicing queries. 2025-04-28 14:54:38 -04:00
Mathias Vorreiter Pedersen
b91a2cc159 Shared: Use 'isSink/1' in 'PropagateFlowConfig'. 2025-04-28 17:36:37 +01:00
REDMOND\brodes
7b7ed61beb Adding an asymmetric algorithm slice. 2025-04-28 11:34:32 -04:00
REDMOND\brodes
fdd09a4dbf Adding a new means for determining if there is nonce reuse. 2025-04-28 11:34:16 -04:00
REDMOND\brodes
28ccc83346 Adding a means to distinguish asymmetric algorithms. 2025-04-28 11:33:37 -04:00
Nick Rolfe
50f7ee1158 Merge pull request #19401 from github/post-release-prep/codeql-cli-2.21.2
Post-release preparation for codeql-cli-2.21.2
2025-04-28 16:16:21 +01:00
github-actions[bot]
2e0699ab2b Post-release preparation for codeql-cli-2.21.2 2025-04-28 14:03:28 +00:00
Nick Rolfe
69bc12dd4f Fix spelling/wording in qhelp for rb/uninitialized-local-variable 2025-04-28 14:41:21 +01: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
Napalys Klicius
8b53f8f2a6 Fix, prevent addHook return values from being treated as XSS sinks 2025-04-28 14:22:51 +02:00
Napalys Klicius
b4c98b40a5 Merge pull request #19364 from Napalys/js/aws_creds
JS: Improved modeling of `aws-sdk`
2025-04-28 14:18:03 +02:00
Jeroen Ketema
0bb0b5c587 C++: Add use-after-free FP tests 2025-04-28 14:13:14 +02:00
Napalys Klicius
73309fb9dd Updated modeling of aws-sdk with MaD 2025-04-28 14:00:12 +02:00
Napalys Klicius
654177daa7 Fixed naming acronyms to be PascalCase 2025-04-28 14:00:12 +02:00
Napalys Klicius
f7f9fb823a Updated takesConfigurationObject with API graphs 2025-04-28 14:00:12 +02:00
Napalys Klicius
42d5b80e81 Added support for AWS.Credentials hardcoded credentials 2025-04-28 14:00:12 +02:00
Napalys Klicius
f69037c176 Added ability to detect direct write to global AWS.config 2025-04-28 14:00:12 +02:00
Napalys Klicius
05e4677fd1 Added ability to detect new AWS.ServiceName cases with hardcoded credentials 2025-04-28 14:00:12 +02:00
Napalys Klicius
e6450a17ec Added test cases for individual AWS services, direct modification of global credentials and AWS.Credentials 2025-04-28 14:00:12 +02: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
Michael Nebel
f9d8be1ef7 C#: Add change note. 2025-04-28 13:41:06 +02:00
Michael Nebel
8bc965641a C#: Update integration tests expected output. 2025-04-28 13:38:15 +02:00
Michael Nebel
318bfc6d73 C#: Add cs/equality-on-floats to the code-quality suite. 2025-04-28 13:32:34 +02:00
Mathias Vorreiter Pedersen
f6e7d79f62 Merge pull request #19383 from MathiasVP/add-missing-predicate-to-mad-generation
C++: Fix missing summaries in MaD generation
2025-04-28 11:58:05 +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
Michael Nebel
2d6457e4d3 C#: Set the precision of cs/equality-on-floats to high. 2025-04-28 11:45:12 +02:00
Mathias Vorreiter Pedersen
e942ec9964 C++: Fix annotations after #19311. 2025-04-28 10:39:11 +01:00
Mathias Vorreiter Pedersen
6466a5dbaf Merge branch 'main' into add-missing-predicate-to-mad-generation 2025-04-28 10:33:24 +01:00
Nick Rolfe
70a3fe3e33 Add YAML front matter to change note 2025-04-28 10:09:33 +01:00
Asger F
152d6f3c29 JS: Tolerate trailing comma in JSON objects 2025-04-28 10:56:48 +02:00
Asger F
6dd8114f00 JS: Add test with trailing comma in JSON object 2025-04-28 10:56:34 +02: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
4ac104060e Bazel: remove 2.0.0 rules_kotlin patching 2025-04-28 10:22:11 +02:00
Paolo Tranquilli
aafd7f8418 Merge branch 'main' into redsun82/update-rules-kotlin 2025-04-28 10:20:55 +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
Paolo Tranquilli
89a9ae8bf4 Bazel: update rules_kotlin to 2.1.3 2025-04-25 17:18:09 +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
Mathias Vorreiter Pedersen
79c03100f8 C++: Accept test changes. 2025-04-25 12:29:38 +01:00
Mathias Vorreiter Pedersen
2f265395af C++: Add missing predicate to grab the parameter position of a return kind. 2025-04-25 12:19:25 +01:00
Mathias Vorreiter Pedersen
63b0dd68c9 C++: Add a test with missing summaries. 2025-04-25 12:18:42 +01:00
Jeroen Ketema
9396f0ee55 C++: Set defaultFieldFlowBranchLimit to 3 2025-04-25 13:10:42 +02:00
Jeroen Ketema
ac3c3ae13a C++: Do not limit second level scopes to the top-level 2025-04-25 13:10:40 +02: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
Tom Hvitved
7e205366ab Rust: Adjust clone modeling 2025-04-25 08:49:02 +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
Tom Hvitved
6df5a1ef80 Rust: Extract SelfParams from crate graph 2025-04-24 15:30:23 +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
Napalys
fdfdcc0d93 Undo unnecessary name tracking for request, response objects 2025-04-22 14:16:45 +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
Napalys Klicius
63402ea581 Merge pull request #2 from asgerf/js/fastify-addhook
JS: Add isMiddlewareSetup() hook to Routing model
2025-04-22 12:07:39 +02:00
Asger F
00661b62dc JS: Add isMiddlewareSetup() hook to Routing model 2025-04-22 12:00:02 +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
Joe Farebrother
6431228d37 Limit size of allowImplicitRead for performance 2025-04-16 09:40:01 +01:00
Nicolas Will
1958c192ec Reimplement EC, MAC, key creation logic + consumer 2025-04-15 23:00:12 -04: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
Napalys
5c3556da66 Add user-controlled property tracking and update code injection alerts in Fastify hooks 2025-04-15 09:41:52 +02:00
Napalys
9b194ea613 Added addHook to RouteSetup thus now it is recognized now as rouute handler 2025-04-15 09:37:13 +02:00
Napalys
c175081698 Added test cases for fastify.addHook 2025-04-15 09:33:41 +02:00
Napalys
f1a3293f4c Added change note 2025-04-15 09:27:51 +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
Nicolas Will
b9d0abda63 Move CipherOperation into KeyOperation, refactor
- KeyOperation and Algorithm now encompasses encryption, decryption, wrapping, unwrapping, signing, and verifying.
- Removed elliptic curve implementation from JCA.qll pending rewrite
- Removed JCAAlgorithmInstance abstraction from JCA.qll
- Cleaned up and removed JCA-specific naming from Model.qll
- Added and clarified documentation
2025-04-09 21:19:00 +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
REDMOND\brodes
a2fe19af38 Initial progress on key agreement. 2025-04-04 16:00:05 -04: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
Ben Rodes
69429a3e02 Merge pull request #9 from nicolaswill/brodes/elliptic_curves
Misc. modifications to support elliptic curves and hooking them up to…
2025-04-04 09:06:20 -04:00
REDMOND\brodes
697c9f0bb0 Elliptic curve AVCs are incorrect, but I'm not sure how to fix them generally. Putting in a stop gap to use 'isCipherAVC' for now. 2025-04-04 09:02:09 -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
REDMOND\brodes
66a60296b8 Merge branch 'brodes/cipher_operation' into brodes/elliptic_curves 2025-04-02 13:46:12 -04:00
Nicolas Will
50507586ac Refactor output artifact type 2025-04-02 19:44:57 +02:00
Jami Cogswell
1a2c34dd28 Java: update qhelp implementation notes for clarity 2025-04-01 16:24:13 -04:00
REDMOND\brodes
ac96649a02 Misc. modifications to support elliptic curves and hooking them up to keygeneration. 2025-04-01 16:15:49 -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
Nicolas Will
bec69ca106 Refactor consumer and generic source model 2025-03-26 13:27:32 +01:00
Nicolas Will
9cd0340d21 Remove rankdir=LR; from DOT output 2025-03-26 13:26:45 +01: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
Nicolas Will
e9c3e14fab Merge branch 'brodes/cipher_operation' of https://github.com/nicolaswill/codeql into brodes/cipher_operation 2025-03-22 08:01:06 +01:00
Nicolas Will
fb7c003398 Add initial MAC support for JCA, refactor hashes 2025-03-22 08:01:03 +01:00
REDMOND\brodes
9278a41578 Merge branch 'brodes/cipher_operation' of https://github.com/nicolaswill/codeql into brodes/cipher_operation 2025-03-20 16:28:43 -04:00
REDMOND\brodes
b695641362 Add signature to cipher operation 2025-03-20 16:27:20 -04:00
Nicolas Will
d18dac0c8e Add JCA key (generation) modelling 2025-03-20 21:26:18 +01:00
REDMOND\brodes
63aaebbea6 . 2025-03-19 18:30:06 -04:00
Nicolas Will
95607c5f31 Refactor instances and consumers + add JCA hashes 2025-03-18 22:05:00 +01:00
REDMOND\brodes
8a7671dc2a Adding block mode models to openssl. 2025-03-11 15:20:05 -04:00
REDMOND\brodes
71eae39feb Adding missing block modes. 2025-03-11 15:19:42 -04:00
REDMOND\brodes
c98e6d7c56 Adding a stub EVP_CIpher_Operation for EVP_PKEY, this probably should be made into it's own class, hence it is a stub with comments. 2025-03-11 14:49:07 -04:00
REDMOND\brodes
a9458ba762 Formatting, removing dead comments, 2025-03-11 14:48:38 -04:00
REDMOND\brodes
d988afd4a4 Adding an EVP_AASYM_CIPHER_fetch getter. 2025-03-11 14:47:10 -04:00
REDMOND\brodes
7757279908 Adding a KDF algorithm getter. 2025-03-11 14:46:36 -04:00
REDMOND\brodes
44b1e921d6 commenting out hash size for now, TODO 2025-03-11 14:10:04 -04:00
REDMOND\brodes
085e8d40fd Hash nodes have instances. 2025-03-11 14:06:36 -04:00
REDMOND\brodes
f69b057893 Updating OpenSSLKnownAlgorithmConstants.qll (a few bugs) and also enforcing that known key sizes are on the normalized name (need to re-visit for GOST). 2025-03-11 13:35:44 -04:00
REDMOND\brodes
ae574f7cf2 Resolving hash and cipher types for openssl not using literals but KnownOpenSSLAlgorithmConstant. 2025-03-11 13:35:02 -04:00
REDMOND\brodes
f72efa638a Uncommenting out generic dataflow 2025-03-10 16:12:53 -04:00
REDMOND\brodes
c83cb533ce Adding an instantiation of the additional flow step class to automatically apply to generic dataflow. Flow step passthrough comes from the algorithm to getter flow passthroughs. 2025-03-10 15:56:01 -04:00
REDMOND\brodes
036035b6a2 Adding modeling for OpenSSL random number generation. 2025-03-10 15:04:19 -04:00
REDMOND\brodes
fe52351aed Stubbing out hash operation node, borrowing from cipher operaiton node 2025-03-10 14:10:55 -04:00
REDMOND\brodes
73368ea59a Adding hashes to openssl library import 2025-03-10 13:27:39 -04:00
REDMOND\brodes
0672027822 Tracing new notion of known getters, which now includes direct getters for cipher and hash. Removed a redundant hash qll, and fixed misplacement of has type in model. 2025-03-10 11:46:26 -04:00
REDMOND\brodes
451808616e Getting rid of commented out code. 2025-03-10 11:35:16 -04:00
REDMOND\brodes
bd07b8a4c7 Making getter flow through 'copy' more general (copy can appear in any part of the call name now. 2025-03-10 11:34:26 -04:00
REDMOND\brodes
6a4659fc7e Updating known constants for OpenSSL to handle direct algorithm getters from older versions of openssl (e.g., EVP_md5()) 2025-03-10 11:33:46 -04:00
REDMOND\brodes
3316d6135d Ctx flow comments. 2025-03-10 11:32:14 -04:00
REDMOND\brodes
d99812a10d Adding GOSTHash to THashType. 2025-03-10 09:59:28 -04:00
REDMOND\brodes
64241caf1d Merge branch 'brodes/cipher_operation' of https://github.com/nicolaswill/codeql into brodes/cipher_operation 2025-03-07 14:25:13 -05:00
REDMOND\brodes
bac0a635f9 Initial hash models for openssl. 2025-03-07 14:24:01 -05:00
Nicolas Will
47affa0fed Restore location output for nodes 2025-03-07 18:30:58 +01:00
REDMOND\brodes
cf72fde911 Fixing cross product in getPropertyAsGraphString (parameter root not bound in all cases, fixing using a bindingetset) 2025-03-07 12:11:12 -05:00
REDMOND\brodes
32d29ffde3 Changed casing on TCipherType, Added some initial fixes for hash support, started developing openssl hashing modeling. 2025-03-07 10:02:36 -05:00
REDMOND\brodes
b9bd199432 Regression fixes for JCA 2025-03-06 13:39:23 -05:00
REDMOND\brodes
6083df2b7f Completed tying algorithm instances to consumers. Now the model should have known literals for cipher instances, and it traces those instances to consumers (inits) and those inits are traced to cipher operations. 2025-03-05 15:48:08 -05:00
REDMOND\brodes
de3ff45cba Misc updates for OpenSSL modeling to trace algorithm literals to known alg getters, and converting the literal to a TCipherType. 2025-03-05 15:17:52 -05:00
REDMOND\brodes
cce5f24b38 Initial OpenSSL modeling work. 2025-03-04 15:52:57 -05:00
REDMOND\brodes
8865d89fe9 Removing old ReusedNonce query. 2025-03-03 16:51:30 -05:00
REDMOND\brodes
2ee1681126 Adding a proof-of-concept PossibleReusedNonce query. 2025-03-03 15:09:27 -05:00
REDMOND\brodes
14cb2bb12f Updates to insecure or unknown nonce at operation. 2025-03-03 14:42:50 -05:00
REDMOND\brodes
076f53147d Proof-of-concept query for InsecureOrUnknownNonceAtOperation 2025-03-03 13:53:16 -05:00
Nicolas Will
627790f98b Clean up consumer and instance interfaces 2025-03-03 19:06:53 +01:00
Nicolas Will
cf33cf7653 Add input and output nodes and fix cross product 2025-02-28 15:21:46 +01:00
Nicolas Will
0354afc365 Make ArtifactConsumers instances of some Artifacts
TODO: refactor the interfaces
2025-02-27 15:54:38 +01:00
Nicolas Will
ef0614ad45 Restore removed node location output 2025-02-27 05:45:27 +01:00
Nicolas Will
04f4683399 Rewrite handling of known unknowns and data-flow 2025-02-27 05:42:02 +01:00
Nicolas Will
f55f27b0d9 Expand handling of generic artifact sources 2025-02-25 18:22:38 +01:00
Nicolas Will
eb91ecf1fb Add generic artifact data-flow
The relation between RNG and other artifacts has been added
Nonce has been completed to report its source
2025-02-25 02:53:13 +01:00
Nicolas Will
2b0b927b0b Add Nonce association to Operation, update graph 2025-02-24 17:37:41 +01:00
REDMOND\brodes
86cab46b8d Misc. updates to support all JCA cipher operations, including wrap, unwrap and doFinal calls. Corrected pathing for init tracing to detect what mode is being set along a path. Added support for tracing the init operation mode argument to source. Since this involved creating an Operation Mode, changes were also made to make cipher block modes (CBC) more explicit (previously just called mode, but now that term is used for various purposes). 2025-02-21 12:53:35 -05:00
REDMOND\brodes
9ac9252f75 Adding a todo 2025-02-20 11:11:41 -05:00
REDMOND\brodes
011ed3fbfd Simplifying additional flow step logic. 2025-02-20 11:10:24 -05:00
REDMOND\brodes
83dc5b9906 Fixing type bug 2025-02-20 10:45:33 -05:00
REDMOND\brodes
9ee4a7a7b8 Adding a sketch for a CipherOperation concept to model encryption/decryption operations. 2025-02-20 10:37:40 -05:00
REDMOND\brodes
3871c6a33e Adding support for encryption operation detection. 2025-02-18 16:09:00 -05:00
Nicolas Will
8707e4d9a3 Continue Artifact data-flow WIP 2025-02-18 18:35:49 +01:00
Nicolas Will
df01fa7a9c Expand model and JCA modeling 2025-02-17 00:16:08 +01:00
Nicolas Will
b777a22d35 Expand model and specialize newtype relations 2025-02-14 23:43:07 +01:00
Nicolas Will
874e3b5e06 Modify model to use newtypes, expand modeling 2025-02-12 17:58:15 +01:00
Nicolas Will
4d44755945 Refactor Model and CBOM print queries 2025-02-11 15:37:15 +01:00
Kristen Newbury
1a12fb3099 Update JCA model, refactor modes 2025-02-10 13:49:32 -05:00
Kristen Newbury
59208bdb85 Update JCA model to use shared lib 2025-02-10 12:22:22 -05:00
Kristen Newbury
9c8ade7ddd Merge branch 'nic/crypto-test' into knewbury01/JCA-sample 2025-02-10 11:48:15 -05:00
Kristen Newbury
6005437001 Update JCA model with flow to call as AESuse and format JCA model 2025-02-10 11:26:48 -05:00
Kristen Newbury
60d931af9f Update progress on JCA 2025-02-07 15:46:13 -05:00
Nicolas Will
7a96f5682e Merge pull request #3 from nicolaswill/nicolaswill/shared-crypto-library
Move language-agnostic model to shared library
2025-02-06 21:57:10 +01:00
Nicolas Will
3dc28c2d17 Move language-agnostic model to shared library 2025-02-06 21:54:18 +01:00
Kristen Newbury
2e12bb5f5c Merge branch 'nic/crypto-test' into knewbury01/JCA-sample 2025-02-06 12:56:32 -05:00
Nicolas Will
cd70acde66 Merge pull request #1 from nicolaswill/brodes/experiments
Concepts for elliptic curves and misc. updates.
2025-02-06 14:43:09 +01:00
Kristen Newbury
efcf7eab0c Add broken crypto query 2025-02-05 17:24:25 -05:00
Kristen Newbury
86e51dad8a Improve JCA aes alg model, add test 2025-02-05 13:39:48 -05:00
Kristen Newbury
5f355c7f55 Add first sample JCA encryption model 2025-02-04 11:55:09 -05:00
Nicolas Will
69a63855cc Update CBOMGraph.ql 2025-01-29 21:55:57 +01:00
Nicolas Will
9af18bc100 WIP: add dgml/dot output/remove test code 2025-01-29 19:45:04 +01:00
REDMOND\brodes
0cd3df9d26 Concepts for elliptic cureve and misc. updates. 2025-01-29 10:27:46 -05:00
Nicolas Will
e027b0e9a0 WIP: add properties 2025-01-28 02:02:06 +01:00
Nicolas Will
78362341ff WIP: hash types example and documentation 2025-01-24 22:32:32 +01:00
Nicolas Will
1a7d8cb99d WIP 2025-01-24 17:33:03 +01:00
Nicolas Will
395d54bf86 Create Base.qll 2025-01-23 12:46:09 +01:00
Taus
8808f0f824 Misc: Add script for calculating MRVA totals
Use this script if you want to quickly calculate the totals of some
query across all the queries in a MRVA run.

For an example of such a query, see e.g.
`python/ql/src/Metrics/Internal/TypeAnnotations.ql`

The script expects the query to produce an output table of the form
```
| header0  | header1  | header2  | header3  | ...
|----------|----------|----------|----------|----
| message1 | value11  | value12  | value13  | ...
| message2 | value21  | value22  | value23  | ...
...
```
where all of the `values` are numbers. For each `(message, header)`
pair, it then calculates the total of all the values in that cell,
across all of the repos in the MRVA run.

To use the script, simply pass it the URL of the exported Gist of the
MRVA run. After calculating the totals, the script will then
(optionally, but by default) add the totals to the `_summary.md` file,
and push these changes to the Gist.
2025-01-08 16:01:11 +00:00
1666 changed files with 78608 additions and 11485 deletions

View File

@@ -68,7 +68,7 @@ jobs:
DATABASE=$2
cd codeql-$QL_VARIANT
SHORTNAME=`basename $DATABASE`
python java/ql/src/utils/modelgenerator/GenerateFlowModel.py --with-summaries --with-sinks $DATABASE $SHORTNAME/$QL_VARIANT
python misc/scripts/models-as-data/generate_mad.py --language java --with-summaries --with-sinks $DATABASE $SHORTNAME/$QL_VARIANT
mkdir -p $MODELS/$SHORTNAME
mv java/ql/lib/ext/generated/$SHORTNAME/$QL_VARIANT $MODELS/$SHORTNAME
cd ..

View File

@@ -17,6 +17,7 @@
# Experimental CodeQL cryptography
**/experimental/quantum/ @github/ps-codeql
/shared/quantum/ @github/ps-codeql
# CodeQL tools and associated docs
/docs/codeql/codeql-cli/ @github/codeql-cli-reviewers

View File

@@ -24,7 +24,7 @@ bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "abseil-cpp", version = "20240116.1", repo_name = "absl")
bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "json")
bazel_dep(name = "fmt", version = "10.0.0")
bazel_dep(name = "rules_kotlin", version = "2.0.0-codeql.1")
bazel_dep(name = "rules_kotlin", version = "2.1.3-codeql.1")
bazel_dep(name = "gazelle", version = "0.40.0")
bazel_dep(name = "rules_dotnet", version = "0.17.4")
bazel_dep(name = "googletest", version = "1.14.0.bcr.1")
@@ -193,10 +193,6 @@ use_repo(
kotlin_extractor_deps,
"codeql_kotlin_defaults",
"codeql_kotlin_embeddable",
"kotlin-compiler-1.5.0",
"kotlin-compiler-1.5.10",
"kotlin-compiler-1.5.20",
"kotlin-compiler-1.5.30",
"kotlin-compiler-1.6.0",
"kotlin-compiler-1.6.20",
"kotlin-compiler-1.7.0",
@@ -208,10 +204,7 @@ use_repo(
"kotlin-compiler-2.0.20-Beta2",
"kotlin-compiler-2.1.0-Beta1",
"kotlin-compiler-2.1.20-Beta1",
"kotlin-compiler-embeddable-1.5.0",
"kotlin-compiler-embeddable-1.5.10",
"kotlin-compiler-embeddable-1.5.20",
"kotlin-compiler-embeddable-1.5.30",
"kotlin-compiler-2.2.0-Beta1",
"kotlin-compiler-embeddable-1.6.0",
"kotlin-compiler-embeddable-1.6.20",
"kotlin-compiler-embeddable-1.7.0",
@@ -223,10 +216,7 @@ use_repo(
"kotlin-compiler-embeddable-2.0.20-Beta2",
"kotlin-compiler-embeddable-2.1.0-Beta1",
"kotlin-compiler-embeddable-2.1.20-Beta1",
"kotlin-stdlib-1.5.0",
"kotlin-stdlib-1.5.10",
"kotlin-stdlib-1.5.20",
"kotlin-stdlib-1.5.30",
"kotlin-compiler-embeddable-2.2.0-Beta1",
"kotlin-stdlib-1.6.0",
"kotlin-stdlib-1.6.20",
"kotlin-stdlib-1.7.0",
@@ -238,6 +228,7 @@ use_repo(
"kotlin-stdlib-2.0.20-Beta2",
"kotlin-stdlib-2.1.0-Beta1",
"kotlin-stdlib-2.1.20-Beta1",
"kotlin-stdlib-2.2.0-Beta1",
)
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")

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,17 @@
## 0.4.7
## 0.4.9
No user-facing changes.
## 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

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

View File

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

View File

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

View File

@@ -1,5 +1,33 @@
## 0.6.1
No user-facing changes.
## 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

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

View File

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

View File

@@ -1 +1,3 @@
[]
- queries: .
- apply: code-quality-selectors.yml
from: codeql/suite-helpers

View File

@@ -1,5 +1,5 @@
name: codeql/actions-queries
version: 0.5.5-dev
version: 0.6.1
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

@@ -0,0 +1,2 @@
#include "a.h"
#define FOUR 4

View File

@@ -0,0 +1,3 @@
int main() {
return ONE + FOUR;
}

View File

@@ -0,0 +1 @@
#import "d.h"

View File

@@ -0,0 +1,3 @@
int main() {
return SEVENTEEN;
}

View File

@@ -0,0 +1,5 @@
#if 1
#pragma hdrstop
extern int x;
#define SEEN_F
#endif

View File

@@ -0,0 +1,5 @@
#ifdef SEEN_F
static int g() {
return 20;
}
#endif

View File

@@ -0,0 +1,4 @@
#include "h1.h"
#pragma hdrstop
#include "h2.h"
#define SEEN_H

View File

@@ -13,4 +13,3 @@ static int h2() {
return 32;
}
#endif
// semmle-extractor-options: --clang -include-pch ${testdir}/clang-pch.testproj/h.pch

View File

@@ -0,0 +1,17 @@
import os
def test(codeql, cpp):
os.mkdir("pch")
extractor = cpp.get_tool("extractor")
codeql.database.create(command=[
f'"{extractor}" --mimic-clang -emit-pch -o pch/a.pch a.c',
f'"{extractor}" --mimic-clang -include-pch pch/a.pch -Iextra_dummy_path b.c',
f'"{extractor}" --mimic-clang -include pch/a -Iextra_dummy_path c.c',
f'"{extractor}" --mimic-clang -emit-pch -o pch/d.pch d.c',
f'"{extractor}" --mimic-clang -include-pch pch/d.pch e.c',
f'"{extractor}" --mimic-clang -emit-pch -o pch/f.pch f.c',
f'"{extractor}" --mimic-clang -include-pch pch/f.pch g.c',
f'"{extractor}" --mimic-clang -emit-pch -o pch/h.pch h.c',
f'"{extractor}" --mimic-clang -include-pch pch/h.pch i.c',
])

View File

@@ -0,0 +1 @@
#include "a.h"

View File

@@ -0,0 +1,6 @@
#pragma hdrstop
#include "b.h"
int b() {
return A;
}

View File

@@ -0,0 +1,6 @@
#include "d.h"
#include "c.h"
int c() {
return A;
}

View File

@@ -0,0 +1,11 @@
import os
def test(codeql, cpp):
os.mkdir("pch")
extractor = cpp.get_tool("extractor")
codeql.database.create(command=[
f'"{extractor}" --mimic-cl /Yca.h /Fppch/a.pch a.c',
f'"{extractor}" --mimic-cl /Yub.h /Fppch/a.pch b.c',
f'"{extractor}" --mimic-cl /Yuc.h /Fppch/a.pch c.c',
])

View File

@@ -0,0 +1,60 @@
ql/cpp/ql/src/Critical/DoubleFree.ql
ql/cpp/ql/src/Critical/IncorrectCheckScanf.ql
ql/cpp/ql/src/Critical/NewFreeMismatch.ql
ql/cpp/ql/src/Critical/OverflowStatic.ql
ql/cpp/ql/src/Critical/UseAfterFree.ql
ql/cpp/ql/src/Diagnostics/ExtractedFiles.ql
ql/cpp/ql/src/Diagnostics/ExtractionWarnings.ql
ql/cpp/ql/src/Diagnostics/FailedExtractorInvocations.ql
ql/cpp/ql/src/Likely Bugs/Arithmetic/BadAdditionOverflowCheck.ql
ql/cpp/ql/src/Likely Bugs/Arithmetic/IntMultToLong.ql
ql/cpp/ql/src/Likely Bugs/Arithmetic/SignedOverflowCheck.ql
ql/cpp/ql/src/Likely Bugs/Conversion/CastArrayPointerArithmetic.ql
ql/cpp/ql/src/Likely Bugs/Format/SnprintfOverflow.ql
ql/cpp/ql/src/Likely Bugs/Format/WrongNumberOfFormatArguments.ql
ql/cpp/ql/src/Likely Bugs/Format/WrongTypeFormatArguments.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/AllocaInLoop.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/PointerOverflow.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/ReturnStackAllocatedMemory.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousCallToStrncat.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/UsingExpiredStackAddress.ql
ql/cpp/ql/src/Likely Bugs/OO/UnsafeUseOfThis.ql
ql/cpp/ql/src/Likely Bugs/RedundantNullCheckSimple.ql
ql/cpp/ql/src/Likely Bugs/Underspecified Functions/TooFewArguments.ql
ql/cpp/ql/src/Security/CWE/CWE-014/MemsetMayBeDeleted.ql
ql/cpp/ql/src/Security/CWE/CWE-078/ExecTainted.ql
ql/cpp/ql/src/Security/CWE/CWE-079/CgiXss.ql
ql/cpp/ql/src/Security/CWE/CWE-089/SqlTainted.ql
ql/cpp/ql/src/Security/CWE/CWE-120/BadlyBoundedWrite.ql
ql/cpp/ql/src/Security/CWE/CWE-120/VeryLikelyOverrunWrite.ql
ql/cpp/ql/src/Security/CWE/CWE-131/NoSpaceForZeroTerminator.ql
ql/cpp/ql/src/Security/CWE/CWE-134/UncontrolledFormatString.ql
ql/cpp/ql/src/Security/CWE/CWE-190/ArithmeticUncontrolled.ql
ql/cpp/ql/src/Security/CWE/CWE-190/ComparisonWithWiderType.ql
ql/cpp/ql/src/Security/CWE/CWE-191/UnsignedDifferenceExpressionComparedZero.ql
ql/cpp/ql/src/Security/CWE/CWE-253/HResultBooleanConversion.ql
ql/cpp/ql/src/Security/CWE/CWE-311/CleartextFileWrite.ql
ql/cpp/ql/src/Security/CWE/CWE-311/CleartextTransmission.ql
ql/cpp/ql/src/Security/CWE/CWE-319/UseOfHttp.ql
ql/cpp/ql/src/Security/CWE/CWE-326/InsufficientKeySize.ql
ql/cpp/ql/src/Security/CWE/CWE-327/BrokenCryptoAlgorithm.ql
ql/cpp/ql/src/Security/CWE/CWE-327/OpenSslHeartbleed.ql
ql/cpp/ql/src/Security/CWE/CWE-367/TOCTOUFilesystemRace.ql
ql/cpp/ql/src/Security/CWE/CWE-416/IteratorToExpiredContainer.ql
ql/cpp/ql/src/Security/CWE/CWE-416/UseOfStringAfterLifetimeEnds.ql
ql/cpp/ql/src/Security/CWE/CWE-416/UseOfUniquePointerAfterLifetimeEnds.ql
ql/cpp/ql/src/Security/CWE/CWE-468/SuspiciousAddWithSizeof.ql
ql/cpp/ql/src/Security/CWE/CWE-497/ExposedSystemData.ql
ql/cpp/ql/src/Security/CWE/CWE-611/XXE.ql
ql/cpp/ql/src/Security/CWE/CWE-676/DangerousFunctionOverflow.ql
ql/cpp/ql/src/Security/CWE/CWE-676/DangerousUseOfCin.ql
ql/cpp/ql/src/Security/CWE/CWE-704/WcharCharConversion.ql
ql/cpp/ql/src/Security/CWE/CWE-732/OpenCallMissingModeArgument.ql
ql/cpp/ql/src/Security/CWE/CWE-732/UnsafeDaclSecurityDescriptor.ql
ql/cpp/ql/src/Summary/LinesOfCode.ql
ql/cpp/ql/src/Summary/LinesOfUserCode.ql
ql/cpp/ql/src/Telemetry/CompilerErrors.ql
ql/cpp/ql/src/Telemetry/DatabaseQuality.ql
ql/cpp/ql/src/Telemetry/ExtractionMetrics.ql
ql/cpp/ql/src/Telemetry/MissingIncludes.ql
ql/cpp/ql/src/Telemetry/SucceededIncludes.ql

View File

@@ -0,0 +1,181 @@
ql/cpp/ql/src/Best Practices/BlockWithTooManyStatements.ql
ql/cpp/ql/src/Best Practices/ComplexCondition.ql
ql/cpp/ql/src/Best Practices/Exceptions/AccidentalRethrow.ql
ql/cpp/ql/src/Best Practices/Exceptions/CatchingByValue.ql
ql/cpp/ql/src/Best Practices/Exceptions/LeakyCatch.ql
ql/cpp/ql/src/Best Practices/Exceptions/ThrowingPointers.ql
ql/cpp/ql/src/Best Practices/GuardedFree.ql
ql/cpp/ql/src/Best Practices/Hiding/DeclarationHidesParameter.ql
ql/cpp/ql/src/Best Practices/Hiding/DeclarationHidesVariable.ql
ql/cpp/ql/src/Best Practices/Hiding/LocalVariableHidesGlobalVariable.ql
ql/cpp/ql/src/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation.ql
ql/cpp/ql/src/Best Practices/Likely Errors/EmptyBlock.ql
ql/cpp/ql/src/Best Practices/Likely Errors/OffsetUseBeforeRangeCheck.ql
ql/cpp/ql/src/Best Practices/Likely Errors/Slicing.ql
ql/cpp/ql/src/Best Practices/RuleOfTwo.ql
ql/cpp/ql/src/Best Practices/SloppyGlobal.ql
ql/cpp/ql/src/Best Practices/SwitchLongCase.ql
ql/cpp/ql/src/Best Practices/Unused Entities/UnusedLocals.ql
ql/cpp/ql/src/Best Practices/Unused Entities/UnusedStaticFunctions.ql
ql/cpp/ql/src/Best Practices/Unused Entities/UnusedStaticVariables.ql
ql/cpp/ql/src/Best Practices/UseOfGoto.ql
ql/cpp/ql/src/Critical/DeadCodeGoto.ql
ql/cpp/ql/src/Critical/DoubleFree.ql
ql/cpp/ql/src/Critical/IncorrectCheckScanf.ql
ql/cpp/ql/src/Critical/LargeParameter.ql
ql/cpp/ql/src/Critical/MissingCheckScanf.ql
ql/cpp/ql/src/Critical/NewArrayDeleteMismatch.ql
ql/cpp/ql/src/Critical/NewDeleteArrayMismatch.ql
ql/cpp/ql/src/Critical/NewFreeMismatch.ql
ql/cpp/ql/src/Critical/OverflowStatic.ql
ql/cpp/ql/src/Critical/SizeCheck.ql
ql/cpp/ql/src/Critical/SizeCheck2.ql
ql/cpp/ql/src/Critical/UseAfterFree.ql
ql/cpp/ql/src/Diagnostics/ExtractedFiles.ql
ql/cpp/ql/src/Diagnostics/ExtractionWarnings.ql
ql/cpp/ql/src/Diagnostics/FailedExtractorInvocations.ql
ql/cpp/ql/src/Documentation/CommentedOutCode.ql
ql/cpp/ql/src/Documentation/FixmeComments.ql
ql/cpp/ql/src/Documentation/UncommentedFunction.ql
ql/cpp/ql/src/Header Cleanup/Cleanup-DuplicateIncludeGuard.ql
ql/cpp/ql/src/Likely Bugs/AmbiguouslySignedBitField.ql
ql/cpp/ql/src/Likely Bugs/Arithmetic/BadAdditionOverflowCheck.ql
ql/cpp/ql/src/Likely Bugs/Arithmetic/BadCheckOdd.ql
ql/cpp/ql/src/Likely Bugs/Arithmetic/BitwiseSignCheck.ql
ql/cpp/ql/src/Likely Bugs/Arithmetic/ComparisonPrecedence.ql
ql/cpp/ql/src/Likely Bugs/Arithmetic/FloatComparison.ql
ql/cpp/ql/src/Likely Bugs/Arithmetic/IntMultToLong.ql
ql/cpp/ql/src/Likely Bugs/Arithmetic/PointlessComparison.ql
ql/cpp/ql/src/Likely Bugs/Arithmetic/PointlessSelfComparison.ql
ql/cpp/ql/src/Likely Bugs/Arithmetic/SignedOverflowCheck.ql
ql/cpp/ql/src/Likely Bugs/Arithmetic/UnsignedGEZero.ql
ql/cpp/ql/src/Likely Bugs/ContinueInFalseLoop.ql
ql/cpp/ql/src/Likely Bugs/Conversion/ArrayArgSizeMismatch.ql
ql/cpp/ql/src/Likely Bugs/Conversion/CastArrayPointerArithmetic.ql
ql/cpp/ql/src/Likely Bugs/Conversion/ImplicitDowncastFromBitfield.ql
ql/cpp/ql/src/Likely Bugs/Conversion/LossyFunctionResultCast.ql
ql/cpp/ql/src/Likely Bugs/Conversion/LossyPointerCast.ql
ql/cpp/ql/src/Likely Bugs/Format/NonConstantFormat.ql
ql/cpp/ql/src/Likely Bugs/Format/SnprintfOverflow.ql
ql/cpp/ql/src/Likely Bugs/Format/TooManyFormatArguments.ql
ql/cpp/ql/src/Likely Bugs/Format/WrongNumberOfFormatArguments.ql
ql/cpp/ql/src/Likely Bugs/Format/WrongTypeFormatArguments.ql
ql/cpp/ql/src/Likely Bugs/InconsistentCallOnResult.ql
ql/cpp/ql/src/Likely Bugs/InconsistentCheckReturnNull.ql
ql/cpp/ql/src/Likely Bugs/Leap Year/Adding365DaysPerYear.ql
ql/cpp/ql/src/Likely Bugs/Leap Year/UncheckedLeapYearAfterYearModification.ql
ql/cpp/ql/src/Likely Bugs/Leap Year/UncheckedReturnValueForTimeFunctions.ql
ql/cpp/ql/src/Likely Bugs/Likely Typos/AssignWhereCompareMeant.ql
ql/cpp/ql/src/Likely Bugs/Likely Typos/CompareWhereAssignMeant.ql
ql/cpp/ql/src/Likely Bugs/Likely Typos/DubiousNullCheck.ql
ql/cpp/ql/src/Likely Bugs/Likely Typos/ExprHasNoEffect.ql
ql/cpp/ql/src/Likely Bugs/Likely Typos/FutileConditional.ql
ql/cpp/ql/src/Likely Bugs/Likely Typos/IncorrectNotOperatorUsage.ql
ql/cpp/ql/src/Likely Bugs/Likely Typos/MissingEnumCaseInSwitch.ql
ql/cpp/ql/src/Likely Bugs/Likely Typos/ShortCircuitBitMask.ql
ql/cpp/ql/src/Likely Bugs/Likely Typos/UsingStrcpyAsBoolean.ql
ql/cpp/ql/src/Likely Bugs/Likely Typos/inconsistentLoopDirection.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/AllocaInLoop.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/PointerOverflow.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/ReturnCstrOfLocalStdString.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/ReturnStackAllocatedMemory.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/StackAddressEscapes.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/StrncpyFlippedArgs.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousCallToStrncat.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousSizeof.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/UninitializedLocal.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/UnsafeUseOfStrcat.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/UsingExpiredStackAddress.ql
ql/cpp/ql/src/Likely Bugs/NestedLoopSameVar.ql
ql/cpp/ql/src/Likely Bugs/OO/IncorrectConstructorDelegation.ql
ql/cpp/ql/src/Likely Bugs/OO/NonVirtualDestructorInBaseClass.ql
ql/cpp/ql/src/Likely Bugs/OO/ThrowInDestructor.ql
ql/cpp/ql/src/Likely Bugs/OO/UnsafeUseOfThis.ql
ql/cpp/ql/src/Likely Bugs/Protocols/TlsSettingsMisconfiguration.ql
ql/cpp/ql/src/Likely Bugs/Protocols/UseOfDeprecatedHardcodedProtocol.ql
ql/cpp/ql/src/Likely Bugs/RedundantNullCheckSimple.ql
ql/cpp/ql/src/Likely Bugs/ReturnConstType.ql
ql/cpp/ql/src/Likely Bugs/ReturnConstTypeMember.ql
ql/cpp/ql/src/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.ql
ql/cpp/ql/src/Likely Bugs/Underspecified Functions/MistypedFunctionArguments.ql
ql/cpp/ql/src/Likely Bugs/Underspecified Functions/TooFewArguments.ql
ql/cpp/ql/src/Likely Bugs/Underspecified Functions/TooManyArguments.ql
ql/cpp/ql/src/Likely Bugs/UseInOwnInitializer.ql
ql/cpp/ql/src/Security/CWE/CWE-014/MemsetMayBeDeleted.ql
ql/cpp/ql/src/Security/CWE/CWE-022/TaintedPath.ql
ql/cpp/ql/src/Security/CWE/CWE-078/ExecTainted.ql
ql/cpp/ql/src/Security/CWE/CWE-079/CgiXss.ql
ql/cpp/ql/src/Security/CWE/CWE-089/SqlTainted.ql
ql/cpp/ql/src/Security/CWE/CWE-114/UncontrolledProcessOperation.ql
ql/cpp/ql/src/Security/CWE/CWE-119/OverflowBuffer.ql
ql/cpp/ql/src/Security/CWE/CWE-119/OverrunWriteProductFlow.ql
ql/cpp/ql/src/Security/CWE/CWE-120/BadlyBoundedWrite.ql
ql/cpp/ql/src/Security/CWE/CWE-120/OverrunWrite.ql
ql/cpp/ql/src/Security/CWE/CWE-120/OverrunWriteFloat.ql
ql/cpp/ql/src/Security/CWE/CWE-120/UnboundedWrite.ql
ql/cpp/ql/src/Security/CWE/CWE-120/VeryLikelyOverrunWrite.ql
ql/cpp/ql/src/Security/CWE/CWE-121/UnterminatedVarargsCall.ql
ql/cpp/ql/src/Security/CWE/CWE-131/NoSpaceForZeroTerminator.ql
ql/cpp/ql/src/Security/CWE/CWE-134/UncontrolledFormatString.ql
ql/cpp/ql/src/Security/CWE/CWE-190/ArithmeticUncontrolled.ql
ql/cpp/ql/src/Security/CWE/CWE-190/ComparisonWithWiderType.ql
ql/cpp/ql/src/Security/CWE/CWE-190/TaintedAllocationSize.ql
ql/cpp/ql/src/Security/CWE/CWE-191/UnsignedDifferenceExpressionComparedZero.ql
ql/cpp/ql/src/Security/CWE/CWE-193/InvalidPointerDeref.ql
ql/cpp/ql/src/Security/CWE/CWE-253/HResultBooleanConversion.ql
ql/cpp/ql/src/Security/CWE/CWE-290/AuthenticationBypass.ql
ql/cpp/ql/src/Security/CWE/CWE-295/SSLResultConflation.ql
ql/cpp/ql/src/Security/CWE/CWE-295/SSLResultNotChecked.ql
ql/cpp/ql/src/Security/CWE/CWE-311/CleartextBufferWrite.ql
ql/cpp/ql/src/Security/CWE/CWE-311/CleartextFileWrite.ql
ql/cpp/ql/src/Security/CWE/CWE-311/CleartextTransmission.ql
ql/cpp/ql/src/Security/CWE/CWE-313/CleartextSqliteDatabase.ql
ql/cpp/ql/src/Security/CWE/CWE-319/UseOfHttp.ql
ql/cpp/ql/src/Security/CWE/CWE-326/InsufficientKeySize.ql
ql/cpp/ql/src/Security/CWE/CWE-327/BrokenCryptoAlgorithm.ql
ql/cpp/ql/src/Security/CWE/CWE-327/OpenSslHeartbleed.ql
ql/cpp/ql/src/Security/CWE/CWE-367/TOCTOUFilesystemRace.ql
ql/cpp/ql/src/Security/CWE/CWE-416/IteratorToExpiredContainer.ql
ql/cpp/ql/src/Security/CWE/CWE-416/UseOfStringAfterLifetimeEnds.ql
ql/cpp/ql/src/Security/CWE/CWE-416/UseOfUniquePointerAfterLifetimeEnds.ql
ql/cpp/ql/src/Security/CWE/CWE-428/UnsafeCreateProcessCall.ql
ql/cpp/ql/src/Security/CWE/CWE-468/IncorrectPointerScaling.ql
ql/cpp/ql/src/Security/CWE/CWE-468/IncorrectPointerScalingVoid.ql
ql/cpp/ql/src/Security/CWE/CWE-468/SuspiciousAddWithSizeof.ql
ql/cpp/ql/src/Security/CWE/CWE-497/ExposedSystemData.ql
ql/cpp/ql/src/Security/CWE/CWE-497/PotentiallyExposedSystemData.ql
ql/cpp/ql/src/Security/CWE/CWE-570/IncorrectAllocationErrorHandling.ql
ql/cpp/ql/src/Security/CWE/CWE-611/XXE.ql
ql/cpp/ql/src/Security/CWE/CWE-676/DangerousFunctionOverflow.ql
ql/cpp/ql/src/Security/CWE/CWE-676/DangerousUseOfCin.ql
ql/cpp/ql/src/Security/CWE/CWE-676/PotentiallyDangerousFunction.ql
ql/cpp/ql/src/Security/CWE/CWE-704/WcharCharConversion.ql
ql/cpp/ql/src/Security/CWE/CWE-732/DoNotCreateWorldWritable.ql
ql/cpp/ql/src/Security/CWE/CWE-732/OpenCallMissingModeArgument.ql
ql/cpp/ql/src/Security/CWE/CWE-732/UnsafeDaclSecurityDescriptor.ql
ql/cpp/ql/src/Security/CWE/CWE-807/TaintedCondition.ql
ql/cpp/ql/src/Security/CWE/CWE-843/TypeConfusion.ql
ql/cpp/ql/src/Summary/LinesOfCode.ql
ql/cpp/ql/src/Summary/LinesOfUserCode.ql
ql/cpp/ql/src/Telemetry/CompilerErrors.ql
ql/cpp/ql/src/Telemetry/DatabaseQuality.ql
ql/cpp/ql/src/Telemetry/ExtractionMetrics.ql
ql/cpp/ql/src/Telemetry/MissingIncludes.ql
ql/cpp/ql/src/Telemetry/SucceededIncludes.ql
ql/cpp/ql/src/jsf/4.06 Pre-Processing Directives/AV Rule 32.ql
ql/cpp/ql/src/jsf/4.07 Header Files/AV Rule 35.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 71.1.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 79.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 82.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 88.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 89.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 95.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 97.ql
ql/cpp/ql/src/jsf/4.13 Functions/AV Rule 107.ql
ql/cpp/ql/src/jsf/4.13 Functions/AV Rule 114.ql
ql/cpp/ql/src/jsf/4.16 Initialization/AV Rule 145.ql
ql/cpp/ql/src/jsf/4.17 Types/AV Rule 148.ql
ql/cpp/ql/src/jsf/4.21 Operators/AV Rule 166.ql
ql/cpp/ql/src/jsf/4.24 Control Flow Structures/AV Rule 196.ql
ql/cpp/ql/src/jsf/4.24 Control Flow Structures/AV Rule 197.ql
ql/cpp/ql/src/jsf/4.24 Control Flow Structures/AV Rule 201.ql

View File

@@ -0,0 +1,97 @@
ql/cpp/ql/src/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation.ql
ql/cpp/ql/src/Best Practices/Likely Errors/OffsetUseBeforeRangeCheck.ql
ql/cpp/ql/src/Critical/DoubleFree.ql
ql/cpp/ql/src/Critical/IncorrectCheckScanf.ql
ql/cpp/ql/src/Critical/MissingCheckScanf.ql
ql/cpp/ql/src/Critical/NewFreeMismatch.ql
ql/cpp/ql/src/Critical/OverflowStatic.ql
ql/cpp/ql/src/Critical/SizeCheck.ql
ql/cpp/ql/src/Critical/SizeCheck2.ql
ql/cpp/ql/src/Critical/UseAfterFree.ql
ql/cpp/ql/src/Diagnostics/ExtractedFiles.ql
ql/cpp/ql/src/Diagnostics/ExtractionWarnings.ql
ql/cpp/ql/src/Diagnostics/FailedExtractorInvocations.ql
ql/cpp/ql/src/Likely Bugs/Arithmetic/BadAdditionOverflowCheck.ql
ql/cpp/ql/src/Likely Bugs/Arithmetic/IntMultToLong.ql
ql/cpp/ql/src/Likely Bugs/Arithmetic/SignedOverflowCheck.ql
ql/cpp/ql/src/Likely Bugs/Conversion/CastArrayPointerArithmetic.ql
ql/cpp/ql/src/Likely Bugs/Format/NonConstantFormat.ql
ql/cpp/ql/src/Likely Bugs/Format/SnprintfOverflow.ql
ql/cpp/ql/src/Likely Bugs/Format/WrongNumberOfFormatArguments.ql
ql/cpp/ql/src/Likely Bugs/Format/WrongTypeFormatArguments.ql
ql/cpp/ql/src/Likely Bugs/Likely Typos/IncorrectNotOperatorUsage.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/AllocaInLoop.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/PointerOverflow.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/ReturnStackAllocatedMemory.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/StrncpyFlippedArgs.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousCallToStrncat.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousSizeof.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/UninitializedLocal.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/UnsafeUseOfStrcat.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/UsingExpiredStackAddress.ql
ql/cpp/ql/src/Likely Bugs/OO/UnsafeUseOfThis.ql
ql/cpp/ql/src/Likely Bugs/Protocols/TlsSettingsMisconfiguration.ql
ql/cpp/ql/src/Likely Bugs/Protocols/UseOfDeprecatedHardcodedProtocol.ql
ql/cpp/ql/src/Likely Bugs/RedundantNullCheckSimple.ql
ql/cpp/ql/src/Likely Bugs/Underspecified Functions/TooFewArguments.ql
ql/cpp/ql/src/Security/CWE/CWE-014/MemsetMayBeDeleted.ql
ql/cpp/ql/src/Security/CWE/CWE-022/TaintedPath.ql
ql/cpp/ql/src/Security/CWE/CWE-078/ExecTainted.ql
ql/cpp/ql/src/Security/CWE/CWE-079/CgiXss.ql
ql/cpp/ql/src/Security/CWE/CWE-089/SqlTainted.ql
ql/cpp/ql/src/Security/CWE/CWE-114/UncontrolledProcessOperation.ql
ql/cpp/ql/src/Security/CWE/CWE-119/OverflowBuffer.ql
ql/cpp/ql/src/Security/CWE/CWE-119/OverrunWriteProductFlow.ql
ql/cpp/ql/src/Security/CWE/CWE-120/BadlyBoundedWrite.ql
ql/cpp/ql/src/Security/CWE/CWE-120/OverrunWrite.ql
ql/cpp/ql/src/Security/CWE/CWE-120/OverrunWriteFloat.ql
ql/cpp/ql/src/Security/CWE/CWE-120/UnboundedWrite.ql
ql/cpp/ql/src/Security/CWE/CWE-120/VeryLikelyOverrunWrite.ql
ql/cpp/ql/src/Security/CWE/CWE-121/UnterminatedVarargsCall.ql
ql/cpp/ql/src/Security/CWE/CWE-131/NoSpaceForZeroTerminator.ql
ql/cpp/ql/src/Security/CWE/CWE-134/UncontrolledFormatString.ql
ql/cpp/ql/src/Security/CWE/CWE-190/ArithmeticUncontrolled.ql
ql/cpp/ql/src/Security/CWE/CWE-190/ComparisonWithWiderType.ql
ql/cpp/ql/src/Security/CWE/CWE-190/TaintedAllocationSize.ql
ql/cpp/ql/src/Security/CWE/CWE-191/UnsignedDifferenceExpressionComparedZero.ql
ql/cpp/ql/src/Security/CWE/CWE-193/InvalidPointerDeref.ql
ql/cpp/ql/src/Security/CWE/CWE-253/HResultBooleanConversion.ql
ql/cpp/ql/src/Security/CWE/CWE-290/AuthenticationBypass.ql
ql/cpp/ql/src/Security/CWE/CWE-295/SSLResultConflation.ql
ql/cpp/ql/src/Security/CWE/CWE-295/SSLResultNotChecked.ql
ql/cpp/ql/src/Security/CWE/CWE-311/CleartextBufferWrite.ql
ql/cpp/ql/src/Security/CWE/CWE-311/CleartextFileWrite.ql
ql/cpp/ql/src/Security/CWE/CWE-311/CleartextTransmission.ql
ql/cpp/ql/src/Security/CWE/CWE-313/CleartextSqliteDatabase.ql
ql/cpp/ql/src/Security/CWE/CWE-319/UseOfHttp.ql
ql/cpp/ql/src/Security/CWE/CWE-326/InsufficientKeySize.ql
ql/cpp/ql/src/Security/CWE/CWE-327/BrokenCryptoAlgorithm.ql
ql/cpp/ql/src/Security/CWE/CWE-327/OpenSslHeartbleed.ql
ql/cpp/ql/src/Security/CWE/CWE-367/TOCTOUFilesystemRace.ql
ql/cpp/ql/src/Security/CWE/CWE-416/IteratorToExpiredContainer.ql
ql/cpp/ql/src/Security/CWE/CWE-416/UseOfStringAfterLifetimeEnds.ql
ql/cpp/ql/src/Security/CWE/CWE-416/UseOfUniquePointerAfterLifetimeEnds.ql
ql/cpp/ql/src/Security/CWE/CWE-428/UnsafeCreateProcessCall.ql
ql/cpp/ql/src/Security/CWE/CWE-468/IncorrectPointerScaling.ql
ql/cpp/ql/src/Security/CWE/CWE-468/IncorrectPointerScalingVoid.ql
ql/cpp/ql/src/Security/CWE/CWE-468/SuspiciousAddWithSizeof.ql
ql/cpp/ql/src/Security/CWE/CWE-497/ExposedSystemData.ql
ql/cpp/ql/src/Security/CWE/CWE-497/PotentiallyExposedSystemData.ql
ql/cpp/ql/src/Security/CWE/CWE-570/IncorrectAllocationErrorHandling.ql
ql/cpp/ql/src/Security/CWE/CWE-611/XXE.ql
ql/cpp/ql/src/Security/CWE/CWE-676/DangerousFunctionOverflow.ql
ql/cpp/ql/src/Security/CWE/CWE-676/DangerousUseOfCin.ql
ql/cpp/ql/src/Security/CWE/CWE-676/PotentiallyDangerousFunction.ql
ql/cpp/ql/src/Security/CWE/CWE-704/WcharCharConversion.ql
ql/cpp/ql/src/Security/CWE/CWE-732/DoNotCreateWorldWritable.ql
ql/cpp/ql/src/Security/CWE/CWE-732/OpenCallMissingModeArgument.ql
ql/cpp/ql/src/Security/CWE/CWE-732/UnsafeDaclSecurityDescriptor.ql
ql/cpp/ql/src/Security/CWE/CWE-807/TaintedCondition.ql
ql/cpp/ql/src/Security/CWE/CWE-843/TypeConfusion.ql
ql/cpp/ql/src/Summary/LinesOfCode.ql
ql/cpp/ql/src/Summary/LinesOfUserCode.ql
ql/cpp/ql/src/Telemetry/CompilerErrors.ql
ql/cpp/ql/src/Telemetry/DatabaseQuality.ql
ql/cpp/ql/src/Telemetry/ExtractionMetrics.ql
ql/cpp/ql/src/Telemetry/MissingIncludes.ql
ql/cpp/ql/src/Telemetry/SucceededIncludes.ql

View File

@@ -0,0 +1,448 @@
ql/cpp/ql/src/AlertSuppression.ql
ql/cpp/ql/src/Architecture/FeatureEnvy.ql
ql/cpp/ql/src/Architecture/General Class-Level Information/ClassHierarchies.ql
ql/cpp/ql/src/Architecture/General Class-Level Information/HubClasses.ql
ql/cpp/ql/src/Architecture/General Class-Level Information/InheritanceDepthDistribution.ql
ql/cpp/ql/src/Architecture/General Namespace-Level Information/CyclicNamespaces.ql
ql/cpp/ql/src/Architecture/General Namespace-Level Information/GlobalNamespaceClasses.ql
ql/cpp/ql/src/Architecture/General Namespace-Level Information/NamespaceDependencies.ql
ql/cpp/ql/src/Architecture/General Top-Level Information/GeneralStatistics.ql
ql/cpp/ql/src/Architecture/InappropriateIntimacy.ql
ql/cpp/ql/src/Architecture/Refactoring Opportunities/ClassesWithManyDependencies.ql
ql/cpp/ql/src/Architecture/Refactoring Opportunities/ClassesWithManyFields.ql
ql/cpp/ql/src/Architecture/Refactoring Opportunities/ComplexFunctions.ql
ql/cpp/ql/src/Architecture/Refactoring Opportunities/CyclomaticComplexity.ql
ql/cpp/ql/src/Architecture/Refactoring Opportunities/FunctionsWithManyParameters.ql
ql/cpp/ql/src/Best Practices/Magic Constants/JapaneseEraDate.ql
ql/cpp/ql/src/Best Practices/Magic Constants/MagicConstantsNumbers.ql
ql/cpp/ql/src/Best Practices/Magic Constants/MagicConstantsString.ql
ql/cpp/ql/src/Best Practices/Magic Constants/MagicNumbersUseConstant.ql
ql/cpp/ql/src/Best Practices/Magic Constants/MagicStringsUseConstant.ql
ql/cpp/ql/src/Best Practices/NVI.ql
ql/cpp/ql/src/Best Practices/NVIHub.ql
ql/cpp/ql/src/Best Practices/RuleOfThree.ql
ql/cpp/ql/src/Best Practices/Unused Entities/UnusedIncludes.ql
ql/cpp/ql/src/Critical/DeadCodeCondition.ql
ql/cpp/ql/src/Critical/DeadCodeFunction.ql
ql/cpp/ql/src/Critical/DescriptorMayNotBeClosed.ql
ql/cpp/ql/src/Critical/DescriptorNeverClosed.ql
ql/cpp/ql/src/Critical/FileMayNotBeClosed.ql
ql/cpp/ql/src/Critical/FileNeverClosed.ql
ql/cpp/ql/src/Critical/GlobalUseBeforeInit.ql
ql/cpp/ql/src/Critical/InconsistentNullnessTesting.ql
ql/cpp/ql/src/Critical/InitialisationNotRun.ql
ql/cpp/ql/src/Critical/LateNegativeTest.ql
ql/cpp/ql/src/Critical/MemoryMayNotBeFreed.ql
ql/cpp/ql/src/Critical/MemoryNeverFreed.ql
ql/cpp/ql/src/Critical/MissingNegativityTest.ql
ql/cpp/ql/src/Critical/MissingNullTest.ql
ql/cpp/ql/src/Critical/NotInitialised.ql
ql/cpp/ql/src/Critical/OverflowCalculated.ql
ql/cpp/ql/src/Critical/OverflowDestination.ql
ql/cpp/ql/src/Critical/ReturnStackAllocatedObject.ql
ql/cpp/ql/src/Critical/ReturnValueIgnored.ql
ql/cpp/ql/src/Critical/Unused.ql
ql/cpp/ql/src/Diagnostics/Internal/ExtractionErrors.ql
ql/cpp/ql/src/Documentation/DocumentApi.ql
ql/cpp/ql/src/Documentation/TodoComments.ql
ql/cpp/ql/src/JPL_C/LOC-2/Rule 03/ExitNonterminatingLoop.ql
ql/cpp/ql/src/JPL_C/LOC-2/Rule 03/LoopBounds.ql
ql/cpp/ql/src/JPL_C/LOC-2/Rule 04/Recursion.ql
ql/cpp/ql/src/JPL_C/LOC-2/Rule 05/HeapMemory.ql
ql/cpp/ql/src/JPL_C/LOC-2/Rule 07/ThreadSafety.ql
ql/cpp/ql/src/JPL_C/LOC-2/Rule 09/AvoidNestedSemaphores.ql
ql/cpp/ql/src/JPL_C/LOC-2/Rule 09/AvoidSemaphores.ql
ql/cpp/ql/src/JPL_C/LOC-2/Rule 09/OutOfOrderLocks.ql
ql/cpp/ql/src/JPL_C/LOC-2/Rule 09/ReleaseLocksWhenAcquired.ql
ql/cpp/ql/src/JPL_C/LOC-2/Rule 11/SimpleControlFlowGoto.ql
ql/cpp/ql/src/JPL_C/LOC-2/Rule 11/SimpleControlFlowJmp.ql
ql/cpp/ql/src/JPL_C/LOC-2/Rule 12/EnumInitialization.ql
ql/cpp/ql/src/JPL_C/LOC-3/Rule 13/ExternDeclsInHeader.ql
ql/cpp/ql/src/JPL_C/LOC-3/Rule 13/LimitedScopeFile.ql
ql/cpp/ql/src/JPL_C/LOC-3/Rule 13/LimitedScopeFunction.ql
ql/cpp/ql/src/JPL_C/LOC-3/Rule 13/LimitedScopeLocalHidesGlobal.ql
ql/cpp/ql/src/JPL_C/LOC-3/Rule 14/CheckingReturnValues.ql
ql/cpp/ql/src/JPL_C/LOC-3/Rule 15/CheckingParameterValues.ql
ql/cpp/ql/src/JPL_C/LOC-3/Rule 16/UseOfAssertionsConstant.ql
ql/cpp/ql/src/JPL_C/LOC-3/Rule 16/UseOfAssertionsDensity.ql
ql/cpp/ql/src/JPL_C/LOC-3/Rule 16/UseOfAssertionsNonBoolean.ql
ql/cpp/ql/src/JPL_C/LOC-3/Rule 16/UseOfAssertionsSideEffect.ql
ql/cpp/ql/src/JPL_C/LOC-3/Rule 17/BasicIntTypes.ql
ql/cpp/ql/src/JPL_C/LOC-3/Rule 18/CompoundExpressions.ql
ql/cpp/ql/src/JPL_C/LOC-3/Rule 19/NoBooleanSideEffects.ql
ql/cpp/ql/src/JPL_C/LOC-4/Rule 20/PreprocessorUse.ql
ql/cpp/ql/src/JPL_C/LOC-4/Rule 20/PreprocessorUseIfdef.ql
ql/cpp/ql/src/JPL_C/LOC-4/Rule 20/PreprocessorUsePartial.ql
ql/cpp/ql/src/JPL_C/LOC-4/Rule 20/PreprocessorUseUndisciplined.ql
ql/cpp/ql/src/JPL_C/LOC-4/Rule 21/MacroInBlock.ql
ql/cpp/ql/src/JPL_C/LOC-4/Rule 22/UseOfUndef.ql
ql/cpp/ql/src/JPL_C/LOC-4/Rule 23/MismatchedIfdefs.ql
ql/cpp/ql/src/JPL_C/LOC-4/Rule 24/MultipleStmtsPerLine.ql
ql/cpp/ql/src/JPL_C/LOC-4/Rule 24/MultipleVarDeclsPerLine.ql
ql/cpp/ql/src/JPL_C/LOC-4/Rule 25/FunctionSizeLimits.ql
ql/cpp/ql/src/JPL_C/LOC-4/Rule 26/DeclarationPointerNesting.ql
ql/cpp/ql/src/JPL_C/LOC-4/Rule 27/PointerDereferenceInStmt.ql
ql/cpp/ql/src/JPL_C/LOC-4/Rule 28/HiddenPointerDereferenceMacro.ql
ql/cpp/ql/src/JPL_C/LOC-4/Rule 28/HiddenPointerIndirectionTypedef.ql
ql/cpp/ql/src/JPL_C/LOC-4/Rule 29/NonConstFunctionPointer.ql
ql/cpp/ql/src/JPL_C/LOC-4/Rule 30/FunctionPointerConversions.ql
ql/cpp/ql/src/JPL_C/LOC-4/Rule 31/IncludesFirst.ql
ql/cpp/ql/src/Likely Bugs/Arithmetic/ComparisonWithCancelingSubExpr.ql
ql/cpp/ql/src/Likely Bugs/Conversion/ConversionChangesSign.ql
ql/cpp/ql/src/Likely Bugs/Conversion/NonzeroValueCastToPointer.ql
ql/cpp/ql/src/Likely Bugs/JapaneseEra/ConstructorOrMethodWithExactEraDate.ql
ql/cpp/ql/src/Likely Bugs/JapaneseEra/StructWithExactEraDate.ql
ql/cpp/ql/src/Likely Bugs/Leap Year/UnsafeArrayForDaysOfYear.ql
ql/cpp/ql/src/Likely Bugs/Likely Typos/BoolValueInBitOp.ql
ql/cpp/ql/src/Likely Bugs/Likely Typos/LogicalExprCouldBeSimplified.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/ImproperNullTermination.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/NtohlArrayNoBound.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/Padding/More64BitWaste.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/Padding/NonPortablePrintf.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/Padding/Suboptimal64BitType.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/PotentialBufferOverflow.ql
ql/cpp/ql/src/Likely Bugs/Memory Management/SuspiciousCallToMemset.ql
ql/cpp/ql/src/Likely Bugs/OO/NonVirtualDestructor.ql
ql/cpp/ql/src/Likely Bugs/OO/SelfAssignmentCheck.ql
ql/cpp/ql/src/Likely Bugs/OO/VirtualCallInStructor.ql
ql/cpp/ql/src/Likely Bugs/ShortLoopVarName.ql
ql/cpp/ql/src/Metrics/Classes/CAfferentCoupling.ql
ql/cpp/ql/src/Metrics/Classes/CEfferentCoupling.ql
ql/cpp/ql/src/Metrics/Classes/CHalsteadBugs.ql
ql/cpp/ql/src/Metrics/Classes/CHalsteadDifficulty.ql
ql/cpp/ql/src/Metrics/Classes/CHalsteadEffort.ql
ql/cpp/ql/src/Metrics/Classes/CHalsteadLength.ql
ql/cpp/ql/src/Metrics/Classes/CHalsteadVocabulary.ql
ql/cpp/ql/src/Metrics/Classes/CHalsteadVolume.ql
ql/cpp/ql/src/Metrics/Classes/CInheritanceDepth.ql
ql/cpp/ql/src/Metrics/Classes/CLackOfCohesionCK.ql
ql/cpp/ql/src/Metrics/Classes/CLackOfCohesionHS.ql
ql/cpp/ql/src/Metrics/Classes/CLinesOfCode.ql
ql/cpp/ql/src/Metrics/Classes/CNumberOfFields.ql
ql/cpp/ql/src/Metrics/Classes/CNumberOfFunctions.ql
ql/cpp/ql/src/Metrics/Classes/CNumberOfStatements.ql
ql/cpp/ql/src/Metrics/Classes/CPercentageOfComplexCode.ql
ql/cpp/ql/src/Metrics/Classes/CResponse.ql
ql/cpp/ql/src/Metrics/Classes/CSizeOfAPI.ql
ql/cpp/ql/src/Metrics/Classes/CSpecialisation.ql
ql/cpp/ql/src/Metrics/Dependencies/ExternalDependencies.ql
ql/cpp/ql/src/Metrics/Dependencies/ExternalDependenciesSourceLinks.ql
ql/cpp/ql/src/Metrics/External/FileCompilationDisplayStrings.ql
ql/cpp/ql/src/Metrics/External/FileCompilationSourceLinks.ql
ql/cpp/ql/src/Metrics/Files/AutogeneratedLOC.ql
ql/cpp/ql/src/Metrics/Files/ConditionalSegmentConditions.ql
ql/cpp/ql/src/Metrics/Files/ConditionalSegmentLines.ql
ql/cpp/ql/src/Metrics/Files/FAfferentCoupling.ql
ql/cpp/ql/src/Metrics/Files/FCommentRatio.ql
ql/cpp/ql/src/Metrics/Files/FCyclomaticComplexity.ql
ql/cpp/ql/src/Metrics/Files/FDirectIncludes.ql
ql/cpp/ql/src/Metrics/Files/FEfferentCoupling.ql
ql/cpp/ql/src/Metrics/Files/FHalsteadBugs.ql
ql/cpp/ql/src/Metrics/Files/FHalsteadDifficulty.ql
ql/cpp/ql/src/Metrics/Files/FHalsteadEffort.ql
ql/cpp/ql/src/Metrics/Files/FHalsteadLength.ql
ql/cpp/ql/src/Metrics/Files/FHalsteadVocabulary.ql
ql/cpp/ql/src/Metrics/Files/FHalsteadVolume.ql
ql/cpp/ql/src/Metrics/Files/FLines.ql
ql/cpp/ql/src/Metrics/Files/FLinesOfCode.ql
ql/cpp/ql/src/Metrics/Files/FLinesOfCommentedOutCode.ql
ql/cpp/ql/src/Metrics/Files/FLinesOfComments.ql
ql/cpp/ql/src/Metrics/Files/FMacroRatio.ql
ql/cpp/ql/src/Metrics/Files/FNumberOfClasses.ql
ql/cpp/ql/src/Metrics/Files/FNumberOfTests.ql
ql/cpp/ql/src/Metrics/Files/FTimeInFrontend.ql
ql/cpp/ql/src/Metrics/Files/FTodoComments.ql
ql/cpp/ql/src/Metrics/Files/FTransitiveIncludes.ql
ql/cpp/ql/src/Metrics/Files/FTransitiveSourceIncludes.ql
ql/cpp/ql/src/Metrics/Files/FunctionLength.ql
ql/cpp/ql/src/Metrics/Files/NumberOfFunctions.ql
ql/cpp/ql/src/Metrics/Files/NumberOfGlobals.ql
ql/cpp/ql/src/Metrics/Files/NumberOfParameters.ql
ql/cpp/ql/src/Metrics/Files/NumberOfPublicFunctions.ql
ql/cpp/ql/src/Metrics/Files/NumberOfPublicGlobals.ql
ql/cpp/ql/src/Metrics/Functions/FunCyclomaticComplexity.ql
ql/cpp/ql/src/Metrics/Functions/FunIterationNestingDepth.ql
ql/cpp/ql/src/Metrics/Functions/FunLinesOfCode.ql
ql/cpp/ql/src/Metrics/Functions/FunLinesOfComments.ql
ql/cpp/ql/src/Metrics/Functions/FunNumberOfCalls.ql
ql/cpp/ql/src/Metrics/Functions/FunNumberOfParameters.ql
ql/cpp/ql/src/Metrics/Functions/FunNumberOfStatements.ql
ql/cpp/ql/src/Metrics/Functions/FunPercentageOfComments.ql
ql/cpp/ql/src/Metrics/Functions/StatementNestingDepth.ql
ql/cpp/ql/src/Metrics/Internal/ASTConsistency.ql
ql/cpp/ql/src/Metrics/Internal/CallableDisplayStrings.ql
ql/cpp/ql/src/Metrics/Internal/CallableExtents.ql
ql/cpp/ql/src/Metrics/Internal/CallableSourceLinks.ql
ql/cpp/ql/src/Metrics/Internal/DiagnosticsSumElapsedTimes.ql
ql/cpp/ql/src/Metrics/Internal/IRConsistency.ql
ql/cpp/ql/src/Metrics/Internal/IncludeResolutionStatus.ql
ql/cpp/ql/src/Metrics/Internal/ReftypeDisplayStrings.ql
ql/cpp/ql/src/Metrics/Internal/ReftypeSourceLinks.ql
ql/cpp/ql/src/Metrics/Namespaces/AbstractNamespaces.ql
ql/cpp/ql/src/Metrics/Namespaces/ConcreteNamespaces.ql
ql/cpp/ql/src/Metrics/Namespaces/HighAfferentCouplingNamespaces.ql
ql/cpp/ql/src/Metrics/Namespaces/HighDistanceFromMainLineNamespaces.ql
ql/cpp/ql/src/Metrics/Namespaces/HighEfferentCouplingNamespaces.ql
ql/cpp/ql/src/Metrics/Namespaces/StableNamespaces.ql
ql/cpp/ql/src/Metrics/Namespaces/UnstableNamespaces.ql
ql/cpp/ql/src/Microsoft/CallWithNullSAL.ql
ql/cpp/ql/src/Microsoft/IgnoreReturnValueSAL.ql
ql/cpp/ql/src/Microsoft/InconsistentSAL.ql
ql/cpp/ql/src/PointsTo/Debug.ql
ql/cpp/ql/src/PointsTo/PreparedStagedPointsTo.ql
ql/cpp/ql/src/PointsTo/Stats.ql
ql/cpp/ql/src/PointsTo/TaintedFormatStrings.ql
ql/cpp/ql/src/Power of 10/Rule 1/UseOfGoto.ql
ql/cpp/ql/src/Power of 10/Rule 1/UseOfJmp.ql
ql/cpp/ql/src/Power of 10/Rule 1/UseOfRecursion.ql
ql/cpp/ql/src/Power of 10/Rule 2/BoundedLoopIterations.ql
ql/cpp/ql/src/Power of 10/Rule 2/ExitPermanentLoop.ql
ql/cpp/ql/src/Power of 10/Rule 3/DynamicAllocAfterInit.ql
ql/cpp/ql/src/Power of 10/Rule 4/FunctionTooLong.ql
ql/cpp/ql/src/Power of 10/Rule 4/OneStmtPerLine.ql
ql/cpp/ql/src/Power of 10/Rule 5/AssertionDensity.ql
ql/cpp/ql/src/Power of 10/Rule 5/AssertionSideEffect.ql
ql/cpp/ql/src/Power of 10/Rule 5/ConstantAssertion.ql
ql/cpp/ql/src/Power of 10/Rule 5/NonBooleanAssertion.ql
ql/cpp/ql/src/Power of 10/Rule 6/GlobalCouldBeStatic.ql
ql/cpp/ql/src/Power of 10/Rule 6/VariableScopeTooLarge.ql
ql/cpp/ql/src/Power of 10/Rule 7/CheckArguments.ql
ql/cpp/ql/src/Power of 10/Rule 7/CheckReturnValues.ql
ql/cpp/ql/src/Power of 10/Rule 8/AvoidConditionalCompilation.ql
ql/cpp/ql/src/Power of 10/Rule 8/PartialMacro.ql
ql/cpp/ql/src/Power of 10/Rule 8/RestrictPreprocessor.ql
ql/cpp/ql/src/Power of 10/Rule 8/UndisciplinedMacro.ql
ql/cpp/ql/src/Power of 10/Rule 9/FunctionPointer.ql
ql/cpp/ql/src/Power of 10/Rule 9/HiddenPointerIndirection.ql
ql/cpp/ql/src/Power of 10/Rule 9/PointerNesting.ql
ql/cpp/ql/src/Security/CWE/CWE-020/CountUntrustedDataToExternalAPI.ql
ql/cpp/ql/src/Security/CWE/CWE-020/IRCountUntrustedDataToExternalAPI.ql
ql/cpp/ql/src/Security/CWE/CWE-020/IRUntrustedDataToExternalAPI.ql
ql/cpp/ql/src/Security/CWE/CWE-020/UntrustedDataToExternalAPI.ql
ql/cpp/ql/src/Security/CWE/CWE-129/ImproperArrayIndexValidation.ql
ql/cpp/ql/src/Security/CWE/CWE-170/ImproperNullTerminationTainted.ql
ql/cpp/ql/src/Security/CWE/CWE-190/ArithmeticTainted.ql
ql/cpp/ql/src/Security/CWE/CWE-190/ArithmeticWithExtremeValues.ql
ql/cpp/ql/src/Security/CWE/CWE-190/IntegerOverflowTainted.ql
ql/cpp/ql/src/Security/CWE/CWE-457/ConditionallyUninitializedVariable.ql
ql/cpp/ql/src/Security/CWE/CWE-468/IncorrectPointerScalingChar.ql
ql/cpp/ql/src/Security/CWE/CWE-764/LockOrderCycle.ql
ql/cpp/ql/src/Security/CWE/CWE-764/TwiceLocked.ql
ql/cpp/ql/src/Security/CWE/CWE-764/UnreleasedLock.ql
ql/cpp/ql/src/Security/CWE/CWE-835/InfiniteLoopWithUnsatisfiableExitCondition.ql
ql/cpp/ql/src/definitions.ql
ql/cpp/ql/src/experimental/Best Practices/UselessTest.ql
ql/cpp/ql/src/experimental/Best Practices/WrongUintAccess.ql
ql/cpp/ql/src/experimental/Likely Bugs/ArrayAccessProductFlow.ql
ql/cpp/ql/src/experimental/Likely Bugs/DerefNullResult.ql
ql/cpp/ql/src/experimental/Likely Bugs/RedundantNullCheckParam.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-020/LateCheckOfFunctionArgument.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-020/NoCheckBeforeUnsafePutUser.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-078/WordexpTainted.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-1041/FindWrapperFunctions.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-1126/DeclarationOfVariableWithUnnecessarilyWideScope.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-120/MemoryUnsafeFunctionScan.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-1240/CustomCryptographicPrimitive.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-125/DangerousWorksWithMultibyteOrWideCharacters.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-190/AllocMultiplicationOverflow.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-190/DangerousUseOfTransformationAfterOperation.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-190/IfStatementAdditionOverflow.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-200/ExposureSensitiveInformationUnauthorizedActor.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-243/IncorrectChangingWorkingDirectory.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-266/IncorrectPrivilegeAssignment.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-273/PrivilegeDroppingOutoforder.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-285/PamAuthorization.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-295/CurlSSL.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-359/PrivateCleartextWrite.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-362/double-fetch.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-369/DivideByZeroUsingReturnValue.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-377/InsecureTemporaryFile.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-401/MemoryLeakOnFailedCallToRealloc.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-409/DecompressionBombs.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-415/DoubleFree.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-416/UseAfterExpiredLifetime.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-476/DangerousUseOfExceptionBlocks.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-561/FindIncorrectlyUsedSwitch.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-670/DangerousUseSSL_shutdown.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-675/DoubleRelease.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-691/InsufficientControlFlowManagementAfterRefactoringTheCode.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-691/InsufficientControlFlowManagementWhenUsingBitOperations.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-703/FindIncorrectlyUsedExceptions.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-754/ImproperCheckReturnValueScanf.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-758/UndefinedOrImplementationDefinedBehavior.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-783/OperatorPrecedenceLogicErrorWhenUseBitwiseOrLogicalOperations.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-783/OperatorPrecedenceLogicErrorWhenUseBoolType.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-787/UnsignedToSignedPointerArith.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-788/AccessOfMemoryLocationAfterEndOfBufferUsingStrlen.ql
ql/cpp/ql/src/experimental/Security/CWE/CWE-805/BufferAccessWithIncorrectLengthValue.ql
ql/cpp/ql/src/experimental/cryptography/example_alerts/UnknownAsymmetricKeyGen.ql
ql/cpp/ql/src/experimental/cryptography/example_alerts/WeakAsymmetricKeyGen.ql
ql/cpp/ql/src/experimental/cryptography/example_alerts/WeakBlockMode.ql
ql/cpp/ql/src/experimental/cryptography/example_alerts/WeakEllipticCurve.ql
ql/cpp/ql/src/experimental/cryptography/example_alerts/WeakEncryption.ql
ql/cpp/ql/src/experimental/cryptography/example_alerts/WeakHashes.ql
ql/cpp/ql/src/experimental/cryptography/inventory/new_models/AllAsymmetricAlgorithms.ql
ql/cpp/ql/src/experimental/cryptography/inventory/new_models/AllCryptoAlgorithms.ql
ql/cpp/ql/src/experimental/cryptography/inventory/new_models/AsymmetricEncryptionAlgorithms.ql
ql/cpp/ql/src/experimental/cryptography/inventory/new_models/AsymmetricPaddingAlgorithms.ql
ql/cpp/ql/src/experimental/cryptography/inventory/new_models/AuthenticatedEncryptionAlgorithms.ql
ql/cpp/ql/src/experimental/cryptography/inventory/new_models/BlockModeAlgorithms.ql
ql/cpp/ql/src/experimental/cryptography/inventory/new_models/BlockModeKnownIVsOrNonces.ql
ql/cpp/ql/src/experimental/cryptography/inventory/new_models/BlockModeUnknownIVsOrNonces.ql
ql/cpp/ql/src/experimental/cryptography/inventory/new_models/EllipticCurveAlgorithmSize.ql
ql/cpp/ql/src/experimental/cryptography/inventory/new_models/EllipticCurveAlgorithms.ql
ql/cpp/ql/src/experimental/cryptography/inventory/new_models/HashingAlgorithms.ql
ql/cpp/ql/src/experimental/cryptography/inventory/new_models/KeyExchangeAlgorithms.ql
ql/cpp/ql/src/experimental/cryptography/inventory/new_models/KnownAsymmetricKeyGeneration.ql
ql/cpp/ql/src/experimental/cryptography/inventory/new_models/SigningAlgorithms.ql
ql/cpp/ql/src/experimental/cryptography/inventory/new_models/SymmetricEncryptionAlgorithms.ql
ql/cpp/ql/src/experimental/cryptography/inventory/new_models/SymmetricPaddingAlgorithms.ql
ql/cpp/ql/src/experimental/cryptography/inventory/new_models/UnknownAsymmetricKeyGeneration.ql
ql/cpp/ql/src/experimental/quantum/PrintCBOMGraph.ql
ql/cpp/ql/src/external/examples/filters/BumpMetricBy10.ql
ql/cpp/ql/src/external/examples/filters/EditDefectMessage.ql
ql/cpp/ql/src/external/examples/filters/ExcludeGeneratedCode.ql
ql/cpp/ql/src/filters/ClassifyFiles.ql
ql/cpp/ql/src/jsf/3.02 Code Size and Complexity/AV Rule 1.ql
ql/cpp/ql/src/jsf/3.02 Code Size and Complexity/AV Rule 2.ql
ql/cpp/ql/src/jsf/3.02 Code Size and Complexity/AV Rule 3.ql
ql/cpp/ql/src/jsf/4.04 Environment/AV Rule 11.ql
ql/cpp/ql/src/jsf/4.04 Environment/AV Rule 12.ql
ql/cpp/ql/src/jsf/4.04 Environment/AV Rule 13.ql
ql/cpp/ql/src/jsf/4.04 Environment/AV Rule 14.ql
ql/cpp/ql/src/jsf/4.04 Environment/AV Rule 9.ql
ql/cpp/ql/src/jsf/4.05 Libraries/AV Rule 17.ql
ql/cpp/ql/src/jsf/4.05 Libraries/AV Rule 18.ql
ql/cpp/ql/src/jsf/4.05 Libraries/AV Rule 19.ql
ql/cpp/ql/src/jsf/4.05 Libraries/AV Rule 20.ql
ql/cpp/ql/src/jsf/4.05 Libraries/AV Rule 21.ql
ql/cpp/ql/src/jsf/4.05 Libraries/AV Rule 22.ql
ql/cpp/ql/src/jsf/4.05 Libraries/AV Rule 23.ql
ql/cpp/ql/src/jsf/4.05 Libraries/AV Rule 24.ql
ql/cpp/ql/src/jsf/4.05 Libraries/AV Rule 25.ql
ql/cpp/ql/src/jsf/4.06 Pre-Processing Directives/AV Rule 26.ql
ql/cpp/ql/src/jsf/4.06 Pre-Processing Directives/AV Rule 27.ql
ql/cpp/ql/src/jsf/4.06 Pre-Processing Directives/AV Rule 28.ql
ql/cpp/ql/src/jsf/4.06 Pre-Processing Directives/AV Rule 29.ql
ql/cpp/ql/src/jsf/4.06 Pre-Processing Directives/AV Rule 30.ql
ql/cpp/ql/src/jsf/4.06 Pre-Processing Directives/AV Rule 31.ql
ql/cpp/ql/src/jsf/4.07 Header Files/AV Rule 33.ql
ql/cpp/ql/src/jsf/4.07 Header Files/AV Rule 39.ql
ql/cpp/ql/src/jsf/4.08 Implementation Files/AV Rule 40.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 41.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 42.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 43.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 44.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 45.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 46.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 47.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 48.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 49.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 50.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 51.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 52.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 53.1.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 53.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 54.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 57.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 58.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 59.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 60.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 61.ql
ql/cpp/ql/src/jsf/4.09 Style/AV Rule 63.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 68.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 69.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 70.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 71.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 73.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 74.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 75.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 76.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 77.1.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 78.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 81.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 85.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 88.1.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 94.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 96.ql
ql/cpp/ql/src/jsf/4.10 Classes/AV Rule 97.1.ql
ql/cpp/ql/src/jsf/4.11 Namespaces/AV Rule 99.ql
ql/cpp/ql/src/jsf/4.12 Templates/AV Rule 104.ql
ql/cpp/ql/src/jsf/4.13 Functions/AV Rule 108.ql
ql/cpp/ql/src/jsf/4.13 Functions/AV Rule 110.ql
ql/cpp/ql/src/jsf/4.13 Functions/AV Rule 111.ql
ql/cpp/ql/src/jsf/4.13 Functions/AV Rule 113.ql
ql/cpp/ql/src/jsf/4.13 Functions/AV Rule 115.ql
ql/cpp/ql/src/jsf/4.13 Functions/AV Rule 119.ql
ql/cpp/ql/src/jsf/4.14 Comments/AV Rule 126.ql
ql/cpp/ql/src/jsf/4.14 Comments/AV Rule 127.ql
ql/cpp/ql/src/jsf/4.14 Comments/AV Rule 133.ql
ql/cpp/ql/src/jsf/4.15 Declarations and Definitions/AV Rule 135.ql
ql/cpp/ql/src/jsf/4.15 Declarations and Definitions/AV Rule 138.ql
ql/cpp/ql/src/jsf/4.15 Declarations and Definitions/AV Rule 139.ql
ql/cpp/ql/src/jsf/4.15 Declarations and Definitions/AV Rule 140.ql
ql/cpp/ql/src/jsf/4.16 Initialization/AV Rule 142.ql
ql/cpp/ql/src/jsf/4.16 Initialization/AV Rule 143.ql
ql/cpp/ql/src/jsf/4.17 Types/AV Rule 147.ql
ql/cpp/ql/src/jsf/4.18 Constants/AV Rule 149.ql
ql/cpp/ql/src/jsf/4.18 Constants/AV Rule 150.ql
ql/cpp/ql/src/jsf/4.18 Constants/AV Rule 151.1.ql
ql/cpp/ql/src/jsf/4.18 Constants/AV Rule 151.ql
ql/cpp/ql/src/jsf/4.19 Variables/AV Rule 152.ql
ql/cpp/ql/src/jsf/4.20 Unions and Bit Fields/AV Rule 153.ql
ql/cpp/ql/src/jsf/4.20 Unions and Bit Fields/AV Rule 154.ql
ql/cpp/ql/src/jsf/4.20 Unions and Bit Fields/AV Rule 155.ql
ql/cpp/ql/src/jsf/4.20 Unions and Bit Fields/AV Rule 156.ql
ql/cpp/ql/src/jsf/4.21 Operators/AV Rule 157.ql
ql/cpp/ql/src/jsf/4.21 Operators/AV Rule 158.ql
ql/cpp/ql/src/jsf/4.21 Operators/AV Rule 159.ql
ql/cpp/ql/src/jsf/4.21 Operators/AV Rule 160.ql
ql/cpp/ql/src/jsf/4.21 Operators/AV Rule 162.ql
ql/cpp/ql/src/jsf/4.21 Operators/AV Rule 163.ql
ql/cpp/ql/src/jsf/4.21 Operators/AV Rule 164.ql
ql/cpp/ql/src/jsf/4.21 Operators/AV Rule 165.ql
ql/cpp/ql/src/jsf/4.21 Operators/AV Rule 168.ql
ql/cpp/ql/src/jsf/4.22 Pointers and References/AV Rule 170.ql
ql/cpp/ql/src/jsf/4.22 Pointers and References/AV Rule 171.ql
ql/cpp/ql/src/jsf/4.22 Pointers and References/AV Rule 173.ql
ql/cpp/ql/src/jsf/4.22 Pointers and References/AV Rule 175.ql
ql/cpp/ql/src/jsf/4.22 Pointers and References/AV Rule 176.ql
ql/cpp/ql/src/jsf/4.23 Type Conversions/AV Rule 178.ql
ql/cpp/ql/src/jsf/4.23 Type Conversions/AV Rule 179.ql
ql/cpp/ql/src/jsf/4.23 Type Conversions/AV Rule 180.ql
ql/cpp/ql/src/jsf/4.23 Type Conversions/AV Rule 181.ql
ql/cpp/ql/src/jsf/4.23 Type Conversions/AV Rule 182.ql
ql/cpp/ql/src/jsf/4.23 Type Conversions/AV Rule 184.ql
ql/cpp/ql/src/jsf/4.23 Type Conversions/AV Rule 185.ql
ql/cpp/ql/src/jsf/4.24 Control Flow Structures/AV Rule 186.ql
ql/cpp/ql/src/jsf/4.24 Control Flow Structures/AV Rule 187.ql
ql/cpp/ql/src/jsf/4.24 Control Flow Structures/AV Rule 188.ql
ql/cpp/ql/src/jsf/4.24 Control Flow Structures/AV Rule 189.ql
ql/cpp/ql/src/jsf/4.24 Control Flow Structures/AV Rule 190.ql
ql/cpp/ql/src/jsf/4.24 Control Flow Structures/AV Rule 191.ql
ql/cpp/ql/src/jsf/4.24 Control Flow Structures/AV Rule 192.ql
ql/cpp/ql/src/jsf/4.24 Control Flow Structures/AV Rule 193.ql
ql/cpp/ql/src/jsf/4.24 Control Flow Structures/AV Rule 194.ql
ql/cpp/ql/src/jsf/4.24 Control Flow Structures/AV Rule 195.ql
ql/cpp/ql/src/jsf/4.24 Control Flow Structures/AV Rule 198.ql
ql/cpp/ql/src/jsf/4.24 Control Flow Structures/AV Rule 199.ql
ql/cpp/ql/src/jsf/4.24 Control Flow Structures/AV Rule 200.ql
ql/cpp/ql/src/jsf/4.25 Expressions/AV Rule 202.ql
ql/cpp/ql/src/jsf/4.25 Expressions/AV Rule 204.1.ql
ql/cpp/ql/src/jsf/4.25 Expressions/AV Rule 204.ql
ql/cpp/ql/src/jsf/4.25 Expressions/AV Rule 205.ql
ql/cpp/ql/src/jsf/4.26 Memory Allocation/AV Rule 206.ql
ql/cpp/ql/src/jsf/4.26 Memory Allocation/AV Rule 207.ql
ql/cpp/ql/src/jsf/4.27 Fault Handling/AV Rule 208.ql
ql/cpp/ql/src/jsf/4.28 Portable Code/AV Rule 209.ql
ql/cpp/ql/src/jsf/4.28 Portable Code/AV Rule 210.ql
ql/cpp/ql/src/jsf/4.28 Portable Code/AV Rule 212.ql
ql/cpp/ql/src/jsf/4.28 Portable Code/AV Rule 213.ql
ql/cpp/ql/src/jsf/4.28 Portable Code/AV Rule 214.ql
ql/cpp/ql/src/jsf/4.28 Portable Code/AV Rule 215.ql
ql/cpp/ql/src/utils/modelgenerator/CaptureContentSummaryModels.ql
ql/cpp/ql/src/utils/modelgenerator/CaptureNeutralModels.ql
ql/cpp/ql/src/utils/modelgenerator/CaptureSinkModels.ql
ql/cpp/ql/src/utils/modelgenerator/CaptureSourceModels.ql
ql/cpp/ql/src/utils/modelgenerator/CaptureSummaryModels.ql

View File

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

View File

@@ -1,3 +1,18 @@
## 4.3.1
### Bug Fixes
* Fixed an infinite loop in `semmle.code.cpp.rangeanalysis.new.RangeAnalysis` when computing ranges in very large and complex function bodies.
## 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

@@ -0,0 +1,5 @@
## 4.3.1
### Bug Fixes
* Fixed an infinite loop in `semmle.code.cpp.rangeanalysis.new.RangeAnalysis` when computing ranges in very large and complex function bodies.

View File

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

View File

@@ -0,0 +1,113 @@
private import cpp as Language
import semmle.code.cpp.dataflow.new.DataFlow
import codeql.quantum.experimental.Model
module CryptoInput implements InputSig<Language::Location> {
class DataFlowNode = DataFlow::Node;
class LocatableElement = Language::Locatable;
class UnknownLocation = Language::UnknownDefaultLocation;
LocatableElement dfn_to_element(DataFlow::Node node) {
result = node.asExpr() or
result = node.asParameter() or
result = node.asVariable()
}
string locationToFileBaseNameAndLineNumberString(Location location) {
result = location.getFile().getBaseName() + ":" + location.getStartLine()
}
predicate artifactOutputFlowsToGenericInput(
DataFlow::Node artifactOutput, DataFlow::Node otherInput
) {
ArtifactFlow::flow(artifactOutput, otherInput)
}
}
module Crypto = CryptographyBase<Language::Location, CryptoInput>;
module ArtifactFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
source = any(Crypto::ArtifactInstance artifact).getOutputNode()
}
predicate isSink(DataFlow::Node sink) {
sink = any(Crypto::FlowAwareElement other).getInputNode()
}
predicate isBarrierOut(DataFlow::Node node) {
node = any(Crypto::FlowAwareElement element).getInputNode()
}
predicate isBarrierIn(DataFlow::Node node) {
node = any(Crypto::FlowAwareElement element).getOutputNode()
}
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
node1.(AdditionalFlowInputStep).getOutput() = node2
}
}
module ArtifactFlow = DataFlow::Global<ArtifactFlowConfig>;
/**
* Artifact output to node input configuration
*/
abstract class AdditionalFlowInputStep extends DataFlow::Node {
abstract DataFlow::Node getOutput();
final DataFlow::Node getInput() { result = this }
}
/**
* Generic data source to node input configuration
*/
module GenericDataSourceFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
source = any(Crypto::GenericSourceInstance i).getOutputNode()
}
predicate isSink(DataFlow::Node sink) {
sink = any(Crypto::FlowAwareElement other).getInputNode()
}
predicate isBarrierOut(DataFlow::Node node) {
node = any(Crypto::FlowAwareElement element).getInputNode()
}
predicate isBarrierIn(DataFlow::Node node) {
node = any(Crypto::FlowAwareElement element).getOutputNode()
}
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
node1.(AdditionalFlowInputStep).getOutput() = node2
}
}
module ArtifactUniversalFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
source = any(Crypto::ArtifactInstance artifact).getOutputNode()
}
predicate isSink(DataFlow::Node sink) {
sink = any(Crypto::FlowAwareElement other).getInputNode()
}
predicate isBarrierOut(DataFlow::Node node) {
node = any(Crypto::FlowAwareElement element).getInputNode()
}
predicate isBarrierIn(DataFlow::Node node) {
node = any(Crypto::FlowAwareElement element).getOutputNode()
}
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
node1.(AdditionalFlowInputStep).getOutput() = node2
}
}
module ArtifactUniversalFlow = DataFlow::Global<ArtifactUniversalFlowConfig>;
import OpenSSL.OpenSSL

View File

@@ -0,0 +1,170 @@
import cpp
import semmle.code.cpp.dataflow.new.DataFlow
import experimental.quantum.OpenSSL.AlgorithmInstances.KnownAlgorithmConstants
import experimental.quantum.OpenSSL.AlgorithmValueConsumers.OpenSSLAlgorithmValueConsumers
/**
* Traces 'known algorithms' to AVCs, specifically
* algorithms that are in the set of known algorithm constants.
* Padding-specific consumers exist that have their own values that
* overlap with the known algorithm constants.
* Padding consumers (specific padding consumers) are excluded from the set of sinks.
*/
module KnownOpenSSLAlgorithmToAlgorithmValueConsumerConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
source.asExpr() instanceof KnownOpenSSLAlgorithmConstant
}
predicate isSink(DataFlow::Node sink) {
exists(OpenSSLAlgorithmValueConsumer c |
c.getInputNode() = sink and
not c instanceof PaddingAlgorithmValueConsumer
)
}
predicate isBarrier(DataFlow::Node node) {
// False positive reducer, don't flow out through argv
exists(VariableAccess va, Variable v |
v.getAnAccess() = va and va = node.asExpr()
or
va = node.asIndirectExpr()
|
v.getName().matches("%argv")
)
}
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
knownPassThroughStep(node1, node2)
}
}
module KnownOpenSSLAlgorithmToAlgorithmValueConsumerFlow =
DataFlow::Global<KnownOpenSSLAlgorithmToAlgorithmValueConsumerConfig>;
module RSAPaddingAlgorithmToPaddingAlgorithmValueConsumerConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
source.asExpr() instanceof KnownOpenSSLAlgorithmConstant
}
predicate isSink(DataFlow::Node sink) {
exists(PaddingAlgorithmValueConsumer c | c.getInputNode() = sink)
}
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
knownPassThroughStep(node1, node2)
}
}
module RSAPaddingAlgorithmToPaddingAlgorithmValueConsumerFlow =
DataFlow::Global<RSAPaddingAlgorithmToPaddingAlgorithmValueConsumerConfig>;
class OpenSSLAlgorithmAdditionalFlowStep extends AdditionalFlowInputStep {
OpenSSLAlgorithmAdditionalFlowStep() { exists(AlgorithmPassthroughCall c | c.getInNode() = this) }
override DataFlow::Node getOutput() {
exists(AlgorithmPassthroughCall c | c.getInNode() = this and c.getOutNode() = result)
}
}
abstract class AlgorithmPassthroughCall extends Call {
abstract DataFlow::Node getInNode();
abstract DataFlow::Node getOutNode();
}
class CopyAndDupAlgorithmPassthroughCall extends AlgorithmPassthroughCall {
DataFlow::Node inNode;
DataFlow::Node outNode;
CopyAndDupAlgorithmPassthroughCall() {
// Flow out through any return or other argument of the same type
// Assume flow in and out is asIndirectExpr or asDefinitingArgument since a pointer is assumed
// to be involved
// NOTE: not attempting to detect openssl specific copy/dup functions, but anything suspected to be copy/dup
this.getTarget().getName().toLowerCase().matches(["%_dup%", "%_copy%"]) and
exists(Expr inArg, Type t |
inArg = this.getAnArgument() and t = inArg.getUnspecifiedType().stripType()
|
inNode.asIndirectExpr() = inArg and
(
// Case 1: flow through another argument as an out arg of the same type
exists(Expr outArg |
outArg = this.getAnArgument() and
outArg != inArg and
outArg.getUnspecifiedType().stripType() = t
|
outNode.asDefiningArgument() = outArg
)
or
// Case 2: flow through the return value if the result is the same as the intput type
exists(Expr outArg | outArg = this and outArg.getUnspecifiedType().stripType() = t |
outNode.asIndirectExpr() = outArg
)
)
)
}
override DataFlow::Node getInNode() { result = inNode }
override DataFlow::Node getOutNode() { result = outNode }
}
class NIDToPointerPassthroughCall extends AlgorithmPassthroughCall {
DataFlow::Node inNode;
DataFlow::Node outNode;
NIDToPointerPassthroughCall() {
this.getTarget().getName() in ["OBJ_nid2obj", "OBJ_nid2ln", "OBJ_nid2sn"] and
inNode.asExpr() = this.getArgument(0) and
outNode.asExpr() = this
//outNode.asIndirectExpr() = this
}
override DataFlow::Node getInNode() { result = inNode }
override DataFlow::Node getOutNode() { result = outNode }
}
class PointerToPointerPassthroughCall extends AlgorithmPassthroughCall {
DataFlow::Node inNode;
DataFlow::Node outNode;
PointerToPointerPassthroughCall() {
this.getTarget().getName() = "OBJ_txt2obj" and
inNode.asIndirectExpr() = this.getArgument(0) and
outNode.asIndirectExpr() = this
or
//outNode.asExpr() = this
this.getTarget().getName() in ["OBJ_obj2txt", "i2t_ASN1_OBJECT"] and
inNode.asIndirectExpr() = this.getArgument(2) and
outNode.asDefiningArgument() = this.getArgument(0)
}
override DataFlow::Node getInNode() { result = inNode }
override DataFlow::Node getOutNode() { result = outNode }
}
class PointerToNIDPassthroughCall extends AlgorithmPassthroughCall {
DataFlow::Node inNode;
DataFlow::Node outNode;
PointerToNIDPassthroughCall() {
this.getTarget().getName() in ["OBJ_obj2nid", "OBJ_ln2nid", "OBJ_sn2nid", "OBJ_txt2nid"] and
(
inNode.asIndirectExpr() = this.getArgument(0)
or
inNode.asExpr() = this.getArgument(0)
) and
outNode.asExpr() = this
}
override DataFlow::Node getInNode() { result = inNode }
override DataFlow::Node getOutNode() { result = outNode }
}
// TODO: pkeys pass through EVP_PKEY_CTX_new and any similar variant
predicate knownPassThroughStep(DataFlow::Node node1, DataFlow::Node node2) {
exists(AlgorithmPassthroughCall c | c.getInNode() = node1 and c.getOutNode() = node2)
}

View File

@@ -0,0 +1,76 @@
import cpp
import experimental.quantum.Language
import OpenSSLAlgorithmInstanceBase
import experimental.quantum.OpenSSL.AlgorithmInstances.KnownAlgorithmConstants
import experimental.quantum.OpenSSL.AlgorithmValueConsumers.DirectAlgorithmValueConsumer
import AlgToAVCFlow
/**
* Given a `KnownOpenSSLBlockModeAlgorithmConstant`, converts this to a block family type.
* Does not bind if there is know mapping (no mapping to 'unknown' or 'other').
*/
predicate knownOpenSSLConstantToBlockModeFamilyType(
KnownOpenSSLBlockModeAlgorithmConstant e, Crypto::TBlockCipherModeOfOperationType type
) {
exists(string name |
name = e.getNormalizedName() and
(
name.matches("CBC") and type instanceof Crypto::CBC
or
name.matches("CFB%") and type instanceof Crypto::CFB
or
name.matches("CTR") and type instanceof Crypto::CTR
or
name.matches("GCM") and type instanceof Crypto::GCM
or
name.matches("OFB") and type instanceof Crypto::OFB
or
name.matches("XTS") and type instanceof Crypto::XTS
or
name.matches("CCM") and type instanceof Crypto::CCM
or
name.matches("GCM") and type instanceof Crypto::GCM
or
name.matches("CCM") and type instanceof Crypto::CCM
or
name.matches("ECB") and type instanceof Crypto::ECB
)
)
}
class KnownOpenSSLBlockModeConstantAlgorithmInstance extends OpenSSLAlgorithmInstance,
Crypto::ModeOfOperationAlgorithmInstance instanceof KnownOpenSSLBlockModeAlgorithmConstant
{
OpenSSLAlgorithmValueConsumer getterCall;
KnownOpenSSLBlockModeConstantAlgorithmInstance() {
// Two possibilities:
// 1) The source is a literal and flows to a getter, then we know we have an instance
// 2) The source is a KnownOpenSSLAlgorithm is call, and we know we have an instance immediately from that
// Possibility 1:
this instanceof Literal and
exists(DataFlow::Node src, DataFlow::Node sink |
// Sink is an argument to a CipherGetterCall
sink = getterCall.(OpenSSLAlgorithmValueConsumer).getInputNode() and
// Source is `this`
src.asExpr() = this and
// This traces to a getter
KnownOpenSSLAlgorithmToAlgorithmValueConsumerFlow::flow(src, sink)
)
or
// Possibility 2:
this instanceof DirectAlgorithmValueConsumer and getterCall = this
}
override Crypto::TBlockCipherModeOfOperationType getModeType() {
knownOpenSSLConstantToBlockModeFamilyType(this, result)
or
not knownOpenSSLConstantToBlockModeFamilyType(this, _) and result = Crypto::OtherMode()
}
// NOTE: I'm not going to attempt to parse out the mode specific part, so returning
// the same as the raw name for now.
override string getRawModeAlgorithmName() { result = this.(Literal).getValue().toString() }
override OpenSSLAlgorithmValueConsumer getAVC() { result = getterCall }
}

View File

@@ -0,0 +1,126 @@
import cpp
import experimental.quantum.Language
import KnownAlgorithmConstants
import Crypto::KeyOpAlg as KeyOpAlg
import OpenSSLAlgorithmInstanceBase
import PaddingAlgorithmInstance
import experimental.quantum.OpenSSL.AlgorithmValueConsumers.OpenSSLAlgorithmValueConsumers
import AlgToAVCFlow
import BlockAlgorithmInstance
/**
* Given a `KnownOpenSSLCipherAlgorithmConstant`, converts this to a cipher family type.
* Does not bind if there is know mapping (no mapping to 'unknown' or 'other').
*/
predicate knownOpenSSLConstantToCipherFamilyType(
KnownOpenSSLCipherAlgorithmConstant e, Crypto::KeyOpAlg::TAlgorithm type
) {
exists(string name |
name = e.getNormalizedName() and
(
name.matches("AES%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::AES())
or
name.matches("ARIA%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::ARIA())
or
name.matches("BLOWFISH%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::BLOWFISH())
or
name.matches("BF%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::BLOWFISH())
or
name.matches("CAMELLIA%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::CAMELLIA())
or
name.matches("CHACHA20%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::CHACHA20())
or
name.matches("CAST5%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::CAST5())
or
name.matches("2DES%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::DoubleDES())
or
name.matches("3DES%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::TripleDES())
or
name.matches("DES%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::DES())
or
name.matches("DESX%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::DESX())
or
name.matches("GOST%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::GOST())
or
name.matches("IDEA%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::IDEA())
or
name.matches("KUZNYECHIK%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::KUZNYECHIK())
or
name.matches("MAGMA%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::MAGMA())
or
name.matches("RC2%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::RC2())
or
name.matches("RC4%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::RC4())
or
name.matches("RC5%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::RC5())
or
name.matches("RSA%") and type = KeyOpAlg::TAsymmetricCipher(KeyOpAlg::RSA())
or
name.matches("SEED%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::SEED())
or
name.matches("SM4%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::SM4())
)
)
}
class KnownOpenSSLCipherConstantAlgorithmInstance extends OpenSSLAlgorithmInstance,
Crypto::KeyOperationAlgorithmInstance instanceof KnownOpenSSLCipherAlgorithmConstant
{
OpenSSLAlgorithmValueConsumer getterCall;
KnownOpenSSLCipherConstantAlgorithmInstance() {
// Two possibilities:
// 1) The source is a literal and flows to a getter, then we know we have an instance
// 2) The source is a KnownOpenSSLAlgorithm is call, and we know we have an instance immediately from that
// Possibility 1:
this instanceof Literal and
exists(DataFlow::Node src, DataFlow::Node sink |
// Sink is an argument to a CipherGetterCall
sink = getterCall.(OpenSSLAlgorithmValueConsumer).getInputNode() and
// Source is `this`
src.asExpr() = this and
// This traces to a getter
KnownOpenSSLAlgorithmToAlgorithmValueConsumerFlow::flow(src, sink)
)
or
// Possibility 2:
this instanceof DirectAlgorithmValueConsumer and getterCall = this
}
override Crypto::ModeOfOperationAlgorithmInstance getModeOfOperationAlgorithm() {
// if there is a block mode associated with the same element, then that's the block mode
// note, if none are associated, we may need to parse if the cipher is a block cipher
// to determine if this is an unknown vs not relevant.
result = this
}
override Crypto::PaddingAlgorithmInstance getPaddingAlgorithm() {
//TODO: the padding is either self, or it flows through getter ctx to a set padding call
// like EVP_PKEY_CTX_set_rsa_padding
result = this
// TODO or trace through getter ctx to set padding
}
override string getRawAlgorithmName() { result = this.(Literal).getValue().toString() }
override string getKeySizeFixed() {
exists(int keySize |
this.(KnownOpenSSLCipherAlgorithmConstant).getExplicitKeySize() = keySize and
result = keySize.toString()
)
}
override Crypto::KeyOpAlg::Algorithm getAlgorithmType() {
knownOpenSSLConstantToCipherFamilyType(this, result)
or
not knownOpenSSLConstantToCipherFamilyType(this, _) and
result = Crypto::KeyOpAlg::TUnknownKeyOperationAlgorithmType()
}
override OpenSSLAlgorithmValueConsumer getAVC() { result = getterCall }
override Crypto::ConsumerInputDataFlowNode getKeySizeConsumer() {
// TODO: trace to any key size initializer, symmetric and asymmetric
none()
}
}

View File

@@ -0,0 +1,83 @@
import cpp
import experimental.quantum.Language
import KnownAlgorithmConstants
import experimental.quantum.OpenSSL.AlgorithmValueConsumers.OpenSSLAlgorithmValueConsumers
import AlgToAVCFlow
predicate knownOpenSSLConstantToHashFamilyType(
KnownOpenSSLHashAlgorithmConstant e, Crypto::THashType type
) {
exists(string name |
name = e.getNormalizedName() and
(
name.matches("BLAKE2B") and type instanceof Crypto::BLAKE2B
or
name.matches("BLAKE2S") and type instanceof Crypto::BLAKE2S
or
name.matches("GOST%") and type instanceof Crypto::GOSTHash
or
name.matches("MD2") and type instanceof Crypto::MD2
or
name.matches("MD4") and type instanceof Crypto::MD4
or
name.matches("MD5") and type instanceof Crypto::MD5
or
name.matches("MDC2") and type instanceof Crypto::MDC2
or
name.matches("POLY1305") and type instanceof Crypto::POLY1305
or
name.matches(["SHA", "SHA1"]) and type instanceof Crypto::SHA1
or
name.matches("SHA+%") and not name.matches(["SHA1", "SHA3-"]) and type instanceof Crypto::SHA2
or
name.matches("SHA3-%") and type instanceof Crypto::SHA3
or
name.matches(["SHAKE"]) and type instanceof Crypto::SHAKE
or
name.matches("SM3") and type instanceof Crypto::SM3
or
name.matches("RIPEMD160") and type instanceof Crypto::RIPEMD160
or
name.matches("WHIRLPOOL") and type instanceof Crypto::WHIRLPOOL
)
)
}
class KnownOpenSSLHashConstantAlgorithmInstance extends OpenSSLAlgorithmInstance,
Crypto::HashAlgorithmInstance instanceof KnownOpenSSLHashAlgorithmConstant
{
OpenSSLAlgorithmValueConsumer getterCall;
KnownOpenSSLHashConstantAlgorithmInstance() {
// Two possibilities:
// 1) The source is a literal and flows to a getter, then we know we have an instance
// 2) The source is a KnownOpenSSLAlgorithm is call, and we know we have an instance immediately from that
// Possibility 1:
this instanceof Literal and
exists(DataFlow::Node src, DataFlow::Node sink |
// Sink is an argument to a CipherGetterCall
sink = getterCall.(OpenSSLAlgorithmValueConsumer).getInputNode() and
// Source is `this`
src.asExpr() = this and
// This traces to a getter
KnownOpenSSLAlgorithmToAlgorithmValueConsumerFlow::flow(src, sink)
)
or
// Possibility 2:
this instanceof DirectAlgorithmValueConsumer and getterCall = this
}
override OpenSSLAlgorithmValueConsumer getAVC() { result = getterCall }
override Crypto::THashType getHashFamily() {
knownOpenSSLConstantToHashFamilyType(this, result)
or
not knownOpenSSLConstantToHashFamilyType(this, _) and result = Crypto::OtherHashType()
}
override string getRawHashAlgorithmName() { result = this.(Literal).getValue().toString() }
override int getFixedDigestLength() {
this.(KnownOpenSSLHashAlgorithmConstant).getExplicitDigestLength() = result
}
}

View File

@@ -0,0 +1,6 @@
import experimental.quantum.Language
import experimental.quantum.OpenSSL.AlgorithmValueConsumers.OpenSSLAlgorithmValueConsumerBase
abstract class OpenSSLAlgorithmInstance extends Crypto::AlgorithmInstance {
abstract OpenSSLAlgorithmValueConsumer getAVC();
}

View File

@@ -0,0 +1,5 @@
import OpenSSLAlgorithmInstanceBase
import CipherAlgorithmInstance
import PaddingAlgorithmInstance
import BlockAlgorithmInstance
import HashAlgorithmInstance

View File

@@ -0,0 +1,167 @@
import cpp
import experimental.quantum.Language
import OpenSSLAlgorithmInstanceBase
import experimental.quantum.OpenSSL.AlgorithmInstances.KnownAlgorithmConstants
import AlgToAVCFlow
import experimental.quantum.OpenSSL.AlgorithmValueConsumers.DirectAlgorithmValueConsumer
/**
* Given a `KnownOpenSSLPaddingAlgorithmConstant`, converts this to a padding family type.
* Does not bind if there is know mapping (no mapping to 'unknown' or 'other').
*/
predicate knownOpenSSLConstantToPaddingFamilyType(
KnownOpenSSLPaddingAlgorithmConstant e, Crypto::TPaddingType type
) {
exists(string name |
name = e.getNormalizedName() and
(
name.matches("OAEP") and type = Crypto::OAEP()
or
name.matches("PSS") and type = Crypto::PSS()
or
name.matches("PKCS7") and type = Crypto::PKCS7()
or
name.matches("PKCS1V15") and type = Crypto::PKCS1_v1_5()
)
)
}
//abstract class OpenSSLPaddingAlgorithmInstance extends OpenSSLAlgorithmInstance, Crypto::PaddingAlgorithmInstance{}
// TODO: need to alter this to include known padding constants which don't have the
// same mechanics as those with known nids
class KnownOpenSSLPaddingConstantAlgorithmInstance extends OpenSSLAlgorithmInstance,
Crypto::PaddingAlgorithmInstance instanceof Expr
{
OpenSSLAlgorithmValueConsumer getterCall;
boolean isPaddingSpecificConsumer;
KnownOpenSSLPaddingConstantAlgorithmInstance() {
// three possibilities:
// 1) The source is a 'typical' literal and flows to a getter, then we know we have an instance
// 2) The source is a KnownOpenSSLAlgorithm is call, and we know we have an instance immediately from that
// 3) the source is a padding-specific literal flowing to a padding-specific consumer
// Possibility 1:
this instanceof Literal and
this instanceof KnownOpenSSLPaddingAlgorithmConstant and
exists(DataFlow::Node src, DataFlow::Node sink |
// Sink is an argument to a CipherGetterCall
sink = getterCall.(OpenSSLAlgorithmValueConsumer).getInputNode() and
// Source is `this`
src.asExpr() = this and
// This traces to a getter
KnownOpenSSLAlgorithmToAlgorithmValueConsumerFlow::flow(src, sink) and
isPaddingSpecificConsumer = false
)
or
// Possibility 2:
this instanceof DirectAlgorithmValueConsumer and
getterCall = this and
this instanceof KnownOpenSSLPaddingAlgorithmConstant and
isPaddingSpecificConsumer = false
or
// Possibility 3:
// from rsa.h in openssl:
// # define RSA_PKCS1_PADDING 1
// # define RSA_NO_PADDING 3
// # define RSA_PKCS1_OAEP_PADDING 4
// # define RSA_X931_PADDING 5
// /* EVP_PKEY_ only */
// # define RSA_PKCS1_PSS_PADDING 6
// # define RSA_PKCS1_WITH_TLS_PADDING 7
// /* internal RSA_ only */
// # define RSA_PKCS1_NO_IMPLICIT_REJECT_PADDING 8
this instanceof Literal and
this.getValue().toInt() in [0, 1, 3, 4, 5, 6, 7, 8] and
exists(DataFlow::Node src, DataFlow::Node sink |
// Sink is an argument to a CipherGetterCall
sink = getterCall.(OpenSSLAlgorithmValueConsumer).getInputNode() and
// Source is `this`
src.asExpr() = this and
// This traces to a padding-specific consumer
RSAPaddingAlgorithmToPaddingAlgorithmValueConsumerFlow::flow(src, sink)
) and
isPaddingSpecificConsumer = true
}
override string getRawPaddingAlgorithmName() { result = this.(Literal).getValue().toString() }
override OpenSSLAlgorithmValueConsumer getAVC() { result = getterCall }
override Crypto::TPaddingType getPaddingType() {
isPaddingSpecificConsumer = true and
(
if this.(Literal).getValue().toInt() in [1, 7, 8]
then result = Crypto::PKCS1_v1_5()
else
if this.(Literal).getValue().toInt() = 3
then result = Crypto::NoPadding()
else
if this.(Literal).getValue().toInt() = 4
then result = Crypto::OAEP()
else
if this.(Literal).getValue().toInt() = 5
then result = Crypto::ANSI_X9_23()
else
if this.(Literal).getValue().toInt() = 6
then result = Crypto::PSS()
else result = Crypto::OtherPadding()
)
or
isPaddingSpecificConsumer = false and
knownOpenSSLConstantToPaddingFamilyType(this, result)
}
}
// // Values used for EVP_PKEY_CTX_set_rsa_padding, these are
// // not the same as 'typical' constants found in the set of known algorithm constants
// // they do not have an NID
// // TODO: what about setting the padding directly?
// class KnownRSAPaddingConstant extends OpenSSLPaddingAlgorithmInstance, Crypto::PaddingAlgorithmInstance instanceof Literal
// {
// KnownRSAPaddingConstant() {
// // from rsa.h in openssl:
// // # define RSA_PKCS1_PADDING 1
// // # define RSA_NO_PADDING 3
// // # define RSA_PKCS1_OAEP_PADDING 4
// // # define RSA_X931_PADDING 5
// // /* EVP_PKEY_ only */
// // # define RSA_PKCS1_PSS_PADDING 6
// // # define RSA_PKCS1_WITH_TLS_PADDING 7
// // /* internal RSA_ only */
// // # define RSA_PKCS1_NO_IMPLICIT_REJECT_PADDING 8
// this instanceof Literal and
// this.getValue().toInt() in [0, 1, 3, 4, 5, 6, 7, 8]
// // TODO: trace to padding-specific consumers
// RSAPaddingAlgorithmToPaddingAlgorithmValueConsumerFlow
// }
// override string getRawPaddingAlgorithmName() { result = this.(Literal).getValue().toString() }
// override Crypto::TPaddingType getPaddingType() {
// if this.(Literal).getValue().toInt() in [1, 6, 7, 8]
// then result = Crypto::PKCS1_v1_5()
// else
// if this.(Literal).getValue().toInt() = 3
// then result = Crypto::NoPadding()
// else
// if this.(Literal).getValue().toInt() = 4
// then result = Crypto::OAEP()
// else
// if this.(Literal).getValue().toInt() = 5
// then result = Crypto::ANSI_X9_23()
// else result = Crypto::OtherPadding()
// }
// }
class OAEPPaddingAlgorithmInstance extends Crypto::OAEPPaddingAlgorithmInstance,
KnownOpenSSLPaddingConstantAlgorithmInstance
{
OAEPPaddingAlgorithmInstance() {
this.(Crypto::PaddingAlgorithmInstance).getPaddingType() = Crypto::OAEP()
}
override Crypto::HashAlgorithmInstance getOAEPEncodingHashAlgorithm() {
none() //TODO
}
override Crypto::HashAlgorithmInstance getMGF1HashAlgorithm() {
none() //TODO
}
}

View File

@@ -0,0 +1,39 @@
import cpp
import experimental.quantum.Language
import experimental.quantum.OpenSSL.LibraryDetector
import experimental.quantum.OpenSSL.AlgorithmInstances.KnownAlgorithmConstants
import experimental.quantum.OpenSSL.AlgorithmInstances.OpenSSLAlgorithmInstanceBase
import OpenSSLAlgorithmValueConsumerBase
abstract class CipherAlgorithmValueConsumer extends OpenSSLAlgorithmValueConsumer { }
// https://www.openssl.org/docs/manmaster/man3/EVP_CIPHER_fetch.html
class EVPCipherAlgorithmValueConsumer extends CipherAlgorithmValueConsumer {
DataFlow::Node valueArgNode;
DataFlow::Node resultNode;
EVPCipherAlgorithmValueConsumer() {
resultNode.asExpr() = this and
isPossibleOpenSSLFunction(this.(Call).getTarget()) and
(
this.(Call).getTarget().getName() in [
"EVP_get_cipherbyname", "EVP_get_cipherbyobj", "EVP_get_cipherbynid"
] and
valueArgNode.asExpr() = this.(Call).getArgument(0)
or
this.(Call).getTarget().getName() in ["EVP_CIPHER_fetch", "EVP_ASYM_CIPHER_fetch"] and
valueArgNode.asExpr() = this.(Call).getArgument(1)
)
}
override DataFlow::Node getResultNode() { result = resultNode }
override Crypto::ConsumerInputDataFlowNode getInputNode() { result = valueArgNode }
// override DataFlow::Node getInputNode() { result = valueArgNode }
override Crypto::AlgorithmInstance getAKnownAlgorithmSource() {
exists(OpenSSLAlgorithmInstance i | i.getAVC() = this and result = i)
//TODO: As a potential alternative, for OpenSSL only, add a generic source node for literals and only create flow (flowsTo) to
// OpenSSL AVCs... the unknown literal sources would have to be any literals not in the known set.
}
}

View File

@@ -0,0 +1,36 @@
import cpp
import experimental.quantum.Language
import experimental.quantum.OpenSSL.AlgorithmInstances.KnownAlgorithmConstants
import experimental.quantum.OpenSSL.AlgorithmValueConsumers.OpenSSLAlgorithmValueConsumerBase
// TODO: can self referential to itself, which is also an algorithm (Known algorithm)
/**
* Cases like EVP_MD5(),
* there is no input, rather it directly gets an algorithm
* and returns it.
*/
class DirectAlgorithmValueConsumer extends OpenSSLAlgorithmValueConsumer {
DataFlow::Node resultNode;
Expr resultExpr;
DirectAlgorithmValueConsumer() {
this instanceof KnownOpenSSLAlgorithmConstant and
this instanceof Call and
resultExpr = this and
resultNode.asExpr() = resultExpr
}
/**
* These cases take in no explicit value (the value is implicit)
*/
override Crypto::ConsumerInputDataFlowNode getInputNode() { none() }
override DataFlow::Node getResultNode() { result = resultNode }
// override DataFlow::Node getOutputNode() { result = resultNode }
override Crypto::AlgorithmInstance getAKnownAlgorithmSource() {
// Note: algorithm source definitions enforces that
// this class will be a known algorithm source
result = this
}
}

View File

@@ -0,0 +1,35 @@
// import EVPHashInitializer
// import EVPHashOperation
// import EVPHashAlgorithmSource
import cpp
import experimental.quantum.Language
import semmle.code.cpp.dataflow.new.DataFlow
import experimental.quantum.OpenSSL.AlgorithmValueConsumers.OpenSSLAlgorithmValueConsumerBase
import experimental.quantum.OpenSSL.AlgorithmInstances.OpenSSLAlgorithmInstances
import experimental.quantum.OpenSSL.LibraryDetector
abstract class HashAlgorithmValueConsumer extends OpenSSLAlgorithmValueConsumer { }
/**
* EVP_Q_Digest directly consumes algorithm constant values
*/
class EVP_Q_Digest_Algorithm_Consumer extends OpenSSLAlgorithmValueConsumer {
EVP_Q_Digest_Algorithm_Consumer() {
isPossibleOpenSSLFunction(this.(Call).getTarget()) and
this.(Call).getTarget().getName() = "EVP_Q_digest"
}
override Crypto::ConsumerInputDataFlowNode getInputNode() {
result.asExpr() = this.(Call).getArgument(1)
}
override Crypto::AlgorithmInstance getAKnownAlgorithmSource() {
exists(OpenSSLAlgorithmInstance i | i.getAVC() = this and result = i)
}
override DataFlow::Node getResultNode() {
// EVP_Q_Digest directly consumes the algorithm constant value and performs the operation, there is no
// algorithm result
none()
}
}

View File

@@ -0,0 +1,9 @@
import experimental.quantum.Language
import semmle.code.cpp.dataflow.new.DataFlow
abstract class OpenSSLAlgorithmValueConsumer extends Crypto::AlgorithmValueConsumer instanceof Call {
/**
* Returns the node representing the resulting algorithm
*/
abstract DataFlow::Node getResultNode();
}

View File

@@ -0,0 +1,5 @@
import OpenSSLAlgorithmValueConsumerBase
import CipherAlgorithmValueConsumer
import DirectAlgorithmValueConsumer
import PaddingAlgorithmValueConsumer
import HashAlgorithmValueConsumer

View File

@@ -0,0 +1,36 @@
import cpp
import experimental.quantum.Language
import experimental.quantum.OpenSSL.LibraryDetector
import experimental.quantum.OpenSSL.AlgorithmInstances.KnownAlgorithmConstants
import experimental.quantum.OpenSSL.AlgorithmInstances.OpenSSLAlgorithmInstanceBase
import OpenSSLAlgorithmValueConsumerBase
abstract class PaddingAlgorithmValueConsumer extends OpenSSLAlgorithmValueConsumer { }
// https://docs.openssl.org/master/man7/EVP_ASYM_CIPHER-RSA/#rsa-asymmetric-cipher-parameters
// TODO: need to handle setting padding through EVP_PKEY_CTX_set_params, where modes like "OSSL_PKEY_RSA_PAD_MODE_OAEP"
// are set.
class EVP_PKEY_CTX_set_rsa_padding_AlgorithmValueConsumer extends PaddingAlgorithmValueConsumer {
DataFlow::Node valueArgNode;
DataFlow::Node resultNode;
EVP_PKEY_CTX_set_rsa_padding_AlgorithmValueConsumer() {
resultNode.asExpr() = this and
isPossibleOpenSSLFunction(this.(Call).getTarget()) and
(
this.(Call).getTarget().getName() in ["EVP_PKEY_CTX_set_rsa_padding"] and
valueArgNode.asExpr() = this.(Call).getArgument(1)
)
}
override DataFlow::Node getResultNode() { result = resultNode }
override Crypto::ConsumerInputDataFlowNode getInputNode() { result = valueArgNode }
// override DataFlow::Node getInputNode() { result = valueArgNode }
override Crypto::AlgorithmInstance getAKnownAlgorithmSource() {
exists(OpenSSLAlgorithmInstance i | i.getAVC() = this and result = i)
//TODO: As a potential alternative, for OpenSSL only, add a generic source node for literals and only create flow (flowsTo) to
// OpenSSL AVCs... the unknown literal sources would have to be any literals not in the known set.
}
}

View File

@@ -0,0 +1,99 @@
//TODO: model as data on open APIs should be able to get common flows, and obviate some of this
// e.g., copy/dup calls, need to ingest those models for openSSL and refactor.
/**
* In OpenSSL, flow between 'context' parameters is often used to
* store state/config of how an operation will eventually be performed.
* Tracing algorithms and configurations to operations therefore
* requires tracing context parameters for many OpenSSL apis.
*
* This library provides a dataflow analysis to track context parameters
* between any two functions accepting openssl context parameters.
* The dataflow takes into consideration flowing through duplication and copy calls
* as well as flow through flow killers (free/reset calls).
*
* TODO: we may need to revisit 'free' as a dataflow killer, depending on how
* we want to model use after frees.
*
* This library also provides classes to represent context Types and relevant
* arguments/expressions.
*/
import semmle.code.cpp.dataflow.new.DataFlow
class CTXType extends Type {
CTXType() {
// TODO: should we limit this to an openssl path?
this.getUnspecifiedType().stripType().getName().matches("evp_%ctx_%st")
}
}
class CTXPointerExpr extends Expr {
CTXPointerExpr() {
this.getType() instanceof CTXType and
this.getType() instanceof PointerType
}
}
class CTXPointerArgument extends CTXPointerExpr {
CTXPointerArgument() { exists(Call c | c.getAnArgument() = this) }
Call getCall() { result.getAnArgument() = this }
}
class CTXClearCall extends Call {
CTXClearCall() {
this.getTarget().getName().toLowerCase().matches(["%free%", "%reset%"]) and
this.getAnArgument() instanceof CTXPointerArgument
}
}
class CTXCopyOutArgCall extends Call {
CTXCopyOutArgCall() {
this.getTarget().getName().toLowerCase().matches(["%copy%"]) and
this.getAnArgument() instanceof CTXPointerArgument
}
}
class CTXCopyReturnCall extends Call {
CTXCopyReturnCall() {
this.getTarget().getName().toLowerCase().matches(["%dup%"]) and
this.getAnArgument() instanceof CTXPointerArgument and
this instanceof CTXPointerExpr
}
}
module OpenSSLCTXArgumentFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source.asExpr() instanceof CTXPointerArgument }
predicate isSink(DataFlow::Node sink) { sink.asExpr() instanceof CTXPointerArgument }
predicate isBarrier(DataFlow::Node node) {
exists(CTXClearCall c | c.getAnArgument() = node.asExpr())
}
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
exists(CTXCopyOutArgCall c |
c.getAnArgument() = node1.asExpr() and
c.getAnArgument() = node2.asExpr() and
node1.asExpr() != node2.asExpr() and
node2.asExpr().getType() instanceof CTXType
)
or
exists(CTXCopyReturnCall c |
c.getAnArgument() = node1.asExpr() and
c = node2.asExpr() and
node1.asExpr() != node2.asExpr() and
node2.asExpr().getType() instanceof CTXType
)
}
}
module OpenSSLCTXArgumentFlow = DataFlow::Global<OpenSSLCTXArgumentFlowConfig>;
predicate ctxArgFlowsToCtxArg(CTXPointerArgument source, CTXPointerArgument sink) {
exists(DataFlow::Node a, DataFlow::Node b |
OpenSSLCTXArgumentFlow::flow(a, b) and
a.asExpr() = source and
b.asExpr() = sink
)
}

View File

@@ -0,0 +1,7 @@
import cpp
predicate isPossibleOpenSSLFunction(Function f) {
isPossibleOpenSSLLocation(f.getADeclarationLocation())
}
predicate isPossibleOpenSSLLocation(Location l) { l.toString().toLowerCase().matches("%openssl%") }

View File

@@ -0,0 +1,9 @@
import cpp
import semmle.code.cpp.dataflow.new.DataFlow
module OpenSSLModel {
import experimental.quantum.Language
import experimental.quantum.OpenSSL.AlgorithmInstances.OpenSSLAlgorithmInstances
import experimental.quantum.OpenSSL.AlgorithmValueConsumers.OpenSSLAlgorithmValueConsumers
import experimental.quantum.OpenSSL.Operations.OpenSSLOperations
}

View File

@@ -0,0 +1,123 @@
/**
* see: https://docs.openssl.org/master/man3/EVP_EncryptInit/
* Models cipher initialization for EVP cipher operations.
*/
import experimental.quantum.Language
import experimental.quantum.OpenSSL.CtxFlow as CTXFlow
module EncValToInitEncArgConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source.asExpr().getValue().toInt() in [0, 1] }
predicate isSink(DataFlow::Node sink) {
exists(EVP_Cipher_Initializer initCall | sink.asExpr() = initCall.getOperationSubtypeArg())
}
}
module EncValToInitEncArgFlow = DataFlow::Global<EncValToInitEncArgConfig>;
int getEncConfigValue(Expr e) {
exists(EVP_Cipher_Initializer initCall | e = initCall.getOperationSubtypeArg()) and
exists(DataFlow::Node a, DataFlow::Node b |
EncValToInitEncArgFlow::flow(a, b) and b.asExpr() = e and result = a.asExpr().getValue().toInt()
)
}
bindingset[i]
Crypto::KeyOperationSubtype intToCipherOperationSubtype(int i) {
if i = 0
then result instanceof Crypto::TEncryptMode
else
if i = 1
then result instanceof Crypto::TDecryptMode
else result instanceof Crypto::TUnknownKeyOperationMode
}
// TODO: need to add key consumer
abstract class EVP_Cipher_Initializer extends Call {
Expr getContextArg() { result = this.(Call).getArgument(0) }
Expr getAlgorithmArg() { result = this.(Call).getArgument(1) }
abstract Expr getKeyArg();
abstract Expr getIVArg();
// abstract Crypto::CipherOperationSubtype getCipherOperationSubtype();
abstract Expr getOperationSubtypeArg();
Crypto::KeyOperationSubtype getCipherOperationSubtype() {
if this.(Call).getTarget().getName().toLowerCase().matches("%encrypt%")
then result instanceof Crypto::TEncryptMode
else
if this.(Call).getTarget().getName().toLowerCase().matches("%decrypt%")
then result instanceof Crypto::TDecryptMode
else
if exists(getEncConfigValue(this.getOperationSubtypeArg()))
then result = intToCipherOperationSubtype(getEncConfigValue(this.getOperationSubtypeArg()))
else result instanceof Crypto::TUnknownKeyOperationMode
}
}
abstract class EVP_EX_Initializer extends EVP_Cipher_Initializer {
override Expr getKeyArg() { result = this.(Call).getArgument(3) }
override Expr getIVArg() { result = this.(Call).getArgument(4) }
}
abstract class EVP_EX2_Initializer extends EVP_Cipher_Initializer {
override Expr getKeyArg() { result = this.(Call).getArgument(2) }
override Expr getIVArg() { result = this.(Call).getArgument(3) }
}
class EVP_Cipher_EX_Init_Call extends EVP_EX_Initializer {
EVP_Cipher_EX_Init_Call() {
this.(Call).getTarget().getName() in [
"EVP_EncryptInit_ex", "EVP_DecryptInit_ex", "EVP_CipherInit_ex"
]
}
override Expr getOperationSubtypeArg() {
this.(Call).getTarget().getName().toLowerCase().matches("%cipherinit%") and
result = this.(Call).getArgument(5)
}
}
class EVP_Cipher_EX2_or_Simple_Init_Call extends EVP_EX2_Initializer {
EVP_Cipher_EX2_or_Simple_Init_Call() {
this.(Call).getTarget().getName() in [
"EVP_EncryptInit_ex2", "EVP_DecryptInit_ex2", "EVP_CipherInit_ex2", "EVP_EncryptInit",
"EVP_DecryptInit", "EVP_CipherInit"
]
}
override Expr getOperationSubtypeArg() {
this.(Call).getTarget().getName().toLowerCase().matches("%cipherinit%") and
result = this.(Call).getArgument(4)
}
}
class EVP_CipherInit_SKEY_Call extends EVP_EX2_Initializer {
EVP_CipherInit_SKEY_Call() { this.(Call).getTarget().getName() in ["EVP_CipherInit_SKEY"] }
override Expr getOperationSubtypeArg() { result = this.(Call).getArgument(5) }
}
class EVPCipherInitializerAlgorithmArgument extends Expr {
EVPCipherInitializerAlgorithmArgument() {
exists(EVP_Cipher_Initializer initCall | this = initCall.getAlgorithmArg())
}
}
class EVPCipherInitializerKeyArgument extends Expr {
EVPCipherInitializerKeyArgument() {
exists(EVP_Cipher_Initializer initCall | this = initCall.getKeyArg())
}
}
class EVPCipherInitializerIVArgument extends Expr {
EVPCipherInitializerIVArgument() {
exists(EVP_Cipher_Initializer initCall | this = initCall.getIVArg())
}
}

View File

@@ -0,0 +1,116 @@
import experimental.quantum.Language
import experimental.quantum.OpenSSL.CtxFlow as CTXFlow
import EVPCipherInitializer
import OpenSSLOperationBase
import experimental.quantum.OpenSSL.AlgorithmValueConsumers.OpenSSLAlgorithmValueConsumers
private module AlgGetterToAlgConsumerConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
exists(OpenSSLAlgorithmValueConsumer c | c.getResultNode() = source)
}
predicate isSink(DataFlow::Node sink) {
exists(EVP_Cipher_Operation c | c.getInitCall().getAlgorithmArg() = sink.asExpr())
}
}
private module AlgGetterToAlgConsumerFlow = DataFlow::Global<AlgGetterToAlgConsumerConfig>;
// import experimental.quantum.OpenSSL.AlgorithmValueConsumers.AlgorithmValueConsumers
// import OpenSSLOperation
// class EVPCipherOutput extends CipherOutputArtifact {
// EVPCipherOutput() { exists(EVP_Cipher_Operation op | op.getOutputArg() = this) }
// override DataFlow::Node getOutputNode() { result.asDefiningArgument() = this }
// }
//
/**
* see: https://docs.openssl.org/master/man3/EVP_EncryptInit/#synopsis
* Base configuration for all EVP cipher operations.
* NOTE: cannot extend instance of OpenSSLOperation, as we need to override
* elements of OpenSSLOperation (i.e., we are creating an instance)
*/
abstract class EVP_Cipher_Operation extends OpenSSLOperation, Crypto::KeyOperationInstance {
Expr getContextArg() { result = this.(Call).getArgument(0) }
override Expr getOutputArg() { result = this.(Call).getArgument(1) }
override Crypto::KeyOperationSubtype getKeyOperationSubtype() {
result instanceof Crypto::TEncryptMode and
this.(Call).getTarget().getName().toLowerCase().matches("%encrypt%")
or
result instanceof Crypto::TDecryptMode and
this.(Call).getTarget().getName().toLowerCase().matches("%decrypt%")
or
result = this.getInitCall().getCipherOperationSubtype() and
this.(Call).getTarget().getName().toLowerCase().matches("%cipher%")
}
EVP_Cipher_Initializer getInitCall() {
CTXFlow::ctxArgFlowsToCtxArg(result.getContextArg(), this.getContextArg())
}
override Crypto::ConsumerInputDataFlowNode getNonceConsumer() {
this.getInitCall().getIVArg() = result.asExpr()
}
override Crypto::ConsumerInputDataFlowNode getInputConsumer() { result = this.getInputNode() }
override Crypto::ConsumerInputDataFlowNode getKeyConsumer() {
this.getInitCall().getKeyArg() = result.asExpr()
}
override Crypto::ArtifactOutputDataFlowNode getOutputArtifact() { result = this.getOutputNode() }
override Crypto::AlgorithmValueConsumer getAnAlgorithmValueConsumer() {
AlgGetterToAlgConsumerFlow::flow(result.(OpenSSLAlgorithmValueConsumer).getResultNode(),
DataFlow::exprNode(this.getInitCall().getAlgorithmArg()))
}
}
// abstract class EVP_Update_Call extends EVP_Cipher_Operation { }
abstract class EVP_Final_Call extends EVP_Cipher_Operation {
override Expr getInputArg() { none() }
}
// TODO: only model Final (model final as operation and model update but not as an operation)
// Updates are multiple input consumers (most important)
// TODO: assuming update doesn't ouput, otherwise it outputs artifacts, but is not an operation
class EVP_Cipher_Call extends EVP_Cipher_Operation {
EVP_Cipher_Call() { this.(Call).getTarget().getName() = "EVP_Cipher" }
override Expr getInputArg() { result = this.(Call).getArgument(2) }
}
// ******* TODO: model UPDATE but not as the core operation, rather a step towards final
// see the JCA
// class EVP_Encrypt_Decrypt_or_Cipher_Update_Call extends EVP_Update_Call {
// EVP_Encrypt_Decrypt_or_Cipher_Update_Call() {
// this.(Call).getTarget().getName() in [
// "EVP_EncryptUpdate", "EVP_DecryptUpdate", "EVP_CipherUpdate"
// ]
// }
// override Expr getInputArg() { result = this.(Call).getArgument(3) }
// }
class EVP_Encrypt_Decrypt_or_Cipher_Final_Call extends EVP_Final_Call {
EVP_Encrypt_Decrypt_or_Cipher_Final_Call() {
this.(Call).getTarget().getName() in [
"EVP_EncryptFinal_ex", "EVP_DecryptFinal_ex", "EVP_CipherFinal_ex", "EVP_EncryptFinal",
"EVP_DecryptFinal", "EVP_CipherFinal"
]
}
}
class EVP_PKEY_Operation extends EVP_Cipher_Operation {
EVP_PKEY_Operation() {
this.(Call).getTarget().getName() in ["EVP_PKEY_decrypt", "EVP_PKEY_encrypt"]
}
override Expr getInputArg() { result = this.(Call).getArgument(3) }
// TODO: how PKEY is initialized is different that symmetric cipher
// Consider making an entirely new class for this and specializing
// the get init call
}
class EVPCipherInputArgument extends Expr {
EVPCipherInputArgument() { exists(EVP_Cipher_Operation op | op.getInputArg() = this) }
}

View File

@@ -0,0 +1,17 @@
import cpp
abstract class EVP_Hash_Initializer extends Call {
Expr getContextArg() { result = this.(Call).getArgument(0) }
abstract Expr getAlgorithmArg();
}
class EVP_DigestInit_Variant_Calls extends EVP_Hash_Initializer {
EVP_DigestInit_Variant_Calls() {
this.(Call).getTarget().getName() in [
"EVP_DigestInit", "EVP_DigestInit_ex", "EVP_DigestInit_ex2"
]
}
override Expr getAlgorithmArg() { result = this.(Call).getArgument(1) }
}

View File

@@ -0,0 +1,117 @@
/**
* https://docs.openssl.org/3.0/man3/EVP_DigestInit/#synopsis
*/
import experimental.quantum.Language
import experimental.quantum.OpenSSL.CtxFlow as CTXFlow
import experimental.quantum.OpenSSL.LibraryDetector
import OpenSSLOperationBase
import EVPHashInitializer
import experimental.quantum.OpenSSL.AlgorithmValueConsumers.OpenSSLAlgorithmValueConsumers
// import EVPHashConsumers
abstract class EVP_Hash_Operation extends OpenSSLOperation, Crypto::HashOperationInstance {
Expr getContextArg() { result = this.(Call).getArgument(0) }
EVP_Hash_Initializer getInitCall() {
CTXFlow::ctxArgFlowsToCtxArg(result.getContextArg(), this.getContextArg())
}
}
private module AlgGetterToAlgConsumerConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
exists(OpenSSLAlgorithmValueConsumer c | c.getResultNode() = source)
}
predicate isSink(DataFlow::Node sink) {
exists(EVP_Hash_Operation c | c.getInitCall().getAlgorithmArg() = sink.asExpr())
}
}
private module AlgGetterToAlgConsumerFlow = DataFlow::Global<AlgGetterToAlgConsumerConfig>;
//https://docs.openssl.org/3.0/man3/EVP_DigestInit/#synopsis
class EVP_Q_Digest_Operation extends EVP_Hash_Operation {
EVP_Q_Digest_Operation() {
this.(Call).getTarget().getName() = "EVP_Q_digest" and
isPossibleOpenSSLFunction(this.(Call).getTarget())
}
//override Crypto::AlgorithmConsumer getAlgorithmConsumer() { }
override EVP_Hash_Initializer getInitCall() {
// This variant of digest does not use an init
// and even if it were used, the init would be ignored/undefined
none()
}
override Expr getOutputArg() { result = this.(Call).getArgument(5) }
override Expr getInputArg() { result = this.(Call).getArgument(3) }
override Crypto::ArtifactOutputDataFlowNode getOutputArtifact() { result = this.getOutputNode() }
override Crypto::ConsumerInputDataFlowNode getInputConsumer() { result = this.getInputNode() }
override Crypto::AlgorithmValueConsumer getAnAlgorithmValueConsumer() {
// The operation is a direct algorithm consumer
// NOTE: the operation itself is already modeld as a value consumer, so we can
// simply return 'this', see modeled hash algorithm consuers for EVP_Q_Digest
this = result
}
}
class EVP_Digest_Operation extends EVP_Hash_Operation {
EVP_Digest_Operation() {
this.(Call).getTarget().getName() = "EVP_Digest" and
isPossibleOpenSSLFunction(this.(Call).getTarget())
}
// There is no context argument for this function
override Expr getContextArg() { none() }
override Crypto::AlgorithmValueConsumer getAnAlgorithmValueConsumer() {
AlgGetterToAlgConsumerFlow::flow(result.(OpenSSLAlgorithmValueConsumer).getResultNode(),
DataFlow::exprNode(this.(Call).getArgument(4)))
}
override EVP_Hash_Initializer getInitCall() {
// This variant of digest does not use an init
// and even if it were used, the init would be ignored/undefined
none()
}
override Expr getOutputArg() { result = this.(Call).getArgument(2) }
override Expr getInputArg() { result = this.(Call).getArgument(0) }
override Crypto::ArtifactOutputDataFlowNode getOutputArtifact() { result = this.getOutputNode() }
override Crypto::ConsumerInputDataFlowNode getInputConsumer() { result = this.getInputNode() }
}
// // override Crypto::AlgorithmValueConsumer getAnAlgorithmValueConsumer() {
// // AlgGetterToAlgConsumerFlow::flow(result.(OpenSSLAlgorithmValueConsumer).getResultNode(),
// // DataFlow::exprNode(this.getInitCall().getAlgorithmArg()))
// // }
// // ***** TODO *** complete modelinlg for hash operations, but have consideration for terminal and non-terminal (non intermedaite) steps
// // see the JCA. May need to update the cipher operations similarly
// // ALSO SEE cipher for how we currently model initialization of the algorithm through an init call
// class EVP_DigestUpdate_Operation extends EVP_Hash_Operation {
// EVP_DigestUpdate_Operation() {
// this.(Call).getTarget().getName() = "EVP_DigestUpdate" and
// isPossibleOpenSSLFunction(this.(Call).getTarget())
// }
// override Crypto::AlgorithmConsumer getAlgorithmConsumer() {
// this.getInitCall().getAlgorithmArg() = result
// }
// }
// class EVP_DigestFinal_Variants_Operation extends EVP_Hash_Operation {
// EVP_DigestFinal_Variants_Operation() {
// this.(Call).getTarget().getName() in [
// "EVP_DigestFinal", "EVP_DigestFinal_ex", "EVP_DigestFinalXOF"
// ] and
// isPossibleOpenSSLFunction(this.(Call).getTarget())
// }
// override Crypto::AlgorithmConsumer getAlgorithmConsumer() {
// this.getInitCall().getAlgorithmArg() = result
// }
// }

View File

@@ -0,0 +1,21 @@
import experimental.quantum.Language
abstract class OpenSSLOperation extends Crypto::OperationInstance instanceof Call {
abstract Expr getInputArg();
/**
* Can be an argument of a call or a return value of a function.
*/
abstract Expr getOutputArg();
DataFlow::Node getInputNode() {
// Assumed to be default to asExpr
result.asExpr() = this.getInputArg()
}
DataFlow::Node getOutputNode() {
if exists(Call c | c.getAnArgument() = this)
then result.asDefiningArgument() = this
else result.asExpr() = this
}
}

View File

@@ -0,0 +1,3 @@
import OpenSSLOperationBase
import EVPCipherOperation
import EVPHashOperation

View File

@@ -0,0 +1,18 @@
import cpp
private import experimental.quantum.Language
private import LibraryDetector
private import semmle.code.cpp.dataflow.new.DataFlow
class OpenSSLRandomNumberGeneratorInstance extends Crypto::RandomNumberGenerationInstance instanceof Call
{
OpenSSLRandomNumberGeneratorInstance() {
this.(Call).getTarget().getName() in ["RAND_bytes", "RAND_pseudo_bytes"] and
isPossibleOpenSSLFunction(this.(Call).getTarget())
}
override Crypto::DataFlowNode getOutputNode() {
result.asDefiningArgument() = this.(Call).getArgument(0)
}
override string getGeneratorName() { result = this.(Call).getTarget().getName() }
}

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.1
groups: cpp
dbscheme: semmlecode.cpp.dbscheme
extractor: cpp
@@ -8,6 +8,7 @@ upgrades: upgrades
dependencies:
codeql/dataflow: ${workspace}
codeql/mad: ${workspace}
codeql/quantum: ${workspace}
codeql/rangeanalysis: ${workspace}
codeql/ssa: ${workspace}
codeql/typeflow: ${workspace}
@@ -16,6 +17,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

@@ -31,4 +31,6 @@ module CppDataFlow implements InputSig<Location> {
predicate viableImplInCallContext = Private::viableImplInCallContext/2;
predicate neverSkipInPathGraph = Private::neverSkipInPathGraph/1;
int defaultFieldFlowBranchLimit() { result = 3 }
}

View File

@@ -1567,7 +1567,7 @@ private int countNumberOfBranchesUsingParameter(SwitchInstruction switch, Parame
|
exists(Ssa::UseImpl use | use.hasIndexInBlock(useblock, _, sv))
or
exists(Ssa::DefImpl def | def.hasIndexInBlock(useblock, _, sv))
exists(Ssa::DefImpl def | def.hasIndexInBlock(sv, useblock, _))
)
)
)
@@ -1652,8 +1652,6 @@ predicate validParameterAliasStep(Node node1, Node node2) {
)
}
private predicate isTopLevel(Cpp::Stmt s) { any(Function f).getBlock().getAStmt() = s }
private Cpp::Stmt getAChainedBranch(Cpp::IfStmt s) {
result = s.getThen()
or
@@ -1684,11 +1682,9 @@ private Instruction getAnInstruction(Node n) {
}
private newtype TDataFlowSecondLevelScope =
TTopLevelIfBranch(Cpp::Stmt s) {
exists(Cpp::IfStmt ifstmt | s = getAChainedBranch(ifstmt) and isTopLevel(ifstmt))
} or
TTopLevelIfBranch(Cpp::Stmt s) { s = getAChainedBranch(_) } or
TTopLevelSwitchCase(Cpp::SwitchCase s) {
exists(Cpp::SwitchStmt switchstmt | s = switchstmt.getASwitchCase() and isTopLevel(switchstmt))
exists(Cpp::SwitchStmt switchstmt | s = switchstmt.getASwitchCase())
}
/**
@@ -1818,7 +1814,7 @@ module IteratorFlow {
*/
private predicate isIteratorWrite(Instruction write, Operand address) {
exists(Ssa::DefImpl writeDef, IRBlock bb, int i |
writeDef.hasIndexInBlock(bb, i, _) and
writeDef.hasIndexInBlock(_, bb, i) and
bb.getInstruction(i) = write and
address = writeDef.getAddressOperand()
)

View File

@@ -191,7 +191,7 @@ abstract class DefImpl extends TDefImpl {
* Holds if this definition (or use) has index `index` in block `block`,
* and is a definition (or use) of the variable `sv`
*/
final predicate hasIndexInBlock(IRBlock block, int index, SourceVariable sv) {
final predicate hasIndexInBlock(SourceVariable sv, IRBlock block, int index) {
this.hasIndexInBlock(block, index) and
sv = this.getSourceVariable()
}
@@ -891,12 +891,12 @@ private module SsaInput implements SsaImplCommon::InputSig<Location> {
predicate variableWrite(BasicBlock bb, int i, SourceVariable v, boolean certain) {
DataFlowImplCommon::forceCachingInSameStage() and
(
exists(DefImpl def | def.hasIndexInBlock(bb, i, v) |
exists(DefImpl def | def.hasIndexInBlock(v, bb, i) |
if def.isCertain() then certain = true else certain = false
)
or
exists(GlobalDefImpl global |
global.hasIndexInBlock(bb, i, v) and
global.hasIndexInBlock(v, bb, i) and
certain = true
)
)
@@ -934,10 +934,11 @@ module SsaCached {
}
/** Gets the `DefImpl` corresponding to `def`. */
pragma[nomagic]
private DefImpl getDefImpl(SsaImpl::Definition def) {
exists(SourceVariable sv, IRBlock bb, int i |
def.definesAt(sv, bb, i) and
result.hasIndexInBlock(bb, i, sv)
result.hasIndexInBlock(sv, bb, i)
)
}

View File

@@ -58,4 +58,12 @@ class IRFunction extends IRFunctionBase {
* Gets all blocks in this function.
*/
final IRBlock getABlock() { result.getEnclosingIRFunction() = this }
/**
* Holds if this function may have incomplete def-use information.
*
* Def-use information may be omitted for a function when it is too expensive
* to compute.
*/
final predicate hasIncompleteSsa() { Construction::hasIncompleteSsa(this) }
}

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