Compare commits

..

3657 Commits

Author SHA1 Message Date
Ian Lynagh
6260f95d5a XXX Experiment 2023-02-10 16:51:55 +00:00
Ian Lynagh
844e372651 Kotlin: Add a changenote for 1.8.20 support 2023-02-08 11:35:23 +00:00
Ian Lynagh
069c9674d1 Kotlin: Update supported versions 2023-02-08 11:35:23 +00:00
Ian Lynagh
6255298876 Kotlin: Use 1.8.10 for CI
I don't think there's any need for the CI version to be one of the
versions we build extractors for, so I've removed that check.
2023-02-08 11:35:23 +00:00
Chris Smowton
99bed0b089 Merge pull request #12127 from smowton/smowton/perf/golang-less-string-construction
Go: Consolidate repeated calls to `matches` and `regexpMatch`
2023-02-08 11:07:39 +00:00
Michael B. Gale
3abf321071 Merge pull request #11496 from github/mbg/add/writable-file-closed-error-query
Go: Add query to detect lack of error handling for `os.File.Close` on writable handles
2023-02-08 10:53:44 +00:00
Mathias Vorreiter Pedersen
7f09684577 Merge pull request #12121 from github/alexdenisov/extract-availability-info
Swift: extract availability info
2023-02-08 09:54:42 +00:00
Henry Mercer
6e9484970f Merge pull request #12128 from github/codeql-ci/atm/release-0.4.7
JS: Bump version numbers of ML-powered packs after 0.4.7 release
2023-02-07 22:29:20 +00:00
Henry Mercer
e972cb069e Merge branch 'main' into codeql-ci/atm/release-0.4.7 2023-02-07 21:31:08 +00:00
github-actions[bot]
4f76ebbb0b JS: Bump version of ML-powered library and query packs to 0.4.8 2023-02-07 19:44:25 +00:00
github-actions[bot]
30b2644f17 JS: Bump patch version of ML-powered library and query packs 2023-02-07 19:34:58 +00:00
Chris Smowton
99d3f689dc Consolidate repeated calls to matches and regexpMatch
This is especially useful if it avoids temporary string construction, such as toLowerCase().matches(...)
2023-02-07 19:22:49 +00:00
Mathias Vorreiter Pedersen
334c41c3e1 Merge pull request #12122 from github/post-release-prep/codeql-cli-2.12.2
Post-release preparation for codeql-cli-2.12.2
2023-02-07 16:17:57 +00:00
Mathias Vorreiter Pedersen
1980e25ac9 Merge pull request #12120 from MathiasVP/even-fewer-strings
C++: Avoid unnecessary calls to `toLowerCase()`
2023-02-07 13:57:12 +00:00
Alex Denisov
3448cde048 Swift: add database migration 2023-02-07 14:31:19 +01:00
Alex Denisov
712c25e6f4 Swift: extract availability info 2023-02-07 14:26:39 +01:00
github-actions[bot]
522a892d32 Post-release preparation for codeql-cli-2.12.2 2023-02-07 13:19:06 +00:00
Mathias Vorreiter Pedersen
746f04bafc C++: Construct fewer strings. 2023-02-07 11:44:32 +00:00
Tom Hvitved
984729f9b0 Merge pull request #12117 from hvitved/ruby/delay-location-to-string
Ruby: Avoid computing `Location::toString` in full
2023-02-07 12:42:03 +01:00
Mathias Vorreiter Pedersen
ff29356ae9 Merge pull request #12106 from MathiasVP/fewer-strings
C++: Replace `toUpperCase().matches("...")` with case-insensitive `regexpMatch`
2023-02-07 11:31:36 +00:00
Paolo Tranquilli
c9397a5abf Merge pull request #10950 from github/redsun82/swift-regex
Swift: extract `RegexLiteralExpr`
2023-02-07 11:30:43 +01:00
Geoffrey White
d8616e77d5 Merge pull request #12108 from geoffw0/strings3
Swift: Remove a no-longer-needed special case from swift/unsafe-js-eval.
2023-02-07 09:44:41 +00:00
Mathias Vorreiter Pedersen
aef66c462a Merge pull request #12107 from aibaars/downgrade-tree-sitter
Ruby: downgrade tree-sitter to 0.20.7
2023-02-07 09:29:42 +00:00
Paolo Tranquilli
a3b443c310 Swift: add upgrade/downgrade scripts for regex extraction 2023-02-07 10:21:37 +01:00
Paolo Tranquilli
ad04a408c7 Swift: add doc to RegexLiteralExpression 2023-02-07 10:21:37 +01:00
Paolo Tranquilli
50889b8fa1 Swift: move regex test to integration tests 2023-02-07 10:21:37 +01:00
Tom Hvitved
c0e3186607 Ruby: Avoid computing Location::toString in full 2023-02-07 10:06:47 +01:00
Paolo Tranquilli
d201c1eadd Swift: support linux-only tests 2023-02-07 09:41:06 +01:00
Paolo Tranquilli
a244b825df Merge branch 'main' into redsun82/swift-regex 2023-02-07 09:37:09 +01:00
Anders Schack-Mulligen
3c580896dc Merge pull request #11712 from aschackmull/java/constant-guards
Java: Apply deadcode guard to data flow nodes.
2023-02-07 09:14:20 +01:00
Jeroen Ketema
a4c3ea2efc Merge pull request #9245 from ihsinme/ihsinme-patch-102
CPP: Add query for CWE-805: Buffer Access with Incorrect Length Value using some functions
2023-02-06 21:24:07 +01:00
Jeroen Ketema
1c35109675 C++: Add experimental tag to experimental query 2023-02-06 20:31:26 +01:00
Jeroen Ketema
868f07bc91 Merge branch 'main' into ihsinme-patch-102 2023-02-06 20:16:53 +01:00
Geoffrey White
996536b08e Swift: Remove a no-longer-needed special case from swift/unsafe-js-eval. 2023-02-06 17:35:21 +00:00
Mathias Vorreiter Pedersen
4016299aa8 Update cpp/ql/lib/semmle/code/cpp/security/Encryption.qll
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2023-02-06 15:55:15 +00:00
Arthur Baars
12f5732782 Ruby: downgrade tree-sitter to 0.20.7
The 0.20.9 version caused a stack overflow error on
the mongo-ruby-driver repository.
2023-02-06 16:27:51 +01:00
Erik Krogh Kristensen
4eebeab8a8 Merge pull request #12078 from erik-krogh/qlCache
QL: simplify the QL-for-QL workflow, which should also fix the cache
2023-02-06 16:21:45 +01:00
Mathias Vorreiter Pedersen
1c9a526afa C++: Construct fewer strings. 2023-02-06 15:18:15 +00:00
erik-krogh
9364a85e49 add Rust format check to QL-for-QL tests 2023-02-06 14:26:30 +01:00
Erik Krogh Kristensen
9360ae9638 Merge pull request #12076 from erik-krogh/poly-sink-track
PY: add tracking of strings to compile-sites for poly-redos
2023-02-06 14:21:04 +01:00
Anders Schack-Mulligen
b4607d3fab Java: Add change notes. 2023-02-06 13:55:34 +01:00
Geoffrey White
dc59ed08f9 Merge pull request #12094 from geoffw0/string2
Swift: Models for the String class
2023-02-06 11:24:19 +00:00
Chris Smowton
cd2fc6566f Merge pull request #12101 from owen-mc/go/gofmt-remove-confusing-error-message
Fix files that gofmt can't parse
2023-02-06 10:58:54 +00:00
Mathias Vorreiter Pedersen
00fe448e3a Merge pull request #12072 from aschackmull/dataflow/stage3-perf
Dataflow: Fix join in `fwdFlowRead` (take 2)
2023-02-06 10:43:11 +00:00
Erik Krogh Kristensen
f32fa25c1a Merge pull request #12100 from github/dependabot/cargo/ql/serde_json-1.0.92
build(deps): bump serde_json from 1.0.91 to 1.0.92 in /ql
2023-02-06 10:33:32 +01:00
Michael B. Gale
f7a2a8677a Rename change note file 2023-02-06 09:13:11 +00:00
Michael B. Gale
6c0d2bdee1 Add example without defer statement 2023-02-06 09:10:41 +00:00
Michael B. Gale
25f907867b Update expected test output 2023-02-06 08:51:46 +00:00
Michael B. Gale
abe38373da Inline precededBySync 2023-02-06 08:47:47 +00:00
Michael B. Gale
c252ec0414 Add test for deferred close that returns error 2023-02-06 08:47:47 +00:00
Michael B. Gale
e05bce9863 Update expected test results 2023-02-06 08:47:46 +00:00
Michael B. Gale
314ecab90a Use dominatesNode and improve variable naming 2023-02-06 08:47:46 +00:00
Michael B. Gale
85a339030b Make the query a path-problem 2023-02-06 08:47:46 +00:00
Michael B. Gale
199c8641ec Rename close to sink in query 2023-02-06 08:47:46 +00:00
Michael B. Gale
f648b021a9 Despecialise parameter names for precededBySync 2023-02-06 08:47:46 +00:00
Michael B. Gale
bd6c167be6 Fixup: more docs improvements 2023-02-06 08:47:46 +00:00
Michael B. Gale
f866e16679 Use any instead of exists for isCloseSink 2023-02-06 08:47:45 +00:00
Michael B. Gale
5ab6056b26 Fixup: docs comment 2023-02-06 08:47:45 +00:00
Michael B. Gale
3f446bc76e Use three-argument hasQualifiedName 2023-02-06 08:47:45 +00:00
Michael B. Gale
07041bb659 Use Method instead of Function where able 2023-02-06 08:47:45 +00:00
Michael B. Gale
416ed57583 Fix qldoc comments 2023-02-06 08:47:45 +00:00
Michael B. Gale
f321adf9f4 Fix typo
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2023-02-06 08:47:44 +00:00
Michael B. Gale
10109b4925 Fix class comments 2023-02-06 08:47:44 +00:00
Michael B. Gale
49ce91fd5b Update precision to high 2023-02-06 08:47:44 +00:00
Michael B. Gale
7e9617f3ce Detect lack of error handling for os.File.Close 2023-02-06 08:47:43 +00:00
Tamás Vajk
c03fe70b8d Merge pull request #12086 from tamasvajk/feature/fix-exception-handling-archive
C#: Change handled exception in `TrapWriter.ArchiveContents`
2023-02-06 08:53:56 +01:00
Owen Mansel-Chan
9ed7836367 Fix files that gofmt can't parse
We have some .go files that gofmt can't parse because they don't start
with "package". This was intentional, as they are fragments to be
included in .qhelp files. They don't affect the return code as gofmt
doesn't change their formatting, so this wasn't changing the result of
the check. However, it was confusing that when the check failed because
some other files weren't formatted correctly, the user would see the
stderr complaining about those files, so we capture stderr.

It would be an improvement to print which files are not formatted
correctly, but that was beyond my abilities with bash and makefiles.
2023-02-06 07:16:58 +00:00
dependabot[bot]
33e8414fc4 build(deps): bump serde_json from 1.0.91 to 1.0.92 in /ql
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.91 to 1.0.92.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.91...v1.0.92)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-06 03:29:59 +00:00
Chris Smowton
03385ac0b5 Merge pull request #12097 from github/smowton/admin/macos-ventura
Add MacOS Ventura to supported platforms
2023-02-04 17:54:21 +00:00
Philip Ginsbach
8cefde36bf Merge pull request #12088 from github/ginsbach/DocumentFinalAlias
document final type aliases
2023-02-04 12:23:03 +00:00
Chris Smowton
f8b574c654 Add MacOS Ventura to supported platforms
Rebase of e8bf8fe7a4
2023-02-04 08:28:03 +00:00
Mathias Vorreiter Pedersen
7642245747 Merge pull request #12095 from github/post-release-prep/codeql-cli-2.12.2
Post-release preparation for codeql-cli-2.12.2
2023-02-04 01:03:14 +00:00
github-actions[bot]
57f40ccd48 Post-release preparation for codeql-cli-2.12.2 2023-02-03 21:12:22 +00:00
Jami
b6805c6913 Merge pull request #11863 from jcogs33/jcogs33/update-paramsString
Java: update paramsString
2023-02-03 15:47:38 -05:00
Sarita Iyer
8edd378290 Merge pull request #12077 from github/codeql-cli-articles-migration-update
Update CodeQL CLI docs articles and links to point to new location on GitHub Docs site
2023-02-03 15:25:33 -05:00
Geoffrey White
364c173fc3 Swift: Accept additional taint flow in UnsafeJsEval test. 2023-02-03 19:21:10 +00:00
Geoffrey White
1f69fff26c Swift: Fix mistake caught by QL-for-QL. 2023-02-03 19:15:08 +00:00
Geoffrey White
f82a548cf9 Swift: Comments and formatting. 2023-02-03 18:50:51 +00:00
Geoffrey White
c666f9c845 Merge pull request #12089 from geoffw0/filedoc
Swift: QLDoc models files consistently.
2023-02-03 18:45:20 +00:00
Geoffrey White
ec72c7504c Swift: Add a partial model of Collection. 2023-02-03 18:42:42 +00:00
Geoffrey White
e357b44943 Swift: Add a partial model of Sequence. 2023-02-03 18:42:42 +00:00
Geoffrey White
4bb0bbf488 Swift: Remove redundant copies. 2023-02-03 18:42:41 +00:00
Geoffrey White
e230951a14 Swift: Model StringProtocol methods. 2023-02-03 18:42:41 +00:00
Sarita Iyer
75b0676c95 Add tocs with links to deprecated articles 2023-02-03 13:37:53 -05:00
Jonas Jensen
41f7c7ae53 Merge pull request #12092 from jbj/aliases-upper-case 2023-02-03 18:40:53 +01:00
Philip Ginsbach
1ec2c2591b fix documentation generator problem 2023-02-03 16:42:07 +00:00
Owen Mansel-Chan
2f637e2c8e Remove unused variable 2023-02-03 16:36:20 +00:00
Jonas Jensen
73112e401c Change type name to upper case
QL doesn't allow types to be declared in lower case, so the example did
not compile.
2023-02-03 17:30:12 +01:00
Philip Ginsbach
a354e776bf document final type aliases 2023-02-03 15:59:47 +00:00
Philip Ginsbach
a639f13fd9 Merge pull request #12085 from github/ginsbach/DocumentModuleSignatureMemberDefaults
document module signature member defaults
2023-02-03 15:33:00 +00:00
Anders Schack-Mulligen
2d6d8aaa74 Java: Account for additional constants in ArrayIndexOutOfBounds query. 2023-02-03 16:16:39 +01:00
Anders Schack-Mulligen
a1aeb995e6 Java: Apply deadcode guard to data flow nodes. 2023-02-03 16:16:39 +01:00
Anders Schack-Mulligen
e8dbd65d77 Java: Refactor compile-time constant calculation and apply to ConstantIntegerExpr. 2023-02-03 16:16:27 +01:00
Sarita Iyer
d99f7b56bd Merge branch 'codeql-cli-articles-migration-update' of https://github.com/github/codeql into codeql-cli-articles-migration-update 2023-02-03 09:56:51 -05:00
Sarita Iyer
c33c5ed517 Update codeql-cli links 2023-02-03 09:56:49 -05:00
Tamas Vajk
f90c5346bf C#: Change handled exception in TrapWriter.ArchiveContents 2023-02-03 15:13:23 +01:00
Geoffrey White
38eeb9c747 Swift: Model String methods. 2023-02-03 12:26:55 +00:00
Geoffrey White
1077dcd2e3 Swift: Model String initializers. 2023-02-03 11:36:35 +00:00
Philip Ginsbach
b8bd98e476 Merge pull request #12075 from github/ginsbach/RemoveIncorrectStatement
remove statement about namespaces from documentation that no longer holds
2023-02-03 11:18:07 +00:00
Geoffrey White
142ca0c9fb Swift: Model StringProtocol initializers. 2023-02-03 10:53:44 +00:00
Geoffrey White
d888510688 Swift: Fix incorrect taint to String fields. 2023-02-03 10:21:52 +00:00
Geoffrey White
d25de8c764 Swift: Taint fields of StringProtocol. 2023-02-03 10:16:33 +00:00
Philip Ginsbach
e552a6206d shadowing and visibility of default predicates 2023-02-03 10:11:25 +00:00
Geoffrey White
21abe54d8d Swift: Greatly extend tests of taint through strings. 2023-02-03 10:11:12 +00:00
Philip Ginsbach
09fdf744d4 introduce module signature member defaults 2023-02-03 10:01:59 +00:00
Geoffrey White
bf6ef43451 Swift: Document library model files consistently. 2023-02-03 09:59:35 +00:00
Mathias Vorreiter Pedersen
4e7ca1a175 Merge pull request #12082 from github/post-release-prep/codeql-cli-2.12.2
Post-release preparation for codeql-cli-2.12.2
2023-02-03 09:40:57 +00:00
Philip Ginsbach
808d3e3a1f Merge pull request #12084 from github/ginsbach/IncorrectEnvironmentNumbering
we actually only distinguish four environments
2023-02-03 09:37:39 +00:00
Philip Ginsbach
56e0b19df8 we actually only distinguish four environments 2023-02-03 09:04:43 +00:00
Arthur Baars
9a4cec7691 Merge pull request #11956 from aibaars/json-log
Ruby: structured logging
2023-02-03 09:54:49 +01:00
github-actions[bot]
faf21f3edb Post-release preparation for codeql-cli-2.12.2 2023-02-02 23:01:04 +00:00
erik-krogh
6e712b293a add tracking of strings to compile-sites for poly-redos, in the style of Ruby 2023-02-02 22:56:20 +01:00
erik-krogh
34266cfa4c simplify the QL-for-QL workflow, which should also fix the cache 2023-02-02 22:17:38 +01:00
Sarita Iyer
fd977cc277 Update CONTRIBUTING.md 2023-02-02 16:13:13 -05:00
Sarita Iyer
465a3e0ece fix typo 2023-02-02 15:36:34 -05:00
Sarita Iyer
9943d0c054 update anchor links 2023-02-02 15:26:53 -05:00
Sarita Iyer
9b17ee9326 add back hidden toc tree 2023-02-02 14:39:49 -05:00
Sarita Iyer
0ab982891e adding back toc-trees to fix error 2023-02-02 14:31:03 -05:00
Sarita Iyer
2772cf79f4 Update CodeQL CLI articles with migration message 2023-02-02 14:11:02 -05:00
erik-krogh
52959d7c0a add failing test for not tracking strings to re.compile 2023-02-02 19:10:32 +01:00
Erik Krogh Kristensen
c8cfb6a0cc Merge pull request #12065 from knewbury01/knewbury01/fix-js-cleartext-logging-doc
Update JS CleartextLogging qhelp
2023-02-02 18:23:59 +01:00
Philip Ginsbach
55cd436b06 Merge pull request #12074 from github/ginsbach/DocumentShadowing2
shadowing in the QL language specification
2023-02-02 17:13:47 +00:00
Philip Ginsbach
1542353af7 statement no longer holds for namespaces with shadowing 2023-02-02 16:55:06 +00:00
Nora Dimitrijević
a3a01ddc11 Merge pull request #11855 from d10c/swift/extract-captures 2023-02-02 17:50:41 +01:00
Mathias Vorreiter Pedersen
cd660e1067 Merge pull request #12071 from github/release-prep/2.12.2
Release preparation for version 2.12.2
2023-02-02 16:49:44 +00:00
Philip Ginsbach
ab184ebd78 shadowing in the QL language specification 2023-02-02 16:19:18 +00:00
Kristen Newbury
21b4931fbb Merge branch 'main' into knewbury01/fix-js-cleartext-logging-doc 2023-02-02 11:12:57 -05:00
Kristen Newbury
231110ddca Update javascript/ql/src/Security/CWE-312/CleartextLogging.qhelp
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2023-02-02 11:12:44 -05:00
Henry Mercer
65863f1fc7 Merge pull request #10826 from github/dependabot/github_actions/actions/setup-dotnet-3.0.2
build(deps): bump actions/setup-dotnet from 2 to 3
2023-02-02 15:54:55 +00:00
Philip Ginsbach
1472d4b782 Merge pull request #12062 from github/ginsbach/DocumentShadowing
shadowing in the handbook
2023-02-02 15:52:54 +00:00
Anders Schack-Mulligen
67d4ed53b9 Dataflow: Sync. 2023-02-02 16:33:00 +01:00
Anders Schack-Mulligen
8cb233df1a Dataflow: A proper perf fix for the stage-dependent fanout direction of the Content-to-Ap relation. 2023-02-02 16:31:07 +01:00
Jeroen Ketema
3cf5107b45 Apply suggestions from code review 2023-02-02 15:48:29 +01:00
github-actions[bot]
a4fa984792 Release preparation for version 2.12.2 2023-02-02 14:34:55 +00:00
Michael Nebel
77283be6c0 Merge pull request #12068 from michaelnebel/csharp/dotnetpublishtest
C#: Avoid that the dotnet publish test refers to a specific .NET vers…
2023-02-02 15:34:06 +01:00
Michael Nebel
960f776e29 C#: Avoid that the dotnet publish test refers to a specific .NET version. 2023-02-02 14:18:50 +01:00
Philip Ginsbach
4282e1a18e explicitly mention aliases 2023-02-02 13:04:43 +00:00
Philip Ginsbach
2b719d503d visible namespaces also include private imports 2023-02-02 13:03:30 +00:00
Michael Nebel
3cd2024a66 Merge pull request #12060 from michaelnebel/csharp11/nameof
C# 11: Nameof on attribute declarations.
2023-02-02 12:46:28 +01:00
Nora Dimitrijević
ad5dbe18a4 Swift: db upgrade/downgrade script 2023-02-02 12:00:47 +01:00
Nora Dimitrijević
50e5b29eb7 Swift: all Callables can have captures [codegen'd] 2023-02-02 11:56:51 +01:00
Nora Dimitrijević
ce2e7f1d12 Swift: all Callables can have captures [hand-written] 2023-02-02 11:35:50 +01:00
Nora Dimitrijević
d230431006 Swift: extract closure captures (codegen'd part) 2023-02-02 11:35:49 +01:00
Nora Dimitrijević
6895c113cf Swift: extract closure captures (hand-written part) 2023-02-02 11:30:33 +01:00
Nora Dimitrijević
87f7bc3a63 Swift: introduce closure capture AST test 2023-02-02 11:30:33 +01:00
Tony Torralba
62158c5e49 Merge pull request #12044 from atorralba/atorralba/webview-models
Swift: Add new source and flow step related to WkWebView
2023-02-02 09:27:21 +01:00
Michael Nebel
4089845ea4 C#: Test that nameof can used on method parameters and type parameters in attribute declarations. 2023-02-02 09:25:24 +01:00
dependabot[bot]
787fe38d90 build(deps): bump actions/setup-dotnet from 2 to 3.0.2
Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 2 to 3.0.2.
- [Release notes](https://github.com/actions/setup-dotnet/releases)
- [Commits](https://github.com/actions/setup-dotnet/compare/v2...v3.0.2)

---
updated-dependencies:
- dependency-name: actions/setup-dotnet
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-02 08:09:43 +00:00
Michael Nebel
7271d9987e Merge pull request #11940 from michaelnebel/csharp/dotnet7
C#: Update project targets, workflows and other scripts to use .NET 7.
2023-02-02 08:14:55 +01:00
Nora Dimitrijević
e137993acd Merge pull request #12061 from d10c/cpp/missing-check-scanf-join-order-fix 2023-02-02 07:57:21 +01:00
Kristen Newbury
dc5eb40d5f Update JS CleartextLogging qhelp 2023-02-01 16:29:13 -05:00
Harry Maclean
d671cc6e43 Merge pull request #12052 from hmac/barrier-guard-fix 2023-02-02 08:16:07 +13:00
Chuan-kai Lin
255f989ede Merge pull request #12034 from cklin/document-assume-small-delta
Document pragma[assume_small_delta]
2023-02-01 10:36:40 -08:00
Philip Ginsbach
c5deb8544b rework documentation of namespaces to take account of shadowing 2023-02-01 16:56:35 +00:00
Tony Torralba
24527bfc4e Minor change in WKNavigationDelegateSource to work around a bug 2023-02-01 17:44:08 +01:00
Tony Torralba
644bc56568 Add new source and flow step related to WkWebView 2023-02-01 17:44:06 +01:00
Tony Torralba
407e7cbbde Merge pull request #12045 from atorralba/atorralba/more-custom-url-schemes
Swift: Add more sources for custom URL schemes
2023-02-01 17:40:20 +01:00
Joe Farebrother
97b2e852c9 Merge pull request #11713 from joefarebrother/sensitive-result-receiver
Java: Add query for leaking sensitive data through a ResultReceiver
2023-02-01 16:34:17 +00:00
Nora Dimitrijević
1df0be3ca2 C++: Fix join order in cpp/missing-check-scanf
The issues were:
* `revFlow`: `revFlow` joins `fwdFlow` on `vn`.
* `Node.getASuccessor()`: `MkNode` self-join on `vn`.
* `hasFlow/5`: `MkNode` self-join on `vn`.
2023-02-01 16:29:43 +01:00
Tony Torralba
834fc51a3a Update java/ql/src/Security/CWE/CWE-927/SensitiveResultReceiver.ql 2023-02-01 15:26:26 +01:00
Tony Torralba
43b234eeb5 Switch to MaD models for UISceneDelegate methods 2023-02-01 15:15:51 +01:00
Tony Torralba
f7cc5f9627 Add more sources for custom URL schemes
Also add the appropriate steps so that these sources are useful
2023-02-01 15:07:37 +01:00
Geoffrey White
96ee0f68b0 Merge pull request #11935 from geoffw0/protocol-extension
Swift: Flow sources through protocol extensions
2023-02-01 13:47:09 +00:00
Joe Farebrother
74dba953ca Apply suggestions from docs review
Co-authored-by: Sam Browning <106113886+sabrowning1@users.noreply.github.com>
2023-02-01 12:54:19 +00:00
Erik Krogh Kristensen
bc36a75bde Merge pull request #12057 from erik-krogh/syncPyFlow
PY: Sync a dataflow config
2023-02-01 11:58:40 +01:00
erik-krogh
77e014c5a4 sync added dataflow config 2023-02-01 11:46:57 +01:00
Erik Krogh Kristensen
01f6862965 Merge pull request #11833 from erik-krogh/trackPyReg
PY: track string-constants to regular expression uses
2023-02-01 11:40:42 +01:00
Arthur Baars
a46061541b Ruby: address review comment 2023-02-01 09:59:05 +01:00
Arthur Baars
fa81d9da18 Apply suggestions from code review
Co-authored-by: Harry Maclean <hmac@github.com>
2023-02-01 09:47:39 +01:00
Tony Torralba
837cdf7782 Merge pull request #12046 from atorralba/atorralba/urlrequest-models
Swift: Add taint for URLRequest fields
2023-02-01 09:24:17 +01:00
Geoffrey White
b9d487ac35 Merge branch 'main' into protocol-extension 2023-02-01 08:21:05 +00:00
Erik Krogh Kristensen
16049d694b Merge pull request #12055 from github/dependabot/cargo/ql/tracing-0.1.37
Bump tracing from 0.1.35 to 0.1.37 in /ql
2023-02-01 09:07:11 +01:00
dependabot[bot]
373148decd Bump tracing from 0.1.35 to 0.1.37 in /ql
Bumps [tracing](https://github.com/tokio-rs/tracing) from 0.1.35 to 0.1.37.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.35...tracing-0.1.37)

---
updated-dependencies:
- dependency-name: tracing
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-01 03:11:28 +00:00
Harry Maclean
da45d3aa7f Ruby: Fix string comparison barrier guard
`strNode` was not properly restricted for some cases.
2023-02-01 14:40:53 +13:00
Harry Maclean
0d68d88741 Merge pull request #11934 from hmac/actioncontroller-filters 2023-02-01 09:10:30 +13:00
Geoffrey White
7f58a2222a Merge branch 'main' into protocol-extension 2023-01-31 16:06:55 +00:00
Chris Smowton
6b0b73b5f6 Merge pull request #12033 from intrigus-lgtm/patch-8
Fix errorneous slash
2023-01-31 14:39:51 +00:00
Mathias Vorreiter Pedersen
a2248e6ca6 Merge pull request #12030 from MathiasVP/iterator-public-models
C++: Make iterator classes public
2023-01-31 14:11:52 +00:00
Mathias Vorreiter Pedersen
0d38ff8e8c Merge pull request #11920 from gsingh93/bit-shift-range
C++: Improve left shift and right shift range analysis accuracy
2023-01-31 14:01:41 +00:00
Erik Krogh Kristensen
8bc9ce749f Merge pull request #12038 from github/dependabot/cargo/ql/tracing-subscriber-0.3.16
Bump tracing-subscriber from 0.3.15 to 0.3.16 in /ql
2023-01-31 14:35:35 +01:00
Arthur Baars
57012714d6 Ruby: serialize timestamps as ISO8601 2023-01-31 14:32:29 +01:00
dependabot[bot]
56a0b1d2d8 Merge pull request #12024 from github/dependabot/cargo/ruby/clap-3.0.14 2023-01-31 13:30:21 +00:00
dependabot[bot]
597c71011e Bump tracing-subscriber from 0.3.15 to 0.3.16 in /ql
Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.3.15 to 0.3.16.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.3.15...tracing-subscriber-0.3.16)

---
updated-dependencies:
- dependency-name: tracing-subscriber
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-31 13:09:13 +00:00
Erik Krogh Kristensen
683761098d Merge pull request #12041 from github/dependabot/cargo/ql/flate2-1.0.25
Bump flate2 from 1.0.24 to 1.0.25 in /ql
2023-01-31 14:07:09 +01:00
Mathias Vorreiter Pedersen
fcc4c91739 C++: More responding to comments. 2023-01-31 13:01:00 +00:00
dependabot[bot]
7f22c4c474 Bump clap from 3.0.12 to 3.0.14 in /ruby
Bumps [clap](https://github.com/clap-rs/clap) from 3.0.12 to 3.0.14.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v3.0.12...v3.0.14)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-31 12:49:34 +00:00
dependabot[bot]
8410e46067 Bump flate2 from 1.0.24 to 1.0.25 in /ql
Bumps [flate2](https://github.com/rust-lang/flate2-rs) from 1.0.24 to 1.0.25.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.24...1.0.25)

---
updated-dependencies:
- dependency-name: flate2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-31 12:48:10 +00:00
Erik Krogh Kristensen
481dab700c Merge pull request #12037 from github/dependabot/cargo/ql/num_cpus-1.14.0
Bump num_cpus from 1.13.1 to 1.14.0 in /ql
2023-01-31 13:45:43 +01:00
Michael Nebel
478474bbed C#: Add ref field test case. 2023-01-31 13:35:47 +01:00
yoff
7ae389bb28 Merge pull request #12026 from erik-krogh/nodePty
JS: add code-injection sink for node-pty
2023-01-31 13:27:32 +01:00
Michael Nebel
ecadb56419 C#: Update CIL consistency test expected output. 2023-01-31 13:21:00 +01:00
Michael Nebel
5657bd0547 C#: Update type annontations test to exclude OS specific stuff. 2023-01-31 13:21:00 +01:00
Michael Nebel
177fcbb4eb C#: Update attribute test to exclude OS specific declarations. 2023-01-31 13:21:00 +01:00
Michael Nebel
0ed48616a7 C#: Use stubs for CWE-321/HardcodedSymmetricEncryptionKey. 2023-01-31 13:21:00 +01:00
Michael Nebel
9808482c41 C#: Update Minimal stubs from source testcase expected output. 2023-01-31 13:21:00 +01:00
Michael Nebel
3510f465b2 C#: Use stubs for ThreadUnsafeICryptoTransformLambda. 2023-01-31 13:21:00 +01:00
Michael Nebel
f3555b1076 C#: Update options files as some classes has been moved to other dll's. 2023-01-31 13:21:00 +01:00
Michael Nebel
5ccfc4d3f4 C#: Add System.Security.Cryptography as a dependency to the HashWithoutSalt query test. 2023-01-31 13:21:00 +01:00
Michael Nebel
fd74c10b06 C#: Use stubs for ThreadUnsafeICryptoTransform. 2023-01-31 13:21:00 +01:00
Michael Nebel
14888d4382 C#: Use stubs for CWE-327 test cases. 2023-01-31 13:21:00 +01:00
Michael Nebel
89de6cb8a0 C#: Update library tests. 2023-01-31 13:20:59 +01:00
Michael Nebel
33a923a85b C#: Use IsKind instead of Kind (compiler warning). 2023-01-31 13:20:59 +01:00
Michael Nebel
3a4e5700e8 C#: Update project targets, workflows and other scripts to use .NET 7. 2023-01-31 13:20:59 +01:00
Michael Nebel
86e9bf2f81 Merge pull request #11996 from michaelnebel/csharp/refstructreffield
C# 11: Extractor support for `ref` fields in `ref struct`.
2023-01-31 13:08:57 +01:00
dependabot[bot]
423bab54d3 Bump num_cpus from 1.13.1 to 1.14.0 in /ql
Bumps [num_cpus](https://github.com/seanmonstar/num_cpus) from 1.13.1 to 1.14.0.
- [Release notes](https://github.com/seanmonstar/num_cpus/releases)
- [Changelog](https://github.com/seanmonstar/num_cpus/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/num_cpus/compare/v1.13.1...v1.14.0)

---
updated-dependencies:
- dependency-name: num_cpus
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-31 12:05:11 +00:00
Erik Krogh Kristensen
38bcb2b727 Merge pull request #12039 from github/dependabot/cargo/ql/serde-1.0.152
Bump serde from 1.0.140 to 1.0.152 in /ql
2023-01-31 13:03:03 +01:00
dependabot[bot]
198b97ca8d Bump serde from 1.0.140 to 1.0.152 in /ql
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.140 to 1.0.152.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.140...v1.0.152)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-31 11:48:44 +00:00
Erik Krogh Kristensen
f2526d1784 Merge pull request #12040 from github/dependabot/cargo/ql/tree-sitter-0.20.9
Bump tree-sitter from 0.20.8 to 0.20.9 in /ql
2023-01-31 12:46:43 +01:00
Gulshan Singh
1a109cab4d Remove unicode characters 2023-01-31 03:38:03 -08:00
dependabot[bot]
807b715320 Bump tree-sitter from 0.20.8 to 0.20.9 in /ql
Bumps [tree-sitter](https://github.com/tree-sitter/tree-sitter) from 0.20.8 to 0.20.9.
- [Release notes](https://github.com/tree-sitter/tree-sitter/releases)
- [Commits](https://github.com/tree-sitter/tree-sitter/commits)

---
updated-dependencies:
- dependency-name: tree-sitter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-31 11:27:40 +00:00
Erik Krogh Kristensen
34ca12e5d2 Merge pull request #12042 from erik-krogh/qlTools
QL: update codeql-action in QL-for-QL
2023-01-31 12:24:37 +01:00
erik-krogh
94cec17505 bump codeql-action 2023-01-31 12:09:21 +01:00
erik-krogh
4436ec070e ensure the test is run when the workflow is updated 2023-01-31 12:09:21 +01:00
Geoffrey White
ee442e4d4b Merge pull request #11979 from geoffw0/modern1
Swift: Modernize injection queries
2023-01-31 10:54:35 +00:00
erik-krogh
0cefa98490 add missing word to the change-note 2023-01-31 11:53:17 +01:00
Mathias Vorreiter Pedersen
daf7d1b7e7 C++: Add more QLDoc. 2023-01-31 10:37:51 +00:00
Mathias Vorreiter Pedersen
7583fe2ad8 C++: Respond to PR reviews. 2023-01-31 10:31:02 +00:00
Tony Torralba
e9a46c926d Add taint for URLRequest fields 2023-01-31 11:15:45 +01:00
erik-krogh
95c19698c7 add change-note 2023-01-31 11:09:07 +01:00
erik-krogh
e5e8496084 fix QL-for-QL warnings 2023-01-31 10:55:27 +01:00
Arthur Baars
d944c2bd79 Ruby: address comments 2023-01-31 10:22:12 +01:00
Gulshan Singh
2f38d363ff Fix typo in dependsOnChild 2023-01-30 19:55:53 -08:00
Gulshan Singh
fb31570af3 Fix bitshift test 2023-01-30 19:55:53 -08:00
Gulshan Singh
1758e25207 Merge lshift/rshift range expressions into a single file and address PR comments 2023-01-30 19:55:53 -08:00
Gulshan Singh
051d36ee6a Add ConstantLShiftExprRange and ConstantRShiftExprRange classes 2023-01-30 19:55:53 -08:00
Gulshan Singh
5710289460 Add bitshift test 2023-01-30 19:55:53 -08:00
Harry Maclean
c99a096c9b Ruby: Update test fixtures 2023-01-31 11:27:19 +13:00
Harry Maclean
69ed00cdf1 Ruby: QL4QL fix 2023-01-31 11:06:32 +13:00
Mathias Vorreiter Pedersen
cd596403a0 Merge pull request #12031 from MathiasVP/ir-get-call-predicate 2023-01-30 21:23:02 +00:00
Chuan-kai Lin
396d2de6e7 Document pragma[assume_small_delta] 2023-01-30 11:42:57 -08:00
intrigus-lgtm
f23d517236 Fix errorneous slash
The additional slash causes the request to fail.
Compare `gh api /repos/openjdk/jdk/code-scanning/codeql/databases/` (fails) with:
```
gh api /repos/openjdk/jdk/code-scanning/codeql/databases/
{
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest"
}
gh: Not Found (HTTP 404)
```
While `gh api /repos/openjdk/jdk/code-scanning/codeql/databases` (works).
2023-01-30 20:26:40 +01:00
Mathias Vorreiter Pedersen
a01a4734ed C++/C#: Sync identical files. 2023-01-30 17:32:53 +00:00
Mathias Vorreiter Pedersen
3a1a9a771c C++: Add a 'getCall' predicate to 'ArgumentOperand'. 2023-01-30 17:31:52 +00:00
Mathias Vorreiter Pedersen
f90007ae71 C++: Make our iterator models public. 2023-01-30 17:23:52 +00:00
Jami
7f6efae7dc Merge pull request #12008 from jcogs33/jcogs33/update-queryproducer-package
Java: update package for `QueryProducer` sinks
2023-01-30 10:27:58 -05:00
Alexander Eyers-Taylor
89d835b9ec Merge pull request #11988 from github/alexet/force-java-11
Use Java 11 for some integration tests
2023-01-30 15:19:00 +00:00
Nora Dimitrijević
fb88372c0f Merge pull request #11862 from d10c/swift/rename-iterabledeclcontext 2023-01-30 16:03:49 +01:00
AlexDenisov
48434f4be3 Merge pull request #12025 from github/alexdenisov/ignore-sandbox-exec
Swift: ignore sandbox-exec
2023-01-30 15:59:19 +01:00
erik-krogh
02da718786 add code-injection sink for node-pty 2023-01-30 15:14:25 +01:00
Alex Denisov
b71c5e6c4b Swift: ignore sandbox-exec 2023-01-30 15:10:30 +01:00
Erik Krogh Kristensen
862948f1cc Merge pull request #12014 from erik-krogh/axios
JS: add support for axios used as a global variable
2023-01-30 14:55:49 +01:00
Ian Lynagh
25e703e562 Merge pull request #11579 from igfoo/igfoo/only_lockless
Kotlin: Remove legacy trap-locking support
2023-01-30 13:44:31 +00:00
Michael Nebel
115a0a4318 C#: Add change note. 2023-01-30 14:28:35 +01:00
Michael Nebel
b25414fe93 C#: Add DB upgrade and downgrade scripts. 2023-01-30 14:28:35 +01:00
Michael Nebel
ff546c1497 C#: Add test cases for ref fields. 2023-01-30 14:28:35 +01:00
Michael Nebel
2be090bb91 C#: Add predicate isRef to the CIL Field class. 2023-01-30 14:28:35 +01:00
Michael Nebel
db047c2c4a C#: Extract CIL fields using their underlying types for a reference type field and annotate the field as a reference type. 2023-01-30 14:28:35 +01:00
Michael Nebel
812bc20812 C#: Add CIL fields as entities that can carry type annotations. 2023-01-30 14:28:35 +01:00
Michael Nebel
23acd5c255 C#: Small re-factor of the Modifier class. 2023-01-30 14:28:34 +01:00
Michael Nebel
3a4ec90ae9 C#: Extraction of ref modifier for fields. 2023-01-30 14:28:34 +01:00
Erik Krogh Kristensen
e46960e0cf Merge pull request #12022 from github/dependabot/cargo/ql/regex-1.7.1
Bump regex from 1.6.0 to 1.7.1 in /ql
2023-01-30 13:11:54 +01:00
dependabot[bot]
e3afb1640a Bump regex from 1.6.0 to 1.7.1 in /ql
Bumps [regex](https://github.com/rust-lang/regex) from 1.6.0 to 1.7.1.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.6.0...1.7.1)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-30 11:19:30 +00:00
Erik Krogh Kristensen
8198bbf893 Merge pull request #12019 from github/dependabot/cargo/ql/serde_json-1.0.91
Bump serde_json from 1.0.82 to 1.0.91 in /ql
2023-01-30 12:16:49 +01:00
Nora Dimitrijević
9346f4d760 Swift: fix failing tests 2023-01-30 11:39:06 +01:00
dependabot[bot]
f430e83fca Bump serde_json from 1.0.82 to 1.0.91 in /ql
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.82 to 1.0.91.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.82...v1.0.91)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-30 10:36:14 +00:00
Erik Krogh Kristensen
f647910e0c Merge pull request #12018 from erik-krogh/qlDependabot
QL: fixup the dependabot config for QL-for-QL
2023-01-30 11:35:05 +01:00
Erik Krogh Kristensen
78683e4e8a Merge pull request #11879 from erik-krogh/rbRegConcept
RB: add a RegexExecution concept, and use it for better regexp tracking
2023-01-30 11:33:09 +01:00
erik-krogh
40a576b775 fixup the dependabot config for QL-for-QL 2023-01-30 11:22:17 +01:00
erik-krogh
f04a9cb523 Merge branch 'main' into rbRegConcept 2023-01-30 11:05:40 +01:00
Erik Krogh Kristensen
3508a4b799 Merge pull request #12016 from erik-krogh/newEntity
QL: support the NewEntity module in QL-for-QL
2023-01-30 11:01:11 +01:00
Arthur Baars
907ebb723e Merge branch 'main' into json-log 2023-01-30 10:49:42 +01:00
erik-krogh
54c4c23b46 support the NewEntity module in QL-for-QL 2023-01-30 10:34:06 +01:00
Mathias Vorreiter Pedersen
6a8c570915 Merge pull request #12009 from MathiasVP/fix-fwd-flow-read-join
DataFlow: Fix join in `fwdFlowRead`
2023-01-30 09:23:43 +00:00
Harry Maclean
f7cdd430a2 Ruby: Small fix 2023-01-30 21:55:19 +13:00
Harry Maclean
7778524e08 Ruby: Refactor 2023-01-30 21:52:59 +13:00
Harry Maclean
5e9210fcea Ruby: use getAnAncestor 2023-01-30 21:21:38 +13:00
Harry Maclean
708e303c01 Ruby: Model except: with a const argument 2023-01-30 21:17:31 +13:00
Harry Maclean
28716866d8 Ruby: getAction -> getAnAction 2023-01-30 18:52:47 +13:00
Harry Maclean
246ad46eb1 Ruby: Account for filter skip ordering
A `skip_*_filter :foo` call only has an effect if there was an earlier
call that registered `:foo` as a filter.
2023-01-30 18:50:30 +13:00
Harry Maclean
a164e76a5d Ruby: Model actioncontroller filter overrides
If a filter is registered twice with the same name, the last
registration wins.
2023-01-30 18:05:22 +13:00
Harry Maclean
28c3bd3e2f Ruby: QL4QL fix 2023-01-30 17:41:36 +13:00
Harry Maclean
fb86ef4aac Ruby: Model ActionController filters
ActionController filters provide a way to register callbacks that run
before, after or around an action (i.e. HTTP request handler). They run
in the same class context as the action, so can get/set instance
variables and generally interact with the action in arbitrary ways.

In order to track flow between filters and actions, we have to model the
callback chain. This commit does that. A later change will add dataflow
steps to actually track flow through the chain.
2023-01-30 17:41:36 +13:00
erik-krogh
e3455a9b21 add support for axios used as a global variable 2023-01-29 22:55:20 +01:00
Nora Dimitrijević
d5f11dfe60 Swift: db upgrade/downgrade script 2023-01-28 00:44:49 +01:00
Nora Dimitrijević
1396d07662 Swift: subsume IterableDeclContext into Decl [tests] 2023-01-28 00:44:49 +01:00
Nora Dimitrijević
9a5614e8c5 Swift: subsume IterableDeclContext into Decl [codegen'd] 2023-01-28 00:44:49 +01:00
Nora Dimitrijević
f96c18a6db Swift: subsume IterableDeclContext into Decl [hand-written] 2023-01-28 00:44:48 +01:00
Mathias Vorreiter Pedersen
95b15825f9 DataFlow: Sync identical files. 2023-01-27 16:24:31 +00:00
Mathias Vorreiter Pedersen
a691535e77 C++: Fix join order in 'fwdFlowRead'. 2023-01-27 16:24:08 +00:00
Jami Cogswell
85c228a0cd Java: remove old sinks 2023-01-27 10:40:17 -05:00
Jami Cogswell
a3fe8c0e93 Java: add change note 2023-01-27 10:35:16 -05:00
Jami Cogswell
9bf43483db Java: update package for QueryProducer sinks 2023-01-27 10:16:42 -05:00
Geoffrey White
6c0b50c696 Merge pull request #11980 from geoffw0/modern2
Swift: Structure modernized queries more consistently
2023-01-27 14:33:43 +00:00
Geoffrey White
794ba428a7 Merge pull request #11942 from geoffw0/rncrypt4
Swift: add RNCryptor sinks to swift/static-initialization-vector
2023-01-27 14:33:06 +00:00
James Fletcher
812306cb52 Merge pull request #12006 from felickz/patch-2
Add link to codeql metadata article for problem.severity
2023-01-27 13:59:06 +00:00
alexet
1b0952c512 Use Java 11 for some integration tests 2023-01-27 13:51:44 +00:00
Chad Bentz
4fee536e6d table spacing 2023-01-27 08:19:43 -05:00
Chad Bentz
3ef4d3118c Add link to codeql metadata article for problem.severity 2023-01-27 08:01:07 -05:00
Ian Lynagh
75562e7fb5 Kotlin: Remove legacy trap-locking support 2023-01-26 16:58:51 +00:00
Michael B. Gale
f192191e8c Merge pull request #11997 from github/smowton/fix/deperrors-conditional
Go: Fix DepErrors test
2023-01-26 14:52:27 +00:00
Mathias Vorreiter Pedersen
508027e0e5 Merge pull request #11998 from MathiasVP/fix-iterator-test 2023-01-26 12:35:12 +00:00
Mathias Vorreiter Pedersen
13baa5b60b C++: Add iterator typedefs to properly instantiate 'int_iterator_by_trait' and 'insert_iterator_by_trait'. 2023-01-26 11:43:33 +00:00
Chris Smowton
7921de243a Fix DepErrors test
This was likely harmlessly causing `go get` reruns, since most (all?) real dependency errors cause `go list` to exit with a nonzero return code in any case.
2023-01-26 11:37:41 +00:00
dependabot[bot]
295152cd32 Merge pull request #11992 from github/dependabot/cargo/ruby/serde-1.0.152 2023-01-26 10:17:56 +00:00
dependabot[bot]
bf02340a6a Merge pull request #11982 from github/dependabot/cargo/ruby/num_cpus-1.14.0 2023-01-26 10:13:09 +00:00
dependabot[bot]
6e69acdd7e Bump serde from 1.0.131 to 1.0.152 in /ruby
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.131 to 1.0.152.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.131...v1.0.152)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-26 03:08:58 +00:00
Harry Maclean
07a7a213b3 Merge pull request #11871 from hmac/rack 2023-01-26 08:40:30 +13:00
Rasmus Wriedt Larsen
1fcfae2464 Merge pull request #11987 from RasmusWL/suite-lists
Misc: Add `security-experimental` to `generate-code-scanning-query-list.py`
2023-01-25 17:29:36 +01:00
Geoffrey White
e92a5eb467 Merge pull request #11911 from geoffw0/rncrypt2
Swift: Add RNCryptor sinks to swift/hardcoded-key
2023-01-25 15:11:16 +00:00
Rasmus Wriedt Larsen
e8714c9edb Misc: Add Swift to generate-code-scanning-query-list.py 2023-01-25 15:22:20 +01:00
Rasmus Wriedt Larsen
b220c2f51d Misc: Add security-experimental to generate-code-scanning-query-list.py
Since not all experimental queries is part of this new suite, it's nice
to be able to list them explicitly without having to replicate the logic
from the .qls file.
2023-01-25 15:20:49 +01:00
Geoffrey White
f6fe627f4b Merge pull request #11914 from geoffw0/rncrypt3
Swift: Add RNCryptor sinks to swift/constant-salt
2023-01-25 13:05:33 +00:00
Alex Ford
3dd9392f5e Merge pull request #11869 from alexrford/rails/render_locals_shared
Ruby: Rails - generalize rails flow step for accessing render locals hash in view
2023-01-25 12:07:26 +00:00
Erik Krogh Kristensen
39e9eaf2bc Merge pull request #11986 from erik-krogh/redosNote2
RB: add note in ReDoS qhelp that Ruby 3.2 has fixed ReDoS
2023-01-25 11:56:04 +01:00
Paolo Tranquilli
f4cb920624 Merge pull request #11932 from github/redsun82/swift-docs
Swift: add and fix some `schema.py` documentation
2023-01-25 10:52:00 +01:00
Geoffrey White
fe13137b48 Swift: Make default implementations private. 2023-01-25 09:29:03 +00:00
erik-krogh
54b0350cac add note in ReDoS qhelp that Ruby 3.2 has fixed ReDoS 2023-01-25 10:24:11 +01:00
dependabot[bot]
531c0559a0 Bump num_cpus from 1.13.0 to 1.14.0 in /ruby
Bumps [num_cpus](https://github.com/seanmonstar/num_cpus) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/seanmonstar/num_cpus/releases)
- [Changelog](https://github.com/seanmonstar/num_cpus/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/num_cpus/compare/v1.13.0...v1.14.0)

---
updated-dependencies:
- dependency-name: num_cpus
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-25 08:48:08 +00:00
Arthur Baars
358ae7529b Merge pull request #11973 from github/dependabot/cargo/ruby/serde_json-1.0.91
Bump serde_json from 1.0.72 to 1.0.91 in /ruby
2023-01-25 09:45:32 +01:00
Arthur Baars
068b71bc3d Merge pull request #11972 from github/dependabot/cargo/ruby/regex-1.7.1
Bump regex from 1.5.5 to 1.7.1 in /ruby
2023-01-25 09:44:57 +01:00
Arthur Baars
e634ab771f Merge pull request #11971 from github/dependabot/cargo/ruby/flate2-1.0.25
Bump flate2 from 1.0.22 to 1.0.25 in /ruby
2023-01-25 09:44:29 +01:00
Erik Krogh Kristensen
99bad77972 Merge pull request #11906 from erik-krogh/moreStem
JS: expand what is parsed as the stem of a pathexpr
2023-01-25 08:44:44 +01:00
Geoffrey White
439d9199be Swift: Add CSV extension points. 2023-01-24 19:28:05 +00:00
Geoffrey White
13d308a4d6 Swift: Autoformat. 2023-01-24 19:15:51 +00:00
Geoffrey White
5375678ca6 Swift: Add consistent CSV extension points. 2023-01-24 18:49:50 +00:00
Geoffrey White
6a210d719b Swift: Rename QueryExtensions.qll files for consistency. 2023-01-24 17:58:13 +00:00
Paolo Tranquilli
ddef87f6e2 Merge pull request #10956 from github/redsun82/swift-linkage-awareness
Swift: disambuigate entities using linkage awareness on modules
2023-01-24 18:49:24 +01:00
Geoffrey White
6a946f6eed Swift: Modernize. 2023-01-24 17:26:51 +00:00
Paolo Tranquilli
4880ab41a2 Swift: use weakly_canonical instead of canonical
`weakly_canonical` will resolve as much as possible in the path, and not
return an error if it can't resolve everything (for example due to a
non existant file). In any case in case of problems with the file we
will see an error when actually using the resolved path.

This tunes down some unhelpful log messages.
2023-01-24 16:34:47 +01:00
Paolo Tranquilli
a74247e5d8 Swift: add filename to an error message 2023-01-24 16:29:10 +01:00
Paolo Tranquilli
6b77e6748a Swift: use same implementation for createTarget{Link,Object}Domain 2023-01-24 16:27:21 +01:00
Geoffrey White
78eff0dc60 Swift: Split off the Extensions.qll as well. 2023-01-24 15:19:41 +00:00
James Fletcher
176b2cae19 Merge pull request #11882 from github/charisk/rename-vscode-run-query-cmd
Rename VS Code Extension Run Query command
2023-01-24 15:17:30 +00:00
Geoffrey White
cbfa7e7252 Swift: Move query logic into .qlls. 2023-01-24 15:04:10 +00:00
Paolo Tranquilli
23344a7183 Merge branch 'main' into redsun82/swift-linkage-awareness 2023-01-24 15:47:44 +01:00
Jeroen Ketema
ae2fa6c1a4 Merge pull request #11975 from MathiasVP/another-dataflow-loop
C++: Add another looping dataflow test
2023-01-24 14:21:16 +01:00
Calum Grant
522c9d640d Merge pull request #11957 from github/yoff-list-support-for-python-3.11
Update supported-versions-compilers.rst
2023-01-24 10:15:11 +00:00
Mathias Vorreiter Pedersen
510211a4c7 C++: Add testcase with looping behavior in C/C++ def-use flow. 2023-01-24 09:44:30 +00:00
Michael Nebel
4df615f994 Merge pull request #11922 from michaelnebel/csharp11/strings
C# 11: String related functionality.
2023-01-24 10:31:31 +01:00
Michael Nebel
0b04654f33 C#: Update expected test output. 2023-01-24 09:51:47 +01:00
Michael Nebel
4c966f2b8a C#: Add some more UTF-8 encoded string examples. 2023-01-24 09:49:38 +01:00
Mathias Vorreiter Pedersen
ca5916f3dc Merge pull request #11946 from MathiasVP/fix-taint-models-2 2023-01-24 08:13:43 +00:00
dependabot[bot]
fd22c7c73e Bump serde_json from 1.0.72 to 1.0.91 in /ruby
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.72 to 1.0.91.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.72...v1.0.91)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-24 06:39:13 +00:00
dependabot[bot]
c4bf25f33c Bump regex from 1.5.5 to 1.7.1 in /ruby
Bumps [regex](https://github.com/rust-lang/regex) from 1.5.5 to 1.7.1.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.5.5...1.7.1)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-24 06:39:09 +00:00
dependabot[bot]
b1f73b59cd Bump flate2 from 1.0.22 to 1.0.25 in /ruby
Bumps [flate2](https://github.com/rust-lang/flate2-rs) from 1.0.22 to 1.0.25.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.22...1.0.25)

---
updated-dependencies:
- dependency-name: flate2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-24 06:39:03 +00:00
Arthur Baars
c512eddb69 Merge pull request #11969 from hmac/simplify-ruby-dependabot-config
Ruby: Simplify dependabot config
2023-01-24 07:34:45 +01:00
Harry Maclean
8050639b16 Ruby: Simplify dependabot config
Dependabot is able to understand cargo workspaces, so it's not necessary
to enumerate each workspace member. It should be enough to configure it
with the workspace root directory. This will hopefully ensure that the
Cargo.lock file gets updated correctly.
2023-01-24 16:37:10 +13:00
Harry Maclean
e6e4e29bf8 Ruby: newline 2023-01-23 21:53:52 +00:00
Harry Maclean
224db456af Ruby: Simplify isRackResponse 2023-01-23 21:53:09 +00:00
Harry Maclean
60f9635ada Ruby: Move import 2023-01-23 21:51:27 +00:00
Harry Maclean
c1207e0938 Ruby: Fix rack response tracking
Use type tracking instead of getReturningNode, which seems to be faster
and works correctly for the cases I've tried.
2023-01-23 21:43:04 +00:00
Erik Krogh Kristensen
fc66c905ff Merge pull request #11859 from erik-krogh/moreShell
JS: slightly broaden the regular expression that recognizes bad string-concats used as shell commands
2023-01-23 22:26:17 +01:00
Henry Mercer
21e63a8a86 Merge pull request #11967 from github/codeql-ci/atm/release-0.4.6
JS: Bump version numbers of ML-powered packs after 0.4.6 release
2023-01-23 20:43:18 +00:00
Henry Mercer
241951f53e Merge branch 'main' into codeql-ci/atm/release-0.4.6 2023-01-23 18:24:36 +00:00
github-actions[bot]
be481d975c JS: Bump version of ML-powered library and query packs to 0.4.7 2023-01-23 18:22:18 +00:00
github-actions[bot]
40a67d61d2 JS: Bump patch version of ML-powered library and query packs 2023-01-23 18:15:56 +00:00
Geoffrey White
25bcaa3a54 Merge pull request #11966 from geoffw0/usenumerics
Swift: Use numeric types in CleartextLogging.qll.
2023-01-23 18:06:17 +00:00
Sid Shankar
e32823c3e0 Merge pull request #11964 from github/sidshank/update-supported-language-versions-Jan-2023
Update supported language versions in documentation
2023-01-23 12:12:43 -05:00
Geoffrey White
19527016a5 Swift: Use numeric types in CleartextLogging.qll. 2023-01-23 16:52:03 +00:00
Geoffrey White
5ddff790b6 Swift: Autoformat. 2023-01-23 16:46:58 +00:00
Sid Shankar
f77d156e9a Update supported version of Java 2023-01-23 15:41:35 +00:00
Sid Shankar
444df6fccb Update supported version of Go 2023-01-23 15:41:02 +00:00
Erik Krogh Kristensen
240248b9cf Merge pull request #11453 from erik-krogh/unsafeHtmlConstruction
RB: add unsafe-html-construction query
2023-01-23 16:40:25 +01:00
erik-krogh
11894144aa remove regular expression that did nothing 2023-01-23 16:38:09 +01:00
Jeroen Ketema
0a0d6d0841 Merge pull request #11963 from MathiasVP/testcase-with-loop
C++: Add testcase with looping behavior
2023-01-23 16:33:36 +01:00
Erik Krogh Kristensen
5be97f3761 Merge pull request #11909 from erik-krogh/concatCode
Rb: recognize string concatenations as sinks for unsafe-code-construction
2023-01-23 16:22:46 +01:00
Mathias Vorreiter Pedersen
a217017859 C++: Add testcase with looping behavior in C/C++ use-use flow. 2023-01-23 14:29:39 +00:00
erik-krogh
ae00518ddf remove the isAdditionalTaintStep predicate from UnsafeHtmlConstructionQuery, as it was not needed 2023-01-23 15:27:19 +01:00
erik-krogh
7c6ee5f293 Merge branch 'main' into unsafeHtmlConstruction 2023-01-23 15:01:01 +01:00
Erik Krogh Kristensen
32c4cf5769 Apply suggestions from code review
Co-authored-by: Alex Ford <alexrford@users.noreply.github.com>
2023-01-23 14:58:04 +01:00
erik-krogh
800077dabe changes based on feedback 2023-01-23 14:54:36 +01:00
Erik Krogh Kristensen
a10b45e0db Merge pull request #11927 from mvogelgesang/express-rate-limit
JS: Updated express-rate-limit example to match implementation examples f…
2023-01-23 14:37:50 +01:00
Jeroen Ketema
05ecd2e015 Merge pull request #11958 from jketema/argv-if-tests
C++: Add some additional uncontrolled format string tests
2023-01-23 14:05:07 +01:00
Erik Krogh Kristensen
45aaeb897a Merge pull request #11955 from erik-krogh/docFrameworks
JS: add Fastify and restify to the list of supported frameworks
2023-01-23 13:14:15 +01:00
Philip Ginsbach
78a2dfa7c4 Merge pull request #11939 from github/ginsbach/DocumentNewNamespaces
document new namespaces
2023-01-23 12:12:49 +00:00
Chris Smowton
fea97a22c6 Merge pull request #11827 from smowton/smowton/admin/test-gradle-script-parsing
Java: Add integration tests for Android projects
2023-01-23 11:39:24 +00:00
Philip Ginsbach
8a3972049b fix grammar 2023-01-23 11:15:22 +00:00
Jeroen Ketema
cfc0dabad9 C++: Add some additional uncontrolled format string tests
These duplicate the `i9` and `i91` tests slightly earlier in the same file, but
use an explicit `if` instead of the ternary operator.
2023-01-23 11:50:45 +01:00
Mathias Vorreiter Pedersen
470abfd0aa C++: Conflate iterator value and indirection for taint-flow to fix AST dataflow. 2023-01-23 10:40:25 +00:00
yoff
fe0290fb39 Update supported-versions-compilers.rst
List 3.11 as supported for Python
2023-01-23 11:33:32 +01:00
Mathias Vorreiter Pedersen
962b651c44 C++: Fix models. 2023-01-23 10:10:02 +00:00
Alex Ford
3b10a2de11 Merge branch 'main' into rails/render_locals_shared 2023-01-23 10:00:22 +00:00
Alex Ford
55550e7980 Merge pull request #11941 from alexrford/summary-component-tostring-syntheticglobal
Add missing toString case for synthetic globals
2023-01-23 10:00:00 +00:00
Erik Krogh Kristensen
1ee9957838 Merge pull request #9807 from erik-krogh/endFilter
JS: recognize "-->" as a bad tag filter
2023-01-23 10:06:50 +01:00
Arthur Baars
99148244a4 Merge pull request #11856 from aibaars/update-grammars
Update grammars
2023-01-23 09:46:50 +01:00
erik-krogh
dc1bfa3a04 add Fastify and restify to the list of supported frameworks 2023-01-23 09:36:49 +01:00
Michael Nebel
69a42d8b1f Merge pull request #11931 from michaelnebel/csharp/refactor
Remove the Csv postfix of some predicate names.
2023-01-23 09:09:48 +01:00
Michael Nebel
440fe80c14 C#: Update stats. 2023-01-23 09:06:34 +01:00
Harry Maclean
21ce9b448a Ruby: Attempt to fix performance of AppCandidate
`DataFlow::MethodNode.getAReturningNode` is expensive to compute.
Instead we look for rack responses which flow to the `SynthReturnNode`.
Each method has only one of these (vs many "returning" nodes) so it is
a lot faster.
I'm not sure yet whether the results are the same.
2023-01-23 15:25:52 +13:00
Chris Smowton
a2e7b83411 Add additional note to Android tests 2023-01-21 11:57:54 +00:00
Chris Smowton
81e59e9005 Force Gradle tests to run sequentially
Otherwise starting multiple Gradle daemons in parallel can fail
2023-01-21 11:57:53 +00:00
Chris Smowton
4197d7bd20 Android tests: use Java 11 under Actions
Some runners still default to Java 8 (e.g. windows-2022 and macos-12), so we need to manually pull Java 11 in in such cases.
2023-01-21 11:57:53 +00:00
Chris Smowton
b6df415fe8 Add Android and Kotlin build script tests
This adds a single plain Gradle project that uses a modern Kotlin build script (i.e. settings.gradle.kts and no build.gradle.kts), plus basic Android samples exercising the possible permutations of: (old vs. new-style build script, Groovy vs. Kotlin build script, wrapper present vs. absent)

Old vs. new style tests our recognition of different cues that this is likely a Droid project and requires `gradle assemble` not `gradle testClasses` (the example given at https://developer.android.com/studio/build/#top-level changed style as of plugin version ~7.3.0).

Groovy vs. Kotlin build script language checks that the regexes recognising Android dependencies and versions work for both build script kinds.

Wrapper present vs. absent exercises the autobuilder logic that guesses an appropriate Gradle version and sets it up in the event the Gradle wrapper isn't provided.
2023-01-21 11:57:53 +00:00
Mathias Vorreiter Pedersen
e664662df9 Merge pull request #11944 from github/post-release-prep/codeql-cli-2.12.1
Post-release preparation for codeql-cli-2.12.1
2023-01-20 21:52:55 +00:00
github-actions[bot]
b62cb6ba84 Post-release preparation for codeql-cli-2.12.1 2023-01-20 19:49:56 +00:00
Arthur Baars
2b9bc3c7e3 Ruby: write errors to json log 2023-01-20 20:11:55 +01:00
Sarita Iyer
f5406570f7 Merge pull request #11817 from github/saritai/docs-contributing-info
Add CONTRIBUTING.MD file for contributing to docs
2023-01-20 12:41:20 -05:00
Geoffrey White
f05be77a0b Swift: Recognize more array sources. 2023-01-20 15:25:00 +00:00
Geoffrey White
7648e8f6a3 Swift: Recognize more sources. 2023-01-20 15:08:12 +00:00
Jean Helie
9e6f9c2705 Merge pull request #11709 from github/jhelie/add-shell-command-injection
ATM: add boosted version for `ShellCommandInjectionFromEnvironment` query
2023-01-20 16:03:30 +01:00
Geoffrey White
581c478872 Swift: Model RNCryptor. 2023-01-20 14:50:23 +00:00
Geoffrey White
bb59d055ff Swift: Add tests for RNCryptor library. 2023-01-20 14:50:21 +00:00
Mathias Vorreiter Pedersen
3059ce3070 Merge pull request #11938 from github/release-prep/2.12.1
Release preparation for version 2.12.1
2023-01-20 14:30:42 +00:00
Alex Ford
8ae993185c Ruby: fix missing docs 2023-01-20 13:40:19 +00:00
Alex Ford
c986ea1070 Ruby: scope local_assigns synthetic globals to both render call and template file 2023-01-20 13:40:19 +00:00
Alex Ford
14c896215c Ruby: factor out some RenderCall methods into a helper module 2023-01-20 13:40:19 +00:00
Alex Ford
03070c9fd0 Ruby: restrict AccessLocalsKeySummary to method calls against self 2023-01-20 13:40:19 +00:00
Alex Ford
f6516db105 Ruby: correct preservesValue in AccessLocalsKeySummary 2023-01-20 13:40:19 +00:00
Alex Ford
ab72301a4c Ruby: add a change note for rails render locals dataflow 2023-01-20 13:40:19 +00:00
Alex Ford
8fec4b804f Ruby: StoredXSS test whitespace change 2023-01-20 13:40:19 +00:00
Alex Ford
fd8dd5e103 Ruby: update StoredXSS test output 2023-01-20 13:40:19 +00:00
Alex Ford
8845157d08 Ruby: slightly limit AccessLocalsKeySummary summarized callables 2023-01-20 13:40:19 +00:00
Alex Ford
b5cc1087fe Ruby: add LocalAssignsHashSyntheticGlobal#getARenderCall predicate 2023-01-20 13:40:19 +00:00
Alex Ford
022171923c Ruby: fix some ql for ql alerts 2023-01-20 13:40:19 +00:00
Alex Ford
bea110b598 Ruby: remove blank line in test file 2023-01-20 13:40:19 +00:00
Alex Ford
b78ae1608e Ruby: remove a fixed TODO 2023-01-20 13:40:19 +00:00
Alex Ford
e5fbc92856 Ruby: generalize rails flow step for accessing render locals hash in view 2023-01-20 13:40:19 +00:00
Alex Ford
e4df1f5a6f Ruby: add missing toString case for synthetic globals 2023-01-20 13:31:43 +00:00
Jeroen Ketema
cddaa0c8fa Apply suggestions from code review 2023-01-20 14:10:27 +01:00
Michael Nebel
4d321d6833 C#: Add upgrade and downgrade scripts. 2023-01-20 13:39:41 +01:00
Michael Nebel
6c7c0854d1 C#: Add change note. 2023-01-20 13:39:41 +01:00
Michael Nebel
5a1e96d671 C#: Update string literal test query and expected output. 2023-01-20 13:39:41 +01:00
Michael Nebel
5c5d330704 C#: Add UTF-8 encoded string test case. 2023-01-20 13:39:41 +01:00
Michael Nebel
20398f1299 C#: Add PrintAst testcase for C# 11 test code. 2023-01-20 13:39:41 +01:00
Michael Nebel
c52dbcbb52 C#: Update all PrintAst test expected output. 2023-01-20 13:39:41 +01:00
Michael Nebel
c87668a91d C#: Library support for string UTF8/UTF16 encodings. 2023-01-20 13:39:41 +01:00
Michael Nebel
e8eedb7b4d C#: Extractor support for UTF-8 encoded strings. 2023-01-20 13:39:41 +01:00
Michael Nebel
72fa3bd905 C#: Add test cases for raw string literals. 2023-01-20 13:39:41 +01:00
Michael Nebel
3b93cd45ea C#: Extract the ValueText instead of Text for interpolated string literals as this contains the value after eg. indentation processing. 2023-01-20 13:39:41 +01:00
Michael Nebel
ad20e81d05 C#: Add test for interpolated strings, where newlines are used in the provided expression. 2023-01-20 13:39:41 +01:00
Philip Ginsbach
3998c9a89a document the existence of a global QlBuiltins module 2023-01-20 12:16:24 +00:00
Philip Ginsbach
127b1ac114 update handbook and reference with signature namespaces 2023-01-20 12:16:22 +00:00
github-actions[bot]
005b3e4a47 Release preparation for version 2.12.1 2023-01-20 12:03:19 +00:00
Geoffrey White
976b0401be Merge pull request #11876 from geoffw0/coredata
Swift: Improve Core Data sinks for swift/cleartext-storage-database
2023-01-20 11:02:03 +00:00
Harry Maclean
16baea22c0 Ruby: doc fix
Co-authored-by: Alex Ford <alexrford@users.noreply.github.com>
2023-01-20 22:06:29 +13:00
Paolo Tranquilli
1c086aae7c Swift: add internal imports to ParentChild.qll 2023-01-20 09:59:36 +01:00
Ian Lynagh
05c80b3f3c Merge pull request #11894 from igfoo/igfoo/make-private
Kotlin: Make a couple of functions private
2023-01-19 20:59:32 +00:00
Sarita Iyer
3a8479614b fix link 2023-01-19 15:13:34 -05:00
Paolo Tranquilli
e840b8f707 Swift: add and fix some schema.py documentation 2023-01-19 18:07:47 +01:00
Ian Lynagh
c2d5281e73 Merge pull request #11930 from igfoo/igfoo/fetch-codeql
CI: fetch-codeql: Set $CODEQL_FETCHED_CODEQL_PATH in the enivironment
2023-01-19 15:33:08 +00:00
Sarita Iyer
a83a98226c Update README.rst 2023-01-19 09:45:43 -05:00
Sarita Iyer
27a5051282 Update README.md 2023-01-19 09:45:01 -05:00
Sarita Iyer
894a494186 Apply suggestions from code review
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2023-01-19 09:39:55 -05:00
Paolo Tranquilli
c2c14cdddb Merge pull request #11929 from github/redsun82/swift-expand-ref-in-auto-docs
Swift: expand `ref` in autogenerated docs
2023-01-19 15:24:05 +01:00
Michael B. Gale
14cc27e49b Merge pull request #11910 from owen-mc/go/log-injection-sanitizer-newreplacer-replace
Add missing string replacement sanitizers to log-injection and string-break
2023-01-19 14:23:03 +00:00
Michael Nebel
dc223cb82e Sync files and make corresponding changes for other languages. 2023-01-19 15:14:06 +01:00
Chris Smowton
9a5e1f5e28 Make import private 2023-01-19 14:10:17 +00:00
Michael Nebel
9cd1dc70e5 C#: Remove the Csv postfix of some predicates. 2023-01-19 15:02:52 +01:00
Owen Mansel-Chan
13d1c88a11 Make new data flow copy for StringOps.StringsNewReplacer 2023-01-19 13:05:31 +00:00
Arthur Baars
d5e60dfb22 Ruby: pass diagnostics::LogWriter to extractor 2023-01-19 13:53:56 +01:00
Geoffrey White
62125fa767 Swift: Explanatory comments. 2023-01-19 11:55:16 +00:00
Ian Lynagh
3a5bec5778 CI: fetch-codeql: Set $CODEQL_FETCHED_CODEQL_PATH in the enivironment 2023-01-19 11:37:05 +00:00
Geoffrey White
2875d8645c Swift: Cover additional edge case. 2023-01-19 11:34:07 +00:00
Geoffrey White
4c47de58c1 Swift: Add a few more test cases. 2023-01-19 11:27:44 +00:00
Geoffrey White
5f8875ff89 Swift: give variables more helpful names. 2023-01-19 10:31:23 +00:00
Geoffrey White
b033114f64 Swift: sources in extension protocols. 2023-01-19 10:04:04 +00:00
Paolo Tranquilli
57ec5db1a9 Merge branch 'main' into redsun82/swift-linkage-awareness 2023-01-19 10:49:33 +01:00
Paolo Tranquilli
490bd051cd Swift: expand ref in autogenerated docs 2023-01-19 09:27:44 +00:00
Michael Nebel
e6aebd9df0 Merge pull request #11814 from michaelnebel/csharp/genericattributes
C# 11: Generic attributes
2023-01-19 07:35:17 +01:00
Erik Krogh Kristensen
ee9b01b5e6 Apply suggestions from code review
Co-authored-by: Alex Ford <alexrford@users.noreply.github.com>
2023-01-18 22:14:46 +01:00
Mark Vogelgesang
a3ff0725a3 Removed change-note as it was not necessary 2023-01-18 16:08:29 -05:00
Mark Vogelgesang
e50a81cbb7 Merge branch 'main' into express-rate-limit 2023-01-18 14:44:29 -05:00
Mark Vogelgesang
c9119848d9 Updated express-rate-limit example to match implementation examples found on packages README 2023-01-18 14:42:40 -05:00
Mathias Vorreiter Pedersen
14468b64fb Merge pull request #11924 from atorralba/atorralba/optbinding-getters
Swift: Support more CFG node types in optional binding flow
2023-01-18 16:37:11 +00:00
Owen Mansel-Chan
3fda9f6e65 Add change note 2023-01-18 15:42:42 +00:00
Arthur Baars
e85e61b6d7 Ruby: add diagnostics module 2023-01-18 16:28:16 +01:00
Owen Mansel-Chan
30f0dd8c03 Add string replacement sanitizer to log injection 2023-01-18 15:24:39 +00:00
Owen Mansel-Chan
015ef4c3ef Add use of strings.Replacer to replace sanitizer 2023-01-18 15:20:14 +00:00
Owen Mansel-Chan
2b1a7898d9 Move ReplaceAll sanitizer to shared code 2023-01-18 15:12:52 +00:00
AlexDenisov
5173f10e68 Merge pull request #11925 from github/alexdenisov/swift-drop-dead-code
Swift: drop dead code
2023-01-18 16:10:25 +01:00
Alex Denisov
35620c4c86 Swift: drop dead code 2023-01-18 15:35:40 +01:00
Mathias Vorreiter Pedersen
e26e83b8df Merge pull request #11728 from github/rdmarsh2/parameterize-range-analysis
C++: Parameterize the semantic range analysis
2023-01-18 14:22:35 +00:00
Geoffrey White
5d6f2436e4 Merge branch 'main' into coredata 2023-01-18 13:39:02 +00:00
Tony Torralba
90517e254a Accept test expectation changes 2023-01-18 13:25:04 +01:00
Mathias Vorreiter Pedersen
48439bc252 Merge pull request #11905 from geoffw0/rncrypt
Swift: Add RNCryptor sinks to swift/constant-password
2023-01-18 11:43:23 +00:00
Tony Torralba
d75a5212b2 Support more CFG node types in optional binding flow 2023-01-18 12:42:44 +01:00
Tony Torralba
4a89a30abd Add failing test 2023-01-18 12:41:59 +01:00
Mathias Vorreiter Pedersen
c8bcfb77b2 Merge pull request #11836 from geoffw0/optbinding
Swift: Data flow through optional binding
2023-01-18 11:25:27 +00:00
Geoffrey White
71c1ca53a9 Merge branch 'main' into rncrypt 2023-01-18 11:09:09 +00:00
erik-krogh
e4d4873d0d remove the dataflow copy for regexp tracking now that type-tracking is used 2023-01-18 11:04:51 +01:00
Michael Nebel
4c94adb5ec C#: Add change note. 2023-01-18 10:50:04 +01:00
Michael Nebel
3846349ba0 C#: Add testcase for CIL generic attribute extraction. 2023-01-18 10:49:44 +01:00
Michael Nebel
821d294be8 C#: Add library support for CIL generic attributes. 2023-01-18 10:49:44 +01:00
Michael Nebel
5ff89a2ccf C#: Update expected test output for printing of constructed generic CIL types. 2023-01-18 10:49:44 +01:00
Michael Nebel
8b231c51f9 C#: Improve printing of constructed generic CIL types. 2023-01-18 10:49:44 +01:00
Michael Nebel
b680795d15 C#: The generic attribute type is a constructed class. 2023-01-18 10:49:44 +01:00
Michael Nebel
62e7c22783 C#: Add generic attribute test and expected results. 2023-01-18 10:48:30 +01:00
Michael Nebel
211af1943c C#: Library support for generic attributes. 2023-01-18 10:48:30 +01:00
Michael Nebel
3a4623b437 Merge pull request #11907 from michaelnebel/csharp/cil/attributes
C#: CIL attributes
2023-01-18 10:46:34 +01:00
Rasmus Wriedt Larsen
e0ccb9306a Merge pull request #11908 from RasmusWL/dataflow-consistency-more-excludes
DataFlow: Add `uniqueParameterNodePositionExclude`
2023-01-18 10:44:51 +01:00
AlexDenisov
8910ba4f32 Merge pull request #11919 from github/redsun82/swift-obsolete-conf
Swift: remove obsolete configuration fields
2023-01-18 10:34:24 +01:00
erik-krogh
1477974bf1 the RegexExecution concept does not need to have getTerm() 2023-01-18 10:10:36 +01:00
erik-krogh
1a3c9c8305 improve performance of regular-expression type-tracking by adding an exploratory initial analysis 2023-01-18 10:10:36 +01:00
erik-krogh
b8f6feb68b delete old test 2023-01-18 10:10:36 +01:00
erik-krogh
45316b6381 rename RegExpConfiguration to RegExpTracking 2023-01-18 10:10:36 +01:00
erik-krogh
25e65e0d9f rewrite the regexp tracking DataFlow::Configuration to TypeTracking 2023-01-18 10:10:36 +01:00
erik-krogh
d0b627b018 move the implementation detail of how regular-expressions are tracked into RegExpConfiguration.qll" 2023-01-18 10:10:05 +01:00
Paolo Tranquilli
f383fd1dc1 Swift: introduce module disambuigation via linkage awareness 2023-01-18 10:07:46 +01:00
Paolo Tranquilli
d7feb001be Swift: prepare extractSwiftInvocation 2023-01-18 10:07:46 +01:00
Paolo Tranquilli
a3b4c32f07 Swift: stamp all named declarations with an id-ref to the containing module 2023-01-18 10:07:46 +01:00
Paolo Tranquilli
f7a046ccd2 Swift: add trap linkage awareness infrastructure 2023-01-18 10:07:46 +01:00
Paolo Tranquilli
5fdb09380c Swift: move TargetTrapDomain to TargetDomains in infra 2023-01-18 10:07:46 +01:00
Paolo Tranquilli
7f389b9f9a Swift: introduce TrapType 2023-01-18 10:07:46 +01:00
Paolo Tranquilli
353536b826 Swift: collect original output module paths 2023-01-18 10:07:46 +01:00
Paolo Tranquilli
84b285a4c6 Swift: collect source files 2023-01-18 10:07:46 +01:00
Paolo Tranquilli
33c4a8233c Swift: collect encountered modules 2023-01-18 10:07:46 +01:00
Paolo Tranquilli
c7f13f1036 Swift: collect TRAP files related to an extractor run
In order to do this a mutable `SwiftExtractorState` is introduced.
2023-01-18 10:07:46 +01:00
Paolo Tranquilli
c31c515205 Swift: move TargetFile as managed inside TrapDomain 2023-01-18 10:07:46 +01:00
Paolo Tranquilli
20eaa34485 Swift: failing tests for linkage awareness 2023-01-18 10:07:46 +01:00
Tony Torralba
c8e894b854 Merge pull request #11917 from github/workflow/coverage/update
Update CSV framework coverage reports
2023-01-18 10:02:22 +01:00
erik-krogh
f516ccb4e2 limit the fieldFlowBranchLimit for the regexp tracker to improve performance 2023-01-18 09:31:04 +01:00
erik-krogh
2fceee4e35 track regular expressions that gets compiled with Regexp.compile 2023-01-18 09:31:04 +01:00
erik-krogh
acf28ebd98 add a RegexExecution, and use it to track regular expressions to their uses in a nice way in rb/polynomial-redos 2023-01-18 09:31:04 +01:00
erik-krogh
6e33dd5df6 add failing test 2023-01-18 09:31:04 +01:00
Erik Krogh Kristensen
1a64393c4c Merge pull request #11893 from erik-krogh/csharpIndexFiles
C#: add --working-dir=. to pre-finalize
2023-01-18 09:05:29 +01:00
Paolo Tranquilli
2c4c2dfeb3 Swift: remove obsolete configuration fields 2023-01-18 08:55:59 +01:00
Michael Nebel
8e3e6505ad C#: Add change note. 2023-01-18 07:56:24 +01:00
github-actions[bot]
571942fb21 Add changed framework coverage reports 2023-01-18 00:17:19 +00:00
Jeroen Ketema
6cd52237c3 Merge pull request #11913 from jketema/test-fixes
C++: Some minor test fixes
2023-01-17 21:52:57 +01:00
erik-krogh
4b74dec18f expand what is parsed as the stem of a pathexpr 2023-01-17 21:28:21 +01:00
yoff
5a82012d03 Merge pull request #11854 from yoff/python/fix-tarslip-improv-bug
Python: fix bug  in `py/tarslip-extended`
2023-01-17 20:44:06 +01:00
Geoffrey White
a568d0af7f Swift: Remove unused variable. 2023-01-17 18:10:02 +00:00
Geoffrey White
b3d30bfc4f Swift: Add NumberLiteral sources as well. 2023-01-17 18:04:26 +00:00
Jeroen Ketema
ee19c3d80f C++: Rename identically named classes in syntax-zoo
Conceptually the test that comprises the whole of `syntax-zoo` forms one
single binary. To this binary ODR applies. There were two class definitions
`Foo` in `syntax-zoo`, violating ODR. Rename those classes to have different
names.
2023-01-17 19:02:40 +01:00
Jeroen Ketema
06767c6760 C++: Split bad_asts.cpp IR test into two files
The statements from `errorExpr` - which does not parse correctly - affected the
tuples that were being generated for the other code in `bad_asts.cpp` due to
the way the front-end handles parse errors. This did not affect the test
results, but was also not the intention of the test. Split off `errorExpr` into
a separate file.
2023-01-17 18:57:29 +01:00
Geoffrey White
d1cfdb97ee Swift: Model RNCryptor. 2023-01-17 17:55:52 +00:00
Sarita Iyer
c8298356dc Rename CONTRIBUTING.MD to CONTRIBUTING.md 2023-01-17 12:32:36 -05:00
Geoffrey White
a92e1c7ea0 Swift: Add tests for RNCryptor library. 2023-01-17 17:31:49 +00:00
Geoffrey White
5e5c4e9a8c Swift: Accept QL-for-QL recommendation. 2023-01-17 16:25:34 +00:00
Geoffrey White
9911dd53e1 Merge branch 'main' into coredata 2023-01-17 16:22:53 +00:00
Geoffrey White
ea06ad1933 Merge pull request #11529 from geoffw0/format
Swift: Uncontrolled format string query
2023-01-17 16:16:10 +00:00
Geoffrey White
3c55cdd5be Swift: Catch the last two test results as well. 2023-01-17 16:04:58 +00:00
Geoffrey White
d42848bb7e Swift: Upgrade the query from dataflow to taint tracking, so as to support more flows. 2023-01-17 16:04:58 +00:00
Geoffrey White
28a707a956 Swift: Model RNCryptor. 2023-01-17 16:04:58 +00:00
Geoffrey White
a8ef9cc987 Swift: Add tests for RNCryptor library. 2023-01-17 16:04:57 +00:00
Edward Minnix III
4c018759c8 Merge pull request #11283 from egregius313/egregius313/webview-setAllowContentAccess
Java: Android WebView Content Access Query
2023-01-17 11:02:47 -05:00
Michael Nebel
62533501fe C#: Update CIL attributes test case and the expected output. 2023-01-17 17:00:01 +01:00
Geoffrey White
54b3262d9c Merge pull request #11891 from geoffw0/authbypass
C++: Fix issue with cpp/user-controlled-bypass
2023-01-17 15:43:08 +00:00
Jami
babdee36aa Merge pull request #11779 from jcogs33/jcogs33/model-more-top-jdk-apis
Java: model top JDK APIs
2023-01-17 10:20:32 -05:00
Geoffrey White
d628cc5ab8 Update cpp/ql/src/Security/CWE/CWE-290/AuthenticationBypass.ql
Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
2023-01-17 14:37:19 +00:00
erik-krogh
8251ad5e99 add unsafe-html-construction query 2023-01-17 15:35:17 +01:00
erik-krogh
8715790fe7 add explicit this 2023-01-17 15:17:48 +01:00
Geoffrey White
037b49b454 Update swift/ql/test/query-tests/Security/CWE-259/rncryptor.swift
Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
2023-01-17 14:16:52 +00:00
Paolo Tranquilli
6b43ff45a4 Merge pull request #11904 from github/redsun82/swift-extension-protocols
Swift: extract `ExtensionDecl` protocols
2023-01-17 15:16:20 +01:00
Paolo Tranquilli
d9bd41b8b1 Merge pull request #11571 from github/redsun82/swift-open-redirection
Swift: generalize open redirection on both platforms and rework output rewriting
2023-01-17 15:15:56 +01:00
Jami Cogswell
10f0975812 Java: remove models for System.[get|set]Property 2023-01-17 08:51:48 -05:00
erik-krogh
a562568522 add string concat as a sink for command-construction 2023-01-17 14:48:09 +01:00
erik-krogh
9d9de18bc9 add a generalized AddExprRoot into Operation.qll 2023-01-17 14:48:08 +01:00
erik-krogh
8fc3b268e8 add string concat as a sink for code-construction 2023-01-17 14:48:06 +01:00
Paolo Tranquilli
9e5db7c6ec Merge branch 'main' into redsun82/swift-extension-protocols 2023-01-17 14:39:09 +01:00
Michael Nebel
5f57a097ab C#: CIL method attribute extraction. 2023-01-17 14:17:35 +01:00
Michael Nebel
951f6362aa Merge pull request #11825 from michaelnebel/csharp/genericmathsupport
C# 11: Support for static virtual and static abstract interface members.
2023-01-17 14:14:02 +01:00
Rasmus Wriedt Larsen
a0b1c2ea79 DataFlow: Add uniqueParameterNodePositionExclude 2023-01-17 14:05:22 +01:00
Rasmus Wriedt Larsen
2b0a5fd5d1 DataFlow: Add uniqueParameterNodeAtPositionExclude 2023-01-17 14:05:17 +01:00
Erik Krogh Kristensen
2e4f4c64fe Merge pull request #11903 from erik-krogh/revertClap
QL: Revert "update clap to 3.0 in QL-for-QL"
2023-01-17 13:29:04 +01:00
Paolo Tranquilli
0a792f2f61 Swift: add upgrade and downgrade scripts for ExtensionDecl new protocols property 2023-01-17 13:07:02 +01:00
Paolo Tranquilli
0d32f00020 Swift: update ExtensionDecl test results 2023-01-17 12:58:02 +01:00
Paolo Tranquilli
d6e0ef9ff9 Swift: extract ExtensionDecl protocols 2023-01-17 12:56:09 +01:00
Paolo Tranquilli
f6e26211f9 Swift: add protocols to ExtensionDecl schema 2023-01-17 12:54:50 +01:00
Geoffrey White
74a37475db Swift: Model RNCryptor. 2023-01-17 11:54:12 +00:00
Mathias Vorreiter Pedersen
44ebc77ada Update cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysisSpecific.qll 2023-01-17 11:52:43 +00:00
Paolo Tranquilli
8906e101cb Swift: add ExtensionDecl QL test 2023-01-17 12:49:53 +01:00
erik-krogh
5a4fe71529 Revert "update clap to 3.0 in QL-for-QL"
This reverts commit d072ed969e.
2023-01-17 12:38:30 +01:00
Erik Krogh Kristensen
50b9f5bba0 Merge pull request #11892 from erik-krogh/clap
QL: update clap to 3.0 in QL-for-QL
2023-01-17 12:33:18 +01:00
Jean Helie
fec7ea6964 ATM: add missing query help files 2023-01-17 12:20:17 +01:00
Jean Helie
b08fa43fdf update tests 2023-01-17 12:20:17 +01:00
Jean Helie
f07984bab2 update test data 2023-01-17 12:20:17 +01:00
Jean Helie
13aaa22df5 add bosted version of ShellCommandInjectionFromEnvironment 2023-01-17 12:20:17 +01:00
Mathias Vorreiter Pedersen
77a9cea737 Merge pull request #11901 from github/redsun82/swift-ql-internal
Swift: introduce `@ql.internal` pragma for classes
2023-01-17 10:46:56 +00:00
Paolo Tranquilli
67bd8cba32 Merge pull request #11900 from github/alexdenisov/swift-ignore-lsregister
Swift: do not trace lsregister
2023-01-17 11:26:22 +01:00
Chris Smowton
29425982a5 Merge pull request #11899 from ataillefer/patch-1
Fix partial path traversal Java example
2023-01-17 09:39:36 +00:00
Paolo Tranquilli
6106edd5e2 Swift: add INTERNAL doc marker to ql.internal classes 2023-01-17 10:30:59 +01:00
Paolo Tranquilli
b22da25e05 Swift: remove ql.internal classes from global import 2023-01-17 10:18:03 +01:00
Paolo Tranquilli
48825442c3 Swift: add ql.internal pragma in schema definitions 2023-01-17 10:10:35 +01:00
Paolo Tranquilli
cdc99b5240 Swift: simplify pragma definition 2023-01-17 10:10:02 +01:00
Geoffrey White
449ebb8a12 Swift: Add tests for RNCryptor library. 2023-01-17 09:03:07 +00:00
Paolo Tranquilli
e3502e2e5f Merge branch 'main' into redsun82/swift-open-redirection 2023-01-17 09:43:00 +01:00
Alex Denisov
63b4e5ef5c Swift: do not trace lsregister 2023-01-17 09:26:31 +01:00
Erik Krogh Kristensen
51bd1ef1e1 Merge pull request #11884 from erik-krogh/qlWin
QL/Ryby: fix qltest on Windows
2023-01-16 21:57:01 +01:00
Antoine Taillefer
660e6d7085 Fix partial path traversal Java example
The Java recommendation example for the "Partial path traversal vulnerability from remote" query doesn't seem right to me. Indeed, the following statement doesn't compile, since `dir.getCanonicalPath()` returns a String:
```
dir.getCanonicalPath().toPath()
```
Maybe the author wanted to state `dir.getCanonicalFile().toPath()`, which would compile, but is useless compared to `dir.getCanonicalPath()`.

Moreover, `parent.getCanonicalFile().toPath()` or `parent.getCanonicalPath()` will **not** be slash-terminated, contrary to what the description says.
From what I can see (and test), the correct fix is to concatenate `File.separator` to the parent canonical path.
2023-01-16 21:14:29 +01:00
erik-krogh
dcc1c3d487 add --working-dir=. to pre-finalize for c# 2023-01-16 18:09:00 +01:00
Ian Lynagh
17de5c120a Kotlin: Make a couple of functions private 2023-01-16 15:29:14 +00:00
Tony Torralba
bd5619147d Merge pull request #11590 from atorralba/atorralba/swift/sensitive-info-logs
Swift: Add Cleartext Logging query
2023-01-16 16:22:20 +01:00
erik-krogh
713599963b add --working-dir to Ruby qltest.cmd to fix Windows 2023-01-16 15:37:35 +01:00
erik-krogh
9e153cfb0d change the Ruby-build test such that Windows fails 2023-01-16 15:37:35 +01:00
erik-krogh
587adea809 QL: add --working-dir to qltest.cmd to fix qltest 2023-01-16 15:37:14 +01:00
erik-krogh
2c1ecb507d fix windows 2023-01-16 15:36:57 +01:00
erik-krogh
1de65131fe add compilation cache to QL-for-QL tests 2023-01-16 15:36:57 +01:00
erik-krogh
0685732e3f delete ql/ specific format step now that we have an all-languages format check 2023-01-16 15:36:57 +01:00
erik-krogh
1d62751e15 test QL-for-QL on mac/win 2023-01-16 15:36:55 +01:00
Tony Torralba
0017461e2d Update swift/ql/src/queries/Security/CWE-312/CleartextLogging.ql
Co-authored-by: Ben Ahmady <32935794+subatoi@users.noreply.github.com>
2023-01-16 15:35:58 +01:00
Tony Torralba
cca6a13fbb Update java/ql/src/Security/CWE/CWE-927/SensitiveResultReceiver.qhelp 2023-01-16 14:21:03 +01:00
Michael Nebel
8981d4c06b C#: Add change note. 2023-01-16 13:43:26 +01:00
Michael Nebel
2f602a629f C#: Add upgrade and downgrade scripts. 2023-01-16 13:27:37 +01:00
Erik Krogh Kristensen
8ccc384043 Merge pull request #11858 from erik-krogh/moreSpawn
JS: track shell:true more in js/shell-command-constructed-from-input
2023-01-16 13:24:50 +01:00
Erik Krogh Kristensen
59a8b21851 Merge pull request #10862 from erik-krogh/unsafeCodeConstruction
Rb: Add an `unsafe-code-construction` query
2023-01-16 13:22:58 +01:00
Michael Nebel
3552a41552 C#: Add test case for static abstract and static virtual interface members. 2023-01-16 13:07:50 +01:00
Michael Nebel
dc50b6bad3 C#: Support for operators in implements relations. 2023-01-16 13:07:50 +01:00
Michael Nebel
8c2931cbb8 C#: Operators are now allowed to be declared virtual. 2023-01-16 13:07:50 +01:00
erik-krogh
d072ed969e update clap to 3.0 in QL-for-QL 2023-01-16 12:34:56 +01:00
Paolo Tranquilli
874fe2b8f9 Swift: introduce an in-memory file hash cache
File hashing is now done internally in `SwiftFileInterception` (and
exported as a `getHashOfRealFile` function for future use in linkage
awareness), and using a per-process in-memory cache. The persistent
caching of paths is removed, so the solution is now robust against input
file changes during the build.

For the same reason, the hash to artifact mapping have the symlinks
reversed now. The artifacts themselves are stored using the hash as
filenames, and the original paths of the artifacts are reacreated in the
scratch dir with symlinks mostly for debugging purposes (to understand
what artifact each hash corresponds to, and to follow what was built by
the extractor).
2023-01-16 12:05:36 +01:00
Tony Torralba
fdb3b65bce Apply suggestions from code review
Co-authored-by: Ben Ahmady <32935794+subatoi@users.noreply.github.com>
2023-01-16 11:57:37 +01:00
Tony Torralba
7f880a24df Merge pull request #11886 from jelaiw/jelaiw-patch-1
Fix small typo in good/bad code sample.
2023-01-16 09:43:23 +01:00
Paolo Tranquilli
738412260f Merge branch 'main' into redsun82/swift-open-redirection 2023-01-16 09:09:10 +01:00
jelaiw
cf7189bb28 Fix small typo in good/bad code sample. 2023-01-13 19:16:11 -06:00
Geoffrey White
1a416884d4 C++: Do something similar with the other three cases. 2023-01-14 00:09:01 +00:00
Geoffrey White
316117f5c9 C++: Reduce number of regexps. 2023-01-13 18:50:41 +00:00
Geoffrey White
2f09f0e2c1 C++: Turn the huge list into a predicate. 2023-01-13 18:47:18 +00:00
Geoffrey White
13ae15b867 C++: Add tests for more edge cases. 2023-01-13 18:38:29 +00:00
Jami Cogswell
fb6725ddaa Java: add WithoutElement comment for clear methods 2023-01-13 13:20:45 -05:00
Mathias Vorreiter Pedersen
2dbacbc302 Merge pull request #11841 from MathiasVP/swift-add-integral-types
Swift: Add integral type classes
2023-01-13 17:30:57 +00:00
Robert Marsh
601b43ac0a Merge branch 'main' into rdmarsh2/parameterize-range-analysis
Conflicting change to boundedPhiInp copied to RangeAnalysisStage.qll
2023-01-13 12:06:21 -05:00
Geoffrey White
c9a0067705 Swift: Remove flow in cases with multiple variables. 2023-01-13 16:37:23 +00:00
Mathias Vorreiter Pedersen
c5038ed281 Merge pull request #11883 from MathiasVP/fold-definitions
C++: Fix bad join in `definitionOf`
2023-01-13 16:28:26 +00:00
Mathias Vorreiter Pedersen
6e6f2115c0 Merge pull request #11857 from MathiasVP/speedup-missing-check-scanf
C++: Speedup `cpp/missing-check-scanf`
2023-01-13 16:11:16 +00:00
Geoffrey White
2c35af51cd Swift: Move logic into Ssa::WriteDefinition.assigns. 2023-01-13 15:19:33 +00:00
Geoffrey White
8a77906296 Swift: Use Ssa::Definition rather than ConcreteVarDecl. 2023-01-13 15:01:20 +00:00
Michael Nebel
2d46272295 Merge pull request #11881 from michaelnebel/java/modeldiffignore
Java: Ignore missing html artifacts in the Model Diff workflow.
2023-01-13 14:11:19 +01:00
Michael Nebel
b36be009d4 Merge pull request #11834 from michaelnebel/csharp/operators
C# 11: Extractor and library support for Unsigned right shift.
2023-01-13 13:21:02 +01:00
erik-krogh
71af8ab022 simplifications inspired by review 2023-01-13 13:18:52 +01:00
Mathias Vorreiter Pedersen
2283eacc0b C++: Fix bad join in 'definitionOf'. 2023-01-13 11:42:15 +00:00
Mathias Vorreiter Pedersen
59072f9e81 C++: Improve QLDoc. 2023-01-13 11:01:23 +00:00
Mathias Vorreiter Pedersen
dd8bead21a C++: Fix spurious backticks. 2023-01-13 10:57:44 +00:00
Mathias Vorreiter Pedersen
cf9998b932 Merge pull request #5 from geoffw0/integraltypes
Swift: Work on integral type classes
2023-01-13 10:01:23 +00:00
Arthur Baars
5865b51a94 Ruby: build extractor using cross 2023-01-13 10:25:27 +01:00
Arthur Baars
dc6f5f60d1 Ruby: update stats 2023-01-13 10:22:42 +01:00
Arthur Baars
28c9b52dce Ruby: add change note 2023-01-13 10:22:42 +01:00
Arthur Baars
46063c7d04 Ruby: update expected output 2023-01-13 10:22:41 +01:00
Arthur Baars
c4ec674057 Ruby: support anonymous (hash)splat parameters/arguments 2023-01-13 10:22:41 +01:00
Arthur Baars
4d3e2bb814 Ruby: upgrade/downgrade scripts 2023-01-13 10:22:41 +01:00
Arthur Baars
290167e1a3 Ruby: re-generated dbscheme/library 2023-01-13 10:22:41 +01:00
Arthur Baars
3a887d1c92 Ruby: update tree-sitter-{ruby, embedded-template} 2023-01-13 10:22:41 +01:00
Charis Kyriakou
792d4a83f9 Rename VS Code Extension Run Query command 2023-01-13 08:46:35 +00:00
Michael Nebel
600412db48 Java: Ignore missing html artifacts. 2023-01-13 08:58:53 +01:00
Michael Nebel
3b15f2359b Merge pull request #11861 from michaelnebel/java/testmodeldiff
Java: Update the Model Difference workflow to use the `gh api`.
2023-01-13 08:20:18 +01:00
Jami Cogswell
a43f3cf95f Java: remove Supplier.get model 2023-01-12 17:09:13 -05:00
Jami Cogswell
f040ff2d8d Java: undo change to Function.apply test case 2023-01-12 17:01:58 -05:00
Robert Marsh
337a747bde C++: cleanup some unneeded code 2023-01-12 16:38:58 -05:00
Robert Marsh
b2b45237c6 C++: use rounding to prevent float wobble in range analysis 2023-01-12 16:38:57 -05:00
Robert Marsh
31b61b1aa6 C++: fix a join order in range analysis 2023-01-12 16:38:57 -05:00
Robert Marsh
938176c9da C++: update test QL for modulus and sign analysis
These now instantiate their respective parameterized modules. No
results change.
2023-01-12 16:38:56 -05:00
Robert Marsh
7586762b10 C++: fix ambiguous import warnings 2023-01-12 16:38:56 -05:00
Robert Marsh
488368ecde C++: private import for module params 2023-01-12 16:38:55 -05:00
Robert Marsh
23281410e3 C++: Make bounds import private to preserve API 2023-01-12 16:38:54 -05:00
Robert Marsh
6db728190e C++: autoformat 2023-01-12 16:38:36 -05:00
Robert Marsh
02f1957919 C++: make SemBound a RangeAnalysis parameter 2023-01-12 16:38:11 -05:00
Robert Marsh
71b93d125e C++: Make RangeAnalysis.qll expose the old API 2023-01-12 16:38:11 -05:00
Robert Marsh
fb1ef07e9f C++: more parameterized modules in range analysis
This makes the modulus analysis and sign analysis into parameterized
modules which are instantiated in the main range analysis module, and
makes RangeAnalysisSpecific and RangeUtils into parameters to the main
range analysis.
Some classes also need to be moved and made into `instanceof` extensions
because they'd otherwise be extending across parameterized module
boundaries.
2023-01-12 16:38:10 -05:00
Robert Marsh
c062d5e206 C++: move language specific predicates to LangParam 2023-01-12 16:38:10 -05:00
Robert Marsh
c10733f926 C++: fix float binding issue in range analysis 2023-01-12 16:38:09 -05:00
Robert Marsh
b8c43d7a71 C++: convert RangeAnalysis to float 2023-01-12 16:38:09 -05:00
Robert Marsh
eebada46b1 C++: rename to RagneAnalysisStage.qll 2023-01-12 16:38:08 -05:00
Robert Marsh
edbe95837f Convert RangeAnalysis to trivial parameterized mod 2023-01-12 16:38:08 -05:00
Jami Cogswell
c3a1d088ac Java: update change note 2023-01-12 16:32:52 -05:00
Jami Cogswell
a39b2aaaac Java: remove endsWith test case 2023-01-12 16:24:57 -05:00
Jami Cogswell
ffb267937a Java: add endsWith additionalTaintStep to ConditionalBypassFlowConfig 2023-01-12 16:24:05 -05:00
Sarita Iyer
4acd1ababe Update docs/codeql/CONTRIBUTING.MD
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2023-01-12 15:57:43 -05:00
Arthur Baars
af8cb65b2e Merge pull request #11877 from aibaars/ql-ql-cross
QL/Ruby: include OS version in cache keys for Rust binaries
2023-01-12 20:02:25 +01:00
Michael Nebel
fd80974210 Java: Download databases using the gh api instead of lgtm. 2023-01-12 19:30:12 +01:00
Michael Nebel
c1c0ff4308 C#: Update database stats. 2023-01-12 19:06:29 +01:00
Michael Nebel
1384aa669b C#: Add change note. 2023-01-12 19:06:29 +01:00
Michael Nebel
5e89119b3d C#: Add upgrade- and downgrade scripts for unsigned right shift operators. 2023-01-12 19:06:29 +01:00
Michael Nebel
529be7ef18 C++: Sync files. 2023-01-12 19:06:29 +01:00
Michael Nebel
5c466f3319 Java: Sync files and update other relavant files related to the new naming of shift. 2023-01-12 19:06:29 +01:00
Michael Nebel
49a87e152a C#: Add unsigned right shift operator test case. 2023-01-12 19:06:28 +01:00
Michael Nebel
30738103f0 C#: Add unsigned right shift operator class. 2023-01-12 19:06:28 +01:00
Michael Nebel
148dc6de5a C#: Rename shift operator classes. 2023-01-12 19:06:28 +01:00
Michael Nebel
f48eda829f C#: Rename some of the TBinarySignOperation constructors. 2023-01-12 19:06:28 +01:00
Michael Nebel
d92b226041 C#: Add test example for unsigned right shift assignment in intermediate representation. 2023-01-12 19:06:28 +01:00
Michael Nebel
5bb8f8ed5c C#: Support for unsigned shift right in the experimental intermediate representation. 2023-01-12 19:06:28 +01:00
Michael Nebel
f74c7c28ae C#: Auto format test file and update expected test output. 2023-01-12 19:06:28 +01:00
Michael Nebel
0f032c5be9 C#: Sign analysis testcase for unsigned right shift. 2023-01-12 19:06:28 +01:00
Michael Nebel
2568318460 C#: Sign analysis support for unsigned right shift. 2023-01-12 19:06:28 +01:00
Michael Nebel
d06a877709 C#: Introduce test cases and expected result for unsigned right shift. 2023-01-12 19:06:28 +01:00
Michael Nebel
9eb7933778 C#: Implement library support for unsigned right shift. 2023-01-12 19:06:28 +01:00
Michael Nebel
99b7bc3b73 C#: Implement extractor support for unsigned right shift. 2023-01-12 19:06:28 +01:00
Michael Nebel
14c92e6eb3 C#: Add expressions kind including dummy stats for unsigned right shift and unsigned right shift assigment. 2023-01-12 19:06:28 +01:00
Michael Nebel
902b0a60d0 C#: Fixup ShiftExpr rename. 2023-01-12 19:06:28 +01:00
Michael Nebel
36980bbf42 C#: Rename shift expression classes. 2023-01-12 19:06:27 +01:00
Michael Nebel
a9f1c95513 C#: Rename shift assignment expression classes. 2023-01-12 19:06:27 +01:00
Chris Smowton
8aa2c23ba8 Merge pull request #11700 from JLLeitschuh/doc/JLL/improve-java-unsafe-deserialization-documentation
[Java] Document fixes for deserialization vulnerabilities by framework
2023-01-12 18:04:13 +00:00
Chris Smowton
09d8a50494 Spelling 2023-01-12 17:46:00 +00:00
Michael Nebel
aefb43324b Merge pull request #11738 from michaelnebel/go/maddataextensions
Go: Models as Data using extensions.
2023-01-12 18:42:35 +01:00
Erik Krogh Kristensen
8f9ad1f5ba Merge pull request #11872 from erik-krogh/jsAst
JS: Fixup some problems in PrintAST
2023-01-12 16:56:56 +01:00
Geoffrey White
7f31c9c7e5 Swift: Add a test. 2023-01-12 15:19:57 +00:00
Jami Cogswell
e0444449c8 Java: remove Function.apply model 2023-01-12 09:58:53 -05:00
Arthur Baars
e29e077a03 Ruby/QL4QL: include OS version in cache keys 2023-01-12 15:47:10 +01:00
erik-krogh
7ae27bcc34 fix errors in JS printAst 2023-01-12 15:37:52 +01:00
Henry Mercer
15ead6d0e6 Merge pull request #11864 from github/codeql-ci/atm/release-0.4.5
JS: Bump version numbers of ML-powered packs after 0.4.5 release
2023-01-12 13:51:24 +00:00
Jami
c725c447ac Merge branch 'main' into jcogs33/update-paramsString 2023-01-12 08:24:57 -05:00
Henry Mercer
70f1015fba Merge branch 'main' into codeql-ci/atm/release-0.4.5 2023-01-12 12:32:25 +00:00
Ian Lynagh
9ebe59d353 Merge pull request #11637 from igfoo/igfoo/kotlin-1.8
Kotlin: Add 1.8 support
2023-01-12 12:15:00 +00:00
Geoffrey White
3d1b2fdbda Swift: Rename NumericOrCharType.qll -> Numer> NumericType.qll. 2023-01-12 11:46:51 +00:00
Joe Farebrother
e12febfd96 Add change note 2023-01-12 11:44:39 +00:00
Joe Farebrother
b565f997a0 Improve qhelp 2023-01-12 11:44:39 +00:00
Joe Farebrother
639c42c9e9 Fix qhelp errors and ql-for-ql errors 2023-01-12 11:44:39 +00:00
Joe Farebrother
f52db7f9a3 Add qhelp 2023-01-12 11:44:39 +00:00
Joe Farebrother
a88759283a Fix typo in qldoc 2023-01-12 11:44:39 +00:00
Joe Farebrother
7e7b5b4488 Improve test case 2023-01-12 11:44:39 +00:00
Joe Farebrother
8449dabefe Add qldoc 2023-01-12 11:44:39 +00:00
Joe Farebrother
de565f9ccc Add test and fix a bug 2023-01-12 11:44:39 +00:00
Joe Farebrother
b96edb9c64 Add Sensitive Result Receiver query 2023-01-12 11:44:39 +00:00
Geoffrey White
418d593a97 Swift: Replace NumericOrCharType with a more basic NumericType, and rename classes for consistency with other static languages. 2023-01-12 11:43:20 +00:00
Geoffrey White
d0eb167d47 Swift: Merge FloatingPointType.qll into NumericOrCharType.qll, because it is a numeric type and other stuff like CharacterType is there. 2023-01-12 11:42:36 +00:00
Geoffrey White
4e5483744f Swift: Add a test case we're discussing. 2023-01-12 10:52:03 +00:00
Michael Nebel
48d0eccbf6 Go: Cleanup and renaming. 2023-01-12 11:13:34 +01:00
Michael Nebel
3749a1bd4d Go: Migrate unit tests to use data extensions for Models as Data. 2023-01-12 11:13:33 +01:00
Michael Nebel
218f553fef Go: Convert remaining CSV production models to use data extensions. 2023-01-12 11:13:33 +01:00
Michael Nebel
ebb3485a73 Go: Use the extensible predicates for model definitions. 2023-01-12 11:13:33 +01:00
Michael Nebel
5fd687d3df Go: Add MaD related extensible predicates. 2023-01-12 11:13:33 +01:00
Michael Nebel
0f993a0d26 Go: Prepare library for adding extensions. 2023-01-12 11:13:28 +01:00
Mathias Vorreiter Pedersen
1ae52b6c7e C++: Speedup 'MissingCheckScanf'. 2023-01-12 10:13:02 +00:00
Paolo Tranquilli
4f5f0aad45 Merge branch 'main' into redsun82/swift-open-redirection 2023-01-12 10:54:04 +01:00
Michael Nebel
18a815ca8b Merge pull request #11721 from michaelnebel/csharpjava/refactorprovenance
C#/Java: Re-factor provenance related predicates.
2023-01-12 10:50:31 +01:00
yoff
006eaf3e2a Merge pull request #11088 from yoff/python/inline-query-tests
Python: Inline query tests
2023-01-12 10:32:26 +01:00
Geoffrey White
994ea704da Swift: Clean up the QL a little. 2023-01-12 09:31:48 +00:00
Jami Cogswell
fd593fd4f0 Java: undo changes to tests that were affected by numeric-flow summary models 2023-01-11 22:34:19 -05:00
Harry Maclean
33a1469a56 Ruby: Add change note 2023-01-12 16:29:00 +13:00
Jami Cogswell
ce74c9d959 Java: Date models as neutral 2023-01-11 22:15:41 -05:00
Jami Cogswell
6bb865ad05 Java: make numeric flow models neutral 2023-01-11 18:04:43 -05:00
Henning Makholm
1d4b2fd0bb Merge pull request #11870 from github/hmakholm/pr/mergeback-2.12.0
Merge codeql-cli-2.12.0 back to main
2023-01-11 23:51:56 +01:00
Harry Maclean
8219465389 Ruby: fix missing doc 2023-01-12 11:35:35 +13:00
Harry Maclean
0626d693f5 Ruby: Recognise rack applications
This is a basic first step in modelling rack apps. We recognise classes
that look like rack applications and then treat the argument to `call`
in the same way that we treat `request.env` in ActionController classes.

This finds a TP in CVE-2021-43840.
2023-01-12 11:28:31 +13:00
Pierre
4e1f772f23 Merge pull request #11702 from github/turbo/experimental/combined
Introduce the security-experimental CodeQL suite and experimental tag
2023-01-11 20:37:42 +01:00
Geoffrey White
6a0b56bf40 Swift: Fix for extensions. 2023-01-11 18:32:07 +00:00
Geoffrey White
2622de9747 Swift: Improve Core Data coverage. 2023-01-11 18:26:34 +00:00
Geoffrey White
82f9903bf0 Swift: Additional test cases for swift/cleartext-storage-database on Core Data. 2023-01-11 18:22:32 +00:00
Jami Cogswell
0c7ffb0554 Java: update System.getProperty model 2023-01-11 12:04:22 -05:00
Pierre
c3116b3f0f Merge branch 'main' into turbo/experimental/combined 2023-01-11 18:02:55 +01:00
Jami Cogswell
2a99af0e6d Java: remove summary model for String.endsWith 2023-01-11 10:58:46 -05:00
Jami Cogswell
99ee6c95a1 Java: remove models for Consumer.accept and Collectors.toMap 2023-01-11 10:44:38 -05:00
Jami Cogswell
ac064ac2a7 Java: remove model for Collectors.joining 2023-01-11 10:30:49 -05:00
Michael Nebel
7e4f7a0c17 C#: Address review comments and sync files. 2023-01-11 16:29:24 +01:00
Michael Nebel
67cbe38255 Sync files. 2023-01-11 16:20:55 +01:00
Michael Nebel
8112058a0a Java: Adapt TopJdpApi library to the re-factor. 2023-01-11 16:20:55 +01:00
Michael Nebel
372ecf402f Go: Delete unused summaryModel predicate. 2023-01-11 16:20:55 +01:00
Michael Nebel
80a4197604 Swift: Re-factor provenance related predicates for summarized callable. 2023-01-11 16:20:55 +01:00
Michael Nebel
c01361a1fd Ruby: Re-factor provenance related predicates for summarized callable. 2023-01-11 16:20:55 +01:00
Michael Nebel
59a9e255c7 Python: Re-factor provenance related predicates for summarized callable. 2023-01-11 16:20:55 +01:00
Michael Nebel
6622eda04c Go: Re-factor provenance related predicates for summarized callable. 2023-01-11 16:20:55 +01:00
Michael Nebel
6a047d6916 Java: Re-factor provenance related predicates for summarized callable. 2023-01-11 16:20:55 +01:00
Michael Nebel
ea173f9516 Sync files. 2023-01-11 16:20:55 +01:00
Michael Nebel
7422029e49 C#: Re-factor provenance related predicates for summarized callable. 2023-01-11 16:20:48 +01:00
Michael Nebel
4b47b08ed2 Merge pull request #11760 from michaelnebel/movemodelgenerator
C#/Java: Move the modelgenerator.
2023-01-11 16:02:36 +01:00
Tony Torralba
c6d9e1ec81 Merge pull request #11742 from atorralba/atorralba/swift/more-path-injection-sinks
Swift: Add more path injection sinks
2023-01-11 15:15:42 +01:00
Tony Torralba
c115a9fee4 Add more path injection sinks 2023-01-11 14:28:24 +01:00
Tony Torralba
5d54482c71 Merge pull request #11770 from atorralba/atorralba/ql/omittable-exists
QL: Add OmittableExists query
2023-01-11 14:27:40 +01:00
Michael Nebel
11ca3f49f6 C#/Java: Adjust imports after moving files. 2023-01-11 13:13:33 +01:00
Michael Nebel
787b4743ee C#/Java: Rename the directories containing the model generator and tests. 2023-01-11 13:13:33 +01:00
Michael Nebel
178fd0e9e1 C#/Java: Remove all dashes in mode-generator. 2023-01-11 13:13:33 +01:00
erik-krogh
6914e9a17a Merge branch 'main' into atorralba/ql/omittable-exists 2023-01-11 13:09:38 +01:00
Erik Krogh Kristensen
466f24663e Merge pull request #11867 from erik-krogh/qlFix
QL: move queries folder instead of .cache folder now that we got .qlx
2023-01-11 13:03:47 +01:00
Erik Krogh Kristensen
3fa6a7cbff cache -> queries
Co-authored-by: Tony Torralba <atorralba@users.noreply.github.com>
2023-01-11 12:29:15 +01:00
Tony Torralba
a4f813183e Merge pull request #11785 from atorralba/atorralba/swift/grdb-sinks
Swift: Add sinks for the GRDB library
2023-01-11 11:49:37 +01:00
erik-krogh
74a58f64aa move queries folder instead of .cache folder now that we got .qlx 2023-01-11 11:13:42 +01:00
erik-krogh
ed2dd87bda update the codeql-action version used in QL-for-QL 2023-01-11 11:13:06 +01:00
Tony Torralba
ecf568629b Add ExprAggregate as a negative edge in getConjunctionParentRec 2023-01-11 09:41:16 +01:00
Jami Cogswell
181a711f04 Java: switch Collectors.joining model from neutral to summary 2023-01-10 21:06:03 -05:00
github-actions[bot]
76e121e359 JS: Bump version of ML-powered library and query packs to 0.4.6 2023-01-10 21:11:23 +00:00
github-actions[bot]
dc88bdccc7 JS: Bump patch version of ML-powered library and query packs 2023-01-10 21:04:31 +00:00
Jami Cogswell
faae811be7 Java: try simplification of paramsString and paramsStringPart 2023-01-10 13:35:52 -05:00
Jami Cogswell
65aa064838 Java: update paramsString qldoc 2023-01-10 13:33:47 -05:00
Edward Minnix III
ce06df3152 Merge pull request #11628 from egregius313/egregius313/android-webview-addjavascriptinterface-dataflow
Java: Add parameters of methods annotated @JavascriptInterface as remote flow sources
2023-01-10 12:41:52 -05:00
erik-krogh
38ca68febb recognize "-->" as a bad tag filter 2023-01-10 18:09:56 +01:00
Florin Coada
4c1c12dd70 suggestions in list format 2023-01-10 11:18:56 -05:00
Jonathan Leitschuh
1d7881e03f Apply suggestions from code review
Co-authored-by: Chris Smowton <smowton@github.com>
2023-01-10 11:18:56 -05:00
Tony Torralba
b7364f5428 Update UnsafeDeserialization.qhelp
Move the table under <recommendation>, minor fixes.
2023-01-10 11:18:56 -05:00
Jonathan Leitschuh
3fa11c21c3 [Java] Document fixes for deserialization vulnerabilities by framework
Related https://github.com/github/codeql/issues/11603
2023-01-10 11:18:56 -05:00
Paolo Tranquilli
0ad585cfe6 Merge pull request #11860 from github/redsun82/swift-clang-14
Swift: make compilation with newer STL possible
2023-01-10 17:17:56 +01:00
Erik Krogh Kristensen
54c780bdf9 Merge pull request #11853 from erik-krogh/assignMore
JS: add local flow when recognizing Object.assign calls for library-inputs
2023-01-10 17:04:29 +01:00
Tony Torralba
ae8c75ac97 Generalize ConjunctionParent 2023-01-10 16:08:42 +01:00
Tony Torralba
72a11e737d Merge pull request #11775 from atorralba/atorralba/all/omittable-exists
All: Remove omittable exists variables
2023-01-10 16:07:06 +01:00
Ian Lynagh
3367da82c4 Kotlin: Accept test changes
We get better locations with Kotlin 1.8.0.
2023-01-10 14:41:30 +00:00
Ian Lynagh
b7eb521fa0 Kotlin: Fix custom_plugin test for Kotlin 1.8.0 2023-01-10 14:41:30 +00:00
Ian Lynagh
c71ea80029 Kotlin: Accept test changes
We now get better locations, with Kotlin 1.8.0.
2023-01-10 14:41:30 +00:00
Ian Lynagh
20b35e5d02 Kotlin: 1.8.0 changes 2023-01-10 14:41:30 +00:00
Ian Lynagh
c4119761cc Kotlin: Another 1.8 build fix 2023-01-10 14:41:30 +00:00
Ian Lynagh
89b3363761 Kotlin: Bump CI version to 1.8.0-Beta 2023-01-10 14:41:30 +00:00
Ian Lynagh
b51c3aae85 Kotlin: Logs test: Allow for -Beta versions etc when parsing the logs 2023-01-10 14:41:29 +00:00
Ian Lynagh
6fbda1a9f0 Kotlin: Accept test changes with 1.8 2023-01-10 14:41:29 +00:00
Ian Lynagh
f7d8d16ed3 Kotlin: Fix build for 1.8.0-Beta
The build no longer works for Kotlin < 1.8: We get

    error: class 'org.jetbrains.kotlin.ir.IrElement' was compiled
           with an incompatible version of Kotlin. The binary version
           of its metadata is 1.8.0, expected version is 1.6.0.
2023-01-10 14:41:29 +00:00
erik-krogh
62b69bbd3e autoformat 2023-01-10 15:38:13 +01:00
Erik Krogh Kristensen
6623e5fbf3 Merge pull request #11852 from erik-krogh/jsInfiniteChar
JS: recognize an infinite repetition of a char-class like regex as a char-class like regex
2023-01-10 15:32:22 +01:00
Erik Krogh Kristensen
ce8836fb65 Update javascript/ql/lib/semmle/javascript/PackageExports.qll
Co-authored-by: Esben Sparre Andreasen <esbena@github.com>
2023-01-10 15:30:44 +01:00
erik-krogh
43696f5e27 add explicit this 2023-01-10 15:27:37 +01:00
erik-krogh
23a847b1cf track shell:true more in js/shell-command-constructed-from-input 2023-01-10 15:27:37 +01:00
Erik Krogh Kristensen
9f8d10de11 Merge pull request #11851 from erik-krogh/jsFixMissingThis
JS: fix bad join-order in js/missing-this-qualifier
2023-01-10 15:23:25 +01:00
Paolo Tranquilli
2fb5621527 Swift: replace $(CC) with clang
On macOS `$(CC)` points to a wrapper that requires `DEVELOPER_DIR` to be
set in the environment. Using `clang` is slightly less generic, but
that's our default any way. Even if we do set a different clang version
somewhere, the selected version of GCC would not change, and the test
is targeting that.
2023-01-10 14:58:21 +01:00
Paolo Tranquilli
943763a026 Swift: add -Wno-pragma-once-outside-header to check 2023-01-10 14:30:35 +01:00
Paolo Tranquilli
28d79eeb77 Swift: make compilation with different STL versions possible
Previous to this patch the code contained a workaround for the standard
defect

https://cplusplus.github.io/LWG/issue3657

where `std::filesystem::path` did not have a `std::hash` implementation.

This patch allows compiling against versions of the STL that contain the
fix to the above issue. This is done by running the compiler against
code defining `std::hash<std::filesystem::path>`: if compilation
succeeds, it means the fix is not there and we need to use the
workaround, contained in `PathHash.h.workaround`. Otherwise, the fix is
there and we use `PathHash.h.fixed` instead, which only includes the
standard headers included by `PathHash.h.workaround`, so that one is a
drop-in replacement of the other.
2023-01-10 14:14:33 +01:00
Jeroen Ketema
1a4048d238 Merge pull request #11830 from jketema/frontend-update
C++: Changes for frontend update
2023-01-10 14:01:46 +01:00
erik-krogh
5c388c554c fix that the TypeTracker was unrestricted for the base-case of nonFirstLocationType 2023-01-10 13:39:50 +01:00
erik-krogh
e02b67af63 add failing test 2023-01-10 13:39:50 +01:00
Tony Torralba
50cd40ed20 Swift: Remove omittable exists variables 2023-01-10 13:39:50 +01:00
Tony Torralba
7ef8099a8b Shared: Remove omittable exists variables 2023-01-10 13:39:50 +01:00
Tony Torralba
c9d1cd97fb Ruby: Remove omittable exists variables 2023-01-10 13:39:49 +01:00
Tony Torralba
f6c3f77602 QL: Remove omittable exists variables 2023-01-10 13:37:58 +01:00
Tony Torralba
d87c8c75d6 Python: Remove omittable exists variables 2023-01-10 13:37:35 +01:00
Tony Torralba
3b6dae41cd JavaScript: Remove omittable exists variables 2023-01-10 13:37:21 +01:00
Tony Torralba
32471d326e Java: Remove omittable exists variables 2023-01-10 13:37:19 +01:00
Tony Torralba
7a92970d89 Go: Remove omittable exists variables 2023-01-10 13:36:48 +01:00
Tony Torralba
2ca0df0369 C#: Remove omittable exists variables 2023-01-10 13:36:25 +01:00
Tony Torralba
3fcc99e5cb C++: Remove omittable exists variables 2023-01-10 13:36:01 +01:00
Erik Krogh Kristensen
f2658a0936 apply suggestions from doc review
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
2023-01-10 12:56:22 +01:00
erik-krogh
79e161e046 slightly broaden the regular expression that recognizes bad string-concats used as shell commands 2023-01-10 12:49:37 +01:00
Tony Torralba
da90ae0e8f Update java/ql/lib/semmle/code/java/dataflow/FlowSources.qll 2023-01-10 11:18:53 +01:00
Jeroen Ketema
8d46642de3 C++: Update dbscheme stats file 2023-01-10 10:41:43 +01:00
Jeroen Ketema
2fc6484162 C++: Add dbscheme upgrade and downgrade scripts 2023-01-10 10:41:43 +01:00
Jeroen Ketema
1bab950023 C++: Introduce (_Complex) _Float16 type which is needed after frontend update 2023-01-10 10:41:43 +01:00
Jeroen Ketema
282ca1094e C++: Accept test changes after improving size of _Float128 in frontend 2023-01-10 10:41:43 +01:00
Jeroen Ketema
e215c4c94c C++: Accept test changes after frontend update
The location of a reference dereference has changed slightly.
2023-01-10 10:41:43 +01:00
Michael Nebel
16cd148961 Merge pull request #11711 from michaelnebel/externalflowcleanup
C#/Java: Delete deprecated ModelCsv classes and related predicates.
2023-01-10 10:22:50 +01:00
Michael Nebel
1729319ebe Merge pull request #11804 from michaelnebel/csharp/alignqueryids
C#: Align query IDs.
2023-01-10 10:14:07 +01:00
Michael Nebel
18a0abdb4c Merge pull request #11740 from michaelnebel/csharp/updatestats
C#: Update stats based on projects.
2023-01-10 10:09:53 +01:00
Ed Minnix
293a203756 Move JavascriptInterfaceMethod to WebView.qll 2023-01-09 15:10:23 -05:00
Rasmus Lerchedahl Petersen
2edbfbf8bc python: update test expectations
...now the bug is fixed
2023-01-09 20:35:20 +01:00
Mathias Vorreiter Pedersen
7f5344e025 Update swift/ql/lib/codeql/swift/elements/type/NumericOrCharType.qll
Co-authored-by: Tony Torralba <atorralba@users.noreply.github.com>
2023-01-09 17:08:27 +00:00
Tony Torralba
8e0a018673 Consider Int8 and UInt8 as OsLogNonRedactedTypes 2023-01-09 18:05:18 +01:00
Tony Torralba
49a41c98ee Test that hashed passwords are 'safe' to log
This doesn't seem completely right, but the heuristic approach we have regarding sensitive expressions has to draw the line somewhere.
2023-01-09 18:01:07 +01:00
Tony Torralba
160d89fb4e Add qhelp examples 2023-01-09 18:01:07 +01:00
Tony Torralba
33029b0ed8 Fix sanitizer QLDoc 2023-01-09 18:01:07 +01:00
Tony Torralba
7e0869965c Uncomment tests 2023-01-09 18:01:07 +01:00
Tony Torralba
c1f19dd145 Add stub so that tests work on Linux 2023-01-09 18:01:07 +01:00
Tony Torralba
b203a9eb6e Add a sanitizer for OSLogPrivacy options
Add test cases to verify how the sanitizer behaves depending on the argument type and the privacy option being used.
2023-01-09 18:01:07 +01:00
Tony Torralba
aad56097ac Add Cleartext Loggin query for Swift.
With some caveats: see TODO comments and failing tests.
2023-01-09 18:01:07 +01:00
Rasmus Lerchedahl Petersen
c142495a8b python: simplify code 2023-01-09 17:51:45 +01:00
Rasmus Lerchedahl Petersen
5fe62e293a python: fix bug, add clarifying comment 2023-01-09 17:45:50 +01:00
erik-krogh
9f100ef2c6 add local flow when recognizing Object.assign calls for library-inputs 2023-01-09 17:44:11 +01:00
Tony Torralba
eb78661c1f Add missing SQL injection tests for the GRDB SQL class 2023-01-09 17:36:54 +01:00
erik-krogh
90f9e3f825 recognize an infinite repetition of a char-class like regex as a char-class like regex 2023-01-09 17:25:08 +01:00
Sarita Iyer
be06469a19 Merge pull request #11835 from github/saritai/pr/qlx
Docs: CodeQL pack compatibility
2023-01-09 10:15:08 -05:00
Ed Minnix
909b1d70d9 Rename files to say "Allow" instead of "Permit" 2023-01-09 10:11:03 -05:00
Ed Minnix
c723df3ca7 Fix alert message in expected file 2023-01-09 10:08:19 -05:00
erik-krogh
785c21f462 fix bad join-order in js/missing-this-qualifier 2023-01-09 16:06:26 +01:00
Ed Minnix
f626d4794a Change wording from "permit" to "allow" in id and name 2023-01-09 10:03:12 -05:00
Ed Minnix
972b4629c8 Fix typo in change note 2023-01-09 10:01:38 -05:00
Ed Minnix
64668883a4 Add good example to documentation 2023-01-09 09:59:38 -05:00
Ed Minnix
2ec73c50f9 Mention WebView in alert message 2023-01-09 09:55:09 -05:00
Arthur Baars
664fdc3b2a Merge pull request #11815 from aibaars/too-many-fields
Ruby: use record_parse_error_for_node to report extractor error
2023-01-09 15:40:19 +01:00
Erik Krogh Kristensen
5157d4df7b Merge pull request #11581 from erik-krogh/stdin
Rb: add stdin as source for unsafe-deserialization
2023-01-09 13:57:47 +01:00
Chris Smowton
e9bbb5d7fa Merge pull request #11730 from smowton/smowton/admin/improve-sql-unescaped-docs
Java: improve naming and description of SqlUnescaped.ql
2023-01-09 12:50:27 +00:00
yoff
c01ce955ba Merge pull request #11778 from yoff/shared/inline-tests
Shared: Inline test expectations
2023-01-09 13:21:18 +01:00
Chris Smowton
2e26fb1171 Merge pull request #11819 from smowton/smowton/admin/port-java-autobuilder-tests
Add Java autobuilder integration tests
2023-01-09 12:17:39 +00:00
Chris Smowton
efe23c1da7 Note that alerts should not be re-raised 2023-01-09 10:56:13 +00:00
Chris Smowton
994a46289f Add change note 2023-01-09 10:56:13 +00:00
Chris Smowton
ef27f9fe96 Replace one more mention of escaping 2023-01-09 10:56:13 +00:00
Chris Smowton
45c732a6f9 Java: improve naming and description of SqlUnescaped.ql
Since the main thing it's objecting to is concatenation not lack of escaping (in particular it doesn't look for escaping sanitizers), rename and re-describe it accordingly.
2023-01-09 10:56:13 +00:00
Mathias Vorreiter Pedersen
381301e552 Update swift/ql/lib/swift.qll
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2023-01-09 10:32:52 +00:00
Geoffrey White
9333e80def Swift: Add getVaList stub to the test. 2023-01-09 10:29:37 +00:00
Taus
06ea249997 Merge pull request #11820 from yoff/python/fix-downgrades
Python: fix downgrade script
2023-01-09 11:24:41 +01:00
Mathias Vorreiter Pedersen
6bb09ef289 Swift: Add integral type classes. 2023-01-09 09:43:09 +00:00
Mathias Vorreiter Pedersen
9be9636816 Merge pull request #11670 from atorralba/atorralba/swift/predicate-injection
Swift: Add predicate injection query
2023-01-09 08:54:13 +00:00
Harry Maclean
5b117084db Merge pull request #11534 from hmac/array-inclusion-barrier-guard-constant
Ruby: Make array inclusion barrier more sensitive
2023-01-09 20:57:09 +13:00
Paolo Tranquilli
82d9edfabf Merge branch 'main' into redsun82/swift-open-redirection 2023-01-09 08:44:02 +01:00
Sarita Iyer
f15291a9de Change the order of sections 2023-01-06 15:00:43 -05:00
Sarita Iyer
d079c7a5ef Apply suggestions from code review
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2023-01-06 14:57:24 -05:00
Jami Cogswell
a3c7b2c3a2 Java: move java.lang.Math.min to the correct file 2023-01-06 14:35:09 -05:00
Geoffrey White
bb50a99b36 Swift: Additional test cases. 2023-01-06 18:48:46 +00:00
Geoffrey White
b5dd815249 Swift: Flow through optional binding. 2023-01-06 18:34:22 +00:00
Geoffrey White
c598d9b882 Swift: Generalize an SSA case for variables declared in Patterns. 2023-01-06 18:34:22 +00:00
Geoffrey White
8a9a69fa00 Swift: Add more dataflow tests for of optionals, patterns, enums. 2023-01-06 18:34:22 +00:00
Jeroen Ketema
a743fbcc95 Merge pull request #11799 from jketema/case-uncomment
C++: Uncomment cases in dbscheme
2023-01-06 19:26:53 +01:00
Sarita Iyer
d7bf2d9375 docs for codeql pack compatibility 2023-01-06 12:07:24 -05:00
Geoffrey White
04f87a26a9 Swift: Test layout change. 2023-01-06 16:52:54 +00:00
Sarita Iyer
a9867a266e fixed link 2023-01-06 11:50:07 -05:00
Sarita Iyer
d68cfc7d4f codeql pack compatibility docs 2023-01-06 11:17:02 -05:00
erik-krogh
538adb47a3 update expected output for DuplicateCharacterInSet 2023-01-06 15:41:57 +01:00
Chris Smowton
831255e9c0 Merge pull request #11832 from github/mbg/fix/go-version-warnings
Go: Handle output from `go version` more gracefully
2023-01-06 14:05:39 +00:00
Jeroen Ketema
c1bc097355 C++: Add upgrade/downgrade scripts for dbscheme update 2023-01-06 14:26:24 +01:00
Jeroen Ketema
cdb34bb1f9 C++: Update database stats file 2023-01-06 14:26:23 +01:00
Jeroen Ketema
b9b0c8091f C++: Uncomment cases in dbscheme
Note that the builtin types `__int{8,16,32,64}` are not uncommented,
as these are never and could have never been generated by the
extractor.
2023-01-06 14:26:23 +01:00
Geoffrey White
f3914ffe25 Merge pull request #11823 from geoffw0/heuristicalloc
C++: Use HeuristicAllocationExpr in more queries
2023-01-06 13:13:14 +00:00
Jami
f5e5f6dfd1 Merge pull request #11821 from jcogs33/jcogs33/fix-mad-typos
Java: fix typos in MaD row `name` columns for `MappingSqlQuery` and `MappingSqlQueryWithParameters`
2023-01-06 07:59:30 -05:00
Rasmus Lerchedahl Petersen
03bd6cb414 python: Allow optional result=OK
Also add a further test case
2023-01-06 13:33:12 +01:00
erik-krogh
10308f5875 track string-constants to regular expression uses 2023-01-06 13:17:31 +01:00
Nick Rolfe
4c5f149afd Merge pull request #11831 from github/post-release-prep/codeql-cli-2.12.0
Post-release preparation for codeql-cli-2.12.0
2023-01-06 12:15:17 +00:00
Michael B. Gale
1ef1d63c11 Add test for parseGoVersion 2023-01-06 11:20:51 +00:00
Michael B. Gale
9af9b32722 Find the last line of output from go version 2023-01-06 11:20:39 +00:00
Geoffrey White
bb451f3911 C++: Fix result duplication. 2023-01-06 11:05:47 +00:00
github-actions[bot]
cdb8f67601 Post-release preparation for codeql-cli-2.12.0 2023-01-06 10:36:34 +00:00
Rasmus Lerchedahl Petersen
8d9e94a00f swift: fix typo 2023-01-06 11:22:49 +01:00
erik-krogh
0a1769657d add change-note 2023-01-06 09:09:09 +01:00
erik-krogh
19d2b49562 drive-by: make Base64.decode64(..) into a flowsummary that is shared with all queries 2023-01-06 09:04:37 +01:00
erik-krogh
1a27441cfb drive-by: delete code-execution sinks from unsafe-deserialization, we risked duplicate alerts 2023-01-06 09:04:36 +01:00
erik-krogh
0e6028a7f3 add stdin as source for unsafe-deserialization 2023-01-06 09:04:36 +01:00
Rasmus Lerchedahl Petersen
d42bb119fe python: align annotations with Ruby
use `result=BAD` for expected alert
and `result=OK` on sinks where alerts are not wanted.
2023-01-05 21:41:28 +01:00
Rasmus Lerchedahl Petersen
ad95225272 python: improve code
according to alert and reviewer's suggestion
2023-01-05 20:42:29 +01:00
erik-krogh
f98ff65b11 use eval() instead of send() in test 2023-01-05 20:04:04 +01:00
Erik Krogh Kristensen
d9176541c6 Apply suggestions from code review
Co-authored-by: Alex Ford <alexrford@users.noreply.github.com>
2023-01-05 20:02:54 +01:00
Nick Rolfe
5317fb5b53 Merge pull request #11828 from github/release-prep/2.12.0
Release preparation for version 2.12.0
2023-01-05 18:58:30 +00:00
Nick Rolfe
a3cc93b80b correct spelling and capitalization of TCP/UDP 2023-01-05 17:43:25 +00:00
Jeroen Ketema
de37f3b7d5 Properly indent code block in change log 2023-01-05 18:38:33 +01:00
Jeroen Ketema
ed87c3a90a Update go/ql/lib/CHANGELOG.md 2023-01-05 18:03:19 +01:00
Jeroen Ketema
af2c321380 Update python/ql/src/change-notes/released/0.6.0.md 2023-01-05 18:01:28 +01:00
Jeroen Ketema
3e634c92c1 Update python/ql/src/CHANGELOG.md 2023-01-05 18:01:21 +01:00
Jeroen Ketema
170242f79c Apply suggestions from code review 2023-01-05 17:57:19 +01:00
Nick Rolfe
44213f0144 Merge pull request #11826 from github/nickrolfe/check-change-note
CI: fail if a changenote filename doesn't have the right format
2023-01-05 16:55:30 +00:00
Nick Rolfe
6e07076151 tweak wording in 2.12 release notes 2023-01-05 16:46:44 +00:00
github-actions[bot]
b6a8193785 Release preparation for version 2.12.0 2023-01-05 16:32:14 +00:00
Nick Rolfe
4e6baf83c8 Update .github/workflows/check-change-note.yml
Co-authored-by: Taus <tausbn@github.com>
2023-01-05 16:26:43 +00:00
Nick Rolfe
0beca9d96c CI: fail if a changenote filename doesn't have the right format 2023-01-05 16:01:07 +00:00
Jeroen Ketema
f370cd840c Merge pull request #11818 from jketema/downgrade-fix
C++: Fix the expression kind in two of the downgrade scripts
2023-01-05 16:33:16 +01:00
Nick Rolfe
f58ec799dd Merge pull request #11822 from github/nickrolfe/codeql-cli-2.12.0-changenote-fix
Go: fix date format in changenote
2023-01-05 15:16:51 +00:00
Geoffrey White
b3e82498fa C++: Change note. 2023-01-05 15:06:40 +00:00
Nick Rolfe
b7846da65d Go: fix date format in changenote 2023-01-05 15:05:39 +00:00
Jami Cogswell
f03f687d61 Java: add change note 2023-01-05 09:08:04 -05:00
Rasmus Lerchedahl Petersen
bb26c31f84 Python: fix downgrade script
When new kinds are inserted, new indices exists that do not
correspond to any old indices.
These were previously mapped, now they are not.
2023-01-05 14:56:52 +01:00
Jami Cogswell
0640bd9d8b Java: fix typos in the MaD row name columns for MappingSqlQuery and MappingSqlQueryWithParameters 2023-01-05 08:32:22 -05:00
Rasmus Lerchedahl Petersen
8afb541718 cpp/swift: fix qldoc 2023-01-05 14:30:13 +01:00
yoff
a74062cd51 Update go/ql/test/TestUtilities/InlineExpectationsTest.qll
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2023-01-05 14:12:16 +01:00
Geoffrey White
3b31da8a62 C++: Update the experimental query as well. 2023-01-05 12:48:17 +00:00
Geoffrey White
46baf9d5e5 C++: Add test cases for an experimental query as well. 2023-01-05 12:48:16 +00:00
Geoffrey White
c160e0b2a4 C++: Add a warning on HeuristicAllocationExpr.getSizeBytes() and similar methods. 2023-01-05 12:47:52 +00:00
Geoffrey White
823c767aac C++: Undo changes to SizeCheck.ql, SizeCheck2.ql. 2023-01-05 12:34:12 +00:00
Chris Smowton
52297c0b23 Add Java autobuilder integration tests 2023-01-05 12:19:25 +00:00
Jonas Jensen
c8f35ea1ea Merge pull request #11810 from kaspersv/kaspersv/inline-late-pragma
Add inline_late pragma to QL language spec
2023-01-05 13:15:12 +01:00
Geoffrey White
2023abdc60 C++: Update the queries. 2023-01-05 11:33:58 +00:00
Geoffrey White
a9aa67177b C++: Add test cases for HeuristicAllocationExpr in queries. 2023-01-05 11:30:21 +00:00
Geoffrey White
10ca2dac19 C++: Remove unnecessary 'semmle' directory. 2023-01-05 11:30:15 +00:00
Jeroen Ketema
14283f01ac C++: Fix the expression kind in two of the downgrade scripts
A 0 value for the expression kind is not valid, as 0 does not occur in the
relevant case split. This should have been the value of `@errorexpr`, which
is 1.
2023-01-05 11:04:31 +01:00
Rasmus Lerchedahl Petersen
c3b3c05cf3 Revert "Merge pull request #37 from erik-krogh/shared/inline-tests"
This reverts commit 65fe9abcfe, reversing
changes made to 08e9d3391f.
2023-01-05 09:19:43 +01:00
Sarita Iyer
745d30252c Update CONTRIBUTING.MD 2023-01-04 16:49:27 -05:00
Sarita Iyer
a62a8d9960 Update CONTRIBUTING.MD 2023-01-04 16:47:34 -05:00
Sarita Iyer
d859e1e9a3 add contributing info 2023-01-04 16:43:17 -05:00
Rasmus Lerchedahl Petersen
2e46919e10 java: nicer code as suggested by review 2023-01-04 19:50:29 +01:00
Geoffrey White
e45750a8ca Merge branch 'main' into format 2023-01-04 18:00:59 +00:00
Robert Marsh
4aa62757a9 Merge pull request #11803 from jketema/gvn-deprecation
C++: Mark a number of private predicates in the GVN library as deprecated
2023-01-04 12:33:23 -05:00
Arthur Baars
799e0c1bcc Ruby: use record_parse_error_for_node to report extractor error 2023-01-04 17:35:47 +01:00
Aditya Sharad
ed73875fac Merge pull request #11747 from adityasharad/tutorial/library-pack
Tutorial: Move QL detective tutorial library into shared `codeql/tutorial` library pack
2023-01-04 08:24:53 -08:00
yoff
65fe9abcfe Merge pull request #37 from erik-krogh/shared/inline-tests
inline Location into the shared implementation of InlineExpectationsTest
2023-01-04 17:08:23 +01:00
Jeroen Ketema
134fbb2128 Merge pull request #11805 from geoffw0/references
Swift: Add a reference for swift/hardcoded-key.
2023-01-04 16:39:24 +01:00
James Fletcher
60a5512ca2 Merge pull request #11813 from github/rc/3.8
Merge docs updates from rc/3.8 into main
2023-01-04 14:19:53 +00:00
James Fletcher
9ef0056c55 Merge pull request #11812 from github/codeql-cli-2.11.6
Merge docs updates from codeql-cli-2.11.6 into rc/3.8
2023-01-04 13:39:55 +00:00
James Fletcher
24552fb948 Merge branch 'rc/3.8' into codeql-cli-2.11.6 2023-01-04 12:06:27 +00:00
James Fletcher
a205818ba6 Merge pull request #11811 from jf205/codeql-cli-2.11.5-docs-mergeback
Merge docs updates from codeql-cli-2.11.5 -> codeql-cli-2.11.6
2023-01-04 11:57:51 +00:00
Geoffrey White
7ad8771b53 Merge remote-tracking branch 'upstream/main' into references 2023-01-04 10:55:24 +00:00
Henry Mercer
b96160f0f3 Merge pull request #11783 from github/henrymercer/specify-baseline-languages
Specify language names in extractor packs
2023-01-04 10:42:18 +00:00
james
2dc7da07bd Merge remote-tracking branch 'upstream/codeql-cli-2.11.6' into codeql-cli-2.11.5-docs-mergeback 2023-01-04 10:40:41 +00:00
Chris Smowton
353573bf31 Merge pull request #11701 from owen-mc/go/count-fields-correctly
Go: Count fields correctly
2023-01-04 10:38:36 +00:00
Kasper Svendsen
9ad572fa29 Add inline_late pragma to QL language spec 2023-01-04 11:28:08 +01:00
James Fletcher
413b4c6eb0 Merge pull request #11554 from github/siaramist/codeql-template
Update intro tutorial to include Codespaces CodeQL template
2023-01-04 09:56:36 +00:00
Erik Krogh Kristensen
cedc9c0bff Merge pull request #11582 from erik-krogh/heuristics
JS: Add experimental variants of common security queries with more sources
2023-01-04 10:46:19 +01:00
Harry Maclean
4d228bcddf Ruby: Recognise more string-valued variables
This increases the sensitivity of our barrier guards.
2023-01-04 11:45:10 +13:00
Harry Maclean
9944252c43 Ruby: Add test for barrier guards
This demonstrates that we are missing a guard when a case branch
compares against a string-valued variable rather than a string literal.
2023-01-04 11:45:10 +13:00
Harry Maclean
698a679c78 Ruby: add test 2023-01-04 11:45:10 +13:00
Harry Maclean
0fbb6bf608 Ruby: Make array inclusion barrier more sensitive 2023-01-04 11:45:09 +13:00
Jami Cogswell
abe501c1af Java: add change note 2023-01-03 17:15:50 -05:00
Aditya Sharad
9988c19a42 Merge branch 'main' into tutorial/library-pack 2023-01-03 14:08:37 -08:00
Jami Cogswell
5d92792e40 Java: update test case affected by Function.apply model 2023-01-03 16:14:08 -05:00
Jami Cogswell
feaae16f7c Java: adjust comments 2023-01-03 16:08:14 -05:00
Ed Minnix
0be8648a9d Add changenote 2023-01-03 15:55:53 -05:00
Ed Minnix
28f555c2b2 Add simple test case for @JavascriptInterface parameter flow 2023-01-03 15:31:40 -05:00
Ed Minnix
ab7ca1d642 Java: Add parameters of @JavascriptInterface methods as a remote flow sources 2023-01-03 15:31:40 -05:00
Ed Minnix
f9b8200009 Add stub for android.webkit.JavascriptInterface annoation 2023-01-03 15:31:40 -05:00
Edward Minnix III
69fd5e93bc Merge pull request #28 from egregius313/egregisu313/webview-setAllowContentAccess-single-query
Merge `setAllowContentAccess` queries into singular query
2023-01-03 15:27:09 -05:00
Ed Minnix
81df89f93e Use proper @id in changenote 2023-01-03 15:19:26 -05:00
Ed Minnix
28ad9d00fb Merge both setAllowContentAccess queries into one query
Previously, the query to detect whether or not access to `content://`
links was done using two queries.

Now they can be merged into one query
2023-01-03 15:17:07 -05:00
Jami Cogswell
29221ae426 Java: add summary model for System.getProperty, adjust comments 2023-01-03 15:11:21 -05:00
Jami Cogswell
21a018e5c5 Java: add summary model and test for File.getName 2023-01-03 13:12:24 -05:00
Geoffrey White
e5a74cb29c Swift: Add a reference for swift/hardcoded-key. 2023-01-03 17:27:31 +00:00
Chris Smowton
c5138674a4 Merge pull request #11800 from github/smowton/admin/delete-install-deps
Remove Go's install-deps.sh script
2023-01-03 17:16:15 +00:00
Geoffrey White
fc646a6d48 Swift: Update .expected following a toString change in main. 2023-01-03 16:25:14 +00:00
Geoffrey White
e05bb7fcee Merge branch 'main' into format 2023-01-03 15:14:55 +00:00
Michael Nebel
17cd182d72 C#: Update stats based on projects. 2023-01-03 15:44:47 +01:00
Calum Grant
b3a3957dc9 Merge pull request #11741 from github/calumgrant/remove-lgtm
Remove references to LGTM in code
2023-01-03 14:23:38 +00:00
Michael Nebel
9d608a78a3 C#: Add change note on renamed query ids. 2023-01-03 15:18:22 +01:00
Michael Nebel
bfe5a0c438 C#: Rename query id's to be prefixed with cs instead of csharp. 2023-01-03 15:13:54 +01:00
Jeroen Ketema
5f4326f2bf C++: Mark a number of private predicates in the GVN library as deprecated
This silences a number of warnings related to GVN deprecation.
2023-01-03 12:47:36 +01:00
Chris Smowton
781e96e2a0 Remove Go's install-deps.sh script 2023-01-03 10:45:06 +00:00
Calum Grant
ad55706527 Merge branch 'main' into calumgrant/remove-lgtm 2023-01-03 10:27:30 +00:00
Jeroen Ketema
dcd0be04c4 Merge pull request #11794 from sigfaulterror/main
Update annotations-in-java.rst
2023-01-02 17:13:14 +01:00
erik-krogh
3811eae679 simplify the qhelp for unsafe-code-construction
The `send()` example is not flagged by any current query, so it was weird talking about it as "vulnerable".
2023-01-02 13:33:56 +01:00
Arthur Baars
1092326699 Merge pull request #11796 from erik-krogh/fixBinding
Ruby: Fix compile error in test
2023-01-02 13:26:20 +01:00
sigfaulterror
1dd545ed99 Update annotations-in-java.rst
A typo in the SuppressWarnings's annotation value, it should be `deprecation` and not `deprecated`.
2023-01-02 13:24:17 +01:00
Erik Krogh Kristensen
79a2b6d0b0 use any() instead of this = this
Co-authored-by: Arthur Baars <aibaars@github.com>
2023-01-02 10:49:54 +01:00
erik-krogh
99dc0a8356 fix binding 2023-01-02 10:30:28 +01:00
erik-krogh
3815a5a096 fix qhelp syntax 2023-01-02 10:19:05 +01:00
Ed Minnix
35de551f6b Formatting 2022-12-31 17:19:49 -05:00
Ed Minnix
515fa21aad Change notes 2022-12-31 17:18:37 -05:00
Ed Minnix
df1a4d2ed1 Documentation fix: Add state1 and state2 to documentation 2022-12-31 15:25:37 -05:00
Ed Minnix
68392aa8d8 Fix test expectations 2022-12-31 15:25:25 -05:00
Ed Minnix
02f70f3536 Add @security-severity tag 2022-12-31 15:00:28 -05:00
Edward Minnix III
1d345c6101 Refactoring and simplification
Co-authored-by: Tony Torralba <atorralba@users.noreply.github.com>
2022-12-31 15:00:28 -05:00
Ed Minnix
9ef319f659 Java: setAllowContentAccess query tests 2022-12-31 15:00:28 -05:00
Ed Minnix
5265cb4b03 Merge two dataflow configurations into one taint tracking 2022-12-31 15:00:28 -05:00
Ed Minnix
973f649e76 Break dataflow into two steps in order to capture flow from WebView to settings call 2022-12-31 15:00:28 -05:00
Ed Minnix
0e15dd9fa9 Query metadata 2022-12-31 15:00:28 -05:00
Edward Minnix III
778749184b Change id to use android/ instead of prepending android-
Co-authored-by: Tony Torralba <atorralba@users.noreply.github.com>
2022-12-31 15:00:28 -05:00
Ed Minnix
da25c586e6 Dataflow query for detecting paths that disable content access
Since the default value is `true`, we need to determine whether or not
the `setAllowContentAccess` method is ever called using dataflow.
2022-12-31 15:00:28 -05:00
Ed Minnix
8a763015e6 Reduce precision rating to medium
This query won't always be a security problem, so it should have a lower
precision rating than `high`.
2022-12-31 15:00:28 -05:00
Ed Minnix
7cc53126f3 Java: WebView setAllowContentAccess query test cases 2022-12-31 15:00:28 -05:00
Ed Minnix
a023726c03 Java: add Android stubs to options file for CWE-200 tests 2022-12-31 15:00:28 -05:00
Ed Minnix
e4e13d38b7 Java: query for Android WebView setAllowContentAccess 2022-12-31 15:00:28 -05:00
Ed Minnix
e259ef5d1d Java: Add class for android.webkit.WebSettings.setAllowContentAccess 2022-12-31 15:00:28 -05:00
Calum Grant
2d0f8798a4 Py: Reformat test 2022-12-28 11:05:48 +00:00
Harry Maclean
a6571a05ab Ruby: Include send example in qhelp 2022-12-28 11:34:55 +13:00
Harry Maclean
d3812f5906 Ruby: Add another code injection example to qhelp 2022-12-28 11:20:56 +13:00
Harry Maclean
b70ca77afc Merge pull request #10899 from hmac/flow-summary-docs
Ruby: Document flow summary syntax
2022-12-28 10:47:38 +13:00
Erik Krogh Kristensen
9c255b6c16 Merge pull request #11786 from erik-krogh/fix-nomagic-termination
QL: fix catastrophic join-order in `ql/cand-missing-nomagic`
2022-12-24 10:54:51 +01:00
erik-krogh
9e63390c78 fix that ql/cand-missing-nomagic had a catastrophic join-order 2022-12-23 21:20:30 +01:00
Tony Torralba
07d99bd643 Add path injection sinks 2022-12-23 17:16:06 +01:00
Tony Torralba
4215a89bc8 Add cleartext storage database sinks 2022-12-23 17:15:59 +01:00
Tony Torralba
ac39aeb6b6 Add SQLi sinks 2022-12-23 17:03:31 +01:00
Erik Krogh Kristensen
393a8c2bd8 Merge pull request #11630 from erik-krogh/useInstanceOf
QL4QL: enable medium precision queries, and make the "suggest instanceof" query louder
2022-12-23 14:22:23 +01:00
Henry Mercer
6be790929d Specify language names in extractor packs 2022-12-23 13:15:04 +00:00
Jami Cogswell
939279af38 Java: add comments 2022-12-22 16:25:12 -05:00
Jami Cogswell
673d37cc3d Java: update Math.min test case 2022-12-22 14:36:06 -05:00
Jami Cogswell
a81c54b58c Java: updates to order alphabetically 2022-12-22 13:22:12 -05:00
Jami Cogswell
e6331dc2e6 Java: update test case affected by Long.parseLong summary model 2022-12-22 12:57:37 -05:00
Jami Cogswell
997219a280 Java: update test case affected by Class.isAssignableFrom neutral model 2022-12-22 12:54:02 -05:00
Jami Cogswell
6007827dd3 Java: update test cases 2022-12-22 12:29:57 -05:00
Mathias Vorreiter Pedersen
98c30b8545 Merge pull request #11761 from MathiasVP/ir-for-microsoft-try-except-finally
C++: Generate IR for `__try __finally` and `__try __except`
2022-12-22 11:23:01 +00:00
Erik Krogh Kristensen
7201071084 Merge pull request #11777 from erik-krogh/use-new-cache
CI: use the new actions/cache@v3 instead of my own fork
2022-12-22 12:15:14 +01:00
Erik Krogh Kristensen
c4883925bb Merge pull request #11519 from erik-krogh/equiv
QL: Mock the `QlBuiltins` module in QL-for-QL
2022-12-22 12:14:57 +01:00
Mathias Vorreiter Pedersen
b330b628e3 Merge pull request #11595 from d10c/swift/extract-mainactor
Swift: MethodRefExpr -> MethodLookupExpr
2022-12-22 10:22:33 +00:00
Tony Torralba
36ca97e4f6 Add exclusions to reduce FP
Predicate parameters that have a database type are excluded.

Also, uses of the exists variable in an agreggation or another quantifier are excluded.
2022-12-22 11:15:07 +01:00
erik-krogh
b3dd50bc36 inline Location into the shared implementation of InlineExpectationsTest 2022-12-22 11:09:43 +01:00
Mathias Vorreiter Pedersen
a974cb1861 C++: Add another test with an _actual_ throw. 2022-12-22 10:01:41 +00:00
Mathias Vorreiter Pedersen
5fa968138c C++: Add another test case with a throw. 2022-12-22 09:38:57 +00:00
Rasmus Lerchedahl Petersen
08e9d3391f swift: use shared inline tests
- add util shared pack to swift
 - remove from identical-files
2022-12-22 10:20:07 +01:00
Rasmus Lerchedahl Petersen
b0d7998342 go: use shared inline tests
- remove from identical-files
2022-12-22 10:20:07 +01:00
Rasmus Lerchedahl Petersen
f28eb6bf31 ql4ql: use shared inline tests
- add util shared pack to ql
 - remove from identical-files
2022-12-22 10:20:07 +01:00
Rasmus Lerchedahl Petersen
0d6c643d77 ruby: use shared inline tests
- remove from identical-files
2022-12-22 10:20:07 +01:00
Rasmus Lerchedahl Petersen
4667068017 java: use shared inline tests
- remove from identical-files
2022-12-22 10:20:06 +01:00
Rasmus Lerchedahl Petersen
a9b232bff4 csharp: use shared inline tests
- remove from identical-files
2022-12-22 10:20:06 +01:00
Rasmus Lerchedahl Petersen
d97e185994 cpp: use shared inline tests
- remove from identical-files
2022-12-22 10:20:06 +01:00
Rasmus Lerchedahl Petersen
e8d3802ee5 Python: use shared inline tests
- remove from identical-files
2022-12-22 10:20:05 +01:00
Rasmus Lerchedahl Petersen
b767dcfd18 shared: Add shared inline expectation test library 2022-12-22 10:20:05 +01:00
Jami Cogswell
de5965525f Java: add initial test cases for summary models 2022-12-21 16:19:37 -05:00
erik-krogh
38bd4d9b12 update expected output to have more copies of "T" 2022-12-21 21:45:59 +01:00
erik-krogh
dbdc7275fc have unique parents, also for mock AST nodes 2022-12-21 21:38:52 +01:00
erik-krogh
5728e3ee8f Merge branch 'main' into equiv 2022-12-21 21:28:32 +01:00
erik-krogh
b4dddc07f1 use the new actions/cache@v3 instead of my own fork 2022-12-21 21:10:55 +01:00
Jami Cogswell
c251da799f Java: update TopJdkApis test 2022-12-21 13:19:09 -05:00
Jami Cogswell
16de30e07e Java: add java.util.stream models 2022-12-21 13:05:23 -05:00
Jami Cogswell
1db829e55c Java: add java.util models 2022-12-21 13:03:57 -05:00
Jami Cogswell
573de92441 Java: add java.util.function models 2022-12-21 12:59:58 -05:00
Jami Cogswell
a8c55ee4b7 Java: add java.util.concurrent models 2022-12-21 12:59:00 -05:00
Jami Cogswell
db0d24fdd1 Java: add java.util.concurrent.atomic models 2022-12-21 12:57:22 -05:00
Jami Cogswell
cfe075ef54 Java: add java.time models 2022-12-21 12:54:35 -05:00
Jami Cogswell
8e20aeb314 Java: add java.text models 2022-12-21 12:51:44 -05:00
Jami Cogswell
b9ce588076 Java: add java.sql models 2022-12-21 12:49:29 -05:00
Jami Cogswell
1544f49f91 Java: add java.math models 2022-12-21 12:47:32 -05:00
Jami Cogswell
ed534b06d5 Java: add java.lang models 2022-12-21 12:45:12 -05:00
Jami Cogswell
99ddd484be Java: add java.io models 2022-12-21 12:34:26 -05:00
Edward Minnix III
b77923f6e6 Merge pull request #11767 from atorralba/atorralba/java/fix-pinning-tests
Java: Small simplification in Missing Certificate Pinning tests
2022-12-21 11:21:47 -05:00
Edward Minnix III
597523e65a Merge pull request #11766 from atorralba/atorralba/java/fix-android-query-id
Java: Fix new Android queries' IDs
2022-12-21 11:21:12 -05:00
Tony Torralba
7d0018c897 Update ql/ql/src/queries/style/OmittableExists.ql 2022-12-21 17:16:34 +01:00
Tony Torralba
ac0c42c5c6 Apply suggestions from code review
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2022-12-21 16:16:58 +01:00
Mathias Vorreiter Pedersen
bbf0ec81ab C++: Fix implicit this. 2022-12-21 14:41:51 +00:00
Mathias Vorreiter Pedersen
ff6e8a285d C++: Model semantics of '__except' condition in IR. 2022-12-21 14:08:26 +00:00
Mathias Vorreiter Pedersen
e6a03a6152 C++: Fix exception handling for '__try __except'. 2022-12-21 14:08:26 +00:00
Arthur Baars
ebfc6eba95 Merge pull request #11773 from aibaars/alert-suppression-swift
Swift: add AlertSuppression.ql
2022-12-21 14:32:10 +01:00
Arthur Baars
7111d950c1 Swift: add AlertSuppression.ql 2022-12-21 13:15:26 +01:00
Arthur Baars
dceb142551 Merge pull request #11771 from aibaars/alert-suppression-fix-test
AlertSuppression: fix python test cases
2022-12-21 13:14:59 +01:00
Henry Mercer
ea6a01a9ea Merge pull request #11765 from github/dependabot/github_actions/actions/stale-7
Bump actions/stale from 6 to 7
2022-12-21 11:43:46 +00:00
Tony Torralba
227e099854 Apply code review suggestions
Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
2022-12-21 12:40:29 +01:00
Tony Torralba
aa1d49cb95 Add OmittableExists QL-for-QL query 2022-12-21 12:26:58 +01:00
Arthur Baars
2f16d8d86a AlertSuppression: fix python test cases 2022-12-21 11:26:16 +01:00
Arthur Baars
98c5b81456 Merge pull request #11723 from aibaars/alert-suppression
CodeQL alert suppression
2022-12-21 10:59:57 +01:00
Arthur Baars
035ad65e43 AlertSuppression: move library into util folder 2022-12-21 10:39:57 +01:00
yoff
4480262bd1 Merge pull request #11244 from github/python/support-grouped-exceptions
Python: support grouped exceptions
2022-12-21 10:10:37 +01:00
Tony Torralba
ab73d13d8b Small simplification 2022-12-21 09:58:13 +01:00
Tony Torralba
345c383acc Fix new Android queries' IDs 2022-12-21 09:36:57 +01:00
Tony Torralba
690dd47990 Merge pull request #11764 from github/workflow/coverage/update
Update CSV framework coverage reports
2022-12-21 09:30:29 +01:00
Nora Dimitrijević
aaadf198ab Swift: fix 'ql/redundant-import' 2022-12-20 23:32:38 -05:00
Nora Dimitrijević
fbb14797b1 Merge branch 'main' into swift/extract-mainactor 2022-12-20 23:20:37 -05:00
Nora Dimitrijević
101f42ab3d Revert "Swift: silence QL-for-QL "Redundant override" FP"
This reverts commit 56a72d7c37.
2022-12-20 23:17:45 -05:00
Nora Dimitrijević
f3ebb6e03b Swift: MethodLookupExpr.getMethodRef() [codegen'd]
This refactors SelfApplyExpr.getFunction() as MethodLookupExpr().getMethodRef().

This is simpler, because we are not hiding DeclRefExprs or reinventing hidden AST resolution.
2022-12-20 23:09:02 -05:00
Nora Dimitrijević
4900e4030a Swift: MethodLookupExpr.getMethodRef() [hand-written]
This refactors SelfApplyExpr.getFunction() as MethodLookupExpr().getMethodRef().

This is simpler, because we are not hiding DeclRefExprs or reinventing hidden AST resolution.
2022-12-20 23:08:32 -05:00
dependabot[bot]
a5bb13f2b6 Bump actions/stale from 6 to 7
Bumps [actions/stale](https://github.com/actions/stale) from 6 to 7.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-21 03:12:32 +00:00
github-actions[bot]
eb98bb2842 Add changed framework coverage reports 2022-12-21 00:15:01 +00:00
Owen Mansel-Chan
3eb419eb1a Give context for code examples 2022-12-20 22:20:13 +00:00
Aditya Sharad
d2ee8c08c0 Ruby: Add shared tutorial pack to testing bundle 2022-12-20 10:56:05 -08:00
Mathias Vorreiter Pedersen
f0ba33ae74 C++: Accept test changes. 2022-12-20 18:19:18 +00:00
Erik Krogh Kristensen
a1639c438f Merge pull request #11762 from erik-krogh/fixParent
QL: fix `getAnnotation()` for new-type branches with parameters
2022-12-20 18:18:39 +01:00
erik-krogh
ab9855e196 fix getAnnotation() for new-type branches with parameters 2022-12-20 15:55:54 +01:00
Paolo Tranquilli
454af0d721 Swift: fix locking of output swiftmodule trap 2022-12-20 15:34:18 +01:00
Paolo Tranquilli
a1161c6efe Swift: remove header patch which is not needed any more 2022-12-20 15:28:52 +01:00
Paolo Tranquilli
725861626c Merge branch 'main' into redsun82/swift-open-redirection 2022-12-20 15:28:30 +01:00
Jami
c9258effb6 Merge pull request #11572 from jcogs33/jcogs33/model-top-jdk-apis
Java: model top 100 JDK APIs
2022-12-20 09:13:53 -05:00
Mathias Vorreiter Pedersen
07ab119b8c C++: Add explicit qualifiers. 2022-12-20 13:38:50 +00:00
Mathias Vorreiter Pedersen
d2964a7d4a C++: Also handle '__finally' blocks. 2022-12-20 13:28:33 +00:00
Mathias Vorreiter Pedersen
3c8efa88e0 C++: Handle Microsoft '__try __except' in the existing 'TryStmt' IR logic. 2022-12-20 13:28:28 +00:00
Mathias Vorreiter Pedersen
cd6e421cf5 C++: Add a test with '__try __except' and '__try __finally' in the 'ir' test directory. 2022-12-20 13:28:22 +00:00
Tony Torralba
30aa9b230c Apply suggestions from code review
Co-authored-by: Ben Ahmady <32935794+subatoi@users.noreply.github.com>
2022-12-20 14:14:05 +01:00
erik-krogh
57f429ec5d change this = this to any() 2022-12-20 13:56:25 +01:00
Erik Krogh Kristensen
0cc3232c10 fix typo
Co-authored-by: Arthur Baars <aibaars@github.com>
2022-12-20 13:56:25 +01:00
erik-krogh
0a828f7b31 fix the left()/right() predicates such that they return an Either 2022-12-20 13:56:25 +01:00
erik-krogh
b1001d1a10 make TypeWithToString private inside the shared pack 2022-12-20 13:56:25 +01:00
erik-krogh
0e426090f2 update expected output 2022-12-20 13:56:23 +01:00
Jami
dc0bad3dc5 update change note
Co-authored-by: yo-h <55373593+yo-h@users.noreply.github.com>
2022-12-20 07:55:58 -05:00
erik-krogh
605bfd6e93 move the "I don't care about parent relation on mocks" hack into the predicate, so the tests dont fail 2022-12-20 13:55:49 +01:00
erik-krogh
54072d29f1 add explicit this 2022-12-20 13:55:49 +01:00
erik-krogh
49277f553f model the last parts of the EquivalenceRelation module 2022-12-20 13:55:49 +01:00
erik-krogh
a11e618cfc mock parameters 2022-12-20 13:55:49 +01:00
erik-krogh
4feb48ce5f classless predicate, used to model the edgeSig predicate 2022-12-20 13:55:49 +01:00
erik-krogh
4dc52379ad add a mock TypeExpr, and use it 2022-12-20 13:55:49 +01:00
erik-krogh
5db2f0aba0 mock classes, and add a Mock T class to QlBuiltins 2022-12-20 13:55:49 +01:00
erik-krogh
b7e0d1f8b3 don't include mock Ast nodes in PrintAst.ql 2022-12-20 13:55:49 +01:00
erik-krogh
51d5e881de add an Ast mocking library, and use it to create mocks of the QlBuiltins and EquivalenceRelation modules 2022-12-20 13:55:48 +01:00
erik-krogh
0ca38faa4d add test of buildins 2022-12-20 13:54:38 +01:00
erik-krogh
236e6db996 fix typos 2022-12-20 13:54:02 +01:00
erik-krogh
50a91b5017 shared: add a shared Either type 2022-12-20 13:54:02 +01:00
Erik Krogh Kristensen
073e9bc52f Merge pull request #11173 from erik-krogh/notDead
QL: improve the dead-code query
2022-12-20 13:36:58 +01:00
Erik Krogh Kristensen
b1e6a86a4b Merge pull request #11757 from erik-krogh/treesitter-qldoc
QL/RB: make top TreeSitter.qll comment into a qldoc
2022-12-20 13:36:31 +01:00
Rasmus Lerchedahl Petersen
f5e33ac00a Merge remote-tracking branch 'origin/main' into python/support-grouped-exceptions 2022-12-20 13:31:50 +01:00
Erik Krogh Kristensen
b5b0a64081 Merge pull request #11751 from jacola/main
Fix javascript syntax
2022-12-20 13:02:23 +01:00
Rasmus Lerchedahl Petersen
ad6ed2f629 python: update expectations
extra tests
2022-12-20 13:01:27 +01:00
Erik Krogh Kristensen
6be223ad6d Merge pull request #11756 from aibaars/fix-ql-module-parameter
QL: fix visibility of module parameters
2022-12-20 12:59:07 +01:00
erik-krogh
2ff23a6fc0 make top TreeSitter.qll comment into a qldoc 2022-12-20 11:39:06 +01:00
Arthur Baars
c8255770bc QL: fix visibility of module parameters 2022-12-20 11:22:20 +01:00
Tony Torralba
149cae9603 Merge pull request #10971 from joefarebrother/android-certificate-pinning
Java: Add Android missing certificate pinning query (CWE-295)
2022-12-20 11:03:16 +01:00
Arthur Baars
bad5c65144 Add test 2022-12-20 10:37:57 +01:00
Mathias Vorreiter Pedersen
cbe330eb7b Merge pull request #11693 from jketema/argv-param-flowsource
C++: Define the `argv` flow source in terms the input parameter
2022-12-20 09:30:19 +00:00
Tony Torralba
3e7a819fe7 Simplification 2022-12-20 09:42:25 +01:00
Jeroen Ketema
edc768b43b Merge pull request #11707 from smowton/smowton/fix/java-empty-multiline-comment
Java: handle printing an empty comment (/**/); add relevant tests
2022-12-20 08:07:42 +01:00
Jacques
b99c500435 Fix associated test 2022-12-20 12:51:13 +09:00
Jacques
97b8126385 Fix javascript 2022-12-20 12:45:59 +09:00
Sid Shankar
52cafdf25f Merge pull request #11745 from github/sidshank/remove-lgtm-for-go 2022-12-19 21:49:02 -05:00
Aditya Sharad
bcd711a708 Tutorial: Add separate QLDoc for Person class
By moving the existing doc comment to the top level,
that comment is shown when a user hovers over the module name
in `import tutorial`.
2022-12-19 15:54:12 -08:00
Aditya Sharad
ed29b3e4d6 Shared packs: Depend on codeql/tutorial from all language libraries
This allows `import tutorial` from queries targeting
any language, just like before, while removing the
duplicate copies of `tutorial.qll`.
2022-12-19 15:52:11 -08:00
Aditya Sharad
d772998bc7 Shared packs: Create codeql/tutorial library pack
This contains the QL detective tutorial library
in `tutorial.qll`, so that it can be shared by
all language libraries and referenced on its own.
2022-12-19 15:52:11 -08:00
Nora Dimitrijević
1c64bf4bbc Swift: remove superfluous newline 2022-12-19 18:00:20 -05:00
Nora Dimitrijević
55c6e565f7 Swift: PrintAst.qll nodes() ordering fix not needed
No-double-parents should be sufficient for a stable top-level ordering.
2022-12-19 17:52:20 -05:00
Nora Dimitrijević
8b0da01e0d Swift: allow self./super. sinks in StaticInitializationVector
Assumption: the extra path is not an issue in practice as the body of
the cryptographic library's init methods are not normally extracted,
only the stubs in this test are.
2022-12-19 17:39:44 -05:00
Nora Dimitrijević
3da54ebc61 Swift: give a clearer name to {Self,Super}RefExpr.getMethodDecl 2022-12-19 17:33:13 -05:00
Nora Dimitrijević
56a72d7c37 Swift: silence QL-for-QL "Redundant override" FP 2022-12-19 16:45:31 -05:00
Sid Shankar
ae3e25786f Remove LGTM references from README.md + cleanup 2022-12-19 20:51:01 +00:00
Sid Shankar
35000e5d7e Remove LGTM reference from CONTRIBUTING.md 2022-12-19 20:12:23 +00:00
Jami Cogswell
19deb59d07 Java: sort neutral models alphabetically 2022-12-19 14:22:17 -05:00
Calum Grant
cfd79e2006 Py: Put in commented-out test and update expected 2022-12-19 17:29:48 +00:00
Calum Grant
e982e144a4 JS: Update qltest output 2022-12-19 17:22:51 +00:00
Tony Torralba
a47ef17a0d Update java/ql/src/Security/CWE/CWE-295/AndroidMissingCertificatePinning1.java
Co-authored-by: Edward Minnix III <egregius313@github.com>
2022-12-19 18:11:54 +01:00
Chris Smowton
ebc0b0c4d6 Merge pull request #11665 from smowton/smowton/admin/revert-kotlin-default-method-type-erasure
Kotlin: Revert type erasure within $default functions
2022-12-19 16:33:20 +00:00
Edward Minnix III
39a7c7bb12 Merge pull request #11282 from egregius313/egregiu313/webview-addjavascriptinterface
Java: Query for detecting addJavascriptInterface method calls
2022-12-19 11:28:45 -05:00
Tony Torralba
624c9ff834 Update java/ql/src/Security/CWE/CWE-295/AndroidMissingCertificatePinning1.java 2022-12-19 17:26:41 +01:00
Arthur Baars
a8be5d7274 AlertSuppression: add change notes 2022-12-19 17:02:52 +01:00
Arthur Baars
0f313231bc AlertSuppression: add more tests 2022-12-19 16:43:11 +01:00
Jeroen Ketema
0c710479ec C++: Update experimental test changes 2022-12-19 16:35:24 +01:00
Tony Torralba
0c6ace350f Update java/ql/src/Security/CWE/CWE-295/AndroidMissingCertificatePinning.ql
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
2022-12-19 16:24:39 +01:00
Calum Grant
0894059d33 Ruby: Remove reference to LGTM 2022-12-19 15:15:43 +00:00
Calum Grant
a1d229e445 Python: Remove references to LGTM 2022-12-19 15:15:32 +00:00
Calum Grant
4a37c01c5f JavaScript: Remove references to LGTM 2022-12-19 15:15:17 +00:00
Arthur Baars
c9739b21cb AlertSuppression: add support for //codeql comments 2022-12-19 16:10:28 +01:00
Arthur Baars
c176606be5 AlertSuppression: allow //lgtm comments to scope over the next line 2022-12-19 16:10:26 +01:00
Arthur Baars
016c7a8ca7 Merge pull request #11719 from aibaars/alert-suppression-shared
Shared AlertSuppression library
2022-12-19 16:04:44 +01:00
Henning Makholm
ca1c46331a Merge pull request #11731 from github/hmakholm/pr/no-option
remove com.semmle.util.data.Option from from extractor code interface II
2022-12-19 15:36:51 +01:00
Erik Krogh Kristensen
f136651384 Merge pull request #11575 from erik-krogh/kernelLoad
Rb: add Kernel methods as sinks to path-injection
2022-12-19 15:09:21 +01:00
Jami Cogswell
a8ee633acd Java: apply review suggestions 2022-12-19 09:09:01 -05:00
James Fletcher
55a04e7ff8 Merge pull request #11736 from github/jf205-patch-1
Update query-classification-and-display.md
2022-12-19 14:00:21 +00:00
Jami Cogswell
f37f0a09aa Java: update change note 2022-12-19 08:41:56 -05:00
Jami Cogswell
42ddd66360 Java: add hasApiName predicate 2022-12-19 08:38:12 -05:00
erik-krogh
66be8cda06 remove more of the implementation into ConditionalBypassQuery.qll 2022-12-19 14:37:19 +01:00
Arthur Baars
8be882f815 Update javascript/ql/src/AlertSuppression.ql
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2022-12-19 14:35:16 +01:00
erik-krogh
d0af30b40a cleanup the implementation of toString() for `SuperCall 2022-12-19 14:28:01 +01:00
James Fletcher
23047d8246 Delete query-classification-and-display.md 2022-12-19 13:24:52 +00:00
James Fletcher
af5de55d1f Merge pull request #11737 from github/jf205-patch-2
Update supported-queries.md
2022-12-19 13:22:10 +00:00
Arthur Baars
682bf6d3a7 Apply suggestions from code review
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2022-12-19 14:16:05 +01:00
Chris Smowton
2ca56e0c1e Java: handle printing an empty comment (/**/); add relevant tests 2022-12-19 14:12:09 +01:00
James Fletcher
75b63bbb0e Update supported-queries.md
Removes mentions of LGTM.
2022-12-19 13:11:31 +00:00
James Fletcher
af60851233 Update query-classification-and-display.md
Removes the section about queries run on LGTM.com.
2022-12-19 12:52:32 +00:00
Jeroen Ketema
edd29f4b0e C++: Add change note 2022-12-19 13:50:50 +01:00
yoff
5f0cde5be7 Merge branch 'main' into python/support-grouped-exceptions 2022-12-19 13:38:25 +01:00
yoff
d4eb2b964c Merge pull request #11699 from erik-krogh/shareHost
Dynamic: Share more regexp code
2022-12-19 13:29:53 +01:00
Jeroen Ketema
ed33b905a6 C++: Simplify cpp/path-injection now argv sources are parameters 2022-12-19 12:54:16 +01:00
Jeroen Ketema
7549915773 C++: Accept test changes 2022-12-19 12:52:35 +01:00
Arthur Baars
06736e3e91 Add .gitattributes for Windows test files 2022-12-19 12:39:01 +01:00
Arthur Baars
f68e18cd9c Python: move AlertSuppression.ql 2022-12-19 12:39:01 +01:00
Arthur Baars
acb5d6e163 Python: use shared AlertSuppression.qll 2022-12-19 12:26:12 +01:00
Arthur Baars
621a108846 Ruby: use shared AlertSuppression.qll 2022-12-19 12:26:06 +01:00
Arthur Baars
453045e276 C#: use shared AlertSuppression.qll 2022-12-19 12:25:50 +01:00
Arthur Baars
ad80822a52 C/C++: use shared AlertSuppression.qll 2022-12-19 12:25:46 +01:00
Arthur Baars
b0e8085765 Go: use shared AlertSuppression.qll 2022-12-19 12:25:21 +01:00
Arthur Baars
23f595bea1 JavaScript: use shared AlertSuppression.qll 2022-12-19 12:25:17 +01:00
Jeroen Ketema
a73bd050f7 C++: Define the argv flow source in terms the input parameter 2022-12-19 12:13:39 +01:00
Jeroen Ketema
2705aebbbc C++: Restrict CWE-119 semmle tests to have a single main function 2022-12-19 12:13:37 +01:00
Tony Torralba
484a16ce1b Update java/ql/src/Security/CWE/CWE-295/AndroidMissingCertificatePinning.ql 2022-12-19 12:10:32 +01:00
Arthur Baars
bc646d407e Java: use shared AlertSuppression.qll 2022-12-19 12:07:28 +01:00
Arthur Baars
072a180093 Util: add AlertSuppression.qll 2022-12-19 12:06:36 +01:00
erik-krogh
442749bb7f JS: add heuristic variants of queries that use RemoteFlowSource 2022-12-19 12:01:22 +01:00
Tony Torralba
a880fecc8b Apply suggestions from code review
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
2022-12-19 11:56:36 +01:00
erik-krogh
2f84b21c7f QL: add getQueryName to QueryDoc 2022-12-19 11:29:20 +01:00
erik-krogh
6c8b1cf4be changes based on Python review 2022-12-19 11:20:31 +01:00
Jean Helie
31f7702a04 Merge pull request #11726 from github/jhelie/fix-endpoint-large-scale-script
ATM: fix script updating endpoint large scale test data
2022-12-19 10:55:30 +01:00
Michael Nebel
0661627248 Merge pull request #11733 from michaelnebel/csharp/updatestats
C#: Add dummy type sizes for the list pattern expressions kinds.
2022-12-19 10:51:06 +01:00
erik-krogh
db49cfb723 Merge branch 'main' into kernelLoad 2022-12-19 09:46:25 +01:00
Erik Krogh Kristensen
08240e2d65 Merge pull request #11661 from erik-krogh/even-faster-atm-ci
ATM: speedup the "ATM - Check query suite" CI job
2022-12-19 09:14:07 +01:00
Michael Nebel
b9f668b320 C#: Add dummy type sizes for the list pattern expressions kinds. 2022-12-19 09:10:35 +01:00
Jami Cogswell
f933fc75cd Java: update another test affected by Integer.parseInt, and one affected by String.length 2022-12-18 21:46:43 -05:00
Jami Cogswell
f3fc68352e Java: update tests affected by Integer.parseInt model 2022-12-18 19:43:32 -05:00
erik-krogh
35e8d6afd4 move getACommonTld into a utility module without parameters 2022-12-18 17:23:45 +01:00
erik-krogh
ba7321ac5c add qldoc to RegExpCharEscape 2022-12-18 17:23:45 +01:00
erik-krogh
26c5480ee6 share {js,rb}/regex/missing-regexp-anchor 2022-12-18 17:23:41 +01:00
turbo
d1d4163b79 Exclude cpp/wrong-use-of-the-umask 2022-12-18 15:55:04 +01:00
turbo
b7c33734b1 Merge remote-tracking branch 'origin/turbo/experimental/combined' into turbo/experimental/combined 2022-12-18 15:44:53 +01:00
turbo
1e5426fca2 Create security-experimental suite helper and all language suite implementations 2022-12-18 15:44:08 +01:00
erik-krogh
355499ea52 move getACommonTld to the shared pack 2022-12-17 17:26:18 +01:00
erik-krogh
f67d0bc8c0 put the shared HostnameRegexp code in the shared regex pack 2022-12-17 17:26:18 +01:00
Jami Cogswell
1d916a2baa Java: clean up 2022-12-16 16:16:56 -05:00
Jami Cogswell
0c22d68a65 Java: update extensible predicate names 2022-12-16 15:40:14 -05:00
Jami
ff652f7dee Merge branch 'main' into jcogs33/model-top-jdk-apis 2022-12-16 15:32:50 -05:00
Jami Cogswell
9762423fbc Java: add more test cases 2022-12-16 15:26:54 -05:00
Henning Makholm
3e85e9f7d9 remove com.semmle.util.data.Option from from extractor code interface II
com.semmle.util.data.Option is going away. Switch the single
cross-repo call that mentions it to use the new Option-less overload
that was introduced in semmle-code PR 44626.
2022-12-16 19:03:20 +01:00
Henry Mercer
30451ee950 Merge pull request #11681 from github/henrymercer/mergeback-3.8
Merge `rc/3.8` back to `main`
2022-12-16 17:43:12 +00:00
Jami Cogswell
83630842b6 Java: add change note 2022-12-16 11:49:52 -05:00
Tom Hvitved
e629568eda Merge pull request #11720 from hvitved/ruby/call-sensitive-initialize-bug-fix
Ruby: Fix bug in call-sensitivity logic for `initialize` calls
2022-12-16 16:36:31 +01:00
Jami Cogswell
c0628035fa Java: reduce code duplication 2022-12-16 10:28:34 -05:00
Owen Mansel-Chan
003edeab80 Merge pull request #11706 from owen-mc/fix/go-callback-type-stubs-2
Go: Use any() to stub getCallbackParameter/ReturnType and getSyntheticGlobalType
2022-12-16 14:43:35 +00:00
Jean Helie
938a7e828c update tests 2022-12-16 15:31:43 +01:00
Jeroen Ketema
32800bca96 Merge pull request #11680 from jketema/predefined-typedef-for-float
C++: Update tests after frontend changes
2022-12-16 15:21:58 +01:00
Michael Nebel
e9d27540c8 Merge pull request #11686 from michaelnebel/csharp/refactorforeach
C#: Re-factor and use `ForEach`.
2022-12-16 14:59:58 +01:00
Jami Cogswell
640b450c47 Java: add message column to qltest 2022-12-16 08:51:18 -05:00
Tom Hvitved
5fba5e4895 Merge pull request #11718 from hvitved/ruby/self-allocate
Ruby: Recognize custom `self.new` methods that return `self.allocate`
2022-12-16 14:46:08 +01:00
Jami Cogswell
bf6148c477 Java: fix bot alert, remove metadata from qltest 2022-12-16 08:44:23 -05:00
Jean Helie
cd0220b248 update autogenerated data for endpoint_large_scale 2022-12-16 14:03:01 +01:00
Jean Helie
904a4bd48b fix script updating endpoint_large_scale test data 2022-12-16 14:03:00 +01:00
Rasmus Lerchedahl Petersen
96ae148118 python: also override `getAHandler
(to get new result type)
2022-12-16 13:40:10 +01:00
Rasmus Lerchedahl Petersen
d216460032 python: unnecessary abstract class
It is enough to make the predicates abstract,
so the whole -`Impl`-construction was unnecessary.
2022-12-16 12:43:41 +01:00
Geoffrey White
640f894b00 Merge branch 'main' into format 2022-12-16 11:42:03 +00:00
Rasmus Lerchedahl Petersen
5094897668 python: unify change notes with fixes 2022-12-16 12:37:25 +01:00
Tom Hvitved
bfc257147c Ruby: Fix bug in call-sensitivity logic for initialize calls 2022-12-16 11:17:15 +01:00
Michael Nebel
b2856c1f5a Merge pull request #11705 from michaelnebel/dataextensiontests
C#/Java: Migrate tests to use implicitly loaded extensions.
2022-12-16 10:50:07 +01:00
Tony Torralba
46ea067449 Add bidirectional import in ExternalFlow.qll 2022-12-16 09:59:48 +01:00
Tom Hvitved
e45edcc159 Merge pull request #11674 from hvitved/dataflow/param-context
Data flow: Track callable in flow-through pruning
2022-12-16 09:25:15 +01:00
Tom Hvitved
accf4ca364 Ruby: Recognize custom self.new methods that return self.allocate 2022-12-16 09:23:36 +01:00
Tom Hvitved
b64083d08e Ruby: Add more call graph tests 2022-12-16 09:21:00 +01:00
Michael Nebel
390b8afb8a C#: Re-factor to use ForEach. 2022-12-16 08:24:09 +01:00
Michael Nebel
0230b8b56f C#: Minor cleanup in the Pattern files. 2022-12-16 08:24:09 +01:00
yoff
4ddb503f61 Update python/ql/lib/change-notes/2022-11-14-grouped-exceptions-breaking.md
Co-authored-by: Rasmus Wriedt Larsen <rasmuswl@github.com>
2022-12-16 08:21:29 +01:00
Michael Nebel
89fcc17182 Merge pull request #11594 from michaelnebel/csharp/listpattern
C#: Support List and Slice patterns.
2022-12-16 08:21:07 +01:00
Jami Cogswell
fdcaa93200 Java: update test case 2022-12-15 23:47:17 -05:00
Jami Cogswell
f01ee9e4c2 Java: remove PR-merging comment 2022-12-15 22:56:15 -05:00
Jami Cogswell
08546549bf Java: update exception models and add test 2022-12-15 22:53:14 -05:00
Jami
fd63348549 Merge pull request #11585 from jcogs33/jcogs33/mad-metrics-query
Java: add MaD metrics query
2022-12-15 19:26:51 -05:00
Nora Dimitrijević
938f724602 Swift: fix db upgrade/downgrade script after pull 2022-12-15 16:37:52 -05:00
Jami Cogswell
96a0950048 Java: update test case 2022-12-15 15:49:53 -05:00
Jami Cogswell
c33bc63aed Java: remove extraneous parentheses 2022-12-15 15:26:04 -05:00
Jami Cogswell
cfeedb5cb4 Java: add float cast 2022-12-15 15:23:28 -05:00
Jami Cogswell
b68a9a51e2 Java: add coverage, generatedCoverage, and manualCoverage metrics 2022-12-15 15:20:08 -05:00
Jami Cogswell
9d10b719d6 Java: add match metric 2022-12-15 15:10:35 -05:00
Jami Cogswell
1c5d4f8048 Java: rename generatedCoverage and manualCoverage 2022-12-15 15:03:00 -05:00
Michael Nebel
c34bde962c Java: Update integration tests to use implicit ext.yml data extensions. 2022-12-15 19:01:29 +01:00
Mathias Vorreiter Pedersen
801f4bc8a3 Merge pull request #11715 from geoffw0/jsevalcleanup 2022-12-15 17:35:49 +00:00
Mathias Vorreiter Pedersen
0f04e841a0 Merge pull request #11708 from geoffw0/perf
Swift: Fix RemoteFlowSource performance issue.
2022-12-15 16:56:35 +00:00
Nora Dimitrijević
ea6c69dd34 Swift: fix test with different linux/macos results
`methodlookup.swift` has one more call to `Builtin.zeroInitializer()`
in macOS than it does in Linux.
2022-12-15 11:48:43 -05:00
Mathias Vorreiter Pedersen
7d5e215a93 Merge pull request #11600 from geoffw0/offsetrangecheck
C++: Fix cpp/offset-use-before-range-check performance.
2022-12-15 16:44:49 +00:00
Nora Dimitrijević
40fb6f98c9 Merge branch 'main' into swift/extract-mainactor 2022-12-15 11:29:12 -05:00
Nora Dimitrijević
893ec33da0 Swift: update .expected for integration tests 2022-12-15 11:28:02 -05:00
Geoffrey White
9481673c07 Swift: Remove temp workaround. 2022-12-15 16:08:51 +00:00
Nora Dimitrijević
60727b1e5e Swift: Fix Builtin(Types) test extraction failure 2022-12-15 10:47:10 -05:00
Geoffrey White
cca0722a2b Merge pull request #11710 from geoffw0/qldocalloc
C++: Clarify Allocation.qll and Deallocation.qll
2022-12-15 15:36:48 +00:00
Geoffrey White
1f7d96a74a Merge branch 'main' into format 2022-12-15 15:17:54 +00:00
Tom Hvitved
f8571dd0b6 Data flow: Work around functionality-induced misoptimization 2022-12-15 15:29:14 +01:00
Tom Hvitved
6eda042229 Data flow: Sync files 2022-12-15 15:29:13 +01:00
Tom Hvitved
adc738cb15 Data flow: Simplify reverse flow-through pruning 2022-12-15 15:29:12 +01:00
Tom Hvitved
d34901ac8c Data flow: Track return position instead of return kind
Reverts bdb205a318.
2022-12-15 15:29:12 +01:00
Tom Hvitved
1820bb4b0b Data flow: Simplify forwards flow-through pruning 2022-12-15 15:29:11 +01:00
Tom Hvitved
cb84b557cf Data flow: Track parameter instead of parameter position
Reverts 70d2a0df8a.
2022-12-15 15:29:11 +01:00
Michael Nebel
2034b00772 C#: Remove deprecated ModelCsv classes. 2022-12-15 15:22:52 +01:00
Michael Nebel
0f038ee93a Java: Remove deprecated ModelCsv classes. 2022-12-15 15:22:44 +01:00
Michael Nebel
f8b1fb465b C#: Downgrade script should convert list- and slice pattern to unknown expression kind. 2022-12-15 14:50:22 +01:00
Michael Nebel
352ae7919b C#: Add change note. 2022-12-15 14:50:22 +01:00
Michael Nebel
b4407eefb2 C#: Add downgrade script. 2022-12-15 14:50:22 +01:00
Michael Nebel
2c9e8bcb2d C#: Add upgrade script. 2022-12-15 14:50:22 +01:00
Michael Nebel
88c8eceb4d C#: Add list pattern test and expected results. 2022-12-15 14:50:21 +01:00
Michael Nebel
e6b4055a5f C#: Add list pattern sample file. 2022-12-15 14:50:21 +01:00
Michael Nebel
98e125fa98 C#: Add library support for list- and slice patterns. 2022-12-15 14:50:21 +01:00
Michael Nebel
cfd3c1fcbe C#: Add extractor support for list- and slice patterns. 2022-12-15 14:50:21 +01:00
Michael Nebel
00354a2f08 C#: Add list- and slice pattern expression kinds and re-generate ExprKind.cs. 2022-12-15 14:50:21 +01:00
Michael Nebel
31c60e545e Java: Update the flow test generator to create ext.yml files. 2022-12-15 14:46:20 +01:00
Paolo Tranquilli
7f505d8715 Swift: do not filter frontend actions 2022-12-15 14:39:43 +01:00
Mathias Vorreiter Pedersen
99286fbdb1 Merge pull request #11704 from jketema/scanf-free
C++: Exclude deallocation functions as `scanf` result accesses
2022-12-15 13:17:43 +00:00
Michael Nebel
6dc798f970 Java: Migrate tests to use implicit ext.yml data extensions. 2022-12-15 14:13:07 +01:00
Geoffrey White
e7ea0d7ee9 C++: Attempt to clarify the way Allocation.qll and Deallocation.qll should be used. 2022-12-15 13:05:56 +00:00
Rasmus Lerchedahl Petersen
3a8fd910b1 python: do not change autogenerated file 2022-12-15 14:02:52 +01:00
Tom Hvitved
d7e44a5426 Merge pull request #10714 from hvitved/ruby/initialize
Ruby: Model flow through `initialize` constructors
2022-12-15 13:42:59 +01:00
Geoffrey White
8e61c78ce6 Swift: Fix RemoteFlowSource performance issue. 2022-12-15 12:36:32 +00:00
Paolo Tranquilli
208388e04d Swift: hard code libc.dylib path on macOS
Also, handle the corner case where loading libc fails.
2022-12-15 13:30:23 +01:00
Owen Mansel-Chan
76a3fa856f Use any() to stub getSyntheticGlobalType
This is used in all other languages not currently using dataflow type
pruning.
2022-12-15 12:24:23 +00:00
Owen Mansel-Chan
1a1b6a1b93 Use any() to stub getCallbackParameter/ReturnType
This is used in all other languages not currently using dataflow type
pruning.
2022-12-15 12:24:23 +00:00
Michael Nebel
100f64c09a C#: Migrate tests to use the implicitly loaded .ext.yml data extensions. 2022-12-15 13:11:09 +01:00
Owen Mansel-Chan
0af530061d Merge pull request #11697 from owen-mc/go/make-dataflowtype-singleton
Make DataFlowType a singleton
2022-12-15 12:07:57 +00:00
Rasmus Lerchedahl Petersen
a97bbdd0bc python: rework hierarchy to avoid breaking API 2022-12-15 13:01:04 +01:00
Jeroen Ketema
ef61d14e9c C++: Add change note 2022-12-15 12:57:13 +01:00
Rasmus Lerchedahl Petersen
997e3599f0 python: make tests valid and more fleshed out 2022-12-15 12:54:16 +01:00
Rasmus Lerchedahl Petersen
8e8d36f35e python: this also works in 3.11 2022-12-15 12:54:14 +01:00
Rasmus Lerchedahl Petersen
3ace1ee69f Python: remove obsolete coments 2022-12-15 12:54:13 +01:00
Jeroen Ketema
0b4c4fd580 C++: Simplify deallocation check 2022-12-15 12:46:32 +01:00
Tony Torralba
6837af97bc Apply suggestions from code review
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2022-12-15 12:35:54 +01:00
Tony Torralba
11c03fb8c9 Add 'good' test cases 2022-12-15 12:35:47 +01:00
Owen Mansel-Chan
039d582060 Fix date in unrelated change note 2022-12-15 11:04:48 +00:00
Owen Mansel-Chan
06038d575e Improve comments about Fields 2022-12-15 11:04:48 +00:00
Owen Mansel-Chan
e01e40c532 Fix FuncTypeExpr.getNumParameter
It actually counts the number of parameter declarations. We correct it
to do what it says and introduce `FuncTypeExpr.getNumParameterDecls`,
which we then use in `FuncTypeExpr.getUniquelyNumberedChild`.
2022-12-15 11:04:48 +00:00
Alex Ford
1b49bfe605 Merge pull request #11497 from alexrford/ruby/rails_globalid
Ruby: model `rails/globalid` component
2022-12-15 10:35:15 +00:00
Erik Krogh Kristensen
1500fa5f67 Merge pull request #10663 from pwntester/restify_improvements
Javascript: Improve Restify support and add new Spife support
2022-12-15 11:08:22 +01:00
Michael Nebel
a67e02df21 Merge pull request #11691 from michaelnebel/renameextensibles
C#/Java: Rename externalflow extensible predicates
2022-12-15 11:05:22 +01:00
Tom Hvitved
b3feb4f295 Update ruby/ql/lib/codeql/ruby/typetracking/TypeTrackerSpecific.qll
Co-authored-by: Asger F <asgerf@github.com>
2022-12-15 10:46:06 +01:00
Paolo Tranquilli
3084eda28a Swift: add swiftmodule hash map testing to frontend_invocations 2022-12-15 10:33:47 +01:00
Paolo Tranquilli
e42ae09e1c Swift: fix interaction between bash wrapper and open redirection on macOS 2022-12-15 09:50:31 +01:00
Michael Nebel
12c1ebd81c C#/Java: Add change note. 2022-12-15 09:41:14 +01:00
Jeroen Ketema
4fb43d56b3 C++: Exclude deallocation functions as scanf result accesses 2022-12-15 09:39:16 +01:00
Jami Cogswell
56acfdf672 Java: update test case 2022-12-15 00:57:08 -05:00
Jami Cogswell
510cd4a163 Java: change negative to neutral 2022-12-15 00:46:03 -05:00
Jami Cogswell
f1ddbbb96f Java: update remaining models 2022-12-15 00:33:35 -05:00
Jami Cogswell
46b8fbc4c9 Java: update remaining models, resolve merge conflict 2022-12-15 00:33:06 -05:00
Jami Cogswell
15069250eb Java: add draft of test case 2022-12-15 00:24:41 -05:00
Jami Cogswell
134577e52b Java: some updates to models 2022-12-15 00:24:41 -05:00
Jami Cogswell
4c590d1190 Java: move most negative models to package.model.yml files 2022-12-15 00:24:41 -05:00
Jami Cogswell
b7016feb44 Java: initial updates based on review comments 2022-12-15 00:24:41 -05:00
Jami Cogswell
b3dbf00ae6 Java: update comment 2022-12-15 00:24:41 -05:00
Jami Cogswell
9d3abc72bf Java: add draft of top 100 jdk models 2022-12-15 00:24:40 -05:00
Nora Dimitrijević
7ea0eada11 Swift: add missing Builtin symbols 2022-12-14 20:03:41 -05:00
turbo
5fd5ebc26e Create security-experimental suite helper and all language suite implementations 2022-12-14 23:35:32 +01:00
Nora Dimitrijević
2d288906a4 Swift: fix db downgrade script 2022-12-14 17:27:11 -05:00
Ed Minnix
72484b9483 Change wording of addJavascriptInterface query description 2022-12-14 16:19:03 -05:00
Nora Dimitrijević
e16b23afc1 Swift: db upgrade/downgrade script 2022-12-14 15:56:05 -05:00
Jami
359e49044f Merge branch 'main' into jcogs33/mad-metrics-query 2022-12-14 15:33:29 -05:00
Nora Dimitrijević
8a3ef31a2c Swift: silence QL-for-QL redundant import warning 2022-12-14 15:22:39 -05:00
Nora Dimitrijević
5faa44389e Swift: Basic acceptance of UnsafeJsEval test
TODO: Fix remaining problem in a separate PR:
- path found to one async `@MainActor` evaluateJavaScript
  call, but not others. Investigate why.
- Remove duplicate paths and those with unnecessary [summary] nodes.
2022-12-14 15:02:15 -05:00
Nora Dimitrijević
95d4c304da Swift: Fix .expected tests
Only UnsafeJsEval remains.
2022-12-14 15:02:15 -05:00
Erik Krogh Kristensen
55558120d9 add explicit this 2022-12-14 20:59:28 +01:00
Nora Dimitrijević
6269e6b24d Swift: move getName to Callable (generated)
Now that getStaticTarget returns a Callable.
2022-12-14 14:30:33 -05:00
Nora Dimitrijević
535daf39b7 Swift: move getName to Callable (hand-written)
Now that getStaticTarget returns a Callable.
2022-12-14 14:29:13 -05:00
Nora Dimitrijević
89cd082f0a Swift: {Method,Initializer}CallExpr + SelfRefExpr
Adds a bit of symmetry in the API.

Also, fix a couple of tests that were using the old types.
2022-12-14 14:28:01 -05:00
Nora Dimitrijević
5f03099000 Swift: clarify DotSyntaxBaseIgnoredExpr
- Add docstring with implementation note.
- Avoid `concat` aggregate in toString().

Still, this class should really be cleaned up in the following ways:

- Rename to a sane name at the schema level
- Have subtypes that change the return type of getSubExpr to reflect
  the structure of the desugared closure. E.g. one for methods,
  one for fields.
2022-12-14 14:28:00 -05:00
Nora Dimitrijević
16a119248d Swift: remove toString() = "call to call to ..." 2022-12-14 14:28:00 -05:00
Nora Dimitrijević
91f35a5d53 Swift: isStaticOrClassMethod + isInstanceMethod
Still, we should really be extracting these attributes.
2022-12-14 14:28:00 -05:00
Nora Dimitrijević
6a0b020573 Swift: move methodlookup test to library-tests 2022-12-14 14:28:00 -05:00
Nora Dimitrijević
15d5674d12 Swift: update .expected files based on last commit 2022-12-14 14:28:00 -05:00
Nora Dimitrijević
a620658a66 Swift: fix PrintAst order, double parents, orphan decl refs
The main problem is that a lot of the old DotSyntaxApplyExpr->MethodRefExpr
synth-constructor hacks were not fully generalized to SelfApplyExpr
and OtherConstructorDeclRefExpr.

Also:

- Gave a index-in-parent-based ordering to PrintAst nodes(), to stabilize it more.
- Use a slightly more general SelfApplyExpr->Decl conversion
2022-12-14 14:28:00 -05:00
Nora Dimitrijević
b5bb814112 Swift: fix toString of some invisible DeclRefExprs 2022-12-14 14:28:00 -05:00
Nora Dimitrijević
f6d5e8db5f Swift: update test .expected files 2022-12-14 14:27:59 -05:00
Nora Dimitrijević
799b4c932f Swift: DotSyntaxBaseIgnored calls now have static target
This relies on getStaticTarget() returning a Callable... Not sure how I feel about that, since often we want to say

```
exists(Call c |
  c.getStaticTarget().hasName("...")
)
```

and Callable has a sparse interface. Maybe some AbstractFunctionDecl
methods can be moved to Callable.
2022-12-14 14:24:36 -05:00
Nora Dimitrijević
89bfad0420 Swift: fix MethodLookupExpr.getMethod()
By adding a couple missing cases.
2022-12-14 14:24:36 -05:00
Nora Dimitrijević
c1e746a980 Swift: add InitializerLookupExpr < MethodLookupExpr 2022-12-14 14:24:36 -05:00
Nora Dimitrijević
2af8ec86e6 Swift: init/deinit stringifies with qualifier 2022-12-14 14:24:36 -05:00
Nora Dimitrijević
14b84c6e06 Swift: add MethodDecl.isStatic/0 2022-12-14 14:24:36 -05:00
Nora Dimitrijević
668d79a62d Swift: one more rename 2022-12-14 14:24:36 -05:00
Nora Dimitrijević
2b060b1433 Swift: initial schema change (generated part) 2022-12-14 14:24:35 -05:00
Nora Dimitrijević
0c55561b8e Swift: initial schema change (hand-written part) 2022-12-14 14:22:53 -05:00
Nora Dimitrijević
1ede851cf5 Swift: initial getStaticTarget test 2022-12-14 14:22:53 -05:00
Nora Dimitrijević
99719d0ee1 Swift: initial PrintAst test for Method Lookups 2022-12-14 14:22:53 -05:00
Paolo Tranquilli
793de3196b Revert "Swift: accept test changes"
This reverts commit 26ae8f177b.
2022-12-14 18:34:12 +01:00
Paolo Tranquilli
14fd89d482 Swift: generalize output redirection code 2022-12-14 18:26:48 +01:00
Paolo Tranquilli
45c0c7fe6c Merge branch 'main' into redsun82/swift-open-redirection 2022-12-14 18:26:16 +01:00
Jami
33955ee4ab Merge pull request #11623 from jcogs33/jcogs33/exclude-funcexpr-from-dataflowtargetapi
Java/C#: exclude `FunctionalExpr`s from `DataFlowTargetApi`
2022-12-14 12:22:50 -05:00
Owen Mansel-Chan
8703da9db6 Merge pull request #11698 from owen-mc/go/fix-test-to-do-what-it-says
Fix test to use `hasQualifiedName/2`
2022-12-14 17:11:58 +00:00
Alvaro Muñoz
f46a8faf00 port RouteSetup API-based implementation to DataFlow one 2022-12-14 17:37:32 +01:00
turbo
b35a1d4206 Adjust docs referring to experimental queries to include details on new tagging system 2022-12-14 17:16:38 +01:00
turbo
4ec401a3f6 Tag all security queries in supported languages' experimental directories with an experimental tag 2022-12-14 17:15:50 +01:00
Tom Hvitved
c04b90bc6b Add change note 2022-12-14 16:30:18 +01:00
Alex Ford
2af5925f38 Ruby: improve coverage of GlobalID::Identification modelling 2022-12-14 15:21:19 +00:00
Owen Mansel-Chan
6ef677b606 Fix test to use hasQualifiedName/2 2022-12-14 15:20:02 +00:00
Owen Mansel-Chan
d18179c243 Add QLDoc for toString on DataFlowType 2022-12-14 14:56:54 +00:00
Asger F
a92acf5218 Merge pull request #11689 from asgerf/js/missing-csrf-qhelp
JS: Update MissingCsrfMiddleware after 'csurf' deprecation
2022-12-14 15:50:32 +01:00
Alvaro Muñoz
818c2da1aa fix Spife tests (without heuristics) 2022-12-14 15:42:27 +01:00
Alvaro Muñoz
4cf7299d79 restore Spife.qll to working status 2022-12-14 15:41:53 +01:00
Owen Mansel-Chan
50414cc748 Make DataFlowType a singleton 2022-12-14 14:40:15 +00:00
Alvaro Muñoz
14faff4477 fix restify tests 2022-12-14 15:38:35 +01:00
Owen Mansel-Chan
38369a72dc Merge pull request #11696 from github/smowton-patch-1
go: fix bug in zip-slip example fix
2022-12-14 14:31:58 +00:00
Michael Nebel
fe3c8613cd Java: Fix name of extensible in java integration test. 2022-12-14 15:25:47 +01:00
Chris Smowton
5799287a2b go: fix bug in zip-slip example fix 2022-12-14 13:51:32 +00:00
erik-krogh
42880f54a6 change ql/to-string-in-logic to a warning query 2022-12-14 14:48:55 +01:00
erik-krogh
1cd1b14e78 remove some more benign results in ql/suggest-instanceof-extension 2022-12-14 14:48:01 +01:00
erik-krogh
35f9f7c71b remove some benign results from ql/suggest-instanceof-extension 2022-12-14 14:47:58 +01:00
Jami
b248b44983 Merge pull request #11668 from jcogs33/jcogs33/update-isjdkinternal
Java: update `isJdkInternal`
2022-12-14 08:33:18 -05:00
erik-krogh
618f48b60b lower the precision of ql/class-predicate-doesnt-use-this to low 2022-12-14 14:31:22 +01:00
erik-krogh
f34f7cc41a exclude test folders from ql/path-problem-query 2022-12-14 14:31:22 +01:00
erik-krogh
3feee23933 fix performance in ql/override-parameter-name and lower the precision to low (it has 1407 results) 2022-12-14 14:31:22 +01:00
erik-krogh
39973df869 include medium precision queries in QL-for-QL 2022-12-14 14:31:22 +01:00
erik-krogh
f6c8e9af1f don't require a member to call a range method before suggesting to use instanceof 2022-12-14 14:31:22 +01:00
Erik Krogh Kristensen
7615668f92 Merge pull request #11662 from erik-krogh/c-useInstanceOf
Swift/C++: Use instanceof in more places
2022-12-14 14:30:21 +01:00
Jami
f61b817751 Merge pull request #11631 from jcogs33/jcogs33/update-externalapi-charpredicate
Java/C#: add `isUninteresting` to `ExternalApi` characteristic predicate
2022-12-14 08:25:02 -05:00
Owen Mansel-Chan
0b849a319b Merge pull request #11587 from owen-mc/go/remove-error-expr-from-dbscheme
Go: Remove @errorexpr from the dbscheme (use @badexpr)
2022-12-14 13:15:04 +00:00
Anders Schack-Mulligen
598b4c38b7 Merge pull request #11619 from aschackmull/java/typetrack-lambda
Java: Switch DispatchFlow to typetracking.
2022-12-14 14:08:29 +01:00
Michael Nebel
bc02adb400 Java: Make the corresponding rename in all the data extensions. 2022-12-14 13:48:31 +01:00
Michael Nebel
b45d079a01 Java: Move and rename externalflow related extensible predicates. 2022-12-14 13:43:34 +01:00
Michael Nebel
9fc1b3ac82 C#: Rename predicates in tests. 2022-12-14 13:43:34 +01:00
Michael Nebel
b5e7ba6135 C#: Rename extensible predicate in data extension definitions. 2022-12-14 13:43:34 +01:00
Michael Nebel
596c2c0345 C#/Java: Rename the modelgenerator and converter predicate names. 2022-12-14 13:43:34 +01:00
Michael Nebel
6d7401de7d C#: Rename the extensible predicates related to external flow. 2022-12-14 13:43:34 +01:00
Alvaro Muñoz
e1f05e960d Merge branch 'restify_improvements' of https://github.com/pwntester/codeql into restify_improvements 2022-12-14 13:11:13 +01:00
Alvaro Muñoz
a71fc930a6 add tests 2022-12-14 13:11:02 +01:00
Tom Hvitved
5d9c64ba6f Ruby: Model flow through initialize constructors 2022-12-14 12:57:39 +01:00
Tom Hvitved
9a7628c988 Ruby: Add data flow tests for constructors 2022-12-14 12:57:39 +01:00
Tom Hvitved
25b2d11368 Merge pull request #11635 from hvitved/dataflow/approx-content
Data flow: Introduce `ApproxContent` in a new pruning stage between stages 2 and 3
2022-12-14 12:56:50 +01:00
Asger F
b63c658e3b JS: recognize tiny-csrf 2022-12-14 12:30:15 +01:00
Asger F
162419138d JS: Replace csurf -> lusca.csrf from example and qhelp 2022-12-14 12:30:15 +01:00
Owen Mansel-Chan
3c6f466e78 Include downgrade scripts in extractor pack 2022-12-14 10:46:20 +00:00
Owen Mansel-Chan
14e6f9fee2 Remove @errorexpr from the dbscheme (use @badexpr) 2022-12-14 10:46:19 +00:00
Henry Mercer
6023a1225c Merge pull request #11673 from github/codeql-ci/atm/release-0.4.4
JS: Bump version numbers of ML-powered packs after 0.4.4 release
2022-12-14 10:27:00 +00:00
Alvaro Muñoz
701676eea1 Update javascript/ql/lib/semmle/javascript/frameworks/Spife.qll
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2022-12-14 10:18:47 +01:00
Tamás Vajk
a6d227d52e Merge pull request #11599 from igfoo/igfoo/diags
Java/Kotlin: Update the diagnostic severity documentation
2022-12-14 10:13:30 +01:00
Michael Nebel
54701f539e Merge pull request #11683 from github/workflow/coverage/update
Update CSV framework coverage reports
2022-12-14 09:41:23 +01:00
Paolo Tranquilli
de2e92d5e1 Swift: remove / delimiters from regex extracted patterns 2022-12-14 09:18:36 +01:00
Paolo Tranquilli
fb5b6eab19 Swift: extract RegexLiteralExpr 2022-12-14 09:12:07 +01:00
Paolo Tranquilli
a80e9206c8 Merge pull request #11639 from github/alexdenisov/switch-to-bootstrapped-swift
Swift: switch to bootstrapped Swift compiler
2022-12-14 09:04:19 +01:00
github-actions[bot]
d905bed92f Add changed framework coverage reports 2022-12-14 00:17:01 +00:00
Jami Cogswell
c956589945 Java: remove dot before percent 2022-12-13 17:46:20 -05:00
Jami Cogswell
dee251e5d6 Java: update isJdkInternal 2022-12-13 17:46:20 -05:00
Jami
11bd35661c Merge branch 'main' into jcogs33/exclude-funcexpr-from-dataflowtargetapi 2022-12-13 17:10:39 -05:00
Edward Minnix III
40c759e61a Add @name property
Co-authored-by: Sam Browning <106113886+sabrowning1@users.noreply.github.com>
2022-12-13 16:14:28 -05:00
Erik Krogh Kristensen
8a89849476 Merge pull request #11660 from erik-krogh/dynamic-useInstanceOf
Py/JS/RB: Use instanceof in more places
2022-12-13 21:50:13 +01:00
Tamás Vajk
8e500ec0f3 Merge pull request #11675 from tamasvajk/kotlin-error-expr-consistency
Kotlin: Report CFG dead end consistency issues on `ErrorExpr`
2022-12-13 20:22:47 +01:00
Henry Mercer
a3933fbf4f Bump minor versions of packs we regularly release 2022-12-13 18:59:24 +00:00
Jeroen Ketema
19fb73ce24 C++: Update tests after frontend changes 2022-12-13 19:52:59 +01:00
Henry Mercer
7167f078be Merge branch 'main' into henrymercer/mergeback-3.8 2022-12-13 18:40:53 +00:00
erik-krogh
d95a4a7baf add a second example of how to use module_eval without constructing a code-string 2022-12-13 19:33:45 +01:00
Jami Cogswell
be7b4151af Java: update getNumApis and remove package binding from query body 2022-12-13 12:54:43 -05:00
erik-krogh
ccf520a5cd Merge branch 'main' into unsafeCodeConstruction 2022-12-13 18:31:49 +01:00
Siara
141bc41881 Update docs/codeql/writing-codeql-queries/introduction-to-ql.rst
Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com>
2022-12-13 09:22:16 -08:00
Siara
44f91ad723 Update docs/codeql/reusables/codespaces-template-note.rst
Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com>
2022-12-13 09:22:07 -08:00
Edward Minnix III
a2c886d367 Grammar and wording changes from docs review
Co-authored-by: Sam Browning <106113886+sabrowning1@users.noreply.github.com>
2022-12-13 11:57:46 -05:00
Edward Minnix III
a85de2b5f4 Merge pull request #10865 from egregius313/egregius313/android-activity-alias
Java: Add library support for activity-alias elements in AndroidManifest.qll
2022-12-13 11:52:01 -05:00
Jami Cogswell
a33436a39b Java: update hasProvenance 2022-12-13 11:26:23 -05:00
Jami Cogswell
3da2fb933b Java: remove parentheses 2022-12-13 11:08:00 -05:00
Jami Cogswell
028fc29639 Java: group test methods 2022-12-13 11:02:21 -05:00
Jami Cogswell
a889cc4f65 Java/C#: remove isTestLibrary 2022-12-13 10:34:04 -05:00
Jami
9b0163ce22 Merge pull request #11624 from jcogs33/jcogs33/exclude-paramless-constructors-from-dataflowtargetapi
Java/C#: exclude parameterless constructors from `DataFlowTargetApi`
2022-12-13 10:05:57 -05:00
Jami Cogswell
91c1ec3be6 C#: exclude AnonymousFunctionExpr from DataFlowTargetApi 2022-12-13 09:54:05 -05:00
Jami Cogswell
1c06378a53 Java: exclude FunctionalExprs from DataFlowTargetApi 2022-12-13 09:54:05 -05:00
Tamas Vajk
5cc2868857 Kotlin: Report CFG dead end consistency issues on ErrorExpr 2022-12-13 15:51:33 +01:00
Anders Schack-Mulligen
a29e529690 Shared: Add missing qldoc. 2022-12-13 15:49:30 +01:00
Asger F
bfe9ee3ead Merge pull request #11672 from asgerf/js/extensions
JS: Add data extension sinks
2022-12-13 15:34:11 +01:00
Henry Mercer
423374a7b8 Merge branch 'main' into codeql-ci/atm/release-0.4.4 2022-12-13 14:26:21 +00:00
github-actions[bot]
745823ca60 JS: Bump version of ML-powered library and query packs to 0.4.5 2022-12-13 13:32:52 +00:00
github-actions[bot]
ea13925a92 JS: Bump patch version of ML-powered library and query packs 2022-12-13 13:28:09 +00:00
Alex Denisov
ee94849528 Swift: switch to bootstrapped Swift compiler 2022-12-13 13:59:13 +01:00
Tony Torralba
85b3092b16 Add security-severity and fix alert message 2022-12-13 12:01:01 +01:00
Asger F
6b15839221 JS: Add tests for the examples used in the docs 2022-12-13 11:33:12 +01:00
Asger F
ba1364a4cb JS: Add sinks mentioned in doc
Note that 'sql-injection' was already added
2022-12-13 11:33:12 +01:00
Alvaro Muñoz
270a4355df format Restify.qll 2022-12-13 11:22:24 +01:00
Alvaro Muñoz
4ba3190d29 Replace API::Node with DataFlow::Node for Spife's RouteSetup 2022-12-13 11:10:04 +01:00
Felicity Chapman
cbbce9b98a Update docs/codeql/writing-codeql-queries/introduction-to-ql.rst 2022-12-13 09:56:50 +00:00
Michael Nebel
b8ef961498 Merge pull request #9415 from JarLob/sockets
Add TCP and UDP socket client taint sources
2022-12-13 10:39:33 +01:00
Felicity Chapman
6aaaf4267b Update docs/codeql/writing-codeql-queries/introduction-to-ql.rst 2022-12-13 09:37:49 +00:00
Chris Smowton
406a12e797 Remove unused function DeclarationStack.findFirst 2022-12-13 09:34:36 +00:00
Tony Torralba
d72d096c86 Add predicate injection query 2022-12-13 10:27:29 +01:00
Tom Hvitved
39fea378b8 Python: Update expected test output 2022-12-13 09:53:01 +01:00
Tom Hvitved
cfcb3a60ba C++: Update expected test output 2022-12-13 09:53:01 +01:00
Tom Hvitved
da6a42980f Swift: Implement ContentApprox 2022-12-13 09:53:01 +01:00
Tom Hvitved
24b1da4d02 Python: Implement ContentApprox 2022-12-13 09:53:01 +01:00
Tom Hvitved
2a28953e41 Java: Implement ContentApprox 2022-12-13 09:53:01 +01:00
Tom Hvitved
4d2436dd82 Go: Implement ContentApprox 2022-12-13 09:53:01 +01:00
Tom Hvitved
64eb0cc941 C#: Implement ContentApprox 2022-12-13 09:53:01 +01:00
Tom Hvitved
bc58cbec8c C++: Implement ContentApprox 2022-12-13 09:53:01 +01:00
Tom Hvitved
0c2eee2a72 Data flow: Sync files 2022-12-13 09:52:55 +01:00
Tom Hvitved
410ef4d713 Data flow: Rename stages 2022-12-13 09:52:46 +01:00
Tom Hvitved
d11cb2ee0f Data flow: Introduce ApproxContent in a new pruning stage between existing stages 2 and 3 2022-12-13 09:52:45 +01:00
AlexDenisov
73196fd732 Merge pull request #11669 from github/redsun82/swift-wrapper
Swift: wrap extractor with shell script
2022-12-13 09:46:42 +01:00
Paolo Tranquilli
0dc717fd9c Swift: remove no more needed library path setting in qltest.sh 2022-12-13 09:13:43 +01:00
Paolo Tranquilli
03d7adb303 Swift: wrap extractor with shell script
This is in preparation for the extractor to use shared libraries
packaged alongside it.

We could probably also move the `CODEQL_EXTRACTOR_SWIFT_RUN_UNDER` logic
in it, where it would be simpler and more robust.
2022-12-13 09:07:37 +01:00
yoff
557a5b469f Merge pull request #11555 from pwntester/new_python_cmdi_sinks
Added two new CMDi sinks for python's stdlib
2022-12-13 09:00:34 +01:00
SiaraMist
0518eda7ab Remove import tutorial 2022-12-12 17:46:03 -08:00
SiaraMist
dee66354cc Link to template reusable 2022-12-12 17:36:43 -08:00
Siara
094a9f4aa7 Edit reusable 2022-12-12 17:32:02 -08:00
Jami
93d8a03e73 Merge branch 'main' into jcogs33/mad-metrics-query 2022-12-12 20:31:53 -05:00
Siara
028ab325f4 Update docs/codeql/reusables/codespaces-template-note.rst
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2022-12-12 17:28:39 -08:00
Jami Cogswell
08b5cf1415 Java/C#: fix formatting issue 2022-12-12 20:24:00 -05:00
Siara
4aa92dfd88 Updates from review comments 2022-12-12 17:13:57 -08:00
Jami Cogswell
a77acd6745 Java: add change note 2022-12-12 17:28:12 -05:00
Jami Cogswell
f0124dae1a Java: replace exists with instanceof 2022-12-12 16:40:19 -05:00
erik-krogh
92a7e787a8 C: do the minimal change to ValueNumberBound instead 2022-12-12 22:17:50 +01:00
Jami
84b69deb55 Merge branch 'main' into jcogs33/update-externalapi-charpredicate 2022-12-12 16:01:22 -05:00
Siara
169a465214 Update docs/codeql/writing-codeql-queries/introduction-to-ql.rst
Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com>
2022-12-12 12:54:01 -08:00
Harry Maclean
0340549744 Ruby: Slight rewording 2022-12-13 09:45:31 +13:00
erik-krogh
e0045d2736 filter out string literals from the taint-sink meta query 2022-12-12 21:44:24 +01:00
Jami Cogswell
3526406db0 Java: add tests 2022-12-12 15:10:55 -05:00
Chris Smowton
dd86f7a696 Kotlin: Revert type erasure within $default functions
This imprecise implementation turned out to cause linkage errors, e.g. when type variables in the signatures of member methods were inappropriately erased. For the time being we accept that $default methods despite having erased signatures in keeping with their JVM representation can contain expressions whose types make reference to their
surrounding function or class' type variables, even though they should be out of scope since $default methods are static and don't have type parameters, and need to cope with the inconsistency in QL.
2022-12-12 18:33:22 +00:00
Jami Cogswell
22f8d97f31 C#: add test case 2022-12-12 13:28:01 -05:00
Jami Cogswell
446ac75c87 Java: update unit test 2022-12-12 13:28:01 -05:00
Jami Cogswell
39154b1455 C#: add isParameterless predicate to Constructor class 2022-12-12 13:28:00 -05:00
Jami Cogswell
5113041623 Java: add isParameterless predicate to Constructor class 2022-12-12 13:28:00 -05:00
Jami Cogswell
a8a8b03d2f C#: exclude parameterless constructors from DataFlowTargetApi 2022-12-12 13:28:00 -05:00
Jami Cogswell
16d8e8e931 Java: exclude parameterless constructors from DataFlowTargetApi 2022-12-12 13:28:00 -05:00
Erik Krogh Kristensen
636d5e341c Merge pull request #11652 from erik-krogh/static-useInstanceOf
Java/C#/GO: Use instanceof in more places
2022-12-12 17:52:04 +01:00
Jami Cogswell
e42d9e4930 Java: switch floats to ints 2022-12-12 11:39:17 -05:00
Jami Cogswell
623068c4b9 Java: add hasProvenance predicate, remove isManuallyGenerated and isBothAutoAndManuallyGenerated 2022-12-12 11:23:46 -05:00
Edward Minnix III
0ebfee8b11 Merge pull request #11241 from egregius313/egregius313/webview-file-access
Java: Query to detect Android Webview file access
2022-12-12 11:12:26 -05:00
erik-krogh
698e05f85a Swift/C++: Use instanceof in more places 2022-12-12 16:58:13 +01:00
erik-krogh
a1564de126 more ram 2022-12-12 16:35:01 +01:00
erik-krogh
f554e1fef1 more threads 2022-12-12 16:33:07 +01:00
erik-krogh
7526c35c60 speedup the "ATM - Check query suite" CI job 2022-12-12 16:25:25 +01:00
erik-krogh
b3a9c1ca06 Py/JS/RB: Use instanceof in more places 2022-12-12 16:06:57 +01:00
Erik Krogh Kristensen
4ff823c36b Merge pull request #11366 from p-/p--ruby-kernel-open-addition
Ruby: Add additional sinks to the `rb/kernel-open` query
2022-12-12 15:56:01 +01:00
erik-krogh
873d3553cd Merge branch 'main' into static-useInstanceOf 2022-12-12 15:36:54 +01:00
Tom Hvitved
912aa461c7 Merge pull request #11654 from hvitved/ruby/stage-collapse
Ruby: Ensure `Node::{toString,getLocation}` are computed in data flow stage
2022-12-12 13:57:47 +01:00
Michael Nebel
0fdf9a42f2 C#: Cleanup and make the last StreamReader model explicit on its input. 2022-12-12 13:21:26 +01:00
JarLob
1d303e0470 C#: Add remote type source kind in model validation. 2022-12-12 12:56:14 +01:00
Jaroslav Lobačevski
340fd8ae4e C#: Add change note. 2022-12-12 12:56:14 +01:00
Jaroslav Lobačevski
204a1d3d06 C#: Add source TCP/UDP source models and StreamReader summary models. 2022-12-12 12:56:14 +01:00
Chris Smowton
2bdc9e80de Merge pull request #11625 from smowton/smowton/admin/autoformat-docs-ql-files
Autoformat docs ql files
2022-12-12 10:37:35 +00:00
Mathias Vorreiter Pedersen
b2fcf87e6a Merge pull request #11638 from jketema/rewrite-tainted-path-v2
C++: Use `FlowSource` in `cpp/path-injection`
2022-12-12 10:08:15 +00:00
Chris Smowton
77004f3e15 Merge pull request #11258 from smowton/smowton/feature/kotlin-annotation-extraction
Kotlin: extract annotations
2022-12-12 09:52:49 +00:00
Alvaro Muñoz
469d7f52dc Use fluent API instead of hasPropertyWrite 2022-12-12 10:46:50 +01:00
Alvaro Muñoz
1410d2838e Update javascript/ql/lib/semmle/javascript/frameworks/Spife.qll
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2022-12-12 09:54:02 +01:00
Paolo Tranquilli
250ac686a2 Merge branch 'main' into redsun82/swift-open-redirection 2022-12-12 08:46:23 +01:00
Michael Nebel
e0f1b38439 Merge pull request #11580 from michaelnebel/renamenegativemodels
C#/Java: Rename Negative Summary Model to Neutral Model
2022-12-12 07:59:06 +01:00
Harry Maclean
6c8896d83f Merge pull request #11337 from hmac/actionmailbox
Ruby: Model ActionMailbox
2022-12-12 10:29:23 +13:00
Tom Hvitved
58549087e0 Ruby: Ensure Node::{toString,getLocation} are computed in data flow stage 2022-12-11 20:37:24 +01:00
Tom Hvitved
367aa35d8c Ruby: Avoid SummarizedCallable::propagatesFlowExt being recursive 2022-12-11 20:37:23 +01:00
Chris Smowton
2b10e4ba04 Merge pull request #11653 from github/post-release-prep/codeql-cli-2.11.6
Post-release preparation for codeql-cli-2.11.6
2022-12-11 19:24:26 +00:00
github-actions[bot]
343b7b1c8b Post-release preparation for codeql-cli-2.11.6 2022-12-11 18:15:04 +00:00
erik-krogh
8262fbbfb5 Java/C#/GO: Use instanceof in more places 2022-12-11 18:32:19 +01:00
Chris Smowton
5ae770f339 Merge pull request #11648 from github/release-prep/2.11.6
Release preparation for version 2.11.6
2022-12-11 07:25:21 +00:00
Jeroen Ketema
beb66d027e C++: Use FlowSource in cpp/path-injection 2022-12-10 20:27:56 +01:00
Jeroen Ketema
d5acd310ce Merge pull request #11644 from jketema/lower-case-flow-source-description
C++: Make all flow source descriptions start with a lower case letter
2022-12-10 20:23:14 +01:00
Mathias Vorreiter Pedersen
bea67abd64 Merge pull request #11643 from jketema/generalize-argv 2022-12-10 16:03:20 +00:00
github-actions[bot]
0b2fb4f70a Release preparation for version 2.11.6 2022-12-10 15:49:35 +00:00
Chris Smowton
af08fe8659 Add change note re: Kotlin version limit 2022-12-10 15:32:22 +00:00
Jami Cogswell
270e38d753 Java: add comments and switch getDeclaringType to getCompilationUnit 2022-12-09 19:46:10 -05:00
SiaraMist
401a46d655 Update phrasing and link 2022-12-09 16:45:33 -08:00
Siara
9f75a768ea Update codespaces-template-note.rst 2022-12-09 15:59:27 -08:00
SiaraMist
ae4bc3eb09 Merge branch 'siaramist/codeql-template' of https://github.com/github/codeql into siaramist/codeql-template 2022-12-09 15:45:05 -08:00
SiaraMist
75fc9d0c6a Update reusable name 2022-12-09 15:43:30 -08:00
Jami Cogswell
6854845b75 Java: refactor isManuallyGenerated and isBothAutoAndManuallyGenerated 2022-12-09 18:37:50 -05:00
Siara
d1aacb7260 Add new line to end of reusable 2022-12-09 15:34:31 -08:00
SiaraMist
b4f7239f54 Updates from review 2022-12-09 15:27:04 -08:00
Jeroen Ketema
ce92ba640a C++: Accept test changes 2022-12-09 23:38:03 +01:00
Jeroen Ketema
9dc2614012 C++: Make all flow source descriptions start with a lower case letter
In every context where we use the description a lower case letter makes more
sense.
2022-12-09 23:18:58 +01:00
Jeroen Ketema
1e1974c9fb C++: Add change note 2022-12-09 23:17:36 +01:00
Jeroen Ketema
331fab5ac0 C++: Generalize the ArgvSource flow source
This matches `isUserInput` and handles cases where `argv` has a different name,
which is allowed.
2022-12-09 23:12:31 +01:00
Jami Cogswell
123fe5edfe C#: add isParameterless predicate to Constructor class 2022-12-09 15:55:32 -05:00
Jami Cogswell
cde93a39cd Java: add isParameterless predicate to Constructor class 2022-12-09 15:51:40 -05:00
Chris Smowton
5282c86158 Apply review feedback 2022-12-09 18:07:14 +00:00
Edward Minnix III
4278997a2c Reword WebView file access query description
Co-authored-by: Sam Browning <106113886+sabrowning1@users.noreply.github.com>
2022-12-09 11:36:09 -05:00
Edward Minnix III
8c8e71dd82 Grammar, concision, and style edits
Co-authored-by: Sam Browning <106113886+sabrowning1@users.noreply.github.com>
2022-12-09 11:35:02 -05:00
Joe Farebrother
12dc11aa18 Add qldoc 2022-12-09 15:07:49 +00:00
Michael Nebel
4835d14865 Java/C#: Delete the deprecated NeutralModelCsv class. 2022-12-09 15:11:49 +01:00
Ian Lynagh
1bf82cecfa Merge pull request #11602 from igfoo/igfoo/diaglimits
Kotlin: Improve diagnostic limit message
2022-12-09 14:05:47 +00:00
Michael Nebel
67732cbfa0 Java: Remove unneeded import for RegenerateModels.py. 2022-12-09 15:04:43 +01:00
Michael Nebel
1a226a15bf C#/Java: Cleanup up printing of generated models. 2022-12-09 15:04:43 +01:00
Michael Nebel
1d103f57a0 C#/Java: Rename CaptureNegativeSummaryModels test to CaptureNeutralModels. 2022-12-09 15:04:43 +01:00
Michael Nebel
2cb88037a4 C#/Java: Rename Negative Summary Model to Neutral Model in conversion and generator tooling. 2022-12-09 15:04:43 +01:00
Michael Nebel
ac2d55880c Go: Rename Negative Summary Model to Neutral Model. 2022-12-09 15:04:43 +01:00
Michael Nebel
d13307e417 Swift: Rename Negative Summary Model to Neutral Model. 2022-12-09 15:04:43 +01:00
Michael Nebel
a14df1ca61 Ruby: Rename Negative Summary Model to Neutral Model. 2022-12-09 15:04:43 +01:00
Michael Nebel
f4f7d83349 Python: Rename Negative Summary Model to Neutral Model. 2022-12-09 15:04:43 +01:00
Michael Nebel
3af00a8f3f Java: Rename Negative Summary Model to Neutral Model. 2022-12-09 15:04:43 +01:00
Michael Nebel
079d48c42a Sync files. 2022-12-09 15:04:42 +01:00
Michael Nebel
ad90e58120 C#: Rename Negative Summary Model to Neutral Model. 2022-12-09 15:04:42 +01:00
Joe Farebrother
8de5efb28f Add SetDefaultConnectionFactoryMethod class 2022-12-09 13:41:18 +00:00
Joe Farebrother
0dea5daffe Change import for consistency, fix some typos 2022-12-09 13:41:18 +00:00
Joe Farebrother
2be68b2f1d Apply suggestions from code review
Co-authored-by: Tony Torralba <atorralba@users.noreply.github.com>
2022-12-09 13:41:18 +00:00
Joe Farebrother
a14ebb7c03 Fixes 2022-12-09 13:41:18 +00:00
Joe Farebrother
fae4043008 Add change note 2022-12-09 13:41:18 +00:00
Joe Farebrother
603c1c1693 Add the domain used to the alert message 2022-12-09 13:41:18 +00:00
Joe Farebrother
ceb253e6d1 Add qhelp 2022-12-09 13:41:18 +00:00
Joe Farebrother
749ecab6b1 Add security severity 2022-12-09 13:41:18 +00:00
Joe Farebrother
0d6a376a36 Add test cases for TrustManager case 2022-12-09 13:41:18 +00:00
Joe Farebrother
c8aca06190 Implement pinning through a TrustManager
+ Fix that the query was accidentally placed in experimental
2022-12-09 13:41:18 +00:00
Joe Farebrother
4afecf575e Generate more stubs for okhttp and fix tests.
Some generated stubs needed to be manually corrected.
2022-12-09 13:41:17 +00:00
Joe Farebrother
bb402c497b Fix typo in dir name 2022-12-09 13:41:17 +00:00
Joe Farebrother
53c4ada883 Add okhttp tests 2022-12-09 13:41:17 +00:00
Joe Farebrother
c32dc1e674 Implement okhttp support 2022-12-09 13:41:17 +00:00
Joe Farebrother
da7032d3d6 Add qldoc 2022-12-09 13:41:17 +00:00
Joe Farebrother
ea3db5d429 Add test cases 2022-12-09 13:41:17 +00:00
Joe Farebrother
c3da3a9aef Add a bit of additional context to the alert message; fix issue with finding the config file 2022-12-09 13:41:17 +00:00
Joe Farebrother
17348fbd32 Add android certificate pinning query 2022-12-09 13:41:17 +00:00
Chris Smowton
b8ed3b7dbf Accept annotation test changes
These are notnull annotations that no longer get inappropriately attached to constructors
2022-12-09 12:57:20 +00:00
Tamás Vajk
357e460cf2 Merge pull request #11588 from tamasvajk/kotlin-extension-defaults
Kotlin: Fix extraction of `$default` extension functions
2022-12-09 13:56:47 +01:00
Mathias Vorreiter Pedersen
7d1f10bc78 Merge pull request #11627 from jketema/getaddrinfo
C++: Model `getaddrinfo` as flow source
2022-12-09 12:38:43 +00:00
Chris Smowton
40e902eca9 Look through generic annotation types extracted from Kotlin 2022-12-09 11:52:28 +00:00
Paolo Tranquilli
a93e361aca Merge branch 'main' into redsun82/swift-open-redirection 2022-12-09 12:19:38 +01:00
Chris Smowton
65dc0dc326 Add dummy extensible predicate definition to integration test 2022-12-09 11:17:37 +00:00
Chris Smowton
a161d79cd8 Remove no-longer-needed expected diagnostics 2022-12-09 10:33:06 +00:00
Chris Smowton
93ea433c49 Add missing imports 2022-12-09 10:33:06 +00:00
Chris Smowton
251513c1d3 Format ql 2022-12-09 10:33:06 +00:00
Chris Smowton
78234c52fd Ensure constructors don't get nullability annotations 2022-12-09 10:33:06 +00:00
Chris Smowton
f5dc5155f9 Don't introduce @NotNull on Kotlin methods that already have that annotation
This usually can't happen, but delegates pointing at Java appear to be synthesised with this normally-hidden annotation
2022-12-09 10:33:05 +00:00
Chris Smowton
c8e2ae8563 Accept integration test changes
These introduce newly-extracted annotations, and note that enum constants no longer get type-access expressions in some circumstances
2022-12-09 10:33:05 +00:00
Chris Smowton
7a7c08b185 Tolerate generic annotations
This causes them to render properly in PrintAst output due to `getAnnotationElement` working as expected, and will hide the fact that they are represented by raw types in bytecode.
2022-12-09 10:33:05 +00:00
Chris Smowton
f6888c727f PrintAst: Assign indices to annotation children that don't have source locations
This avoids them all tying at rank 1 as before.
2022-12-09 10:33:05 +00:00
Chris Smowton
01a5345660 Reimplement Deprecated annotation conversion suitable for older Kotlin versions 2022-12-09 10:33:05 +00:00
Chris Smowton
8ca05d8fef Exclude annotations from consistency check due to intentionally missing children 2022-12-09 10:33:05 +00:00
Chris Smowton
70ebb41d67 Restore nullability annotations
This is imperfect since arguments to those annotations will be missing, but at least the common case of a plain `@NotNull` or `@Nullable` will be right, and the `@NotNull`s introduced by the Kotlin compiler will be present as expected.
2022-12-09 10:33:05 +00:00
Chris Smowton
8bbb34a498 Convert kotlin.Deprecated back into a no-arg java.lang.Deprecated if applicable
This at least maintains consistency with the Java extractor, although we lose its arguments if any were supplied Java-side.
2022-12-09 10:33:05 +00:00
Chris Smowton
658c7a20cf Don't extract error expressions when a default value is missing
This is a shortcoming of the Kotlin extractor, but at least this way we don't introduce an inconsistency if the annotation is later seen from .kt source or by the Java extractor
2022-12-09 10:33:05 +00:00
Chris Smowton
5b2834c833 Restrict type access extraction to classes extracted from source
Type accesses have anonymous IDs, so we mimic the Java extractor and extract them only when seeing a class in a .kt source file.
2022-12-09 10:33:05 +00:00
Chris Smowton
0a788bcbc1 Don't extract return value type accesses for external annotations
This would cause inconsistencies when both the source and external view of the class are in scope, since the type access has a fresh id.
2022-12-09 10:33:05 +00:00
Chris Smowton
225913c49e Replace needless map call 2022-12-09 10:33:04 +00:00
Chris Smowton
80ef3a5290 Move meta-annotation support code out into its own class 2022-12-09 10:33:04 +00:00
Chris Smowton
c4ded5b4a7 Remove unused function 2022-12-09 10:33:04 +00:00
Chris Smowton
3dc9c2e57b Remove unnecessary unchecked cast 2022-12-09 10:33:04 +00:00
Chris Smowton
f9fc08bd40 Replace uses of the !! operator in borrowed code 2022-12-09 10:33:04 +00:00
Chris Smowton
81353f8654 Make annotation extraction compatible with all supported Kotlin versions 2022-12-09 10:33:04 +00:00
Chris Smowton
757fa60a46 Remove unused import 2022-12-09 10:33:04 +00:00
Chris Smowton
f9b878fe98 Add test for .kt defined, Java used repeatable annotation 2022-12-09 10:33:04 +00:00
Chris Smowton
5c019940db Fix missing !! removal 2022-12-09 10:33:04 +00:00
Chris Smowton
ca27f9516a Replace uses of !! operator 2022-12-09 10:33:04 +00:00
Chris Smowton
73df3166eb Test varargs annotation 2022-12-09 10:33:04 +00:00
Chris Smowton
6d5f962c56 Accept test changes (implicit annotations, restoration of annotation type accesses) 2022-12-09 10:33:03 +00:00
Chris Smowton
d96bca071d Add test for repeatable annotations 2022-12-09 10:33:03 +00:00
Chris Smowton
eaa9595ea2 Restore type-accesses to annotation methods; accept test changes. 2022-12-09 10:33:03 +00:00
Chris Smowton
9e0eb56d77 Extract repeatable annotation container types, including synthetic containers 2022-12-09 10:33:03 +00:00
Chris Smowton
0146d8229a Accept more test changes due to string quoting and the Java extractor ignoring the Metadata annotation 2022-12-09 10:33:03 +00:00
Chris Smowton
0446145a67 Accept test changes
These are due to changing string literal representation, omitting empty annotations blocks, and changes to how annotation classes are represented in the database.
2022-12-09 10:33:03 +00:00
Chris Smowton
d530817afc Accept annotation_classes test changes 2022-12-09 10:33:03 +00:00
Chris Smowton
df90fc1a80 Disable type parameter annotation extraction pending a database change 2022-12-09 10:33:03 +00:00
Chris Smowton
9b3c07c32b Add annotation class meta-annotations per classes' expected JVM lowering 2022-12-09 10:33:03 +00:00
Chris Smowton
f7d2644d74 Re-enable extracting most annotations 2022-12-09 10:33:03 +00:00
Chris Smowton
26540111ce Factor out common code for referencing an external type 2022-12-09 10:33:03 +00:00
Chris Smowton
8781366fbe Only extract function annotations for unbound types
Note however this includes extracting annotations for external types, unlike the situation for function bodies.
2022-12-09 10:33:01 +00:00
Chris Smowton
06133e74a5 Handle generic annotations 2022-12-09 10:31:34 +00:00
Chris Smowton
14a47f628c Fixup: remove unneeded test file 2022-12-09 10:31:34 +00:00
Chris Smowton
d7213d2d82 Only convert KClass -> Class in annotation context 2022-12-09 10:31:34 +00:00
Chris Smowton
2fd8e61fe2 Add test of Java/Kotlin annotation naming consistency 2022-12-09 10:31:34 +00:00
Chris Smowton
24434ed0ff Make annotation labelling consistent between Java and Kotlin
This gives all annotations and expressions derived from them globally-significant and stable names, enabling the Kotlin and Java extractors to see the same annotation without introducing database conflicts.
2022-12-09 10:31:34 +00:00
Tamas Vajk
df595c05f2 WIP: revert some annotation extraction to get proper tree in printast 2022-12-09 10:31:34 +00:00
Tamas Vajk
fed770fcd1 Move kotlin annotations to negative child index 2022-12-09 10:31:33 +00:00
Tamas Vajk
96a407c9c5 WIP: extract annotations for all declarations 2022-12-09 10:31:33 +00:00
Tamas Vajk
3e1d4a7400 Add more annotation tests, add KClass to Class substitution 2022-12-09 10:31:33 +00:00
Tamas Vajk
f465dd5362 Add more annotation tests 2022-12-09 10:31:33 +00:00
Tamas Vajk
a0cd9fea34 Fix more not from source expressions in tests 2022-12-09 10:31:33 +00:00
Tamas Vajk
b73bfd6133 Compilation fixup 2022-12-09 10:31:33 +00:00
Tamas Vajk
1898f94472 Filter expressions to source files in tests 2022-12-09 10:31:33 +00:00
Tamas Vajk
b5ae43a887 Remove empty annotations node from PrintAST 2022-12-09 10:31:33 +00:00
Tamas Vajk
3b09cb2224 WIP: Extract annotation values (tests are missing) 2022-12-09 10:31:33 +00:00
Tamas Vajk
7b075c2190 WIP: extract annotations on classes, with constant values 2022-12-09 10:31:33 +00:00
Tamas Vajk
9fa840106f Extract annotation declarations 2022-12-09 10:31:33 +00:00
Tony Torralba
3b9b9b339e Merge pull request #11632 from atorralba/atorralba/swift/nsdata_rename
Swift: Rename NSData.qll to NsData.qll
2022-12-09 10:46:42 +01:00
Tamas Vajk
6bcfdfca88 Adjust getExtensionReceiverParameterIndex predicate name and change note 2022-12-09 10:29:52 +01:00
Tamas Vajk
e410e2744b Add change note 2022-12-09 10:29:52 +01:00
Tamas Vajk
ce5509a080 Kotlin: Adjust MaD argument shifting for $default method 2022-12-09 10:29:52 +01:00
Tamas Vajk
243c311b3d Accept unit test changes 2022-12-09 10:29:52 +01:00
Tamas Vajk
81c35c8b27 Adjust PathSanitizer to use fixed $default extension method functionality 2022-12-09 10:29:52 +01:00
Tamas Vajk
f646938d91 Revert "Kotlin: Adjust ExtensionReceiverAccess.toString to not return hard coded this value"
This reverts commit 9649a8f64aa47d860d3ce2d005a939df75ee0e41.
2022-12-09 10:29:52 +01:00
Tamas Vajk
ac5219fc7a Kotlin: Adjust ExtensionReceiverAccess.toString to not return hard coded this value 2022-12-09 10:29:52 +01:00
Tamas Vajk
d93dce0fa9 Kotlin: Fix extension and dispatch parameter order in $default functions 2022-12-09 10:29:51 +01:00
Tamas Vajk
6457e059f5 Kotlin: Fix extraction of $default extension functions 2022-12-09 10:26:44 +01:00
Tamas Vajk
43f23801f5 Kotlin: Add test for extension $default functions 2022-12-09 10:26:44 +01:00
Tom Hvitved
606d2f42f5 Merge pull request #11620 from github/dependabot/nuget/csharp/autobuilder/Semmle.Autobuild.CSharp/Newtonsoft.Json-13.0.2
Bump Newtonsoft.Json from 13.0.1 to 13.0.2 in /csharp/autobuilder/Semmle.Autobuild.CSharp
2022-12-09 10:26:01 +01:00
Asger F
387a673c10 Merge pull request #11567 from asgerf/js/data-extensions2
JS: Move MaD models to data extensions
2022-12-09 10:09:24 +01:00
Paolo Tranquilli
7162692656 Swift: exit directly on actions not requiring extraction 2022-12-09 10:00:01 +01:00
Paolo Tranquilli
4a41bb4061 Merge branch 'main' into redsun82/swift-open-redirection 2022-12-09 09:59:21 +01:00
Peter Stöckli
d2c8e70be1 Adjust expected file for TaintStep (due to changes to File.join) 2022-12-09 09:57:19 +01:00
Peter Stöckli
03fff2709b Add suggestions to fix FileJoinSanitizer 2022-12-09 09:42:44 +01:00
Tony Torralba
6822399dbb Swift: Rename NSData.qll to NsData.qll 2022-12-09 09:18:55 +01:00
Chris Smowton
cddb5c5e2d Merge pull request #11616 from smowton/smowton/fix/callable-modality-abstraction
Kotlin: extract callable modality
2022-12-09 08:07:57 +00:00
AlexDenisov
2db77a7c08 Merge pull request #11607 from github/redsun82/swift-integration-test-timeout
Swift: add timeout to integration tests on macOS
2022-12-09 08:38:51 +01:00
AlexDenisov
6f631b4daf Merge pull request #11622 from github/redsun82/swift-fix-parent-paths
Swift: fix extraction of sources from `..`
2022-12-09 08:37:46 +01:00
Peter Stöckli
0d8c82009c Merge branch 'main' into p--ruby-kernel-open-addition 2022-12-09 07:54:56 +01:00
Jami Cogswell
0b2f2a3f88 Java: remove predicates from NegativeSummarizedCallable 2022-12-08 23:46:55 -05:00
Jami Cogswell
2c3adb769b Java: remove MadModeledCallable class and update predicate names 2022-12-08 23:32:07 -05:00
Jami Cogswell
974c000b65 Java: add bindingset for package 2022-12-08 23:17:53 -05:00
Jami Cogswell
a32ed21480 Java: clean up comments and predicates 2022-12-08 23:09:09 -05:00
Jami Cogswell
ca00e0ab9e Java: adjust none and all calculations 2022-12-08 22:14:28 -05:00
Jami Cogswell
6248efd394 Java: adjust column names and metric formulas 2022-12-08 21:13:52 -05:00
Jami Cogswell
9e0027cf5b Java: remove negative models 2022-12-08 20:58:37 -05:00
Jami Cogswell
d558f93972 Java: update DataFlowTargetApi for funcexpr and paramless constructor exclusions 2022-12-08 20:51:40 -05:00
Jami Cogswell
083b8d1de6 C#: make predicate private 2022-12-08 20:17:28 -05:00
Siara
c1efb7f3f4 Update introduction-to-ql.rst 2022-12-08 16:12:59 -08:00
Siara
986c15cd08 Update introduction-to-ql.rst 2022-12-08 15:58:07 -08:00
Chris Smowton
1d209d1bcd Accept modifiers test changes 2022-12-08 22:52:40 +00:00
Siara
dded684ad6 Update docs/codeql/writing-codeql-queries/introduction-to-ql.rst 2022-12-08 14:43:14 -08:00
Siara
7b6aa09646 Update introduction-to-ql.rst 2022-12-08 14:42:38 -08:00
Jeroen Ketema
2095f11b8c C++: Add change note 2022-12-08 23:35:32 +01:00
Jami Cogswell
dc51226a56 C#: update qldocs 2022-12-08 17:24:50 -05:00
Jami Cogswell
a1908be165 C#: remove previous uses of isUninteresting 2022-12-08 17:12:26 -05:00
Siara
b89dd3d8ac Merge branch 'codeql-cli-2.11.5' into siaramist/codeql-template 2022-12-08 14:07:58 -08:00
Siara
2ac736cd74 Update introduction-to-ql.rst 2022-12-08 14:07:39 -08:00
Jami Cogswell
ff85e2f9f2 C#: update ExternalApi characteristic predicate to include not isUninteresting 2022-12-08 17:07:24 -05:00
Jami Cogswell
f48cc9f40e Java: remove previous uses of isUninteresting 2022-12-08 16:56:43 -05:00
Jeroen Ketema
aabbafd2bf C++: Fix QL-for-QL warning 2022-12-08 19:33:11 +01:00
Jeroen Ketema
ec0ce56269 C++: Model getaddrinfo as flow source 2022-12-08 19:20:11 +01:00
Jeroen Ketema
89cd4790d5 Merge pull request #11610 from jketema/scanf
C++: Model `scanf` and `fscanf` as flow sources
2022-12-08 19:14:39 +01:00
Chris Smowton
4ea795baf4 Autoformat docs ql files 2022-12-08 17:36:59 +00:00
Chris Smowton
f4f4de392f Outdent river answer files 2022-12-08 17:36:59 +00:00
Jami Cogswell
29046e7960 Java: update ExternalApi characteristic predicate to include not isUninteresting 2022-12-08 12:31:46 -05:00
Geoffrey White
f373b7fe7c Merge pull request #11596 from geoffw0/cleartextbufferwrite
C++: Performance fix for cpp/cleartext-storage-buffer
2022-12-08 17:18:10 +00:00
Geoffrey White
52881385bf Merge pull request #11597 from geoffw0/stats2
Swift: Add taint reach to SummaryStats.ql.
2022-12-08 17:11:56 +00:00
Paolo Tranquilli
7645d4d928 Swift: remove ModuleDecl from PrintAst test 2022-12-08 17:31:48 +01:00
Chris Smowton
f50a4ddf5f Merge pull request #11617 from github/smowton/admin/docs-river-example-codeql-style
Docs: Make river-crossing example comply with the CodeQL style guide
2022-12-08 16:17:54 +00:00
Paolo Tranquilli
26ae8f177b Swift: accept test changes
Downgrading the emit object action to a type check one has some
unexpected side effects, that seem however acceptable:
* experimental false static assertions do not make compilation fail in
  type check mode
* the implicit module loading of `SwiftOnoneSupport` is not happening.
  That module contains some "pre-specializations", it does not seem
  really relevant for analysis
2022-12-08 17:13:00 +01:00
Paolo Tranquilli
935e264f24 Swift: add empty directory marker 2022-12-08 17:04:56 +01:00
Henry Mercer
d196704a2d Merge pull request #11574 from github/henrymercer/check-query-ids
Add a PR check to ensure query IDs are unique
2022-12-08 15:31:26 +00:00
Tom Hvitved
2ab05a81d1 Merge pull request #11621 from hvitved/ruby/library-callable-get-param
Ruby: Add `SummarizedCallable::getParameter`
2022-12-08 16:20:44 +01:00
Jeroen Ketema
8f9a73ee09 C++: Address review comments 2022-12-08 16:14:12 +01:00
Paolo Tranquilli
d03b82c8c5 Merge branch 'main' into redsun82/swift-fix-parent-paths 2022-12-08 16:11:54 +01:00
Paolo Tranquilli
d35c5e90ee Swift: remove fishhook 2022-12-08 16:10:44 +01:00
Paolo Tranquilli
bf1b32f210 Swift: rework file redirection
The hash map mechanism that was already in use for reading swiftmodule
files on macOS is now in use also on Linux. The output replacing
mechanism has been also reworked so that:
* frontend module emission modes have the remapping done directly in
  the internal frontend options instead of painstakingly modifying input
  flags (this requires a patch on the swift headers though)
* object emission mode is silenced to be just a type checking pass,
  thus producing no output files
* all other passes but some debugging and version related ones become
  noops

The open file read redirection uses a global weak pointer instance to
maximize robustness in the face of possibly multi-threaded calls to open
happening while `main` is exiting. Possibly overkill, but better safe
than sorry.
2022-12-08 16:10:44 +01:00
Paolo Tranquilli
944adfe727 Swift: allow modifying frontend outputs 2022-12-08 16:10:25 +01:00
Paolo Tranquilli
219ed64b74 Swift: reorganize bazel third party dependencies 2022-12-08 16:10:25 +01:00
dependabot[bot]
8600d2d12d Bump Newtonsoft.Json in /csharp/autobuilder/Semmle.Autobuild.CSharp
Bumps [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) from 13.0.1 to 13.0.2.
- [Release notes](https://github.com/JamesNK/Newtonsoft.Json/releases)
- [Commits](https://github.com/JamesNK/Newtonsoft.Json/compare/13.0.1...13.0.2)

---
updated-dependencies:
- dependency-name: Newtonsoft.Json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-08 15:01:05 +00:00
Tom Hvitved
cbf722dad0 Ruby: Add SummarizedCallable::getParameter 2022-12-08 15:59:41 +01:00
Paolo Tranquilli
1ba8b6d35a Swift: fix extraction of sources from .. 2022-12-08 15:57:57 +01:00
Chris Smowton
d0a2c1c9b6 Accept test changes 2022-12-08 14:44:43 +00:00
erik-krogh
1a6e16f292 Merge branch 'main' into kernelLoad 2022-12-08 15:41:48 +01:00
Chris Smowton
a79126268c Override modality when needed
In particular when generating an implementation based on an abstract prototype, the result is final, and an interface forwarder is open / Java's default modality.
2022-12-08 14:39:57 +00:00
Asger F
6fa2fe6c86 Merge pull request #11608 from asgerf/docs/sphinx-python2
Docs: Update README to mention Python 2 requirement
2022-12-08 15:36:17 +01:00
erik-krogh
f09e10f61f delete redundant cast 2022-12-08 15:34:26 +01:00
Jeroen Ketema
33fa76f911 C++: Add change note 2022-12-08 15:22:42 +01:00
Jeroen Ketema
b216c79992 C++: Accept test changes 2022-12-08 15:22:41 +01:00
Jeroen Ketema
f35b7f8fe8 C++: Model scanf and fscanf as flow sources 2022-12-08 15:22:41 +01:00
Anders Schack-Mulligen
d157e13318 Java: Switch DispatchFlow to typetracking. 2022-12-08 14:58:44 +01:00
Anders Schack-Mulligen
ae1373c2d6 Shared: Bugfix typetracking source-sink hasFlow. 2022-12-08 14:58:05 +01:00
Chris Smowton
85ee4e6ca1 Merge pull request #11578 from retanoj/MybatisSqli
Java: Add MyBatis Sql Injection no @Param case
2022-12-08 13:53:44 +00:00
Chris Smowton
37b2b0a128 Use set literal instead of disjunction 2022-12-08 13:49:53 +00:00
Geoffrey White
24ce1c27bc Swift: Autoformat. 2022-12-08 13:09:37 +00:00
Henry Mercer
3036b15af2 Merge branch 'main' into henrymercer/check-query-ids 2022-12-08 13:05:46 +00:00
Henry Mercer
280bb6864f Merge pull request #11604 from github/codeql-ci/atm/release-0.4.3
JS: Bump version numbers of ML-powered packs after 0.4.3 release
2022-12-08 13:04:16 +00:00
Henry Mercer
5674251839 Python: Disable TarSlipImprov qhelp 2022-12-08 13:03:31 +00:00
Geoffrey White
e288b07099 Update swift/ql/src/queries/Summary/SummaryStats.ql
Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
2022-12-08 13:02:58 +00:00
Mathias Vorreiter Pedersen
6897b20722 Merge pull request #11601 from MathiasVP/keep-std-string-iterator 2022-12-08 12:59:33 +00:00
Michael Nebel
670ae6c84c Merge pull request #11593 from michaelnebel/csharp/patternmatchspan
C#: Pattern match Span<char> and ReadOnlySpan<char> against a constant string.
2022-12-08 13:53:00 +01:00
Michael Nebel
5883957a67 Merge pull request #11589 from michaelnebel/csharp/numericintptr
C#: nint/System.IntPtr and nuint/System.UIntPtr are indistinguishable…
2022-12-08 13:52:44 +01:00
Chris Smowton
8789dfb655 Make river-crossing example comply with the CodeQL style guide 2022-12-08 12:33:42 +00:00
Chris Smowton
81110b19e7 Merge pull request #11612 from smowton/smowton/admin/merge-rc38-into-main
Merge rc/3.8 into main
2022-12-08 12:25:59 +00:00
Chris Smowton
045e3a2cf3 Kotlin: extract callable modality 2022-12-08 12:22:50 +00:00
Geoffrey White
07ea006cee Swift: Add support for CSV modelled sinks as well. 2022-12-08 11:36:55 +00:00
Geoffrey White
dba344451f Swift: Add UncontrolledFormatStringExtensions.qll. 2022-12-08 11:32:50 +00:00
Chris Smowton
0d2474bd55 Autoformat 2022-12-08 11:30:53 +00:00
Chris Smowton
49bc524fd0 Merge remote-tracking branch 'origin/rc/3.8' into smowton/admin/merge-rc38-into-main 2022-12-08 11:12:30 +00:00
Rasmus Wriedt Larsen
d684dbdf5c Merge pull request #10656 from porcupineyhairs/PyPamImprove
Python: Improve the PAM authentication bypass query
2022-12-08 11:59:10 +01:00
Jeroen Ketema
a6bc9fd10f Merge pull request #11591 from jketema/getenv
C++: Model `secure_getenv` and `_wgetenv` as local flow sources
2022-12-08 10:44:28 +01:00
Asger F
f2b99c5fff Docs: Update README to mention Python 2 requirement 2022-12-08 09:50:01 +01:00
Jeroen Ketema
fc49ede33d C++: Add change note 2022-12-08 09:44:23 +01:00
Jeroen Ketema
a2dac3a41e C++: Move remote flow sink test and also handle local and remote sinks 2022-12-08 09:36:19 +01:00
Mathias Vorreiter Pedersen
ba3d50a462 Merge pull request #11566 from MathiasVP/skip-lvalue-types 2022-12-08 07:53:20 +00:00
Paolo Tranquilli
0058bf4443 Swift: add timeout to inetgration tests on macOS 2022-12-08 08:44:29 +01:00
Jami Cogswell
e9e5f92603 Java: update notModeled for negative numbers 2022-12-07 21:46:52 -05:00
retanoj
0edfc6e01e greedy matching 2022-12-08 09:23:24 +08:00
Jami Cogswell
aa7e6d7811 Java: add negative numbers 2022-12-07 17:17:35 -05:00
Aditya Sharad
c7725ec37c Merge pull request #11605 from github/smowton/admin/merge-2.11.5-into-rc38
Merge codeql-cli-2.11.5 into rc/3.8
2022-12-07 14:09:05 -08:00
Henry Mercer
78f15755d7 Merge branch 'main' into codeql-ci/atm/release-0.4.3 2022-12-07 20:49:26 +00:00
Chris Smowton
32494859cd Merge remote-tracking branch 'origin/codeql-cli-2.11.5' into smowton/admin/merge-2.11.5-into-rc38 2022-12-07 20:06:08 +00:00
github-actions[bot]
d577eeeea8 JS: Bump version of ML-powered library and query packs to 0.4.4 2022-12-07 20:05:30 +00:00
github-actions[bot]
9702ea02fb JS: Bump patch version of ML-powered library and query packs 2022-12-07 20:01:33 +00:00
Ian Lynagh
6267da44ae Kotlin: Improve diagnostic limit message
The message saying that the limit was exceeded is now given at the same
severity as the original message.
2022-12-07 18:33:35 +00:00
Mathias Vorreiter Pedersen
54c12cd715 C++: Reintroduce 'StdBasicStringIterator'. 2022-12-07 18:21:52 +00:00
Geoffrey White
1d4631e231 C++: Better solution. 2022-12-07 18:00:38 +00:00
Tom Hvitved
35938067fe Merge pull request #11517 from aibaars/phi-reads-in-data-flow-graph
Ruby: Include SSA "phi reads" in DataFlow::Node
2022-12-07 18:58:44 +01:00
Mathias Vorreiter Pedersen
05d89b29e2 Merge branch 'main' into skip-lvalue-types 2022-12-07 17:50:23 +00:00
Geoffrey White
627162b343 C++: Fix cpp/offset-use-before-range-check performance. 2022-12-07 17:32:36 +00:00
Ian Lynagh
e6c3bcec63 Java/Kotlin: Update the diagnostic severity documentation 2022-12-07 17:14:51 +00:00
Geoffrey White
a8b8b54f8d Update cpp/ql/src/Security/CWE/CWE-311/CleartextBufferWrite.ql
Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
2022-12-07 16:44:33 +00:00
Geoffrey White
80cd994e36 Swift: Add taint reach to SummaryStats.ql. 2022-12-07 16:17:24 +00:00
Alvaro Muñoz
38b2f537d4 Use ReplyCall.super syntax instead of this.(ReplyCall) 2022-12-07 16:39:07 +01:00
Geoffrey White
4b8575bfc3 C++: Simplify the query slightly. 2022-12-07 15:35:45 +00:00
Arthur Baars
898a4006b0 Merge pull request #10747 from aibaars/ruby-more-flow
Ruby: also treat included/prepended modules as subclasses
2022-12-07 15:49:00 +01:00
Geoffrey White
b3d838d678 C++: Define the sources more clearly and consistently (fixes performance issue). 2022-12-07 14:45:39 +00:00
Chris Smowton
9f9a51685b Merge pull request #11510 from smowton/smowton/fix/kotlin-populate-source-class-files
Kotlin: stub trap .class files when extracting a class from Kotlin source
2022-12-07 14:33:42 +00:00
Edward Minnix III
170c9af9e8 Merge pull request #11238 from egregius313/egregius313/webview-setjavascriptenabled
Java: Query for detecting enabling Javascript in Android WebSettings
2022-12-07 09:31:58 -05:00
Arthur Baars
d862972d5e Ruby: Add use-use stress test 2022-12-07 15:28:51 +01:00
Arthur Baars
d5f4340cf5 Ruby: address comment 2022-12-07 15:28:50 +01:00
Arthur Baars
f11f2cb1a0 Ruby: Update tests 2022-12-07 15:28:50 +01:00
Arthur Baars
2131b0f116 Ruby: Include SSA "phi reads" in DataFlow::Node 2022-12-07 15:28:48 +01:00
Michael Nebel
468b05ccda C#: Expressions of type Span<char> and ReadOnlySpan<char> can be matched against constant strings. 2022-12-07 14:31:51 +01:00
Mathias Vorreiter Pedersen
135c820a32 Merge pull request #11592 from github/redsun82/swift-fix-get-number-of
Swift: fix generated `getNumberOf`
2022-12-07 13:24:09 +00:00
retanoj
9cfeaeb18e Merge branch 'main' into MybatisSqli 2022-12-07 21:19:08 +08:00
erik-krogh
9ef4f12261 add change-note 2022-12-07 14:12:43 +01:00
erik-krogh
8ab31bbe1c have getMethodName return the method being called for super-calls 2022-12-07 14:09:36 +01:00
Jami
5e694b5983 Merge pull request #11192 from jcogs33/jcogs33/share-key-sizes
Share encryption key sizes between Java and Python
2022-12-07 08:08:24 -05:00
Paolo Tranquilli
ef348453fe Swift: accept new, correct test result on TypeTuple::getNumberOfTypes 2022-12-07 13:46:51 +01:00
Paolo Tranquilli
194c99c513 Swift: fix getNumberOf predicate 2022-12-07 13:46:51 +01:00
Paolo Tranquilli
23626f2c69 Swift: add TupleType test 2022-12-07 13:46:51 +01:00
Paolo Tranquilli
9b89ded908 Swift: accept test changes 2022-12-07 13:46:51 +01:00
Paolo Tranquilli
d39f37540e Swift: add has and getNumberOf properties to generated tests 2022-12-07 13:46:51 +01:00
Michael Nebel
2d9975d73f C#: nint/System.IntPtr and nuint/System.UIntPtr are indistinguishable by the extractor. 2022-12-07 13:45:23 +01:00
Jeroen Ketema
01d8ad98f6 C++: Model secure_getenv and _wgetenv as local flow sources 2022-12-07 13:37:12 +01:00
erik-krogh
ee8e0188a6 remove redundant call, the charpred ensures it always holds 2022-12-07 13:23:18 +01:00
erik-krogh
360a99f026 delete getKernelMethod and don't special-case the methodName on super-calls in the Kernel model 2022-12-07 13:14:48 +01:00
Chris Smowton
c526020fd4 Note TODO re: re-enabling suspend function Java interop testing 2022-12-07 11:51:48 +00:00
Chris Smowton
ecbb96ffc1 Remove no-longer-needed diagnostic expectations 2022-12-07 11:50:41 +00:00
Jeroen Ketema
2c08b95430 Merge pull request #11434 from jketema/deprecate-default-taint-tracking
C++: Deprecate `DefaultTaintTracking` and `TaintTrackingImpl`
2022-12-07 12:41:04 +01:00
Tony Torralba
cabce5fb36 Merge pull request #11549 from mbaluda/mbaluda/insecure-cookie
Java: Support interprocedural setting of cookie security
2022-12-07 12:14:46 +01:00
Tony Torralba
321a2f5a73 Merge pull request #11550 from atorralba/atorralba/kotlin/adapt-path-sanitizer
Kotlin: Adapt PathSanitizer
2022-12-07 12:08:00 +01:00
Anders Schack-Mulligen
f17f19c821 Java: Switch to qualified imports. 2022-12-07 11:41:32 +01:00
Asger F
fcdb2fa03f JS: Remove MaD models from .qll files 2022-12-07 11:35:13 +01:00
Asger F
d8e566a50e Add data-extension files 2022-12-07 11:35:13 +01:00
Asger F
5af1b367c7 Support data extensions 2022-12-07 11:35:05 +01:00
Owen Mansel-Chan
2ed8d5d798 Merge pull request #11288 from pwntester/new_sudo_like_argument
Golang: add `rsync` as a program capable of arbitrary shell command execution
2022-12-07 10:20:49 +00:00
Tony Torralba
6dcc0cc188 Further simplification 2022-12-07 10:50:23 +01:00
Alvaro Muñoz
af015d3d30 restoring previous casts to avoid super type ambiguity 2022-12-07 10:39:58 +01:00
Tony Torralba
ccd465d669 Update java/ql/lib/semmle/code/java/security/PathSanitizer.qll 2022-12-07 10:38:33 +01:00
Alvaro Muñoz
407df37a74 Add feedback from Code review 2022-12-07 10:36:44 +01:00
Tony Torralba
2f622ad72c Refactor by introducing helper predicates 2022-12-07 10:31:54 +01:00
Alvaro Muñoz
3e92b4c596 Apply suggestions from code review
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2022-12-07 10:29:29 +01:00
erik-krogh
52c0afa03f change getMethodName to getKernelMethod in other files 2022-12-07 10:27:35 +01:00
Tony Torralba
85b2642a5e Extraction discrepancy fixed in kotlinc 1.7.21 2022-12-07 09:57:31 +01:00
Tom Hvitved
51f11f19cc Merge pull request #11576 from ethanwilloner/main
csharp: URI should be Uri in Owin.qll library.
2022-12-07 09:34:51 +01:00
Alvaro Muñoz
49eedde58a Merge branch 'main' into new_sudo_like_argument 2022-12-07 09:31:17 +01:00
Asger F
afe7872838 Merge pull request #11565 from asgerf/js/rephined-variable-in-access-path
JS: handle rephined variable in access path
2022-12-07 09:26:38 +01:00
Michael Nebel
c1c0432c00 Merge pull request #11144 from michaelnebel/csharp/qualifiedname
C#: Deprecate hasQualifiedName/1 and prepare for deprecating getQualifiedName/0.
2022-12-07 09:16:38 +01:00
Ed Minnix
b6a59f0885 Java: Add support and tests for implicitly exported activity aliases 2022-12-06 23:11:48 -05:00
Ed Minnix
1472335c2e Abbreviated change note in changelog entry for activity-alias 2022-12-06 23:11:48 -05:00
Ed Minnix
2255b0d96a Modify getAndroidComponentXmlElement to handle activity-alias
Since aliases have both the `name` and `targetActivity` attributes, we
should check all identifying attributes in order to add
`<activity-alias>` elements as dataflow sources.
2022-12-06 23:11:48 -05:00
Ed Minnix
4620db0fe9 Activity alias: formatting changes suggested by Actions 2022-12-06 23:11:48 -05:00
Ed Minnix
ec6c421f91 Added change notes for AndroidManifest.qll 2022-12-06 23:11:48 -05:00
Ed Minnix
f4dbd41036 Test files for Activity Alias 2022-12-06 23:11:48 -05:00
Ed Minnix
4df926e148 Add method for finding aliases to AndroidActivityXmlElement 2022-12-06 23:11:48 -05:00
Ed Minnix
b4f08f8b91 Add support for Android Manifest <activity-alias> element 2022-12-06 23:11:48 -05:00
Ed Minnix
4c270fca91 Add generalized identifier resolution for AndroidManifest
Since more than one attribute can hold an identifier, refactor
identifier resolution into a separate method.
2022-12-06 23:11:47 -05:00
Ed Minnix
cf3e5a0abe Add class for XML Attributes meant to hold an identifier in AndroidManifest
Some Android component attributes hold an identifier (e.g.
`android:name` and `android:targetActivity` for `<activity-alias>`).
2022-12-06 23:11:47 -05:00
Jami Cogswell
b82f9b1911 Java: add draft of generated vs manual MaD metrics query 2022-12-06 22:15:19 -05:00
Tiferet Gazit
1a9dd48a88 Merge pull request #11551 from github/tiferet/endpoint-characteristics-test
ATM: Test for contradictory endpoint characteristics
2022-12-06 18:36:41 -08:00
retanoj
8ee418405b consider blankspace / comma /dot field 2022-12-07 10:06:39 +08:00
tiferet
cf29cde2e8 Apply suggestions from code review 2022-12-06 18:05:04 -08:00
Chris Smowton
522a549d61 Improve debug logging when the external decl extractor handles an IrFile 2022-12-06 20:39:14 +00:00
Chris Smowton
d2e7797485 Rename to writeStubTrapFile 2022-12-06 20:39:03 +00:00
Ed Minnix
1c81f8d8d5 Apply suggestion from docs review 2022-12-06 15:32:54 -05:00
Chris Smowton
00f323c8bd Fix: extract directly exposed fields with static modifier 2022-12-06 20:32:10 +00:00
Chris Smowton
5d43c431c0 Merge pull request #11504 from owen-mc/fix-small-error
Fix `mayHaveSideEffects` for `ReturnStmt`
2022-12-06 20:15:07 +00:00
Chris Smowton
c68ac460c9 Accept test changes: again this is a raw class extracted just for its signature. 2022-12-06 18:38:33 +00:00
Chris Smowton
d37a10e4f1 Accept test changes: methods no longer appearing to be final
This is actually a bug, which we should follow up on subsequently.
2022-12-06 18:38:31 +00:00
Chris Smowton
59eb81b50a Accept test changes: a raw class getting extracted solely for use in a signature
We could revert this by allowing useType to avoid triggering class-instance extraction when used just for its signature result
2022-12-06 18:35:04 +00:00
Chris Smowton
f5579d59f8 Accept test changes: classes no longer getting multiple locations 2022-12-06 18:35:04 +00:00
Chris Smowton
9f722a7e12 Disable java_and_kotlin inconsistency test; accept changes
This was testing that a signature inconsistency occurs, but this now manifests as a db inconsistency which can't be used as a test expectation because specific tuple numbers are liable to change with the environment.
2022-12-06 18:35:04 +00:00
Chris Smowton
f2fded6486 Accept jvmstatic-annotation changes
These occur because the Companion field is odd, being extracted from source but not having an associated FieldDeclaration, leading to PrintAst enumerating the node differently depending on whether it has a source-file location or not but in either case choosing not to show it.
2022-12-06 18:35:04 +00:00
Chris Smowton
5e023bf619 Remove no-longer-applicable diagnostic matches
These resulted from the Java compiler exploring NotNull and other Kotlin-emitted annotations, which it no longer does because it finds a .class trap file already present and truncates its class-graph walk
2022-12-06 18:35:04 +00:00
Chris Smowton
82f3c2f6d5 Mark the Companion field as static 2022-12-06 18:35:04 +00:00
Chris Smowton
d9dc8e38f9 Fix binary names for classes declared from source
Only top-level non-class declarations need the IrFile's expected class name inserting
2022-12-06 18:35:04 +00:00
Chris Smowton
910a1f872d Adjust opt-in required to use string-manipulation functions in Kotlin <= 1.5 2022-12-06 18:35:04 +00:00
Chris Smowton
540a2a623e Don't create stub trap files for anonymous or local classes, or unexpected kinds of top-level declaration 2022-12-06 18:35:04 +00:00
Chris Smowton
08e3431107 Also stub class files relating to file classes and top-level declarations 2022-12-06 18:35:04 +00:00
Chris Smowton
748637c2d8 Tidy and use version 0 for classes extracted from source 2022-12-06 18:35:03 +00:00
Chris Smowton
e34d72aee9 Kotlin: stub trap .class files when extracting a class from Kotlin source 2022-12-06 18:35:03 +00:00
Ethan Willoner
64f58061b7 Rename 2022-12-05-owin-uri-fix.md. to 2022-12-05-owin-uri-fix.md 2022-12-06 09:13:28 -08:00
Ethan Willoner
574d6d6119 Fix comment.
Co-authored-by: Tom Hvitved <hvitved@github.com>
2022-12-06 09:10:22 -08:00
Jeroen Ketema
b5147bbfb0 C++: Deprecate DefaultTaintTracking and TaintTrackingImpl 2022-12-06 17:45:16 +01:00
Owen Mansel-Chan
4789431d6e Add change note 2022-12-06 16:25:50 +00:00
Owen Mansel-Chan
d588ee375b Fix mayHaveSideEffects for ReturnStmt
The previous code only worked when the return statement
only has one returned expression.
2022-12-06 15:07:45 +00:00
Mathias Vorreiter Pedersen
2c500142c7 Merge pull request #11435 from jketema/rewrite-tainted-path
C++: Rewrite `cpp/path-injection` to not use `DefaultTaintTracking`
2022-12-06 14:54:57 +00:00
retanoj
b0c86d8e51 change string match to regex match 2022-12-06 21:50:09 +08:00
Michael Nebel
8e4190d84a Merge pull request #11516 from michaelnebel/java/externalflowcleanup
Java: Cleanup imports of `ExternalFlow`
2022-12-06 14:26:39 +01:00
erik-krogh
8f0c0f3c17 add support for super calls to Kernel 2022-12-06 14:25:51 +01:00
erik-krogh
0e9cd1e4b5 factor out methodName to a field in KernelMethodCall 2022-12-06 14:23:46 +01:00
erik-krogh
e24f041661 drive-by: use instanceof KernelMethodCall such that override getAnArgument cannot be mistaken for a method in CallNode 2022-12-06 14:21:48 +01:00
erik-krogh
5849b2c98a drive-by: simplify the imports in PathInjection.ql 2022-12-06 14:09:39 +01:00
erik-krogh
66946ebf6a add Kernel methods as sinks to path-injection 2022-12-06 14:09:15 +01:00
Anders Schack-Mulligen
b579e2e7ed Merge pull request #11493 from aschackmull/java/scc-equivrel
Java: Replace ad-hoc SCC reduction with union-find.
2022-12-06 14:02:46 +01:00
Michael Nebel
27efb0d843 C#: Rename -> for . 2022-12-06 13:53:50 +01:00
Erik Krogh Kristensen
be168901d6 Merge pull request #11085 from dbartol/dbartol/ql-for-ql-latest
Use latest released bundle for QL-for-QL
2022-12-06 12:43:53 +01:00
retanoj
2bbd37f9ab change code snippet to or condition 2022-12-06 19:27:29 +08:00
Michael Nebel
29ccac8e93 C#: Address review comments. 2022-12-06 12:05:48 +01:00
Mathias Vorreiter Pedersen
3eea3b2f45 Merge pull request #11446 from atorralba/atorralba/swift/path-injection
Swift: Add path injection query
2022-12-06 11:03:26 +00:00
Michael Nebel
6b35098fb7 C#: Replace more uses of getQualifiedName/0. 2022-12-06 11:59:13 +01:00
Michael Nebel
0a3295ef3f C#: Address review comments. 2022-12-06 11:59:13 +01:00
Michael Nebel
ae4f4d6df4 C#: Add change note about deprecation of hasQualifiedName/1. 2022-12-06 11:59:13 +01:00
Michael Nebel
f7a1a4a9b7 C#: Add some missing this qualifiers. 2022-12-06 11:59:13 +01:00
Michael Nebel
38e906f854 C#: Use hasQualifiedName instead of getQualifiedName. 2022-12-06 11:59:13 +01:00
Michael Nebel
c24302bec2 C#: Replace all uses of the deprecated hasQualifiedName/1 predicate. 2022-12-06 11:59:12 +01:00
Michael Nebel
315a3a5ed3 C#: Add hasQualifiedName/3 including overrides where relevant and re-write some of the existing hasQualifiedName/2 predicates. 2022-12-06 11:59:12 +01:00
Michael Nebel
38565407c5 C#: Add small module with relevant printing predicates. 2022-12-06 11:59:12 +01:00
Michael Nebel
86c021ef7e C#: Deprecate hasQualifiedName/1. 2022-12-06 11:59:12 +01:00
retanoj
de652e1e27 expected 2022-12-06 18:09:48 +08:00
Chris Smowton
3b5b121aeb Merge pull request #11553 from smowton/smowton/fix/kotlin-synthetic-noarg-constructor
Kotlin: Extract a no-arg constuctor whenever a Kotlin class has default values for all parameters
2022-12-06 10:07:31 +00:00
retanoj
fb8559f03a tiny fix function name 2022-12-06 18:03:00 +08:00
Anders Schack-Mulligen
f0ac59be25 Merge pull request #11521 from aschackmull/shared/typetracking
Shared: Add a qlpack with a parameterized module defining type-trackers.
2022-12-06 10:56:44 +01:00
Anders Schack-Mulligen
1b77f50fd7 Shared: Address review comments. 2022-12-06 10:42:16 +01:00
Michael Nebel
4e93429026 Merge pull request #11577 from michaelnebel/java/enablemodeldifferenceworkflow
Java: Add Model Difference workflow on model generator changes.
2022-12-06 10:35:52 +01:00
retanoj
82d0551215 Merge branch 'main' into MybatisSqli 2022-12-06 17:19:30 +08:00
retanoj
d2140eb4b1 MyBatisAnnotationSqlInjection no @Param case 2022-12-06 17:07:49 +08:00
Michael Nebel
204766b967 Java: Adjust generated model paths in Model difference workflow. 2022-12-06 09:53:39 +01:00
Tom Hvitved
b5e2e1e469 Merge pull request #11564 from hvitved/dataflow/parameter-position-consistency-checks
Data flow: Add consistency checks for parameter positions
2022-12-06 09:33:36 +01:00
Michael Nebel
6fa2193602 Java: Add Model Difference workflow on model generator changes. 2022-12-06 09:26:09 +01:00
Michael Nebel
cd5c0bec33 Merge pull request #11527 from michaelnebel/java/regeneratemodels
Java/C#: Delete old model generator scripts and update Java model re-generator script.
2022-12-06 09:24:13 +01:00
Jeroen Ketema
995efef5da C++: Add explanatory comment to hasFilteredFlowPath 2022-12-06 09:03:21 +01:00
Jeroen Ketema
5637d573c1 C++: Add test case that is no longer detected after latest changes 2022-12-06 08:31:22 +01:00
Tom Hvitved
b171dc9b7b Merge pull request #11477 from hvitved/ruby/call-ctx-rewrite
Ruby: Rework call-context sensitivity logic
2022-12-06 07:39:29 +01:00
Ethan Willoner
b886157f52 Add change note. 2022-12-06 00:27:17 +00:00
Ethan Willoner
82c0449d56 Fix bug: In OwinRequest URI should be Uri. 2022-12-06 00:01:17 +00:00
Jeroen Ketema
6dbc59d5b5 C++: Simplify isSink based on reviewer comments 2022-12-05 23:23:08 +01:00
Henry Mercer
2627632a41 Java: Fix duplicate IDs 2022-12-05 19:06:03 +00:00
Henry Mercer
5b040a9476 Python: Fix duplicate query IDs 2022-12-05 19:04:10 +00:00
Henry Mercer
6484935d25 Add CI job for check query IDs script 2022-12-05 18:51:48 +00:00
Henry Mercer
9c27cc0abe Add a script to check for duplicate query IDs 2022-12-05 18:51:48 +00:00
Nick Rolfe
23b02f4f27 Merge pull request #11544 from github/nickrolfe/update-query-docs
Docs: rewrite "defining the results of a query"
2022-12-05 17:14:56 +00:00
Nick Rolfe
731419fc80 Remove reference to query console
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2022-12-05 16:47:15 +00:00
Felicity Chapman
96476cb50d Merge pull request #11561 from github/felicitymay-lgtm-fixes
Remove one more outdated reference
2022-12-05 16:31:19 +00:00
Chris Smowton
5bb1319b0f Merge pull request #9779 from porcupineyhairs/goSqlInjection
Golang : Add SQL sinks for `gorqlite` and `GoFrame` frameworks
2022-12-05 16:30:22 +00:00
Chris Smowton
407e4cdd07 Don't create a default constructor for annotations, or classes that explicitly declare a no-arg constructor. 2022-12-05 16:17:51 +00:00
Tom Hvitved
7972db68bc C++: Update expected test output 2022-12-05 17:07:32 +01:00
Chris Smowton
8897f5bccc Merge pull request #11552 from smowton/smowton/fix/kotlin-toplevel-internal-names
Kotlin: Don't add name mangling to top-level internal functions
2022-12-05 15:36:52 +00:00
Tony Torralba
7dca1b4b06 Merge branch 'main' into atorralba/swift/path-injection 2022-12-05 16:21:22 +01:00
Mathias Vorreiter Pedersen
5b31da44e1 Merge pull request #11424 from geoffw0/alamofire3
Swift: Alamofire taint sources
2022-12-05 15:15:58 +00:00
Mathias Vorreiter Pedersen
012beebe3b Swift: Update .generated.list 2022-12-05 15:02:44 +00:00
Mathias Vorreiter Pedersen
e7ec5a69a3 Swift: Accept more test changes. 2022-12-05 14:53:23 +00:00
Tony Torralba
bf8084080b Apply suggestions from code review
Co-authored-by: Ben Ahmady <32935794+subatoi@users.noreply.github.com>
2022-12-05 15:37:40 +01:00
Anders Schack-Mulligen
ed1fe1447b Shared: Add more precise types in TypeTracker. 2022-12-05 15:19:20 +01:00
Mathias Vorreiter Pedersen
a07c9ffbc5 Swift: Accept test changes. 2022-12-05 14:19:00 +00:00
Mathias Vorreiter Pedersen
8053b72901 Swift: Skip lvalue types. 2022-12-05 14:15:32 +00:00
Asger F
80777b8c50 JS: handle rephined variables in local access paths 2022-12-05 15:11:50 +01:00
Asger F
025cfe4064 JS: Add reproduction test case 2022-12-05 15:11:43 +01:00
Anders Schack-Mulligen
27755d1551 Shared: Add a qlpack with a parameterized module defining type-trackers. 2022-12-05 14:56:11 +01:00
Anders Schack-Mulligen
9eed12af23 Shared: Initial commit with copy of Ruby TypeTracker. 2022-12-05 14:54:03 +01:00
Erik Krogh Kristensen
6b9cab23d4 Merge pull request #11248 from erik-krogh/js-redosMod
JS: use the shared regex pack
2022-12-05 14:48:37 +01:00
Michael Nebel
fca249a62e Java: Address review comments. 2022-12-05 14:44:52 +01:00
Geoffrey White
64fb98e46f Swift: Rewrite bits to try and get rid of red highlighting. 2022-12-05 13:41:21 +00:00
Geoffrey White
17244734d0 Swift: Results repaired by merge. 2022-12-05 13:36:14 +00:00
Tom Hvitved
8f701cf1cb Python: Update expected test output 2022-12-05 14:33:06 +01:00
Geoffrey White
07c790a430 Merge branch 'main' into alamofire3 2022-12-05 13:29:26 +00:00
Michael Nebel
19db8e5d82 Java: Address review comments and also delete comment about type based summaries only being for C#. 2022-12-05 14:07:16 +01:00
Geoffrey White
6cb69c907d Merge pull request #11514 from geoffw0/generics
Swift: Fix for MaD with generics
2022-12-05 13:02:35 +00:00
Tony Torralba
8422df1c43 Add change note 2022-12-05 13:35:54 +01:00
Nick Rolfe
f31a7cf921 Apply suggestions from code review
Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com>
2022-12-05 12:32:47 +00:00
Tom Hvitved
52f3a48638 Data flow: Sync files 2022-12-05 12:57:27 +01:00
Tom Hvitved
e66a3c4d83 Data flow: Add consistency checks for parameter positions 2022-12-05 12:57:11 +01:00
Mauro Baluda
7c4b76b08b Update InsecureCookie.ql 2022-12-05 12:55:53 +01:00
Chris Smowton
7883bff99e Merge branch 'main' into goSqlInjection 2022-12-05 11:43:14 +00:00
AlexDenisov
ef9b503f69 Merge pull request #11559 from github/redsun82/swift-integration-test-dbs
Swift: always upload integration test logs
2022-12-05 12:41:45 +01:00
Tom Hvitved
faca4b5b56 Merge pull request #11461 from hvitved/ruby/unique-hash-splat-param
Ruby: At most one hash-splat `ParameterNode` per callable
2022-12-05 11:53:28 +01:00
Tony Torralba
47d61e0b4d Add test for File.startsWith 2022-12-05 11:52:50 +01:00
Tony Torralba
71a6b09bad Minor syntax change in tests 2022-12-05 11:52:02 +01:00
Chris Smowton
07e4367151 Merge pull request #11562 from github/smowton/admin/remove-go-work
Delete go.work
2022-12-05 10:40:10 +00:00
Michael Nebel
1c135bd207 Java: Temporarily disable the Model Difference workflow for changes to the model generator. 2022-12-05 11:39:44 +01:00
Michael Nebel
17e7f04adf Java: Update the MaD Model Difference workflow. 2022-12-05 11:39:44 +01:00
Michael Nebel
bf332fa5e7 Java: Update MaD regenerate models worksflow. 2022-12-05 11:39:44 +01:00
Michael Nebel
a9ba964be4 Java: Update the Java model re-generate script. 2022-12-05 11:39:44 +01:00
Michael Nebel
243b94b54a Java/C#: Delete old model generator scripts and rename the new ones. 2022-12-05 11:39:44 +01:00
Geoffrey White
59e9d0828b Merge branch 'main' into generics 2022-12-05 10:30:10 +00:00
Nick Rolfe
d893768726 Docs: rewrite "defining the results of a query"
The old guide was based on the code duplication library, which no longer
works, and used screenshots of LGTM, which is deprecated.
2022-12-05 10:18:32 +00:00
Arthur Baars
889eea92c2 Merge branch 'main' into ruby-more-flow 2022-12-05 11:13:46 +01:00
Mauro Baluda
16d7dc0853 Restrict DF configuration 2022-12-05 11:02:19 +01:00
Arthur Baars
83423854d2 Merge pull request #11339 from aibaars/active_support_enumerable
Ruby: Active support enumerable
2022-12-05 11:02:19 +01:00
Tom Hvitved
3d59935156 Merge pull request #11560 from hvitved/ci/decrease-ram
CI: Change `--ram` value from 52G to 50G in `codeql` tests
2022-12-05 11:02:08 +01:00
Chris Smowton
fea755ecc8 Delete go.work 2022-12-05 10:02:02 +00:00
Tony Torralba
8fb5c37ba8 Add change note 2022-12-05 11:00:57 +01:00
Tony Torralba
995b7327fe Add missing QLDoc 2022-12-05 11:00:57 +01:00
Tony Torralba
21b51b48eb Adapt PathSanitizer to Kotlin 2022-12-05 11:00:57 +01:00
Asger F
6bffb11749 Merge pull request #11253 from asgerf/merge-package-type-columns
Dynamic: Merge package and type columns
2022-12-05 10:57:21 +01:00
Felicity Chapman
6884db120a Remove another outdated reference 2022-12-05 09:56:28 +00:00
Felicity Chapman
90c6771dd1 Merge pull request #11502 from github/felicitymay-8441-detective
LGTM deprecation: Update QL detective tutorials
2022-12-05 09:40:00 +00:00
Michael Nebel
6e486d4347 Re-arrange imports. 2022-12-05 09:49:38 +01:00
Michael Nebel
5c8ef15d6f Java: Add bi-directional imports of some abstract class extensions. 2022-12-05 09:49:38 +01:00
Michael Nebel
65f242cabe Java: Delete import of framework related files in ExternalFlow. 2022-12-05 09:49:38 +01:00
Michael Nebel
4c7cdc6245 Java: Remove unneeded imports of ExternalFlow.qll. 2022-12-05 09:49:38 +01:00
Tom Hvitved
c2d843f96b CI: Change --ram value from 52G to 50G in codeql tests 2022-12-05 09:35:56 +01:00
Tony Torralba
9d2b04928d Fix qhelp after suggestions 2022-12-05 09:16:27 +01:00
Tony Torralba
6e7c7c245b Update swift/ql/src/queries/Security/CWE-022/PathInjection.qhelp
Co-authored-by: Ben Ahmady <32935794+subatoi@users.noreply.github.com>
2022-12-05 08:47:18 +01:00
Paolo Tranquilli
a0d7043615 Swift: always upload integration test logs
This way we can get logs also in case we cancelled the job due to a test
hanging indefinitely (which is happening from time to time to the Xcode
test).
2022-12-05 08:32:36 +01:00
Alvaro Muñoz
7fe4108a0b add change note 2022-12-03 16:37:14 +01:00
Alvaro Muñoz
fc56843c04 improve predicate QLdoc 2022-12-03 16:34:14 +01:00
Felicity Chapman
dea9adbad4 Merge branch 'codeql-cli-2.11.5' into felicitymay-8441-detective 2022-12-02 23:48:23 +00:00
Felicity Chapman
2b24870a3d Merge pull request #11468 from github/felicitymay-8441-basic-query-2
LGTM deprecation: Update basic queries to use VS Code
2022-12-02 23:47:51 +00:00
Porcupiney Hairs
15c58dee5f Golang : Add SQL sinks for gorqlite and GoFrame frameworks 2022-12-03 03:34:07 +05:30
Alvaro Muñoz
7e0e56dadc Added two new CMDi sinks fot python's stdlib 2022-12-02 22:16:40 +01:00
Tiferet Gazit
79d8444b94 Merge pull request #11532 from github/tiferet/endpoint-filter-test
ATM: Test for endpoints scored at inference time
2022-12-02 13:13:52 -08:00
SiaraMist
a1b6bfb270 Initial updates for CodeQL template 2022-12-02 13:07:25 -08:00
Chris Smowton
ff4baf096f Don't add name mangling to top-level internal functions
Turns out kotlinc only adds this sort of name mangling to class member functions
2022-12-02 20:16:19 +00:00
Chris Smowton
1c0494ec53 Extract a no-arg constuctor whenever a Kotlin class has default values for all parameters 2022-12-02 20:07:43 +00:00
Ed Minnix
7c4bd509a7 Java: add AssetLoader example to WebView file access documentation 2022-12-02 14:43:52 -05:00
tiferet
93e3c72c6a Test for contradictory endpoint characteristics 2022-12-02 10:29:39 -08:00
Jami
edfcc0cd6d Merge pull request #11487 from jcogs33/jcogs33/supportedexternalapis-telemetry-query
Java/C#: add SupportedExternalApis telemetry query
2022-12-02 13:27:51 -05:00
Felicity Chapman
5a57844dab Merge pull request #11503 from github/felicitymay-8441-next-batch
LGTM deprecation: a few more references missed in earlier PRs
2022-12-02 18:13:00 +00:00
tiferet
d211decfb4 Fix error in last commit 2022-12-02 09:03:44 -08:00
Mauro Baluda
04f1fe523a Update Test.java 2022-12-02 18:01:10 +01:00
Tiferet Gazit
c0aae3d68e Apply suggestions from code review
Co-authored-by: Stephan Brandauer <kaeluka@github.com>
2022-12-02 09:00:45 -08:00
Mauro Baluda
f3f8f35069 Update InsecureCookie.ql
Support interprocedural setting of cookie security
2022-12-02 17:37:23 +01:00
Paolo Tranquilli
a11756bad1 Merge pull request #11542 from github/alexdenisov/canonical-case
Swift: add a test case showing case canonicalization
2022-12-02 17:12:03 +01:00
Chris Smowton
50c85f6e5b Merge pull request #11545 from github/post-release-prep/codeql-cli-2.11.5
Post-release preparation for codeql-cli-2.11.5
2022-12-02 15:27:47 +00:00
Erik Krogh Kristensen
c4cb410970 Merge pull request #11472 from erik-krogh/exit-code
JS: make the JS autobuilder consistent with Ruby when no JS code was detected
2022-12-02 16:01:02 +01:00
Erik Krogh Kristensen
1c7cae4620 Merge pull request #11547 from mattrothenberg/main
fix: use WHATWG URL for JS examples
2022-12-02 16:00:13 +01:00
tiferet
d17383d98c Add XssThroughDom 2022-12-02 06:59:32 -08:00
tiferet
2e20abca90 Undo error from previous commit
Oops, now I see why that wasn't private
2022-12-02 06:59:31 -08:00
tiferet
294f34bf07 Small improvement
Not strictly needed, but better to keep things private when possible
2022-12-02 06:59:31 -08:00
tiferet
a317f2bfe2 Test for endpoints scored at inference time
Adds a test to detect changes in the endpoints that get scored at inference time.
2022-12-02 06:59:31 -08:00
Mathias Vorreiter Pedersen
2653458a39 Merge pull request #11537 from MathiasVP/iterator-model-changes
C++: Change iterator models
2022-12-02 14:57:21 +00:00
Paolo Tranquilli
f8386e753a Merge pull request #11522 from github/redsun82/swift-integration-test-dbs
Swift: upload test logs as artifacts for integration tests
2022-12-02 15:35:59 +01:00
Edward Minnix III
55090ecb65 Java: Typos and minor fixes
Co-authored-by: Ben Ahmady <32935794+subatoi@users.noreply.github.com>
2022-12-02 09:17:41 -05:00
Michael Nebel
bb716ddb80 Merge pull request #11499 from michaelnebel/java/kotlinstd
Kotlin: Migrate standard library models to data extensions.
2022-12-02 14:44:50 +01:00
Matt Rothenberg
95f994a82b Update RequestForgeryBad.js 2022-12-02 14:17:37 +01:00
Matt Rothenberg
7d674e7cdc set base URL 2022-12-02 14:17:17 +01:00
Felicity Chapman
7aca35d52b Apply suggestions from code review 2022-12-02 13:09:38 +00:00
Matt Rothenberg
c49e9e8503 fix: use let for subdomain assignment 2022-12-02 14:07:39 +01:00
Felicity Chapman
42a438cdcb Apply suggestions from code review
Co-authored-by: Michael B. Gale <mbg@github.com>
2022-12-02 13:06:32 +00:00
Alex Denisov
f5ddbd6abb Swift: add a test case showing case canonicalization 2022-12-02 14:06:21 +01:00
AlexDenisov
691188bc48 Merge pull request #11523 from github/alexdenisov/preserve-symlinks
Swift: resolve symlinks conditionally
2022-12-02 14:05:13 +01:00
Matt Rothenberg
a453405365 Update RequestForgeryBad.js 2022-12-02 14:03:37 +01:00
Matt Rothenberg
2ae0c7e115 Update RequestForgeryGood.js 2022-12-02 14:02:54 +01:00
Owen Mansel-Chan
d3e06ee290 Merge pull request #11431 from owen-mc/go/update-qldoc
Make qldoc clearer about behaviour of override
2022-12-02 12:19:16 +00:00
Geoffrey White
cf3345ee8f Swift: Revert security-severity on CWE-321, for now. 2022-12-02 12:01:43 +00:00
Chris Smowton
fef03a0806 Merge pull request #11540 from github/smowton/fix/path-injection-example-syntax-error
Java: fix syntax error in path-injection example fix
2022-12-02 11:47:53 +00:00
Chris Smowton
194b754880 Merge pull request #11525 from github/mbg/add/go.work
Add go.work file
2022-12-02 11:47:31 +00:00
github-actions[bot]
5e35785fd0 Post-release preparation for codeql-cli-2.11.5 2022-12-02 11:37:44 +00:00
Michael Nebel
309807796c Java: Deprecate ModelCsv classes. 2022-12-02 12:20:22 +01:00
Michael Nebel
b80829a3a0 Java/Kotlin: Cleanup files needed for inline models. 2022-12-02 12:20:22 +01:00
Michael Nebel
f5069ffc1f Kotlin: Remove the inlined models. 2022-12-02 12:20:22 +01:00
Michael Nebel
42411fd455 Java/Kotlin: Allow dashes in callable names (the Kotlin standard library contains methods with dashes). 2022-12-02 12:20:22 +01:00
Michael Nebel
d9e4aafe3a Kotlin: Add Kotlin standard library models as Data extensions. 2022-12-02 12:20:22 +01:00
Michael Nebel
5194108233 Java/C#: Improve the newlines in the generated model files. 2022-12-02 12:20:17 +01:00
Paolo Tranquilli
cd700dfe11 Swift: upload integration test logs also on failure 2022-12-02 12:20:14 +01:00
Michael Nebel
b2dd29ff05 Java/C#: Update conversion script to also produce negative models. 2022-12-02 12:18:50 +01:00
Michael Nebel
fb670325d8 Java/C#: Add query for aiding the conversion of existing negative models. 2022-12-02 12:18:50 +01:00
Michael Nebel
95e65347ca Merge pull request #11455 from michaelnebel/java/flowtestcaseextensions
Java: Update the flow test case generator to produce data extensions.
2022-12-02 12:15:16 +01:00
Paolo Tranquilli
24be481574 Merge pull request #11429 from github/redsun82/swift-type-mapping
Swift: make mapping from swift types to tags explicit
2022-12-02 12:12:12 +01:00
Asger F
ef72e222b0 Merge pull request #11513 from asgerf/js/api-graph-async-result-node
JS: Remove MkAsyncFunctionResult
2022-12-02 11:29:03 +01:00
Geoffrey White
85a0a42da9 Swift: try again to satisfy ql-for-ql. 2022-12-02 10:15:11 +00:00
Mathias Vorreiter Pedersen
cef7224739 C++: Make QL-for-QL happy. 2022-12-02 10:12:25 +00:00
Mathias Vorreiter Pedersen
a245977075 C++: Change iterator models. 2022-12-02 10:11:20 +00:00
Chris Smowton
6e98c67869 Java: fix syntax error in path-injection example fix 2022-12-02 10:04:53 +00:00
Felicity Chapman
26908ea281 Update docs/codeql/codeql-language-guides/using-flow-labels-for-precise-data-flow-analysis.rst
Co-authored-by: Steve Guntrip <12534592+stevecat@users.noreply.github.com>
2022-12-02 09:36:10 +00:00
Asger F
d2bbb61885 Ruby: update syntax for more models 2022-12-02 10:29:30 +01:00
AlexDenisov
7bf0e7ccc9 Merge pull request #11520 from github/redsun82/swift-xcode-integration-test
Swift: add xcode integration test
2022-12-02 10:29:16 +01:00
Jean Helie
3f203eabec Merge pull request #11486 from github/tiferet/boost-xss-through-dom
ATM: Boost XssThroughDOM
2022-12-02 10:26:53 +01:00
Chris Smowton
fae5a9a033 Merge pull request #11268 from grddev/accelerate-go-list-option
Enable accelerated go-extractor opt-in using 'go list -deps'
2022-12-02 09:17:23 +00:00
Alex Denisov
7a3beac494 Swift: resolve symlinks conditionally 2022-12-02 10:07:10 +01:00
Stephan Brandauer
e6c5975ed9 Merge pull request #11484 from erik-krogh/js-ml-cache
ATM: use the query compilation cache in the ATM qltest
2022-12-02 10:03:18 +01:00
Alex Denisov
e7a48b4c98 Swift: add a test case for symlinks 2022-12-02 10:02:45 +01:00
Asger F
2d578c1a73 Merge branch 'main' into merge-package-type-columns 2022-12-02 10:00:44 +01:00
Michael Nebel
73b171eb2b Update java/ql/src/utils/flowtestcasegenerator/GenerateFlowTestCase.qll
Co-authored-by: Tony Torralba <atorralba@users.noreply.github.com>
2022-12-02 09:47:28 +01:00
Michael Nebel
01307e1255 Update java/ql/src/utils/flowtestcasegenerator/FlowTestCase.qll
Co-authored-by: Tony Torralba <atorralba@users.noreply.github.com>
2022-12-02 09:47:14 +01:00
Michael Nebel
c145678323 Java: Address review comments. 2022-12-02 09:46:39 +01:00
Paolo Tranquilli
1b6a50147a Merge branch 'main' into redsun82/swift-type-mapping
Conflict resolved on addition of `AbiSafeConversionExpr`
2022-12-02 09:02:47 +01:00
Chris Smowton
1e01049966 Revert testing with experimental go list usage 2022-12-01 22:03:32 +00:00
Chris Smowton
60e326b160 Merge pull request #11530 from github/release-prep/2.11.5
Release preparation for version 2.11.5
2022-12-01 21:53:38 +00:00
Jami Cogswell
0e3e849ead add negative summary test for java 2022-12-01 15:49:12 -05:00
Jami Cogswell
aa633412f4 add change notes 2022-12-01 15:25:45 -05:00
Geoffrey White
f7ebd1312e Swift: Corrections. 2022-12-01 20:13:56 +00:00
Jami Cogswell
b789534b6c add csharp tests 2022-12-01 15:11:16 -05:00
github-actions[bot]
31ab22e3a0 Release preparation for version 2.11.5 2022-12-01 20:05:14 +00:00
Jean Helie
155c1463ce Merge branch 'main' into tiferet/boost-xss-through-dom 2022-12-01 20:59:20 +01:00
Rasmus Wriedt Larsen
8af2138ade Merge pull request #11518 from RasmusWL/fix-call-graph-meta-query
Python: Fix `py/meta/points-to-call-graph`
2022-12-01 20:40:24 +01:00
Jami Cogswell
f1ebaf1ae1 add csharp query 2022-12-01 13:56:13 -05:00
Geoffrey White
157a7829ca Swift: correct the example. 2022-12-01 18:35:10 +00:00
Geoffrey White
ad05cc3cb1 Swift: Separate out a FormatString library as well. 2022-12-01 18:09:46 +00:00
Geoffrey White
43596869e7 Swift: Move query logic to a .qll. 2022-12-01 18:09:45 +00:00
Geoffrey White
87fa159384 Swift: Add security-severity, and correct one for another query that apparently wasn't right. 2022-12-01 18:09:39 +00:00
Geoffrey White
58e9a0436e Swift: Add metadata. 2022-12-01 18:09:33 +00:00
Jean Helie
352d1a7e8c ATM: update tests 2022-12-01 19:01:30 +01:00
Jean Helie
98923cee94 ATM: update missing .qll 2022-12-01 18:47:36 +01:00
Felicity Chapman
6869ad48e4 Apply suggestions from code review
Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com>
2022-12-01 17:40:24 +00:00
Jean Helie
ae0d82efd8 ATM: update predicate name 2022-12-01 18:22:33 +01:00
Michael B. Gale
65021e6ed9 Add go.work file 2022-12-01 17:16:33 +00:00
Jean Helie
880548bafc Merge branch 'main' into tiferet/boost-xss-through-dom 2022-12-01 18:13:27 +01:00
Tony Torralba
6bb54f07bf Apply suggestions from code review
Co-authored-by: Ben Ahmady <32935794+subatoi@users.noreply.github.com>
2022-12-01 18:08:47 +01:00
Jami
f54480b7c8 change matches to equality
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
2022-12-01 11:56:44 -05:00
Rasmus Wriedt Larsen
315ceb57e9 Python: Add change-note 2022-12-01 11:56:44 -05:00
Jami Cogswell
548ff47f03 fix typo in QLDoc 2022-12-01 11:56:44 -05:00
Jami Cogswell
f7ae4e894f apply rasmus' approach 2022-12-01 11:56:44 -05:00
Jami Cogswell
1f4bd00993 split rsa/dsa/dh 2022-12-01 11:56:44 -05:00
Jami Cogswell
25f0a13e15 update python test cases 2022-12-01 11:56:44 -05:00
Jami Cogswell
c4dac31895 fix typo in import statement 2022-12-01 11:56:44 -05:00
Jami Cogswell
4d99cd1b7a update EC key size in help file 2022-12-01 11:56:44 -05:00
Jami Cogswell
0fa05d47e3 add shared key sizes 2022-12-01 11:56:44 -05:00
Jean Helie
50a3c0d725 ATM: update expected ML test values 2022-12-01 17:53:09 +01:00
Jean Helie
f388703a3d ATM: update further files following the addition of XssThroughDom query 2022-12-01 17:45:07 +01:00
Paolo Tranquilli
2976daa8eb Merge pull request #11524 from github/redsun82/swift-remove-dangling-ql-file
Swift: remove obsolete file
2022-12-01 17:32:59 +01:00
Geoffrey White
2b61f26a64 Swift: Add doc. 2022-12-01 16:32:34 +00:00
Geoffrey White
32c4728f83 Swift: Add tests. 2022-12-01 16:32:33 +00:00
Geoffrey White
a2210959b5 Swift: Uncontrolled format string query (initial version). 2022-12-01 16:32:33 +00:00
Paolo Tranquilli
c374a5301e Swift: upload test DBs as artifacts for integration tests 2022-12-01 17:30:25 +01:00
Paolo Tranquilli
cd6d00e760 Swift: add xcode integration test 2022-12-01 17:25:34 +01:00
Geoffrey White
a6b8ef310a Swift: Rename predicate. 2022-12-01 16:20:28 +00:00
AlexDenisov
35060659ee Merge pull request #11500 from github/alexdenisov/remove-patches-from-extractor
Swift: remove patches from the extractor
2022-12-01 17:17:36 +01:00
Paolo Tranquilli
68504c097c Swift: remove obsolete file 2022-12-01 17:07:54 +01:00
Gustav Munkby
b4382855fa Fallback to package dir for discovering go.mod
This reverts to the old behavior of reusing the package directory when looking for go.mod. It seems unlikely that this is the right thing to do since we failed to find the module directory, but this behavior should be consistent with what we had before.
2022-12-01 15:43:51 +01:00
erik-krogh
6289ae329b fix a race-condition 2022-12-01 15:27:41 +01:00
Geoffrey White
c6c4975aa6 Swift: codegen. 2022-12-01 14:23:12 +00:00
Geoffrey White
b7d0d28ef9 Swift: QLDoc. 2022-12-01 14:23:03 +00:00
Geoffrey White
d64fd62194 Swift: resolve TODOs. 2022-12-01 14:18:24 +00:00
Asger F
eb9bee23a0 JS: Remove MkAsyncFunctionResult 2022-12-01 15:15:27 +01:00
Rasmus Wriedt Larsen
d47b3265c4 Python: Fix py/meta/points-to-call-graph 2022-12-01 14:56:10 +01:00
Michael Nebel
cd0d09d806 Java: Refactor to avoid using SummaryModelCsv. 2022-12-01 13:07:31 +01:00
Ian Lynagh
ef8e52a4b0 Merge pull request #11437 from igfoo/igfoo/NonSerializableField
Kotlin: Enable java/non-serializable-field for Kotlin
2022-12-01 11:01:15 +00:00
Paolo Tranquilli
4ac9c875f1 Merge pull request #11508 from github/redsun82/swift-frontend-invocations
Swift: add `-merge-modules` to `frontend-invocations` test
2022-12-01 11:26:58 +01:00
Rasmus Wriedt Larsen
e7264fb495 Merge pull request #11480 from RasmusWL/sink-meta-query
Python: Add taint-sinks meta query
2022-12-01 10:23:33 +01:00
Geoffrey White
8acc09b551 Swift: Make ql-for-ql happy. 2022-12-01 09:07:17 +00:00
Geoffrey White
1ea44374a4 Swift: Autoformat. 2022-12-01 08:47:30 +00:00
Geoffrey White
c71bd4cad9 Swift: Remove unused predicate. 2022-12-01 08:47:29 +00:00
Geoffrey White
0a0cfc34e7 Swift: Do the same for methods. 2022-12-01 08:47:29 +00:00
Geoffrey White
5a4d188255 Swift: Fix for extensions. 2022-12-01 08:47:29 +00:00
Geoffrey White
d71eeb4c95 Swift: First fix for MaD on generics. 2022-12-01 08:47:29 +00:00
Geoffrey White
8f24b0b815 Swift: Add missing comment. 2022-12-01 08:47:28 +00:00
Geoffrey White
b1b3487028 Swift: Add a test for MaD data sources in generics. 2022-12-01 08:47:28 +00:00
Felicity Chapman
38b8cf4fd4 Update docs/codeql/codeql-language-guides/basic-query-for-java-code.rst
Co-authored-by: Tony Torralba <atorralba@users.noreply.github.com>
2022-12-01 08:44:40 +00:00
Jeroen Ketema
3dfe18b565 C++: Introduce the coarse upper bound check from default taint tracking 2022-12-01 09:13:48 +01:00
Tiferet Gazit
7c1bfdbf41 Merge pull request #11511 from github/tiferet/renamings
Rename predicates to fit style guide
2022-11-30 18:19:07 -08:00
tiferet
4a6de3e444 Apply suggestion from code review 2022-11-30 17:25:19 -08:00
Harry Maclean
bd129ede42 Merge pull request #11136 from hmac/json-flow-summaries
Ruby: JSON flow summaries
2022-12-01 14:19:47 +13:00
tiferet
a0a742eb82 Rename predicates to fit style guide:
- `getEndpoints` → `appliesToEndpoint`
- `getImplications` → `hasImplications`
- `getAlerts` → `hasAlert`
2022-11-30 17:01:56 -08:00
Jami Cogswell
94c5d53192 add a couple more tests 2022-11-30 18:51:05 -05:00
Jami Cogswell
22c4d975ad remove old import 2022-11-30 18:07:45 -05:00
Jami Cogswell
7f45e320d8 add tests 2022-11-30 18:07:45 -05:00
Jami Cogswell
210d8529b6 add query for SupportedExternalApis 2022-11-30 18:07:45 -05:00
Harry Maclean
91421528df Ruby: Update test 2022-12-01 09:01:03 +13:00
Ed Minnix
04829fc38e Java: SQLInjection example for addJavaScriptInterface query 2022-11-30 13:32:28 -05:00
Ian Lynagh
cd8c40e063 Kotlin: Enable java/non-serializable-field for Kotlin
It now ignores compiler-generated classes
2022-11-30 17:58:43 +00:00
Paolo Tranquilli
4e29ff1d6e Swift: add -merge-modules to frontend-invocations test
Also, moved from Makefile to a bash source.
2022-11-30 17:46:47 +01:00
Ed Minnix
d35321f40e Java: change WebView addJavascriptInterface query precision to medium 2022-11-30 11:35:14 -05:00
Tony Torralba
6ae10c5171 Merge pull request #11501 from atorralba/atorralba/swift/fix-data-test-expectations
Swift: Fix expectations in data.swift
2022-11-30 17:12:32 +01:00
Ed Minnix
e31521bd14 Java: mention the default negative value for setJavaScriptEnabled 2022-11-30 10:56:17 -05:00
Felicity Chapman
86e2333e67 Fix typo and try improving formatting 2022-11-30 15:53:19 +00:00
Edward Minnix III
b189e5b365 Java: fix precision in setJavascriptEnabled query
Co-authored-by: Tony Torralba <atorralba@users.noreply.github.com>
2022-11-30 10:45:31 -05:00
Ed Minnix
5ac1e012ae Java: Mention AssetLoader in WebView file access query documentation 2022-11-30 10:43:53 -05:00
Ed Minnix
c836c4feb7 Java: Specify default value in WebView file access query 2022-11-30 10:43:05 -05:00
Edward Minnix III
710e012e09 Java: fix precision of Android WebView File access query
Co-authored-by: Tony Torralba <atorralba@users.noreply.github.com>
2022-11-30 10:41:45 -05:00
Felicity Chapman
3e1d49ad80 First draft update tutorials 2022-11-30 15:38:58 +00:00
Tony Torralba
d958a62bf2 Fix expectations in data.swift 2022-11-30 16:19:55 +01:00
Karim Ali
8f456295e0 Merge pull request #11185 from karimhamdanali/swift-string-taint-steps
Swift: add `String` taint steps
2022-11-30 17:03:15 +02:00
erik-krogh
cddc9db690 change back to the old order of extracting externs before Xml 2022-11-30 15:46:46 +01:00
Alex Denisov
0bfe502bb0 Swift: remove patches from the extractor
Moved elsewhere https://github.com/dsp-testing/codeql-swift-artifacts/pull/3
2022-11-30 15:36:09 +01:00
Karim Ali
f6bc88471a update the expected output for CWE-079
Now that we have support for taint through fields of String, we can now detect certain flows that we previously marked as [NOT DETECTED]. This commit updates the expected output of CWE-079 (and the in-code annotation of the accompanying test case) to reflect that update.
2022-11-30 16:34:24 +02:00
erik-krogh
6620ba8cc8 Merge branch 'main' into exit-code 2022-11-30 15:26:31 +01:00
Paolo Tranquilli
b8c11de89c Merge pull request #11498 from github/redsun82/swift-codegen
Swift: enhance `codegen` UX
2022-11-30 15:17:18 +01:00
Owen Mansel-Chan
45e2a13c37 Merge pull request #11494 from owen-mc/dataflow/some-trivial-fixes
Dataflow: some trivial fixes
2022-11-30 13:59:41 +00:00
Anders Schack-Mulligen
1ce28540fb Merge pull request #11495 from intrigus-lgtm/patch-7
Docs: Add missing `language[monotonicAggregates]` annotation
2022-11-30 14:58:44 +01:00
Paolo Tranquilli
b4e3554af7 Merge pull request #11370 from github/alexdenisov/swift-5.7.1
Swift: upgrade to Swift 5.7.1
2022-11-30 14:23:12 +01:00
Paolo Tranquilli
bb3aa9e908 Swift: add --force to codegen 2022-11-30 14:19:33 +01:00
Alex Ford
7de5113e67 Ruby: rails/globalid changenote 2022-11-30 13:01:27 +00:00
Alex Ford
e321657f59 Ruby: model rails/globalid 2022-11-30 12:50:26 +00:00
Paolo Tranquilli
d6aad13a98 Swift: make codegen run when no registry is there 2022-11-30 13:47:12 +01:00
Paolo Tranquilli
76db5f22b3 Swift: make codegen resilient to formatting errors
More in general, the managed renderer flow does things more sensibly
in case an exception is thrown:
* it will not remove any file
* it will drop already written files from the registry, so that codegen
  won't be skipped for those files during the next run
2022-11-30 13:43:29 +01:00
Tom Hvitved
b33f5925bb Data flow: Sync files 2022-11-30 13:39:25 +01:00
Tom Hvitved
e0bd210797 Ruby: At most one hash-splat ParameterNode per callable 2022-11-30 13:38:55 +01:00
Felicity Chapman
9eafee365f Some updates missed in earlier PRs 2022-11-30 12:30:28 +00:00
Tony Torralba
e222807693 Remove dubious sinks 2022-11-30 13:25:17 +01:00
intrigus-lgtm
4e7e70f981 Docs: Add missing language[monotonicAggregates] annotation
This adds the `language[monotonicAggregates]` annotation so that the example compiles.
2022-11-30 13:12:06 +01:00
Alex Denisov
fe0ae6bf0b Swift: add 5.7.1 migration scripts 2022-11-30 12:52:26 +01:00
Alex Denisov
ad663533c7 Swift: bump setup Swift action 2022-11-30 12:40:42 +01:00
Alex Denisov
67fb56deb8 Swift: workaround an internal crash coming from Swift 5.7.1 2022-11-30 12:40:42 +01:00
Alex Denisov
f618d53302 Swift: add new implicit conversion 2022-11-30 12:40:34 +01:00
Alex Denisov
90d471b486 Swift: upgrade to Swift 5.7.1 2022-11-30 12:40:27 +01:00
Felicity Chapman
6dee013baa Merge branch 'rc/3.8' into felicitymay-8441-basic-query-2 2022-11-30 11:39:20 +00:00
Mathias Vorreiter Pedersen
d53d275bba Merge pull request #11450 from d10c/swift/missing-enum-cases
Swift: extract missing cases of `AccessorKind` and `AccessSemantics` enums
2022-11-30 11:18:52 +00:00
Owen Mansel-Chan
75940dc8b1 Remove @codeql-go from code owners for dataflow 2022-11-30 11:16:53 +00:00
Owen Mansel-Chan
635c202ced Use ArgumentPosition instead of int
This matches what all of the other languages do.
2022-11-30 11:16:52 +00:00
Arthur Baars
6103c577b6 Address comments 2022-11-30 12:02:42 +01:00
Owen Mansel-Chan
55c4643b20 Dataflow: Sync. 2022-11-30 11:00:07 +00:00
Arthur Baars
cbf4197575 Ruby: add change note 2022-11-30 11:57:35 +01:00
Arthur Baars
0f2cb440b0 Ruby: add flow summary for Enumerable#sole 2022-11-30 11:57:35 +01:00
Arthur Baars
5517cfa6c0 Ruby: add flow summary for Enumerable#pluck 2022-11-30 11:57:35 +01:00
Arthur Baars
207ba86d51 Ruby: add flow summary for Enumerable#pick 2022-11-30 11:57:29 +01:00
Anders Schack-Mulligen
3d04b267ef Merge pull request #11492 from aschackmull/shared/util
Shared: Add Util qlpack.
2022-11-30 11:56:34 +01:00
Paolo Tranquilli
2f4cf592a7 Merge pull request #11490 from github/redsun82/cache
CI: add workaround for nested composite actions issue
2022-11-30 11:55:46 +01:00
Owen Mansel-Chan
ce8a20cfd1 Fix variable name (source should be sink) 2022-11-30 10:51:59 +00:00
Anders Schack-Mulligen
758cb8b412 Shared: Fix trailing and non-ascii whitespace. 2022-11-30 11:14:43 +01:00
Tony Torralba
56f5214782 Remove invalid MaD row 2022-11-30 11:10:30 +01:00
Anders Schack-Mulligen
0963b6f221 Java: Replace ad-hoc scc reduction with union-find. 2022-11-30 11:09:25 +01:00
Owen Mansel-Chan
ab276fc5d8 Merge pull request #11481 from owen-mc/dataflow/sync-go-libraries-2
Sync go libraries
2022-11-30 10:02:43 +00:00
Tom Hvitved
bfbe5bdfb8 Ruby: Add data flow test that illustrates spurious flow 2022-11-30 11:01:32 +01:00
Anders Schack-Mulligen
ba56565125 Update shared/util/codeql/util/Option.qll
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2022-11-30 10:55:07 +01:00
Paolo Tranquilli
e12e86b520 Restore previous cache key
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2022-11-30 10:47:29 +01:00
Paolo Tranquilli
d165c4963d CI: add workaround for nested composite actions issue
Because of https://github.com/actions/runner/issues/2009 the deeply
nested action cache was failing to save the cache in the post run phase.

For the moment we just avoid the nesting with a copy-pasted action
snippet.
2022-11-30 10:47:29 +01:00
Paolo Tranquilli
22eb619235 Merge pull request #11467 from erik-krogh/test-ci
CI: fix moving the compilation cache
2022-11-30 10:47:07 +01:00
Anders Schack-Mulligen
71f5c8aa88 Shared: Add Util qlpack. 2022-11-30 10:43:33 +01:00
erik-krogh
045e6ef148 remove unused environment variable 2022-11-30 09:59:20 +01:00
erik-krogh
3d0c9c4642 Merge branch 'main' into test-ci 2022-11-30 09:47:08 +01:00
Tony Torralba
594b7efb84 Merge pull request #11485 from github/workflow/coverage/update
Update CSV framework coverage reports
2022-11-30 09:16:05 +01:00
Paolo Tranquilli
da5730706d Merge pull request #11483 from github/redsun82/cache
Swift: tentative fix for the bazel cache
2022-11-30 08:25:39 +01:00
tiferet
b885249d9d Add a boosted version of XssThroughDOM 2022-11-29 17:40:20 -08:00
Tiferet Gazit
e2e3667698 Merge pull request #11323 from github/tiferet/simplify-configs
ATM: Simplify query configurations
2022-11-29 17:39:11 -08:00
Harry Maclean
dab7970087 Ruby: Model JSON.pretty_generate 2022-11-30 13:18:45 +13:00
Harry Maclean
14a19d23a6 Ruby: Fix typo in documentation
This import isn't needed.
2022-11-30 13:18:45 +13:00
Harry Maclean
67257671ea Ruby: Remove redundant dataflow test 2022-11-30 13:18:44 +13:00
Harry Maclean
d20d1e5e75 Ruby: Add change note 2022-11-30 13:18:44 +13:00
github-actions[bot]
13f4a0e284 Add changed framework coverage reports 2022-11-30 00:18:26 +00:00
Harry Maclean
35a62018e4 Ruby: US spelling 2022-11-30 13:17:46 +13:00
Harry Maclean
1bd2dd0a6e Ruby: update test fixture 2022-11-30 13:17:46 +13:00
Harry Maclean
eff763d127 Ruby: Model to_json ActiveSupport extension 2022-11-30 13:17:44 +13:00
Harry Maclean
5259d4af63 Ruby: Model various JSON methods 2022-11-30 13:15:18 +13:00
Harry Maclean
0a98559fcb Ruby: Add flow summaries for ActiveSupport::JSON 2022-11-30 13:15:16 +13:00
porcupineyhairs
346dd864b5 Update python/ql/lib/change-notes/2022-11-17-py-pam-improve.md
fix typo

Co-authored-by: intrigus-lgtm <60750685+intrigus-lgtm@users.noreply.github.com>
2022-11-30 05:21:11 +05:30
tiferet
c5184d37e7 Suggestion from code review:
Name the query configuration e.g. `NosqlInjectionATMConfig` rather than `Configuration`.
2022-11-29 15:46:05 -08:00
Harry Maclean
e3def7c22f Ruby: Add change note 2022-11-30 11:50:47 +13:00
Harry Maclean
aed4325ee3 Ruby: Remove unused class 2022-11-30 11:50:35 +13:00
Harry Maclean
b66ea6ed72 Ruby: Simplify ActionMailbox modeling 2022-11-30 11:46:21 +13:00
Harry Maclean
71f2d8f6d8 Ruby: Model ActionMailbox#inbound_mail 2022-11-30 11:46:21 +13:00
Harry Maclean
eac5aa26ee Ruby: Model remote input for ActionMailbox 2022-11-30 11:46:21 +13:00
Harry Maclean
375403fb9d Merge pull request #11114 from hmac/case-barrier-guard-3
Ruby: Add case string comparison barrier guard
2022-11-30 11:21:07 +13:00
erik-krogh
0eae638a93 combine into one job, and run on an XL runner 2022-11-29 22:34:31 +01:00
erik-krogh
84ce23249f use the query compilation cache in the ATM qltest 2022-11-29 22:23:23 +01:00
tiferet
6f807e9d43 Doc suggestion from code review 2022-11-29 13:20:47 -08:00
tiferet
75cd7a9ebc Remove code duplication in query .ql files:
Define the query for finding ATM alerts in the base class `AtmConfig`, and call it from each query's .ql file.
2022-11-29 13:20:47 -08:00
tiferet
a710b723d1 Move the definition of isSink to the base class:
Holds if `sink` is a known taint sink or an "effective" sink.
2022-11-29 13:20:47 -08:00
tiferet
cd24ec88d6 Move the definition of isSource to the base class:
A long as we're not boosting sources, `isSource` is identical to `isKnownSource`.
2022-11-29 13:20:47 -08:00
tiferet
50291c7b7c AtmConfig inherits from TaintTracking::Configuration.
That way the specific configs which inherit from `AtmConfig` also inherit from `TaintTracking::Configuration`.

This removes the need for two separate config classes for each query.
2022-11-29 13:20:47 -08:00
tiferet
05a943c9b5 Delete StandardEndpointFilters.
All remaining functionality in `StandardEndpointFilters` is only being used in `EndpointCharacteristics`, so it can be moved there as a small set of helper predicates.
2022-11-29 13:20:47 -08:00
tiferet
5402f047bf Delete CoreKnowledge.
All remaining functionality in `CoreKnowledge` is only being used in `EndpointCharacteristics`, so it can be moved there as a small set of helper predicates.
2022-11-29 13:20:47 -08:00
Tiferet Gazit
2241252202 Merge pull request #11321 from github/tiferet/complexity-reduction
ATM: Remove redundant code
2022-11-29 13:17:55 -08:00
tiferet
1d4b2ccab4 Merge branch 'main' into tiferet/complexity-reduction 2022-11-29 12:47:18 -08:00
Tiferet Gazit
f375b0cc1b Merge pull request #11281 from github/tiferet/endpoint-filters
ATM: Implement the current endpoint filters as EndpointCharacteristics
2022-11-29 12:38:12 -08:00
erik-krogh
de5ffd5cfa bump extractor version 2022-11-29 21:32:43 +01:00
Erik Krogh Kristensen
d0cf709d2e use proper path construction
Co-authored-by: Asger F <asgerf@github.com>
2022-11-29 21:30:50 +01:00
Nora Dimitrijević
91edeacb9f Swift: update .expected test files 2022-11-29 19:39:48 +01:00
Ian Lynagh
7eaef0cd3d Merge pull request #11436 from igfoo/igfoo/NamingConventionsRefTypes
Kotlin: Enable java/misnamed-type query
2022-11-29 18:39:18 +00:00
Chris Smowton
b471926030 Autoformat 2022-11-29 17:17:39 +00:00
Paolo Tranquilli
47702b9e14 Swift: tentative fix for the bazel cache 2022-11-29 18:16:33 +01:00
Owen Mansel-Chan
083a3bae6e Correct headings in identical-files.json 2022-11-29 16:15:01 +00:00
Owen Mansel-Chan
5c5ec8f66a Add go files to identical-files.json 2022-11-29 16:15:01 +00:00
Owen Mansel-Chan
1731d39119 Remove sync-dataflow-libraries from go makefile 2022-11-29 16:15:01 +00:00
Owen Mansel-Chan
818f02826c Update shared library files for go to f3dca95 2022-11-29 16:15:01 +00:00
Owen Mansel-Chan
d9f8420c86 Update shared library files for go to PR #11183
Merge commit: 94bca43
2022-11-29 16:15:00 +00:00
Owen Mansel-Chan
b63d0892ab Update shared library files for go to PR #10777
Merge commit: 9c6875e
2022-11-29 16:15:00 +00:00
Owen Mansel-Chan
309ab772da Update shared library files for go to PR #10886
Merge commit: 99ca28e
2022-11-29 16:15:00 +00:00
Owen Mansel-Chan
804d131d3b Update shared library files for go to PR #11060
Merge commit: 587e673
2022-11-29 16:14:59 +00:00
Owen Mansel-Chan
40eb422524 Update shared library files for go to PR #10814
Merge commit: 6ef5fac
2022-11-29 16:14:58 +00:00
Owen Mansel-Chan
3006551eb1 Update shared library files for go to PR #10806
Merge commit: d79a7e8
2022-11-29 16:14:58 +00:00
Owen Mansel-Chan
5c7f7328ff Update shared library files for go to PR #10754
Merge commit: d6df69d
2022-11-29 16:14:58 +00:00
Owen Mansel-Chan
c19ab7bc85 Update shared library files for go to PR #10744
Merge commit: 60fe370
2022-11-29 16:14:57 +00:00
Owen Mansel-Chan
8957437a4c Update shared library files for go to PR #10691
Merge commit: 0e6735b
2022-11-29 16:14:57 +00:00
Owen Mansel-Chan
d63f161f06 Update shared library files for go to PR #10577
Merge commit: df2b586
2022-11-29 16:14:57 +00:00
Owen Mansel-Chan
c9aef4ac9f Update shared library files for go to PR #10575
Merge commit: 9f1bbf2
2022-11-29 16:14:56 +00:00
Owen Mansel-Chan
6ccfb4b4ba Update shared library files for go to PR #10505
Merge commit: 8b424d1
2022-11-29 16:14:56 +00:00
Owen Mansel-Chan
628230f14c Update shared library files for go to PR #10360
Merge commit: 569fad6
2022-11-29 16:14:55 +00:00
Owen Mansel-Chan
569da2da60 Update shared library files for go to PR #10127
Merge commit: e265b07
2022-11-29 16:14:55 +00:00
Owen Mansel-Chan
c2b64d4545 Update shared library files for go to PR #9867
Merge commit: c514c88
2022-11-29 16:14:54 +00:00
Owen Mansel-Chan
f05da69392 Update shared library files for go to PR #10007
Merge commit: a3fb54c
2022-11-29 16:14:54 +00:00
Owen Mansel-Chan
ae408290dd Update shared library files for go to PR #9823
Merge commit: aa36556
2022-11-29 16:14:54 +00:00
Owen Mansel-Chan
20b9c60d58 Remove DataFlowImplConsistency.qll from makefile 2022-11-29 16:14:53 +00:00
Paolo Tranquilli
c779b8f711 Merge pull request #11479 from erik-krogh/swift-ignore-errors
Swift: don't crash on non-existing cache
2022-11-29 17:04:11 +01:00
Felicity Chapman
0d7b27d4e4 A few fixes 2022-11-29 15:52:29 +00:00
Felicity Chapman
1142b77f8d Update articles for other languages 2022-11-29 15:09:15 +00:00
Nora Dimitrijević
c5b4e87f6d Swift: AccessorDecl tests for new cases 2022-11-29 16:00:00 +01:00
Nora Dimitrijević
e8fe0b0213 Merge pull request #11473 from github/d10c-preparedbupgrade-md
Update docs/prepare-db-upgrade.md
2022-11-29 15:27:58 +01:00
Rasmus Wriedt Larsen
607639c100 Python: restrict py/meta/points-to-call-graph to non-ignored files 2022-11-29 15:10:45 +01:00
Rasmus Wriedt Larsen
d7aea228ce Python: Add taint-sinks meta query
Inspired by the one they have in JS:
097d5189e9/javascript/ql/src/meta/alerts/TaintSinks.ql
2022-11-29 15:10:09 +01:00
erik-krogh
e5f1fe86e4 don't crash on non-existing cache in swift 2022-11-29 15:02:08 +01:00
Rasmus Wriedt Larsen
544de5232c Python: Use ' instead of ` in select text 2022-11-29 14:47:45 +01:00
Tom Hvitved
86e045916d Ruby: Rework call-context sensitivity logic 2022-11-29 14:47:37 +01:00
Karim Ali
9048d5d79b fix expected output for LocalTaint 2022-11-29 15:38:44 +02:00
Tom Hvitved
5bcb9b285a Merge pull request #11142 from JarLob/const
C#: Extend `Constant Condition` query with `String.IsNullOrEmpty`.
2022-11-29 14:32:48 +01:00
Paolo Tranquilli
d7313082c9 Merge pull request #11466 from github/redsun82/cache
Swift: optimize bazel caching in CI
2022-11-29 14:31:16 +01:00
Karim Ali
9d17fae00c fix expected output for TaintInline 2022-11-29 15:24:12 +02:00
Karim Ali
c0085cbb1a fix expected output for Taint.ql 2022-11-29 15:18:39 +02:00
erik-krogh
63a5f8965e fix tests 2022-11-29 14:08:21 +01:00
Ian Lynagh
3b31b50983 Kotlin: Rename compilerGeneratedKind to compilerGeneratedKindOverride 2022-11-29 13:07:47 +00:00
Arthur Baars
442c4e9a4e Merge pull request #11474 from github/aibaars-patch-2
Ruby: fix upgrade script
2022-11-29 13:45:06 +01:00
Tom Hvitved
b075c55a60 Merge pull request #11449 from hvitved/csharp/autobuild-env-vars-integration-test
C#: Add integration test that checks whether env vars are passed through autobuilder
2022-11-29 13:43:15 +01:00
erik-krogh
136b6db2ad only delete the src/ folder if it was empty 2022-11-29 13:42:27 +01:00
erik-krogh
f3f7a89ef8 make the JS autobuilder consistent with Ruby when no JS code was detected 2022-11-29 13:42:27 +01:00
Felicity Chapman
0def31a2ce Update Go article 2022-11-29 12:37:10 +00:00
Tony Torralba
bf023b0aed Use dominance in path injection sanitizer to avoid FNs 2022-11-29 13:33:27 +01:00
Arthur Baars
52cf27653f Ruby: fix upgrade script 2022-11-29 13:12:14 +01:00
Paolo Tranquilli
a3a68fe83d Tweak comment in incremental-cache action 2022-11-29 13:09:45 +01:00
Michael Nebel
d2c458c066 Java/C#: Correction of autogenerated comment(s) produced by the model generator. 2022-11-29 13:05:18 +01:00
Arthur Baars
cf7ebe2fa8 Merge pull request #11471 from github/rc/3.8
Merge rc/3.8 into main
2022-11-29 12:57:34 +01:00
Michael Nebel
984124b3b5 Java: Improve flow test case generator to emit a data extensions YAML file and qlpack file if needed. 2022-11-29 12:54:54 +01:00
Michael Nebel
48290c95a7 Java: Update the flow test case generator to emit data extension like model data. 2022-11-29 12:54:54 +01:00
Michael Nebel
9507dc15fd Java: Remove un-needed qlfrag files. 2022-11-29 12:54:54 +01:00
Felicity Chapman
c66569bd43 Generalize cpp changes and apply to csharp 2022-11-29 11:50:26 +00:00
erik-krogh
7dcb813ff3 remove two more claseses of FPs in rb/non-constant-kernel-open 2022-11-29 12:49:23 +01:00
Michael Nebel
bc6f0c1622 Merge pull request #11243 from michaelnebel/java/dataextensions
Java: Use data extensions for MaD models.
2022-11-29 12:43:26 +01:00
Nora Dimitrijević
1ee04dc020 Update prepare-db-upgrade.md
Clarify the test steps based on my experience, where I got a "database may be too new" error when the `--search-path=<codeql-root>` directory was not specified.
2022-11-29 12:36:51 +01:00
erik-krogh
cd770e0906 Merge branch 'main' into test-ci 2022-11-29 12:17:05 +01:00
erik-krogh
7c1435b7c6 use withFileTypes in move-caches.js some more 2022-11-29 12:16:38 +01:00
Erik Krogh Kristensen
3cb31ef030 use withFileTypes in move-caches.js
Co-authored-by: Arthur Baars <aibaars@github.com>
2022-11-29 12:10:00 +01:00
Geoffrey White
3304e9f422 Merge pull request #11459 from geoffw0/constructor
Swift: Constructor and destructor related cleanup
2022-11-29 11:00:22 +00:00
Tony Torralba
52ebf66d21 Add basic path sanitizer 2022-11-29 11:55:04 +01:00
Tony Torralba
1576ee9410 Add additional stub to avoid errors when building on Linux 2022-11-29 11:55:03 +01:00
Tony Torralba
8cc66172c3 Add path injection query 2022-11-29 11:55:03 +01:00
Paolo Tranquilli
52a117aaf5 Swift: optimize bazel caching in CI
Previously the cache would become stale. Now the same incremental
cache mechanism in use for the QL cache is adopted (and factored out
in a separate action).

Namely, pushes on main will populate the cache using the commit hash as
key, while PRs will try to use the cache of their merge base, read-only.

To avoid the cache growing out of control, a simple cache eviction is
done on pushes.
2022-11-29 11:43:54 +01:00
Geoffrey White
63c139fdbe Merge branch 'main' into constructor 2022-11-29 10:40:19 +00:00
AlexDenisov
0f87eb45db Merge pull request #11470 from github/redsun82/swift-fix-ci
Swift: revert `swift-actions/setup-swift`
2022-11-29 11:39:08 +01:00
Nora Dimitrijević
93cce0f4c2 Swift: upgrade script 2022-11-29 11:31:08 +01:00
Nora Dimitrijević
13bbee73d8 Swift: Add .generated.list file from codegen 2022-11-29 11:31:07 +01:00
Nora Dimitrijević
931173350f Swift: extract missing cases of AccessorKind and AccessSemantics
This resolves the warnings that were showing up during extractor-pack
compilation.
2022-11-29 11:31:07 +01:00
Nora Dimitrijević
36e7235493 Swift: fix -Wmissing-braces warning in extractor
By initializing va_list the standard way,
i.e. leaving it uninitialized until va_start().
2022-11-29 11:31:07 +01:00
Nora Dimitrijević
c89c449a2c Swift: silence cmake/vscode intellisense Problem
i.e. "TrapLabel not found"
2022-11-29 11:27:33 +01:00
Jeroen Ketema
d3cccca7f1 C++: Filter duplicate (source, sink)-pairs 2022-11-29 11:17:39 +01:00
Paolo Tranquilli
9a25de3ef1 Swift: revert swift-actions/setup-swift 2022-11-29 11:17:08 +01:00
Jeroen Ketema
378206ae7d C++: Stop taint from flowing to arithmetic types
These are not likely to give the user much control over what can be accessed.
2022-11-29 11:15:28 +01:00
Karim Ali
f0d9dabca2 updated expected output for LocalTaint and Tain 2022-11-29 12:13:10 +02:00
Karim Ali
9b3c4e8db2 add test case for unicodeScalars 2022-11-29 12:12:10 +02:00
Karim Ali
7541b01a86 add test case for utf8CString 2022-11-29 12:12:10 +02:00
Karim Ali
58a87396ba add taint steps for fields of String
if a String is tainted, then all its fields (including those declared in extensions) should be tainted as well
2022-11-29 12:12:10 +02:00
Mathias Vorreiter Pedersen
4233c91a7e Merge pull request #11469 from atorralba/atorralba/swift/fix-local-taint
Swift: Fix local taint
2022-11-29 10:00:12 +00:00
Jeroen Ketema
718663415b C++: Stop flow from going through another source
Without this we get confusing results:
```
    char *userAndFile = argv[2];
    char *fileName = argv[1];
    fopen(fileName, "wb+"); // Both argv[1] and argv[2] marked as source without
                            // this change.
```

While here add some more test cases.
2022-11-29 10:52:57 +01:00
Jeroen Ketema
63334764d7 C++: Rewrite cpp/path-injection to not use DefaultTaintTracking 2022-11-29 10:52:57 +01:00
erik-krogh
915d680fcc use a node script instead of bash to move the compilation cache 2022-11-29 10:41:08 +01:00
erik-krogh
67e9841bf3 place the compilation cache in the temp dir 2022-11-29 10:40:54 +01:00
Tony Torralba
0e59257442 Fix local taint steps
Local taint should include local flow and simple summaries through library code
2022-11-29 10:36:56 +01:00
Tom Hvitved
f3dca95958 Merge pull request #11087 from hvitved/dataflow/summary-ctx
Data flow: Add summary/return context to pruning stages 2-4
2022-11-29 10:36:53 +01:00
Geoffrey White
c3dc9672f7 Merge branch 'main' into constructor 2022-11-29 09:30:03 +00:00
Geoffrey White
e0c8a8ecff Merge pull request #11458 from geoffw0/simplify
Swift: Simplify some QL.
2022-11-29 09:29:12 +00:00
Felicity Chapman
5898615f5a Merge pull request #11420 from github/felicitymay-8441-query-guides-java
LGTM deprecation: updates to CodeQL for Java articles
2022-11-29 09:23:21 +00:00
Peter Stöckli
6b1865d2ca Merge branch 'main' into p--ruby-kernel-open-addition 2022-11-29 10:19:36 +01:00
Felicity Chapman
1dc6640bc1 Remove superfluous content
(cherry picked from commit 5d03892943)
2022-11-29 09:19:21 +00:00
Felicity Chapman
229c3e6e8f Update for James' review comments
(cherry picked from commit 174fbf672f)
2022-11-29 09:19:21 +00:00
Felicity Chapman
97db2c91f1 First draft update basic query to use VS Code
(cherry picked from commit 3e0702f904)
2022-11-29 09:19:21 +00:00
Peter Stöckli
deb3accd1e make predicate private 2022-11-29 10:07:13 +01:00
Felicity Chapman
9780990836 Merge pull request #11433 from github/8441-general-changes
LGTM deprecation: miscellaneous changes
2022-11-29 09:06:31 +00:00
Felicity Chapman
434c5ea188 Merge pull request #11422 from github/felicitymay-8441-query-guides-python
LGTM deprecation: updates to CodeQL for Python articles
2022-11-29 09:04:48 +00:00
Felicity Chapman
114d337210 Merge pull request #11421 from github/felicitymay-8441-query-guides-c
LGTM deprecation: updates to CodeQL for C/C++ articles
2022-11-29 09:04:31 +00:00
Felicity Chapman
0624324962 Merge branch 'rc/3.8' into felicitymay-8441-query-guides-java 2022-11-29 09:03:32 +00:00
Peter Stöckli
5b6dd786c3 Add changes for NonConstantKernelOpenQuery 2022-11-29 10:00:57 +01:00
Peter Stöckli
88282ade1a Add predicate to filter out calls to File in opal 2022-11-29 10:00:57 +01:00
Peter Stöckli
315480824b Fix KernelOpen qhelp 2022-11-29 10:00:57 +01:00
Peter Stöckli
d8752a0b12 Add additional sinks to the rb/kernel-open query 2022-11-29 10:00:56 +01:00
Erik Krogh Kristensen
0cd50aac40 Merge pull request #11398 from erik-krogh/splat-stuff
Rb: add some more flow through splat parameters
2022-11-28 22:31:25 +01:00
Erik Krogh Kristensen
ae40b0aba2 Merge pull request #11419 from github/felicitymay-8441-query-guides-javascript
LGTM deprecation: updates to CodeQL for JavaScript articles
2022-11-28 21:57:37 +01:00
tiferet
4580b55673 Oops -- forgot to stage one file in the previous commit :) 2022-11-28 11:34:34 -08:00
tiferet
210644e87d Delete StandardEndpointFilters.
All remaining functionality in `StandardEndpointFilters` is only being used in `EndpointCharacteristics`, so it can be moved there as a small set of helper predicates.
2022-11-28 11:34:34 -08:00
tiferet
15121931b4 Delete CoreKnowledge.
All remaining functionality in `CoreKnowledge` is only being used in `EndpointCharacteristics`, so it can be moved there as a small set of helper predicates.
2022-11-28 11:34:34 -08:00
tiferet
1c679378e7 FilteringReason is no longer being used and can be deleted 2022-11-28 11:34:33 -08:00
tiferet
99de397a5f Remove redundant code
`isOtherModeledArgument` and `isArgumentToBuiltinFunction` contained the old logic for selecting negative endpoints for training.

These can now be deleted, and replaced by a single base class that collects all EndpointCharacteristics that are currently used to indicate negative training samples: `OtherModeledArgumentCharacteristic`.

This in turn lets us delete code from `StandardEndpointFilters` that effectively said that endpoints that are high-confidence non-sinks shouldn't be scored at inference time, either.
2022-11-28 11:34:33 -08:00
tiferet
7b0269c999 Fix British spelling that code scanning didn't like.
I've been working with Brits for too long :)
2022-11-28 11:28:08 -08:00
Tiferet Gazit
72c46c662c Merge pull request #11462 from github/tiferet/endpoint-filters-sidebar
Endpoint filters added commits
2022-11-28 11:18:53 -08:00
tiferet
963407de4c Update the documentation 2022-11-28 11:16:06 -08:00
Geoffrey White
cf7cd2b470 Swift: Convert to MaD. 2022-11-28 19:02:56 +00:00
Gustav Munkby
545ad0179b Merge remote-tracking branch 'origin/main' into accelerate-go-list-option 2022-11-28 19:27:52 +01:00
Geoffrey White
03ae2821c3 Update swift/ql/lib/codeql/swift/frameworks/Alamofire/Alamofire.qll
Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
2022-11-28 18:24:28 +00:00
Geoffrey White
349a10c013 Swift: codegen. 2022-11-28 17:41:41 +00:00
Geoffrey White
96e04e7f63 Swift: Use ConstructorDecl in place of name matching. 2022-11-28 17:39:45 +00:00
Geoffrey White
e97aee5d9d Swift: QLDoc. 2022-11-28 17:39:44 +00:00
Geoffrey White
410609fed4 Swift: Make ConstructorDecl, DestructorDecl into MethodDecls. 2022-11-28 17:20:43 +00:00
Geoffrey White
edb6325117 Swift: Fix comment. 2022-11-28 17:07:34 +00:00
Geoffrey White
aa5c893d5e Swift: Further simplify. 2022-11-28 17:07:34 +00:00
Geoffrey White
97bd91ed19 Swift: Simplify using ApplyExpr.getArgumentWithLabel. 2022-11-28 16:51:46 +00:00
Paolo Tranquilli
28bf0c9e03 Merge pull request #11365 from github/redsun82/swift-integration-test-pack
Swift: fix extractor tests pack
2022-11-28 17:02:54 +01:00
Paolo Tranquilli
ace7146164 Merge pull request #11454 from erik-krogh/swift-test
Swift: CI cache fixes
2022-11-28 16:24:22 +01:00
Rasmus Wriedt Larsen
8694119c3c Python: Update py/pam-auth-bypass change-note wording 2022-11-28 16:16:34 +01:00
Rasmus Wriedt Larsen
4e67ec19d0 Python: Adjust alert text of py/pam-auth-bypass 2022-11-28 16:14:38 +01:00
Rasmus Wriedt Larsen
f8442ccb0e Python: Adjust PAM Auth bypass test slightly 2022-11-28 16:08:44 +01:00
Rasmus Wriedt Larsen
fef06679e5 Python: Remove options file for PAM Auth Bypass
Should not be needed
2022-11-28 16:03:32 +01:00
Rasmus Wriedt Larsen
3d9556e5a3 Python: Use proper Query suffix 2022-11-28 16:03:17 +01:00
Rasmus Wriedt Larsen
c310948521 Python: Remove enclosing module for PAM Auth Bypass.qll 2022-11-28 16:02:38 +01:00
Rasmus Wriedt Larsen
479a9e4156 Python: Update .expected 2022-11-28 16:01:42 +01:00
Felicity Chapman
59b6d657cc Apply suggestions from code review
Co-authored-by: hubwriter <hubwriter@github.com>
2022-11-28 15:45:05 +01:00
Felicity Chapman
7e5a9fbe2e Update note for review comments 2022-11-28 15:41:39 +01:00
Felicity Chapman
179941daab First set of updates for JavaScript articles 2022-11-28 15:41:39 +01:00
Felicity Chapman
33ae086861 Apply suggestions from code review
Co-authored-by: Tony Torralba <atorralba@users.noreply.github.com>
2022-11-28 15:38:03 +01:00
Felicity Chapman
d6ae5c898a Respond to review feedback 2022-11-28 15:38:03 +01:00
Felicity Chapman
a9b6a12317 Updates for Java articles 2022-11-28 15:38:03 +01:00
Felicity Chapman
85961f5dce Update docs/codeql/codeql-language-guides/functions-in-cpp.rst 2022-11-28 15:36:05 +01:00
Felicity Chapman
8ec06d45e0 Replace LGTM description with VS Code 2022-11-28 15:36:05 +01:00
Felicity Chapman
b22ccc114e Minor changes to Go and Ruby article 2022-11-28 15:36:05 +01:00
Felicity Chapman
0ac0277639 Minor change to C# article 2022-11-28 15:36:05 +01:00
Felicity Chapman
a407f0a4ac Update main C/C++ articles 2022-11-28 15:36:04 +01:00
Felicity Chapman
da4c178534 Update main Python articles 2022-11-28 15:34:12 +01:00
Felicity Chapman
c1e6d4c82a Update .github/ISSUE_TEMPLATE/ql---general.md 2022-11-28 15:26:24 +01:00
Felicity Chapman
c451fa8ad4 Update cpp/ql/src/Likely Bugs/RedundantNullCheckSimple.ql
Co-authored-by: Taus <tausbn@github.com>
2022-11-28 15:26:24 +01:00
Felicity Chapman
ea127c3d99 A few more references 2022-11-28 15:26:24 +01:00
Felicity Chapman
b5f849463b Update QL library references 2022-11-28 15:26:24 +01:00
Felicity Chapman
c06db6b67c Remove LGTM support info 2022-11-28 15:26:22 +01:00
Felicity Chapman
fb0959bcea Update QL reference 2022-11-28 15:25:38 +01:00
Felicity Chapman
5f835da838 Update HTML comment in query 2022-11-28 15:25:38 +01:00
Felicity Chapman
36a6ccba8b Remove reference in template 2022-11-28 15:25:38 +01:00
Felicity Chapman
a76d47681d Replace references in Qhelp files 2022-11-28 15:25:37 +01:00
Mathias Vorreiter Pedersen
3716d67cc9 Merge pull request #11451 from geoffw0/wkuserscript
Swift: models for WKUserScript
2022-11-28 14:24:19 +00:00
Geoffrey White
f291320655 Merge pull request #11447 from geoffw0/localflow2
Swift: Update queries to use LocalFlowSource
2022-11-28 14:18:01 +00:00
erik-krogh
d2824413db skip the only remaining macos job running on main 2022-11-28 14:44:34 +01:00
erik-krogh
751ffbd9c8 use different keys for different caches 2022-11-28 14:44:07 +01:00
Erik Krogh Kristensen
7049532227 Merge pull request #11364 from github/redsun82/swift-ci-cache
Swift: cache more aggressively in CI
2022-11-28 14:34:43 +01:00
Asger F
76afc2dcc3 JS: Fix formatting and rephrase comment 2022-11-28 14:00:43 +01:00
erik-krogh
fd7442868f fix copy-pate error in UnsafeCodeConstructionQuery.qll 2022-11-28 13:45:24 +01:00
Geoffrey White
30468dd419 Swift: Implement field content as well. 2022-11-28 12:27:33 +00:00
Geoffrey White
ffbd201450 Swift: Implement basic model of WKUserScript. 2022-11-28 12:20:29 +00:00
Geoffrey White
116d9667e7 Swift: Remove special case from query. 2022-11-28 12:15:38 +00:00
Ian Lynagh
a32363de79 Kotlin: Avoid giving a single class 2 compiler-generated kinds 2022-11-28 12:14:50 +00:00
Ian Lynagh
7863bc2c99 Kotlin: Accept test output 2022-11-28 12:14:36 +00:00
Tom Hvitved
1e63893411 C#: Add integration test that checks whether env vars are passed through autobuilder 2022-11-28 13:12:24 +01:00
Geoffrey White
3971cbf294 Swift: Extend the taint test with WKUserScript. 2022-11-28 12:11:38 +00:00
Erik Krogh Kristensen
477a32831b Merge pull request #11448 from github/erik-krogh/lgtm-codeql-js-extractor
JS: update `javascript/extractor/README.md` to mention CodeQL instead of LGTM
2022-11-28 13:10:25 +01:00
Arthur Baars
a879fd519a Merge pull request #11295 from github/aibaars-patch-2
"CodeQL False positive" -> "CodeQL false positive"
2022-11-28 13:06:39 +01:00
Arthur Baars
a8effd1961 Ruby: add change note 2022-11-28 13:02:22 +01:00
Michael Nebel
d7e656a32a Java: Add change note. 2022-11-28 12:30:36 +01:00
Michael Nebel
43a63d6373 Java: Convert all models to data extensions in testcases. 2022-11-28 12:30:36 +01:00
Michael Nebel
74f02cf855 Java: Allow empty package name in model definitions. 2022-11-28 12:30:35 +01:00
Michael Nebel
b96540c937 Java: Convert permissve-dot-regex-query to data extensions. 2022-11-28 12:30:35 +01:00
Michael Nebel
91840c613e Java: Convert unsafe-url-forward to data extensions. 2022-11-28 12:30:35 +01:00
Michael Nebel
aed5ee4edc Java: Convert thread-resource-abuse to data extensions. 2022-11-28 12:30:35 +01:00
Michael Nebel
07578f11d4 Java: Convert hardcoded-jwt-key models to data extensions. 2022-11-28 12:30:35 +01:00
Michael Nebel
ab12b6cc2b Java: Convert android-web-resource-response to data extensions. 2022-11-28 12:30:35 +01:00
Michael Nebel
5c15ad412c Java: Convert log4j-injection to data extensions. 2022-11-28 12:30:35 +01:00
Michael Nebel
665d40dc4b Java: Convert file-path-injection to data extensions. 2022-11-28 12:30:35 +01:00
Michael Nebel
b61f515af2 Jave: Make support for query specific models. 2022-11-28 12:30:35 +01:00
Michael Nebel
805430983c Java: Convert commons-io to data extensions. 2022-11-28 12:30:35 +01:00
Michael Nebel
d7aafbfe64 Java: Add model generator script that emits data extensions. 2022-11-28 12:30:35 +01:00
Michael Nebel
9c93402b26 Java: Convert integration test to use data extensions instead of inlined models. 2022-11-28 12:30:35 +01:00
Michael Nebel
157a228088 Java: Add query packs with names to enable dependency resolution. 2022-11-28 12:30:35 +01:00
Michael Nebel
2d309bb8f8 Java: Include the library query pack to get the data extensions included. 2022-11-28 12:30:35 +01:00
Michael Nebel
b3a3b676ba Java: Remove manual models from QL code. 2022-11-28 12:30:34 +01:00
Michael Nebel
f4e1867d28 Java: Define extensible predicates to at least be empty. 2022-11-28 12:30:34 +01:00
Michael Nebel
0abeb831c7 Java: Move summaryModel predicate, which constructs a CSV row to the testcode where it is used. 2022-11-28 12:30:34 +01:00
Michael Nebel
663d091776 Java: Invert dependencies and use the extensible predicates. 2022-11-28 12:30:34 +01:00
Michael Nebel
9cb5ff1cdc Java: Add data extensions for all manual models. 2022-11-28 12:30:34 +01:00
Michael Nebel
8e25cac653 Java: Add extensible predicates. 2022-11-28 12:30:34 +01:00
Michael Nebel
7b6f202f23 Java: Renaming. 2022-11-28 12:30:34 +01:00
Michael Nebel
63e2206d16 Java: Prepare QL pack for data extensions. 2022-11-28 12:30:34 +01:00
Michael Nebel
fc4b9827b9 Java: Add script for converting extensions. 2022-11-28 12:30:34 +01:00
Michael Nebel
9f7103c4fb Java: Add queries for extracting sources, sinks and summaries. 2022-11-28 12:30:34 +01:00
Michael Nebel
a8ee878356 Java: Add bi-directional import of FragmentInjection. 2022-11-28 12:30:33 +01:00
Michael Nebel
663112576a Java: Update commons-io models. 2022-11-28 12:30:33 +01:00
Erik Krogh Kristensen
7a3898168f Update README.md 2022-11-28 12:12:36 +01:00
Tom Hvitved
cde05e1190 Data flow: Sync files 2022-11-28 12:11:38 +01:00
Tom Hvitved
c65780ee99 Data flow: Inline revFlowInNotToReturn 2022-11-28 12:11:18 +01:00
Tom Hvitved
bdb205a318 Data flow: Track return kind instead of return position in pruning stages 2-4 2022-11-28 12:11:18 +01:00
Tom Hvitved
4346a7f426 Data flow: Inline fwdFlowOutNotFromArg 2022-11-28 12:11:18 +01:00
Tom Hvitved
70d2a0df8a Data flow: Track parameter position instead of parameter in pruning stages 2-4 2022-11-28 12:11:12 +01:00
Taus
530b795eaa Merge pull request #11402 from yoff/python/port-super-not-enclosing-class
Python: port `py/super-not-enclosing-class`
2022-11-28 11:52:57 +01:00
Nick Rolfe
8a94cabdbf Merge pull request #11250 from github/nickrolfe/stack-trace-exposure
Ruby: add stack-trace exposure query
2022-11-28 10:45:59 +00:00
Asger F
e99571baae Update javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModelsSpecific.qll
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2022-11-28 11:45:08 +01:00
Geoffrey White
dc02fa0386 Swift: Make ql-for-ql happy. 2022-11-28 10:17:11 +00:00
Geoffrey White
b3d2e759a6 Swift: Update swift/sql-injection to include local flow sources. 2022-11-28 10:11:44 +00:00
Geoffrey White
a5a459fe0a Swift: Update swift/unsafe-js-eval to include local flow sources. 2022-11-28 10:11:44 +00:00
Michael Nebel
7456f3750d Merge pull request #11432 from michaelnebel/java/flowtestgeneratortools
Java: Flow test case generator
2022-11-28 10:41:42 +01:00
erik-krogh
0c2ff98dc2 add flow from the first splat argument to the first splat parameter 2022-11-28 09:54:05 +01:00
erik-krogh
d5725255fe add failing test for splat parameter flow 2022-11-28 09:53:03 +01:00
Michael Nebel
24e830f91d Java: Fix some minor bugs in the CSV printing of summaries for flow test generation. 2022-11-28 09:07:40 +01:00
Michael Nebel
abe4d99e12 Java: Make some rudimentary tooling for testing the flow test case generator script. 2022-11-28 09:07:40 +01:00
Chris Smowton
5a0cce2a18 Merge pull request #11430 from erik-krogh/go-go
GO: get the Go CI to go fast!
2022-11-26 11:47:04 +00:00
erik-krogh
2b0ecec0c8 only run other-os on non-ql changes 2022-11-26 10:43:33 +01:00
erik-krogh
dcfa0b38c1 use a non-xl mac runner because the XL runners keep queing 2022-11-26 10:43:33 +01:00
erik-krogh
2b996f11cc use query compilation cache 2022-11-26 10:43:33 +01:00
erik-krogh
1e732ad4d7 use XL workers, and update the windows runner 2022-11-26 10:43:33 +01:00
erik-krogh
d7763f236f use more threads for codeql test 2022-11-26 10:43:33 +01:00
erik-krogh
b6034b4935 delete language specific format check 2022-11-26 10:43:30 +01:00
Chris Smowton
fb1f22144d Merge pull request #11352 from smowton/smowton/admin/kotlin-tests-1.7.20
Kotlin: bump default CI version to 1.7.20
2022-11-25 21:05:10 +00:00
Chris Smowton
0879f02db6 Adapt custom_plugin test to Kotlin 1.7.20 2022-11-25 17:54:53 +00:00
Ian Lynagh
a423f5f695 Kotlin: Enable java/misnamed-type query
We used to get alerts for the class around a local function, a lambda,
or a function reference, which we give name "". Now those are marked as
compiler-generated, and the query ignores compiler-generated types.
2022-11-25 17:11:40 +00:00
Paolo Tranquilli
edddaaa838 Swift: make mapping from swift types to tags explicit
This should decouple schema names from swift names, allowing to
rename schema names regardless of internal swift compiler names.
2022-11-25 13:10:33 +01:00
Jeroen Ketema
53b86fd53b Merge pull request #11428 from jketema/default-taint-tests
C++: Add more tests that exercise the default taint barrier implementation
2022-11-25 12:13:18 +01:00
Chris Smowton
180c3cee44 Accept integration test changes caused by variable location changes 2022-11-25 10:54:50 +00:00
Chris Smowton
32847c125a Accept more test changes due to variable locations changing
There is also one non-location change: kotlin.Byte (and likely other primitives) now have real equals and toString overrides, which matches their native source and documentation; before they appeared to have fake overrides.
2022-11-25 10:47:48 +00:00
Alex Ford
8362caa9d9 Merge pull request #11417 from alexrford/ruby/activesupport-json_escape
Ruby: model ActiveSupport `json_escape` flow
2022-11-25 10:46:34 +00:00
Chris Smowton
8ec681e61c Kotlin: bump default CI version to 1.7.20
A bunch of test expectations change because 7f531d8426 means that we now see (a) local variable declarations with source locations covering only their identifier, not the whole statement, and (b) more SYNTHETIC_OFFSET values for the parts of a destructuring assignment
or initialiser, which show up as file.kt:0:0:0:0 in DbLocation form.
2022-11-25 10:19:26 +00:00
erik-krogh
f75b853ae4 add change-note 2022-11-25 11:08:14 +01:00
Owen Mansel-Chan
ebdea243b2 Make qldoc clearer about behaviour of override 2022-11-25 09:46:07 +00:00
erik-krogh
53f24a5281 fix QL-for-QL warning 2022-11-25 10:32:06 +01:00
erik-krogh
0817238177 drive-by: same change in unsafe-shell-command-construction 2022-11-25 10:32:06 +01:00
erik-krogh
378cc1aed2 add support for string-like-literals 2022-11-25 10:32:06 +01:00
erik-krogh
80c92dc3e6 add support for array pushes 2022-11-25 10:32:05 +01:00
erik-krogh
3461404bbb add basic support for arrays 2022-11-25 10:31:35 +01:00
erik-krogh
0f2a48f461 fix QL-for-QL warnings 2022-11-25 10:26:24 +01:00
erik-krogh
2033dd2dcc remove parameters named "code" as source 2022-11-25 10:25:31 +01:00
erik-krogh
e7c6571f52 remove the "send(..)" and similar from unsafe-code-construction 2022-11-25 10:25:31 +01:00
erik-krogh
f1668801d3 add a rb/unsafe-code-construction query
rebase
2022-11-25 10:25:30 +01:00
Jeroen Ketema
4607f5990e C++: Add more tests that exercise the default taint barrier implementation 2022-11-25 10:19:45 +01:00
Paolo Tranquilli
8df7d465cb Swift: cache more aggressively in CI
* the QL compilation cache action is used for ql and integration tests
* all caches (Bazel and QL) are populated on push
2022-11-25 08:52:46 +01:00
Rasmus Lerchedahl Petersen
77d98b217e Python: add import 2022-11-25 08:52:35 +01:00
yoff
d804acdef7 Apply suggestions from code review
Co-authored-by: Taus <tausbn@github.com>
2022-11-25 08:50:37 +01:00
Paolo Tranquilli
9b4b29cab7 Merge branch 'main' into redsun82/swift-integration-test-pack 2022-11-25 08:49:36 +01:00
Harry Maclean
f49507e59a Ruby: Add note about WithElement usage 2022-11-25 16:55:37 +13:00
Harry Maclean
df398fb9a0 Ruby: Add more flow summary tests 2022-11-25 16:55:37 +13:00
Harry Maclean
fe13ac188f Ruby: US spelling 2022-11-25 16:55:37 +13:00
Harry Maclean
0b065001a8 Ruby: Add tests for flow summary behaviour
These test cases are a companion to the flow summary docs, and ensure
that the documentated behaviour matches reality.
2022-11-25 16:55:37 +13:00
Harry Maclean
c0501c189e Ruby: Document ?/any behaviour in output paths 2022-11-25 16:55:37 +13:00
Harry Maclean
5b07c3a746 Ruby: Elaborate WithoutElement docs 2022-11-25 16:55:37 +13:00
Harry Maclean
5e3a817064 Ruby: With[out]Element only valid in input 2022-11-25 16:55:37 +13:00
Harry Maclean
0c2dd1a5a6 Ruby: Flesh out hash-splat docs 2022-11-25 16:55:37 +13:00
Harry Maclean
43f2713925 Ruby: Update test fixture 2022-11-25 16:55:37 +13:00
Harry Maclean
78f604aef1 Ruby: Document Field access path token 2022-11-25 16:55:37 +13:00
Harry Maclean
6f852aad0b Ruby: Document flow summary syntax 2022-11-25 16:55:36 +13:00
Harry Maclean
0a4a8516eb Ruby: simplify Hash#transform_keys! flow summary 2022-11-25 16:55:36 +13:00
Geoffrey White
208a728d39 Swift: Fixes. 2022-11-25 00:28:53 +00:00
Geoffrey White
37cdef7ab1 Swift: add basic Alamofire taint source model. 2022-11-25 00:14:23 +00:00
Geoffrey White
afb5dc7da3 Swift: Add test for Alamofire sources. 2022-11-25 00:08:51 +00:00
Harry Maclean
2822c94aa7 Ruby: Minor refactor of barrier guard code 2022-11-25 09:12:51 +13:00
Harry Maclean
6897fb46cb Ruby: Clean up WhenClause CFG 2022-11-25 09:12:51 +13:00
Alexander Eyers-Taylor
3c7f7511be Merge pull request #11418 from alexet/alexet/mockito-class-rename
Java: Add new Mockito runner class location.
2022-11-24 17:49:31 +00:00
alexet
e24e3bf13f Java: Add new Mockito runner class location. 2022-11-24 16:43:57 +00:00
erik-krogh
5f6cb1684b move the code-injection tests into a subfolder 2022-11-24 17:23:25 +01:00
Henry Mercer
df3dc6fadc Merge pull request #11414 from github/codeql-ci/atm/release-0.4.2
JS: Bump version numbers of ML-powered packs after 0.4.2 release
2022-11-24 16:07:28 +00:00
Alex Ford
e6446e501c Ruby: fix docs failure 2022-11-24 15:37:03 +00:00
Alex Ford
893c8763bb Ruby: model ActiveSupport json_escape flow 2022-11-24 15:33:08 +00:00
Edoardo Pirovano
9071acea01 Merge pull request #11416 from github/edoardo/mergeback-3.8
Merge `rc/3.8` into `main`
2022-11-24 15:05:28 +00:00
Erik Krogh Kristensen
03737543d4 Merge pull request #11403 from erik-krogh/additional
ReDoS: add missing additional keywords
2022-11-24 15:53:51 +01:00
Edoardo Pirovano
8eeba92a47 Merge pull request #11415 from github/edoardo/mergeback-2.11.4
Merge `codeql-cli-2.11.4` into `rc/3.8`
2022-11-24 14:42:36 +00:00
Henry Mercer
56e5f01ce0 Merge branch 'main' into codeql-ci/atm/release-0.4.2 2022-11-24 14:41:49 +00:00
github-actions[bot]
78d49e44b1 JS: Bump version of ML-powered library and query packs to 0.4.3 2022-11-24 14:22:14 +00:00
github-actions[bot]
8d96bfe973 JS: Bump patch version of ML-powered library and query packs 2022-11-24 14:18:13 +00:00
Nick Rolfe
50b10be2db Ruby: StackTraceExposure: add test for a specific rescue type 2022-11-24 14:08:34 +00:00
Nick Rolfe
1c407a28cd Apply suggestions from code review
Co-authored-by: Harry Maclean <hmac@github.com>
2022-11-24 14:02:32 +00:00
Tony Torralba
adf905d838 Merge pull request #11368 from ka1n4t/main
Java: Add binding between annotation and sink-param in MyBatis SQL Injection query
2022-11-24 14:34:57 +01:00
Tony Torralba
1d57663343 Merge pull request #11345 from atorralba/atorralba/swift/data-models
Swift: Add taint models for the Data class
2022-11-24 14:23:41 +01:00
Geoffrey White
32442a33de Merge pull request #11270 from geoffw0/optionals2
Swift: Dataflow through ?? and ? :
2022-11-24 13:20:54 +00:00
Ian Lynagh
184c903ec7 Merge pull request #11401 from igfoo/igfoo/unused
Kotlin: Remove an unused argument
2022-11-24 12:47:50 +00:00
Ian Lynagh
501ea31c25 Merge pull request #11404 from igfoo/igfoo/build_refactor
Kotlin build system: Refactor jar-finder
2022-11-24 12:47:34 +00:00
Anders Schack-Mulligen
f2897f5bfc Merge pull request #11392 from aschackmull/java/adjust-mad-dispatch-priority
Java: Adjust the prioritisation between MaD and source dispatch.
2022-11-24 13:10:48 +01:00
Tony Torralba
e4e5291511 Fix more test expectations after rebase 2022-11-24 13:03:12 +01:00
Erik Krogh Kristensen
6464135800 Merge pull request #11409 from erik-krogh/cache-more
Ruby: cache the compiled extractor in the build tests
2022-11-24 12:42:33 +01:00
Tony Torralba
fc7c66dab2 Remove now unnecessary additional taint step in UnsafeJsEval 2022-11-24 12:35:52 +01:00
Tony Torralba
e67b72d954 Update test expectations 2022-11-24 12:35:51 +01:00
Tony Torralba
25354d2dd8 Apply code review suggestions 2022-11-24 12:35:51 +01:00
Tony Torralba
6a8b9fde78 Add data flowsources test 2022-11-24 12:35:51 +01:00
Tony Torralba
d6b14a1395 Update test expectations 2022-11-24 12:35:50 +01:00
Tony Torralba
2284127650 Add MaD rows for the Data class 2022-11-24 12:35:50 +01:00
Tony Torralba
4bbc1dc734 Update test expectations 2022-11-24 12:34:48 +01:00
Tony Torralba
cac6e946ab Merge pull request #11411 from atorralba/atorralba/swift/fix-nsdata-test
Swift: Fix expectation in NSData tests
2022-11-24 12:34:28 +01:00
Ben Ahmady
7f5df4fc0e Merge pull request #11384 from github/subatoi/codeql-cli-2.11.4
Adds Kotlin (beta) content
2022-11-24 11:33:46 +00:00
Geoffrey White
c6835cd270 Swift: Update .generated.list. 2022-11-24 11:16:56 +00:00
Tony Torralba
4f8ef13cd8 Fix expectation in NSData tests 2022-11-24 12:13:46 +01:00
Tony Torralba
04450c5173 Merge pull request #11378 from atorralba/atorralba/swift/nsdata-models
Swift: Add models for NSData and NSMutableData
2022-11-24 11:19:14 +01:00
Tony Torralba
17218fa663 Formatting 2022-11-24 11:14:16 +01:00
Ben Ahmady
42259ef8d1 Update docs/codeql/reusables/kotlin-java-differences.rst 2022-11-24 10:10:42 +00:00
Tony Torralba
443d0f50c1 Apply suggestions from code review 2022-11-24 11:10:07 +01:00
erik-krogh
c9a600d496 Ruby: cache the compiled extractor, because that's way smaller than the cargo cache 2022-11-24 10:55:38 +01:00
Tony Torralba
2ac06b8db9 Turns out lambda flow is already supported 2022-11-24 10:52:27 +01:00
Nora Dimitrijević
8f065e9483 Merge pull request #11001 from d10c/swift/js-injection 2022-11-24 10:52:05 +01:00
Tom Hvitved
4e4ee32dbc Data flow: Join on one more column in flowThroughIntoCall 2022-11-24 10:48:29 +01:00
Michael Nebel
cb4a7e22f0 Merge pull request #11395 from michaelnebel/csharp/externalflowcleanup
C#: ExternalFlow.qll cleanup.
2022-11-24 10:28:58 +01:00
Harry Maclean
57f689401e Ruby: SplatExprCfgNode extends UnaryOperationCfgNode 2022-11-24 17:33:57 +13:00
Ian Lynagh
2d92cee26a Kotlin build system: Refactor jar-finder
We were globbing with a * in the filename, but that is not necessary.
2022-11-23 21:43:32 +00:00
Erik Krogh Kristensen
1eec067474 Merge pull request #11294 from erik-krogh/fileDoc
QL: improve the "this block-comment should have been a QLDoc"-query
2022-11-23 22:23:36 +01:00
Erik Krogh Kristensen
3d4f64f168 Merge pull request #11397 from erik-krogh/call-instanceof
Rb: use `instanceof` instead of `extends` on `DataFlow::CallNode` in some case
2022-11-23 22:20:17 +01:00
Erik Krogh Kristensen
efdfc361be Merge pull request #11396 from erik-krogh/jsTypo
JS: fix two typos
2022-11-23 22:18:43 +01:00
erik-krogh
95f35196e4 add missing additional keywords 2022-11-23 20:45:51 +01:00
Ian Lynagh
5b8b9044a5 Kotlin: Remove an unused argument 2022-11-23 18:47:53 +00:00
tiferet
03b8e649f1 Filter endpoints by confidence
Select endpoints to score at inference time base purely on their confidence level, and not on whether they fit the historical definition of endpoint filters.
2022-11-23 10:46:27 -08:00
Tom Hvitved
3fbe089f65 Merge pull request #11387 from hvitved/csharp/autobuild-options-split
C#: Split `AutobuildOptions` into C#/C++ specific classes
2022-11-23 19:30:48 +01:00
Geoffrey White
2b52a44024 Merge pull request #11210 from geoffw0/alamofire2
Swift: Add Alamofire model to swift/cleartext-transmission
2022-11-23 18:23:44 +00:00
Henry Mercer
146d2460b7 Merge pull request #11390 from github/henrymercer/atm/add-pack-descriptions
ATM: Add descriptions to ML-powered packs
2022-11-23 18:04:59 +00:00
Ben Ahmady
357c823b92 Changes after feedback 2022-11-23 16:59:52 +00:00
Andrew Eisenberg
b9694eb09a Merge pull request #11388 from hvitved/codeql-workspace-yml-fix
Fix typo in `codeql-workspace.yml`
2022-11-23 08:42:54 -08:00
Ian Lynagh
d03817ce2d Merge pull request #11399 from igfoo/igfoo/kotlin-basic
Java/Kotlin: Make the basic query in docs work for both languages
2022-11-23 16:01:04 +00:00
Michael Nebel
2684b3f396 C#: Make bi-directional import of Servicestack remote flow source definitions. 2022-11-23 16:59:40 +01:00
Ian Lynagh
277b5b483d Java/Kotlin docs: Tweak text 2022-11-23 15:51:40 +00:00
Michael Nebel
582cfb9330 C#: Remove the frameworks module in ExternalFlow as MaD models are no longer inlined in the code. 2022-11-23 16:20:36 +01:00
Ian Lynagh
950c4c811c Java/Kotlin: Make the basic query in docs work for both languages 2022-11-23 15:18:29 +00:00
Ian Lynagh
9ee36215bd Java: Fix basic query in docs 2022-11-23 15:14:46 +00:00
Ben Ahmady
ee0811df26 Update docs/codeql/codeql-language-guides/codeql-for-java.rst 2022-11-23 15:13:40 +00:00
Ben Ahmady
f9215ec5ca Update docs/codeql/reusables/kotlin-java-differences.rst
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2022-11-23 15:10:24 +00:00
Ben Ahmady
72999c7af1 Update docs/codeql/reusables/kotlin-java-differences.rst
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2022-11-23 15:10:14 +00:00
Ben Ahmady
3c3442d8f0 Update docs/codeql/reusables/kotlin-java-differences.rst
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2022-11-23 15:09:58 +00:00
Geoffrey White
ef837f72e4 Swift: Test .expected changes resulting from merge. 2022-11-23 14:57:08 +00:00
Ian Lynagh
8042edb6a9 Merge pull request #11393 from igfoo/igfoo/typo
Java: Fix typo: ceritificate
2022-11-23 14:26:14 +00:00
erik-krogh
33216f3867 cleanup imports 2022-11-23 15:22:19 +01:00
Michael Nebel
311614c5e6 C#: Remove imports of ExternalFlow.qll. 2022-11-23 15:03:03 +01:00
Asger F
abf0c0f296 Python: update more comments referring to the package column 2022-11-23 15:02:08 +01:00
erik-krogh
19b5f64a11 use instanceof instead of extends on DataFlow::CallNode in some case 2022-11-23 14:58:17 +01:00
Asger F
5a51d718c6 Update some comments referring to the package column 2022-11-23 14:44:03 +01:00
erik-krogh
2eb6b1adb3 JS: fix two typos 2022-11-23 14:38:12 +01:00
Rasmus Lerchedahl Petersen
91198524cd Python: port py/super-not-enclosing-class 2022-11-23 14:37:45 +01:00
AlexDenisov
ac7063ba09 Merge pull request #11394 from github/redsun82/swift-error-on-uppercase-acronyms
Swift: reject uppercase acronyms in schema
2022-11-23 14:21:07 +01:00
Paolo Tranquilli
876add5214 Swift: reject uppercase acronyms in schema
This was causing hardly debuggable errors because names are transformed
to underscored lowercase names in the dbscheme and back to camelcase
for trap emission classes, which is not a noop in case uppercase
acronyms (like SIL or ABI) are in the name.

This makes the error be surfaced early with a helpful message.
2022-11-23 13:56:03 +01:00
Ben Ahmady
dcd082e955 Possible build fix, else needs new parameter 2022-11-23 12:48:47 +00:00
Tom Hvitved
bc6a41c1e6 Merge pull request #10927 from hvitved/csharp/phi-reads-in-data-flow-graph
C#: Include "phi reads" in `DataFlow::Node`
2022-11-23 13:34:18 +01:00
Ian Lynagh
d401be1845 Java: Fix typo: ceritificate 2022-11-23 12:12:32 +00:00
Nick Rolfe
686a1cbafe Merge pull request #11386 from github/nickrolfe/dbscheme_case_split
Ruby/QL: only create dbscheme case-splits for columns on defining tables
2022-11-23 12:06:57 +00:00
Tom Hvitved
8f3731fd42 C#: Split AutobuildOptions into C#/C++ specific classes 2022-11-23 12:57:16 +01:00
Anders Schack-Mulligen
807f87e01f Java: Adjust the prioritisation between MaD and source dispatch. 2022-11-23 12:56:32 +01:00
AlexDenisov
1c17d854d8 Merge pull request #11391 from github/redsun82/swift-package-downgrades
Swift: add downgrades script to extractor pack
2022-11-23 12:46:28 +01:00
Tony Torralba
6cfa89e1db Merge pull request #11165 from atorralba/atorralba/swift/xxe-query-libxml2-sinks
Swift: Add libxml2 sinks to the XXE query
2022-11-23 12:39:44 +01:00
Paolo Tranquilli
a1bffff0b0 Swift: add downgrades script to extractor pack 2022-11-23 12:15:29 +01:00
Tom Hvitved
28c32fc78e Merge pull request #11383 from hvitved/csharp/ci-extractor-unit-tests
C#: Also include extractor unit tests in `csharp-qltest.yml`
2022-11-23 11:58:07 +01:00
Henry Mercer
3b69821630 ATM: Add descriptions to ML-powered packs 2022-11-23 10:46:23 +00:00
Tom Hvitved
a55c56feed Fix typo in codeql-workspace.yml 2022-11-23 11:33:52 +01:00
Ben Ahmady
40c2b3c43b Merge branch 'codeql-cli-2.11.4' into subatoi/codeql-cli-2.11.4 2022-11-23 10:18:46 +00:00
Asger F
1c910550e6 Python: merge package/type columns 2022-11-23 11:17:42 +01:00
Asger F
22316ee4fe Ruby: merge package/type columns 2022-11-23 11:17:42 +01:00
Asger F
2e3413c9b8 JS: Merge package/type columns 2022-11-23 11:17:42 +01:00
Ben Ahmady
093ff4061d Update docs/codeql/reusables/kotlin-java-differences.rst
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2022-11-23 10:08:45 +00:00
Ben Ahmady
7644ecad52 Update docs/codeql/reusables/kotlin-java-differences.rst
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2022-11-23 10:08:29 +00:00
Ben Ahmady
0a91ee1019 Update docs/codeql/codeql-language-guides/abstract-syntax-tree-classes-for-working-with-java-programs.rst 2022-11-23 10:08:20 +00:00
Ben Ahmady
df7f0cf9a9 Update docs/codeql/codeql-language-guides/analyzing-data-flow-in-java.rst 2022-11-23 10:08:10 +00:00
Ben Ahmady
c06b8a68e5 Update docs/codeql/reusables/kotlin-java-differences.rst
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2022-11-23 10:08:00 +00:00
Ben Ahmady
c663da5be6 Update docs/codeql/reusables/kotlin-java-differences.rst
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2022-11-23 10:07:03 +00:00
Ben Ahmady
4bd7e24b5f Update docs/codeql/reusables/kotlin-java-differences.rst
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2022-11-23 10:06:57 +00:00
Ben Ahmady
605c7113a2 Update docs/codeql/reusables/kotlin-java-differences.rst
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2022-11-23 10:06:48 +00:00
Ben Ahmady
e2240abc78 Update docs/codeql/codeql-language-guides/codeql-for-java.rst
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2022-11-23 10:06:34 +00:00
Nick Rolfe
e16bdc4d07 Ruby/QL: only create dbscheme case-splits for columns on defining tables 2022-11-23 10:00:08 +00:00
Geoffrey White
556d68aeed Update swift/ql/src/queries/Security/CWE-311/CleartextTransmission.ql
Co-authored-by: Tony Torralba <atorralba@users.noreply.github.com>
2022-11-23 09:17:18 +00:00
Paolo Tranquilli
545c2f67e9 Merge pull request #11382 from github/alexdenisov/swift-relax-file-archiving
Swift: do not abort if cannot archive a source file
2022-11-23 06:56:26 +01:00
Paolo Tranquilli
d345cec339 Merge pull request #11381 from github/alexdenisov/swift-fix-remapping-regression
Swift: fix remapping bug
2022-11-23 06:56:05 +01:00
ka1n4t
d113fb23c8 Add test case for PR-11368 2022-11-23 11:05:58 +08:00
Tom Hvitved
4ad7d2d822 C#: Also include extractor unit tests in csharp-qltest.yml 2022-11-22 19:55:38 +01:00
Ben Ahmady
24c413fbf9 Adds Kotlin (beta) content 2022-11-22 18:33:24 +00:00
Geoffrey White
7d45ca6293 Merge branch 'main' into optionals2 2022-11-22 17:35:27 +00:00
Alex Denisov
8f02463411 Swift: fix remapping bug
This issue has slipped during a recent refactoring:
https://github.com/github/codeql/pull/10987/files#diff-c5ab26a06a93c4507a834859a6a56878d5bfe16c4d7cbac4afc4f081d46f461aL63-R64
2022-11-22 17:25:07 +01:00
Alex Denisov
a2ac1384cb Swift: do not abort if cannot archive a source file 2022-11-22 17:18:40 +01:00
Tony Torralba
92ee0aa7ae Merge pull request #11367 from atorralba/atorralba/java/add-bitwise-implicit-intents
Java: Consider taint through bitwise operations on PendingIntent flags
2022-11-22 17:08:52 +01:00
Tony Torralba
2e1a78e1bf Add models for NSData and NSMutableData 2022-11-22 15:48:58 +01:00
Rasmus Wriedt Larsen
5866af413f Merge pull request #11347 from tausbn/python-clean-up-import-resolution
Python: Add change note for module resolution
2022-11-22 15:28:38 +01:00
Rasmus Wriedt Larsen
04a68f8d52 Merge pull request #11372 from RasmusWL/getpass
Python: Model `getpass.getpass` as source of passwords
2022-11-22 14:49:04 +01:00
Rasmus Wriedt Larsen
b281cc88ff Merge pull request #11208 from RasmusWL/call-graph-tests
Python: Test improvements in preparation for new call-graph PR
2022-11-22 14:31:09 +01:00
Rasmus Wriedt Larsen
9195b73d84 Python: Model getpass.getpass as source of passwords 2022-11-22 14:11:52 +01:00
Rasmus Wriedt Larsen
80e71b202a Python: Cleartext queires: Remove flow from getpass.py 2022-11-22 14:08:00 +01:00
Rasmus Wriedt Larsen
9342e3ba76 Python: Enable new test
But look at all those elements from getpass.py implementation :(
2022-11-22 13:59:59 +01:00
Rasmus Wriedt Larsen
e01df3ea7c Python: Prepare for new test
.expected line changes 😠
2022-11-22 13:52:50 +01:00
Taus
18be30d177 Python: Apply suggestion from review
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
2022-11-22 13:46:45 +01:00
Rasmus Wriedt Larsen
1b30cf8eca Merge branch 'main' into call-graph-tests 2022-11-22 13:39:27 +01:00
Erik Krogh Kristensen
158ea26dd1 Merge pull request #11362 from erik-krogh/read-only-cache
CI: use read-only-cache when running on a PR
2022-11-22 13:04:34 +01:00
Erik Krogh Kristensen
f67219965e Merge pull request #11082 from erik-krogh/shellArr
JS: treat arrays that gets executed with shell:true as a sink for `js/shell-command-constructed-from-input`
2022-11-22 13:03:50 +01:00
Erik Krogh Kristensen
b2267c0e49 Merge pull request #11343 from erik-krogh/redundantAssignment
QL: add redundant-assignment query
2022-11-22 13:03:14 +01:00
Erik Krogh Kristensen
06386b2cdd Merge pull request #11072 from erik-krogh/slicing
JS: poly-redos: don't sanitize calls through substring calls that just remove the start
2022-11-22 13:02:09 +01:00
erik-krogh
6b5cd9abc3 use RegExpTreeView insteaed of RegexTreeView in JS 2022-11-22 12:55:48 +01:00
erik-krogh
f9b775e4b8 do private imports of the deprecated Dep modules 2022-11-22 12:39:56 +01:00
Tony Torralba
1667fbad88 Add change note 2022-11-22 11:48:21 +01:00
Tony Torralba
43f4dd8bc4 Consider taint through bitwise operations on PendingIntent flags 2022-11-22 11:39:30 +01:00
Tom Hvitved
ed841aee30 Merge pull request #11329 from hvitved/csharp/qltest-ci
C#: Add workflow for running QL tests
2022-11-22 11:36:16 +01:00
ka1n4t
ce2ba21240 Add binding between annotation and sink-param 2022-11-22 18:32:14 +08:00
Rasmus Wriedt Larsen
84faf49bf0 Python: Add tests for compound arguments field flow 2022-11-22 11:29:00 +01:00
Rasmus Wriedt Larsen
d876acde4c Python: Fix SINK/SINK_F usage for crosstalk tests
As discussed in PR review
https://github.com/github/codeql/pull/11208#discussion_r1022473421
2022-11-22 11:29:00 +01:00
Anders Peter Fugmann
d799466e9d Merge pull request #11338 from andersfugmann/update_swift_codeowners
Swift: set @github/codeql-swift as owner
2022-11-22 11:24:19 +01:00
Paolo Tranquilli
414f18fc97 Swift: fix extractor tests pack
This allows `codeql query compile` to run on integration test queries.
2022-11-22 10:58:57 +01:00
Erik Krogh Kristensen
ef270232dc Merge pull request #11358 from erik-krogh/rubyDelPacks
Ruby: delete the target/packs folder in the `compile-queries` job
2022-11-22 10:56:52 +01:00
Geoffrey White
949cfb758d Merge branch 'main' into alamofire2 2022-11-22 09:29:53 +00:00
erik-krogh
10c602d9fb CI: use read-only-cache when running on a PR 2022-11-22 10:20:09 +01:00
Anders Schack-Mulligen
15aa8b62b8 Merge pull request #11359 from github/workflow/coverage/update
Update CSV framework coverage reports
2022-11-22 09:47:38 +01:00
Tom Hvitved
313767539a C#: Add workflow for running QL tests 2022-11-22 09:32:44 +01:00
github-actions[bot]
e70eb3a3ee Add changed framework coverage reports 2022-11-22 00:19:21 +00:00
erik-krogh
29055f7709 delete packs 2022-11-22 00:12:33 +01:00
Jami
8a73675483 Merge pull request #11070 from jcogs33/java-regex-injection
Java: Promote regex injection query from experimental
2022-11-21 15:04:26 -05:00
Mathias Vorreiter Pedersen
c2ac60fc34 Merge pull request #11311 from MathiasVP/repair-mustflow
C++: Repair `MustFlow` library for use-use flow
2022-11-21 19:13:10 +00:00
Jami Cogswell
9e2ec9d12f apply docs review suggestion 2022-11-21 13:39:46 -05:00
Edoardo Pirovano
6c33ddcd47 Merge pull request #11349 from github/edoardo/2.11.4-mergeback
Merge `rc/3.8` into `main`
2022-11-21 18:08:27 +00:00
Erik Krogh Kristensen
af367a5fdf Merge pull request #11348 from erik-krogh/cache-full-extractor
Ruby: cache the entire extractor
2022-11-21 18:06:32 +01:00
erik-krogh
76ceb49841 re-introduce the paths requirements in the ruby workflows 2022-11-21 17:55:57 +01:00
Erik Krogh Kristensen
53ba22ab5c simplify pack creation
Co-authored-by: Arthur Baars <aibaars@github.com>
2022-11-21 17:55:57 +01:00
erik-krogh
3b7ce0680d Ruby: build queries on an XL worker, and use all the threads 2022-11-21 17:55:57 +01:00
erik-krogh
999e8ed0d0 Ruby: remove the path on branch pushes, for caching 2022-11-21 17:55:57 +01:00
erik-krogh
b1db390200 Ruby: use compilation cache in the ruby-build workflow 2022-11-21 17:55:57 +01:00
erik-krogh
9c792902c7 Ruby: cache the entire extractor 2022-11-21 17:55:57 +01:00
erik-krogh
64707f4f7b remove redundant assignments 2022-11-21 17:45:05 +01:00
erik-krogh
937365141f QL: add redundant-assignment query 2022-11-21 17:41:02 +01:00
tiferet
1c9545e49a Address comment from code review:
Make `SyntacticHeuristics` an explicit import
2022-11-21 08:00:31 -08:00
Tony Torralba
e28f1ffe18 Merge pull request #11346 from atorralba/atorralba/java/fix-path-models
Java: Fix a couple of taint models for `java.nio.file.Path(s)`
2022-11-21 16:57:00 +01:00
Erik Krogh Kristensen
4f08000a2e Merge pull request #11344 from erik-krogh/all-the-cache
Ruby: Use compilation cache for the qltest CI workflow
2022-11-21 16:26:29 +01:00
Tony Torralba
16a76853f4 Add libxml2 sinks 2022-11-21 16:25:51 +01:00
Taus
f12e15b46b Python: Fix implicit this warnings 2022-11-21 15:23:13 +00:00
Mathias Vorreiter Pedersen
7e80a57724 C++: Make ql-for-ql happy. 2022-11-21 15:13:19 +00:00
Erik Krogh Kristensen
b4661f4a59 Merge pull request #11245 from erik-krogh/rb-redosMod
Ruby: use the shared regex pack
2022-11-21 15:34:20 +01:00
Tony Torralba
01dcf6a9ac Merge pull request #11340 from atorralba/atorralba/disabled-poms
Java: Handle disabled Maven repositories
2022-11-21 15:31:53 +01:00
Taus
a385e87273 Python: Add change note for module resolution
Also adapts the version-specific tests to support results specific to
Python 2 (though at the moment there are no such tests).
2022-11-21 14:29:39 +00:00
Tony Torralba
5000a14451 Add change note 2022-11-21 15:22:26 +01:00
Mathias Vorreiter Pedersen
fcd9dd0be4 Update cpp/ql/lib/change-notes/2022-11-16-must-flow.md
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2022-11-21 14:18:20 +00:00
Taus
8f4eb7107a Merge pull request #10861 from tausbn/python-clean-up-import-resolution
Python: Clean up import resolution
2022-11-21 15:18:08 +01:00
erik-krogh
57a7f89485 change merge-base to merge_base 2022-11-21 15:15:12 +01:00
Tony Torralba
57656d0a7e Fix a couple of java.nio.file.Path(s) MaD rows 2022-11-21 15:14:02 +01:00
erik-krogh
f50778ae26 Ruby: set ram usage to 52GB in the qltest workflow 2022-11-21 15:02:14 +01:00
erik-krogh
a9c95a3230 ruby: delete the path requirement when running qltest on branches 2022-11-21 14:39:56 +01:00
erik-krogh
4af8d5769a use compilation cache in ruby qltest 2022-11-21 14:35:12 +01:00
erik-krogh
24a973e545 run ruby qltest on a single XL worker 2022-11-21 14:35:12 +01:00
erik-krogh
af58329931 split saving the compilation cache into a shared workflow 2022-11-21 14:35:10 +01:00
Tom Hvitved
d189ba52c0 Merge pull request #11341 from hvitved/cfg/multi-edge-workaround
CFG: Workaround in test output for origin/target pairs with multiple edges
2022-11-21 14:34:17 +01:00
Jeroen Ketema
78ad9ba60f Merge pull request #11262 from rdmarsh2/rdmarsh2/cpp/deprecate-ast-gvn
C++: deprecate AST-based GVN
2022-11-21 13:38:54 +01:00
Tom Hvitved
f7fc61e39d Merge pull request #11336 from hvitved/ruby/ci-check-undefined-labels
Ruby: Add `--check-undefined-labels` to QL test job
2022-11-21 13:36:52 +01:00
AlexDenisov
6f52fe81d1 Merge pull request #11331 from github/redsun82/swift-codegen-skip-unchanged
Swift: skip QL code generation on untouched files
2022-11-21 13:34:41 +01:00
Tom Hvitved
0d89f57680 Swift: Update expected test output 2022-11-21 12:55:40 +01:00
Tom Hvitved
2fac505221 Ruby: Update expected test output 2022-11-21 12:52:27 +01:00
Gustav
256d8547c1 Fix copy-paste error 2022-11-21 12:29:16 +01:00
Nora Dimitrijević
61de07e53f Merge branch 'main' into swift/js-injection 2022-11-21 12:15:00 +01:00
Tom Hvitved
e7ed056b6f Sync files 2022-11-21 12:00:36 +01:00
Tom Hvitved
8c9431d278 CFG: Workaround in test output for source/sink pairs with multiple edges 2022-11-21 11:58:59 +01:00
Jeroen Ketema
752bc2e980 C++: Accept test changes after AST-based GVN deprecation 2022-11-21 11:45:09 +01:00
Tony Torralba
aa2c7426ad Add change note 2022-11-21 11:42:40 +01:00
Erik Krogh Kristensen
b6dd388bdb Merge pull request #11328 from erik-krogh/removeQlCompCheck
QL/RB: delete language specific codeql query compile checks
2022-11-21 10:51:52 +01:00
Tony Torralba
2809c3a77c Handle disabled Maven repositories 2022-11-21 10:11:57 +01:00
Anders Fugmann
26866a7337 Swift: set @github/codeql-swift as owner 2022-11-21 09:58:12 +01:00
Tom Hvitved
99e70e9a50 Data flow: Sync files 2022-11-20 10:19:23 +01:00
Tom Hvitved
a3a3b46d54 Data flow: Account for return nodes with multiple return kinds when restricting flow through
For example, flow out via parameters allows for return nodes with multiple
return kinds:

```csharp
void SetXOrY(C x, C y, bool b)
{
    C c = x;
    if (b)
        c = y;
    c.Field = taint; // post-update node for `c` has two return kinds
}
```
2022-11-20 10:18:46 +01:00
Tom Hvitved
5adf10fcba Data flow: Add return context to pruning stages 2-4 2022-11-20 10:18:46 +01:00
Tom Hvitved
ca17c5b053 Data flow: Add summary context to pruning stages 2-4 2022-11-20 10:18:40 +01:00
Tom Hvitved
1dbcf8eb10 Ruby: Add --check-undefined-labels to QL test job 2022-11-20 10:16:35 +01:00
erik-krogh
41e8170d59 delete the rest of the qlcompile job in Ruby 2022-11-19 11:16:24 +01:00
Erik Krogh Kristensen
a69524f7b4 Merge pull request #11318 from erik-krogh/deleteMoreDeps
delete old deprecations
2022-11-19 11:15:12 +01:00
tiferet
8d22fd25f1 Suggestions from code review 2022-11-18 15:57:46 -08:00
Porcupiney Hairs
db231a111c Python : Improve the PAM authentication bypass query
The current PAM auth bypass query which was contributed by me a few months back, alert on a vulenrable function but does not check if the function is actually function. This leads to a lot of fasle positives.

With this PR, I add a taint-tracking configuration to check if the username parameter can actually be supplied by an attacker.

This should bring the FP's significantly down.
2022-11-19 01:29:25 +05:30
Henry Mercer
a964325724 Merge pull request #11332 from sigfaulterror/patch-1
Update analyzing-databases-with-the-codeql-cli.rst
2022-11-18 18:47:14 +00:00
sigfaulterror
a97570be63 Update analyzing-databases-with-the-codeql-cli.rst
just small doc error
2022-11-18 18:54:03 +01:00
Paolo Tranquilli
aaa96b20ed Swift: fix python compatibility with CI 2022-11-18 17:51:20 +01:00
Mathias Vorreiter Pedersen
4478ac2c17 C++: Add change note. 2022-11-18 16:43:34 +00:00
Mathias Vorreiter Pedersen
ef6b85fa77 C++: Accept test changes. 2022-11-18 16:43:30 +00:00
Mathias Vorreiter Pedersen
b748ed8f43 C++: Repair the 'MustFlow' library. 2022-11-18 16:41:32 +00:00
Paolo Tranquilli
6dcdf8c71f Swift: fix bazel setup 2022-11-18 17:22:44 +01:00
Paolo Tranquilli
aeb7b0d050 Swift: remove ModifiedStubMarkedAsGeneratedError 2022-11-18 17:13:12 +01:00
Nora Dimitrijević
8f5af3fca6 Merge branch 'main' into swift/js-injection 2022-11-18 17:07:20 +01:00
Paolo Tranquilli
2cd58817d7 Swift: skip QL code generation on untouched files
This is a developer QoL improvement, where running codegen will skip
writing (and especially formatting) any files that were not changed.

**Why?** While code generation in itself was pretty much instant, QL
formatting of generated code was starting to take a long time. This made
unconditionally running codegen quite annoying, for example before each
test run as part of an IDE workflow or as part of the pre-commit hook.

**How?** This was not completely straightforward as we could not work
with the contents of the file prior to code generation as that was
already post-processed by the QL formatting, so we had no chance of
comparing the output of template rendering with that. We therefore store
the hashes of the files _prior_ to QL formatting in a checked-in file
(`swift/ql/.generated.list`). We can therefore load those hashes at
the beginning of code generation, use them to compare the template
rendering output and update them in this special registry file.

**What else?** We also extend this mechanism to detect accidental
modification of generated files in a more robust way. Before this patch,
we were doing it with a rough regexp based heuristic. Now, we just store
the hashes of the files _after_ QL formatting in the same checked file,
so we can check that and stop generation if a generated file was
modified, or a stub was modified without removing the `// generated`
header.
2022-11-18 16:56:01 +01:00
Taus
07969260c8 Merge pull request #11132 from erik-krogh/parentQl
QL: fix non-attached annotations for newtype branches
2022-11-18 15:45:02 +01:00
Chris Smowton
f589ba8b9c Merge pull request #11327 from github/post-release-prep/codeql-cli-2.11.4
Post-release preparation for codeql-cli-2.11.4
2022-11-18 14:42:51 +00:00
Taus
d79eed533b Python: Remove unwanted recursion
Depending on `localFlowStep` meant that this predicate ended up being
recursive with itself (by way of flow summaries which depend on API
graphs, which in turn depend on import resolution).

Changing this to use the simple local flow step predicate that we use
for type tracking should fix this issue.
2022-11-18 13:50:50 +00:00
erik-krogh
3cdfed9483 CI: delete language specific codeql query compile checks 2022-11-18 14:41:29 +01:00
Erik Krogh Kristensen
e777934290 Merge pull request #11316 from erik-krogh/examplesComp
CI: Also compile the `examples` folder
2022-11-18 12:29:03 +01:00
github-actions[bot]
5b14ebf22a Post-release preparation for codeql-cli-2.11.4 2022-11-18 11:26:00 +00:00
Geoffrey White
2cf302f9df Merge branch 'main' into alamofire2 2022-11-18 10:48:53 +00:00
erik-krogh
7c091fa6cd also compile the examples folders as part of the compilation check 2022-11-18 10:31:42 +01:00
erik-krogh
23dc977d48 add a severity to incompleteswitchoverenum.ql to fix a compiler warning 2022-11-18 10:29:42 +01:00
Geoffrey White
16a84bd94a Merge branch 'main' into alamofire2 2022-11-18 09:28:46 +00:00
Alvaro Muñoz
8a27660615 change handler function name 2022-11-18 09:43:17 +01:00
Alvaro Muñoz
69ecbda133 add change note 2022-11-18 09:43:17 +01:00
Alvaro Muñoz
7496b61b8d Add rsync since both --rsh and --rsync-path admit commands 2022-11-18 09:43:17 +01:00
Harry Maclean
376d4e03a1 Ruby: Cache some barrier guard predicates 2022-11-18 18:17:02 +13:00
Harry Maclean
5deb16e58c Ruby: Remove redundant predicate
The existing barrier guard machinery recognises guards such as `if x and y`,
so there's no need to explicitly model them.
2022-11-18 18:14:55 +13:00
Taus
e76ab8c78c Merge branch 'main' into python-clean-up-import-resolution 2022-11-17 22:47:50 +00:00
erik-krogh
468a879c1f Python: delete dead code. thanks QL-for-QL 2022-11-17 22:12:51 +01:00
erik-krogh
ba2734909f JS: don't use deprecated files in tests 2022-11-17 22:12:50 +01:00
erik-krogh
3635db8244 JS: delete the deprecated [queryName].qll files 2022-11-17 22:12:50 +01:00
erik-krogh
635b8772d7 JS: delete old deprecations 2022-11-17 22:12:50 +01:00
erik-krogh
e491b61e09 Python: move the contents of PEP249Impl to PEP249, which is possible now that the deprecations have been deleted 2022-11-17 22:12:50 +01:00
erik-krogh
a7ba693ccb Python: delete old deprecations 2022-11-17 22:12:50 +01:00
erik-krogh
a4e5d752e1 Java: delete old deprecations 2022-11-17 22:12:50 +01:00
erik-krogh
d5ec781d4c C#: delete old deprecations 2022-11-17 22:12:50 +01:00
erik-krogh
a5a244fc53 CPP: delete old deprecations 2022-11-17 22:12:50 +01:00
Chris Smowton
e83cc59cba Merge pull request #11296 from smowton/smowton/fix/kotlin-string-literal-formatting
Kotlin: format string literals like the Java annotaton extractor
2022-11-17 20:04:09 +00:00
Chris Smowton
29c47ad515 Merge pull request #11320 from github/release-prep/2.11.4
Release preparation for version 2.11.4
2022-11-17 18:57:14 +00:00
Geoffrey White
2780d9a9a3 Merge branch 'main' into optionals2 2022-11-17 18:16:46 +00:00
Chris Smowton
cf34dbd276 Kotlin: format string literals like the Java annotaton extractor
Java's regular strings are formatted as they appear in source, but we don't easily have this information available in Kotlin. During annotation extraction however it guesses a source rendering because the source is not necessarily available. By formatting to match the annotation extractor, we prepare to ensure consistency with a Java database
when extracting annotations as seen by Kotlin.
2022-11-17 17:28:17 +00:00
Nora Dimitrijević
8b332778e3 Swift: update @security-severity 2022-11-17 18:08:06 +01:00
Chris Smowton
0deb2d4c5f Copyedit Python release notes 2022-11-17 17:03:09 +00:00
Chris Smowton
63fcbb5969 Copyedit Python release notes 2022-11-17 17:02:55 +00:00
Chris Smowton
0219c2b02b Copyedit Javascript changelog 2022-11-17 17:02:01 +00:00
Chris Smowton
80b2f0d3cd Coopyedit Javascript changelog 2022-11-17 17:01:43 +00:00
Chris Smowton
d45c35a02e Copyedit the Java src qlpack 0.4.4 release nnotes 2022-11-17 16:57:08 +00:00
Chris Smowton
47f07d83b8 Copyedit Java src qlpack changelog 2022-11-17 16:56:39 +00:00
Chris Smowton
e13eb79f5b Java: edit 0.4.4 release notes to match the changelog 2022-11-17 16:55:26 +00:00
Chris Smowton
2bd151ba9c Copyedit Java changelog 2022-11-17 16:54:33 +00:00
Chris Smowton
7c74350d5e Copyedit Java changelog 2022-11-17 16:51:21 +00:00
github-actions[bot]
e105c13e77 Release preparation for version 2.11.4 2022-11-17 16:40:45 +00:00
Arthur Baars
4e88b8453a Ruby: add flow summary for Enumerable#index_with 2022-11-17 16:22:32 +01:00
Owen Mansel-Chan
ac54da7d93 Merge pull request #11002 from owen-mc/dataflow/sync-go-libraries
Update go libraries to 55e052a
2022-11-17 15:22:31 +00:00
Owen Mansel-Chan
4073d77635 Add change notes 2022-11-17 14:27:07 +00:00
Owen Mansel-Chan
ab15a19028 Address review comments 2022-11-17 14:27:07 +00:00
Owen Mansel-Chan
166a3688f8 Use standard variable names for hasLocationInfo
This makes them match the QLDoc and also other implementations of
`hasLocationInfo`.
2022-11-17 14:27:07 +00:00
Owen Mansel-Chan
1a65a27fde Update test expectations
In https://github.com/github/codeql/pull/8641, `localFlowExit` was
changed to use `Stage2::readStepCand` instead of `read`, which means
that the big-step relation is broken up less. This causes test result
changes. Nothing is lost from the `select` clause, but some results may
have fewer paths, and fewer nodes and edges are output in the test
results.
2022-11-17 14:27:06 +00:00
Owen Mansel-Chan
71aeeee7c8 Accept trivial change to test output
In the `subpaths` section, the last node is now printed without its type
if it is the sink of the path.

This comes from the commit "Dataflow: Bugfix: include subpaths ending at
a sink. " in https://github.com/github/codeql/pull/7526
2022-11-17 14:27:06 +00:00
Owen Mansel-Chan
f2e2c02db6 Rename predicates to avoid clashes 2022-11-17 14:27:06 +00:00
Owen Mansel-Chan
1718ef88be Data flow: Inline local(Expr)?(Flow|Taint)
See https://github.com/github/codeql/pull/7791
2022-11-17 14:27:05 +00:00
Owen Mansel-Chan
736435adda Go: Add stub expectsContent
Corresponds to https://github.com/github/codeql/pull/8870
2022-11-17 14:27:05 +00:00
Owen Mansel-Chan
50210a9d24 Go: ParameterPosition and ArgumentPosition
Corresponds to https://github.com/github/codeql/pull/7260, though some
of those changes had already been made.
2022-11-17 14:27:05 +00:00
Owen Mansel-Chan
83a3af2fff Go: Summarized Callable
Corresponds to https://github.com/github/codeql/pull/9270
2022-11-17 14:27:04 +00:00
Owen Mansel-Chan
10ed4ad3df Go: Split summaryThroughStep into two predicates
Cf. https://github.com/github/codeql/pull/9195
2022-11-17 14:27:04 +00:00
Owen Mansel-Chan
1ee5d3e80e Move ParameterPosition etc to DataflowDispatch.qll 2022-11-17 14:27:04 +00:00
Owen Mansel-Chan
e5829201e1 Go: Implement ContentSet 2022-11-17 14:27:03 +00:00
Owen Mansel-Chan
282699e5b5 Go: Refactor SummarizedCallable.
Equivalent of https://github.com/github/codeql/pull/9210
2022-11-17 14:27:03 +00:00
Owen Mansel-Chan
c768f04e32 Go: Introduce generated flag as a part of the kind column for flow summaries
Equivalent of https://github.com/github/codeql/pull/8628
2022-11-17 14:27:03 +00:00
Owen Mansel-Chan
dae60c9deb Update data flow libraries to 55e052af26 2022-11-17 14:27:02 +00:00
Taus
811426c586 Python: Remove manual magic entirely
This was causing issues with imports with many "dots" in the name.

Previously, the test added in this commit would not have the desired
result for the `check` call.
2022-11-17 14:15:55 +00:00
Tom Hvitved
9f13cdadcb C#: Add use-use stress test 2022-11-17 13:42:56 +01:00
Chris Smowton
254a5b0928 Merge pull request #11293 from smowton/smowton/admin/exclude-kotlin-metadata-annotation
Java: Remove no-longer-needed expected diagnostics
2022-11-17 11:50:21 +00:00
Tom Hvitved
bbcef98e06 Merge pull request #11317 from hvitved/cpp/update-autobuilder-nuget-packages
C++: Update auto-builder nuget packages
2022-11-17 12:38:26 +01:00
Tamás Vajk
d8b5a04f97 Merge pull request #11291 from tamasvajk/kotlin-confusing-overload
Kotlin: Add test case for confusing overloading query
2022-11-17 11:11:33 +01:00
Tamás Vajk
c92989ca04 Merge pull request #11289 from tamasvajk/kotlin-empty-block
Kotlin: Exclude .kt files from empty block query
2022-11-17 11:11:25 +01:00
Chris Smowton
659f86cecf Merge pull request #11310 from tamasvajk/kotlin-dead-code
Kotlin: Exclude .kt files from dead code queries
2022-11-17 10:10:51 +00:00
Chris Smowton
95fdea8b77 Merge pull request #11308 from tamasvajk/kotlin-non-serializable-field
Kotlin: Exclude .kt files from non serializable field query
2022-11-17 10:10:05 +00:00
Chris Smowton
11188304a7 Merge pull request #11306 from tamasvajk/kotlin-equals-missing
Kotlin: Exclude .kt files from missing `instanceof` in `equals` query
2022-11-17 10:09:35 +00:00
Tom Hvitved
780297152c C#: Downgrade Microsoft.Build nuget package
17.4.0 does not officially support .NET 6 (it supports .NET 7), so downgrade
to avoid warnings.
2022-11-17 11:00:25 +01:00
Tom Hvitved
5ab77600b8 C++: Update auto-builder nuget packages 2022-11-17 10:44:23 +01:00
Erik Krogh Kristensen
45d4318e0e Merge pull request #11272 from erik-krogh/clean-cache
CI: clean up the cache when compiling on main
2022-11-17 10:37:08 +01:00
Tom Hvitved
f24fa402f3 Adjust CFG 2022-11-17 10:32:28 +01:00
Erik Krogh Kristensen
ba894e21e8 Merge pull request #11146 from mbaluda-org/main
JS: Improved Hapi support
2022-11-17 10:22:48 +01:00
Mauro Baluda
a7dc29bad4 Merge branch 'main' into main 2022-11-16 23:53:16 +01:00
Mauro Baluda
49f476d3b4 Update javascript/ql/lib/semmle/javascript/frameworks/Hapi.qll
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2022-11-16 23:53:07 +01:00
Taus
8ed8161d5c Python: Fix tests for Python 2
This should make it so that the `prints3` tag is skipped when running
then Python 2 Language tests.
2022-11-16 22:20:08 +00:00
tiferet
4a1382925e Remove some imports that are no longer used 2022-11-16 14:01:16 -08:00
yoff
505f454878 Apply suggestions from code review
Co-authored-by: Rasmus Wriedt Larsen <rasmuswl@github.com>
2022-11-16 22:20:19 +01:00
tiferet
ccbf1ca2a9 Add a comment 2022-11-16 13:05:06 -08:00
tiferet
38c40a7192 isEffectiveSink can't be final because ExtractMisclassifiedEndpointFeatures overrides it. 2022-11-16 12:12:50 -08:00
tiferet
8fee9cb0d5 Fix CodeQL warnings 2022-11-16 12:06:52 -08:00
Taus
81348049df Python: Fix missing module resolution
This was due to bad manual magic: restricting the attribute name makes
sense when we're talking about submodules of a package, but it doesn't
when we're talking about reexported modules.

Also (hopefully) fixes the tests so that the Python 3-specific bits are
ignored under Python 2.
2022-11-16 19:58:32 +00:00
tiferet
c2035e85d2 Be explicit in requiring that each ATM config set its endpoint type. 2022-11-16 11:55:23 -08:00
tiferet
0fd013f9fd Update the reason names in FilteredTruePositives.expected.
This is needed because we changed the names of three endpoint filters that were all called "not a direct argument to a likely external library call or a heuristic sink" in order to disambiguate them (fc56c5a022).
2022-11-16 11:54:10 -08:00
tiferet
eab270eb84 Move the definitions of isEffectiveSink and getAReasonSinkExcluded to the base class.
They can now be implemented generically for all sink types.
2022-11-16 11:47:24 -08:00
erik-krogh
de2ebe3618 QL: fix the same QLDoc being QLDoc for multiple things 2022-11-16 20:35:39 +01:00
Harry Maclean
a6f6936719 Merge pull request #11058 from hmac/actioncontroller-logger
Ruby: Model various ActionController methods
2022-11-17 08:21:00 +13:00
tiferet
fc56c5a022 Implement the type-specific endpoint filters as EndpointCharacteristics.
Also disambiguate three filters from three different sink types that all have the same name, "not a direct argument to a likely external library call or a heuristic sink".
2022-11-16 11:14:25 -08:00
Tom Hvitved
baaafadeb0 Merge pull request #11266 from hvitved/csharp/update-nuget-packages
C#: Update all nuget packages
2022-11-16 19:53:45 +01:00
Taus
19261ecfbf Python: Remove spurious module references 2022-11-16 18:19:54 +00:00
Taus
2717b9a47d Python: Extend import resolution tests
Extends the tests to

1. Account parts of the test code that may be specific to Python 2 or 3,
2. Also track which arguments passed to `check` are references to
   modules.

The latter revealed a bunch of spurious results, which I have annotated
accordingly.
2022-11-16 17:58:24 +00:00
Tamás Vajk
b70a9d172b Merge pull request #11304 from tamasvajk/kotlin-mut-dep
Kotlin: Exclude .kt files from mutual dependency query
2022-11-16 17:02:46 +01:00
Tamás Vajk
ae38d5d8b7 Merge pull request #11303 from tamasvajk/kotlin-one-stmt-line
Kotlin: Exclude .kt files from one stmt in line query
2022-11-16 17:02:35 +01:00
Mathias Vorreiter Pedersen
2796c46598 Merge pull request #11292 from github/redsun82/swift-remove-ipa-from-dbscheme-cpp
Swift: remove synthesized classes from the dbscheme
2022-11-16 16:00:58 +00:00
Paolo Tranquilli
1c69a1f012 Swift: fix typo in docstring 2022-11-16 16:36:48 +01:00
Paolo Tranquilli
27df44f5ad Swift: replace empty IpaInfo() with a clearer True value 2022-11-16 16:35:17 +01:00
Joe Farebrother
d6c5132f39 Merge pull request #10684 from joefarebrother/android-keyboard-cache
Java: Add query for Sensitive Keyboard Cache
2022-11-16 15:27:44 +00:00
Tamás Vajk
dfc72edba2 Merge pull request #11302 from tamasvajk/kotlin-ignored-return
Kotlin: Exclude .kt files from ignored return value query
2022-11-16 16:23:58 +01:00
Tamás Vajk
ad7c0f9ebc Merge pull request #11301 from tamasvajk/kotlin-naming-ref-type
Kotlin: Exclude .kt files from misnamed reftype query
2022-11-16 16:22:40 +01:00
Tamás Vajk
a3ff83595a Merge pull request #11300 from tamasvajk/kotlin-useless-param-2
Kotlin: Exclude .kt files from useless parameter query
2022-11-16 16:22:27 +01:00
Tamás Vajk
b4b8649fd6 Merge pull request #11299 from tamasvajk/kotlin-nested-serializable
Kotlin: Exclude .kt files from serializable inner class query
2022-11-16 16:22:13 +01:00
Tamas Vajk
8b6bf910ba Kotlin: Exclude .kt files from dead code queries 2022-11-16 16:20:09 +01:00
Tamas Vajk
983851fc60 Kotlin: Add FP test case for dead code queries 2022-11-16 16:18:37 +01:00
erik-krogh
e4b0d8dbf3 simplify the copy-logic, because cp -r actually creates the folders 2022-11-16 16:10:41 +01:00
Rasmus Wriedt Larsen
3894fad54d Merge pull request #11307 from github/RasmusWL/ql-style-no-return
ql-style-guide: Remove use of `return`
2022-11-16 15:39:35 +01:00
Tom Hvitved
7cab6b5491 C#: Include SSA "phi reads" in DataFlow::Node 2022-11-16 15:31:01 +01:00
Tamas Vajk
7d9ce53080 Kotlin: Exclude .kt files from non serializable field query 2022-11-16 15:30:25 +01:00
Tamas Vajk
a9023d06d0 Kotlin: Add FP test case for non serializable field query 2022-11-16 15:29:24 +01:00
Rasmus Wriedt Larsen
9f2d89c903 Update ql-style-guide.md
Our [QLDoc style guide](https://github.com/github/codeql/blob/main/docs/qldoc-style-guide.md#predicates-with-result) says that we should avoid any use of `return`, so it would be smart to also do so in our own style guide for predicate names 😊
2022-11-16 15:27:38 +01:00
Tamas Vajk
fc614ad4d0 Kotlin: Exclude .kt files from missing instanceof in equals query 2022-11-16 15:24:47 +01:00
Tamas Vajk
b6978128b1 Exclude .kt files from mutual dependency query 2022-11-16 15:16:51 +01:00
Tamas Vajk
63e9ae3b93 Kotlin: Add FP test case for mutual dependency query 2022-11-16 15:16:18 +01:00
Tom Hvitved
67b6a82cf1 Merge pull request #11198 from hvitved/ssa/expose-phi-reads
SSA: Expose phi-read nodes
2022-11-16 15:11:58 +01:00
Tamas Vajk
c9241cc933 Exclude .kt files from one stmt in line query 2022-11-16 15:11:38 +01:00
Tamas Vajk
0d70b5c776 Kotlin: Add FP test case for one stmt in line query 2022-11-16 15:10:38 +01:00
Tamas Vajk
c42663723f Exclude .kt files from ignored return value query 2022-11-16 15:05:29 +01:00
Tamas Vajk
5f6f72ba8e Kotlin: Add FP test case for ignored return value query 2022-11-16 15:05:07 +01:00
Tamas Vajk
c1be93a34c Exclude .kt files from misnamed reftype query 2022-11-16 14:59:20 +01:00
Tamas Vajk
e547be5e9a Kotlin: Add FP test case for misnamed reftype query 2022-11-16 14:58:36 +01:00
Tamas Vajk
48c37a2c0f Exclude .kt files from useless parameter query 2022-11-16 14:51:49 +01:00
Tamas Vajk
35078738bc Kotlin: Add FP test case for useless parameter query 2022-11-16 14:51:21 +01:00
Chris Smowton
d6a395ba37 Remove non-longer-needed expected diagnostics 2022-11-16 13:49:59 +00:00
Chris Smowton
6c0bef7e6e Merge pull request #11297 from erik-krogh/add-stats
JS: add stats for @satisfies_expr
2022-11-16 13:49:25 +00:00
Tamas Vajk
7a0e248096 Exclude .kt files from serializable inner class query 2022-11-16 14:46:01 +01:00
Tamas Vajk
782c82a2d3 Kotlin: Add test case for non serializable inner class query 2022-11-16 14:44:48 +01:00
Geoffrey White
127888f3c1 Merge branch 'main' into alamofire2 2022-11-16 13:32:13 +00:00
Geoffrey White
c8630bbe4f Merge branch 'main' into optionals2 2022-11-16 13:31:08 +00:00
Tom Hvitved
54a6f066b3 Address review comment 2022-11-16 14:02:21 +01:00
Tamás Vajk
468a6f2a70 Merge pull request #11290 from tamasvajk/kotlin-autoboxing
Kotlin: Exclude .kt files from autoboxing query
2022-11-16 13:56:29 +01:00
Tamás Vajk
266a0874b5 Merge pull request #11284 from tamasvajk/kotlin-complex-bool-expr
Kotlin: Exclude .kt files from `java/complex-boolean-expression`
2022-11-16 13:55:30 +01:00
Tamás Vajk
91b7798be8 Merge pull request #11286 from tamasvajk/kotlin-resource-leak
Kotlin: Exclude .kt files from resource leak queries
2022-11-16 13:55:12 +01:00
erik-krogh
76c6943159 add stats for @satisfies_expr 2022-11-16 13:48:41 +01:00
erik-krogh
25b32860ba Py: convert a block-comment that could be QLDoc to QLDoc 2022-11-16 13:45:37 +01:00
erik-krogh
fe49e41d7b JS: convert some block-comments that could be QLDoc to QLDoc 2022-11-16 13:45:35 +01:00
erik-krogh
9eaeaf7322 ATM: convert some block-comments that could be QLDoc to QLDoc 2022-11-16 13:41:52 +01:00
erik-krogh
7331363618 Java: convert some block-comments that could be QLDoc to QLDoc 2022-11-16 13:40:15 +01:00
erik-krogh
6bfaf3b2f7 C#: convert some block-comments that could be QLDoc to QLDoc 2022-11-16 13:39:33 +01:00
erik-krogh
20c4699478 CPP: convert some block-comments that could be QLDoc to QLDoc 2022-11-16 13:39:22 +01:00
erik-krogh
78c9fb3d76 QL: don't flag up comments placed on the same line as non-comments 2022-11-16 13:36:28 +01:00
Tom Hvitved
67e8ec1a5f Swift: Update expected test output 2022-11-16 13:36:03 +01:00
Arthur Baars
6fb014b34d "CodeQL False positive" -> "CodeQL false positive" 2022-11-16 13:09:47 +01:00
Arthur Baars
bfb0ca7968 Merge pull request #11276 from aibaars/false-positive
CodeQL: add 'False positive' issue template
2022-11-16 13:00:14 +01:00
Arthur Baars
f0c3d039a1 Merge pull request #11227 from github/sj/remove-LGTM-issue-template
Remove issue template for LGTM.com false positive reports
2022-11-16 12:59:59 +01:00
Anders Schack-Mulligen
94bca4399a Merge pull request #11183 from aschackmull/dataflow/groupflow
Dataflow: Introduce support for src/sink grouping in path results.
2022-11-16 12:59:01 +01:00
erik-krogh
f2222d32db QL: add test 2022-11-16 12:51:57 +01:00
erik-krogh
f71359c81d QL: detect toplevel block-comments that should be QLDoc 2022-11-16 12:51:53 +01:00
erik-krogh
de082260d8 QL: fixup getQLDoc() 2022-11-16 12:51:51 +01:00
Erik Krogh Kristensen
7d4ea47611 Merge pull request #10855 from erik-krogh/formatTaint
Ruby: taint-steps for printf calls - and add a `AdditionalTaintStep` class
2022-11-16 12:08:45 +01:00
Mauro Baluda
8bf0bbb715 code generalization
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2022-11-16 12:06:23 +01:00
Mauro Baluda
798b03f29d code generalization
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2022-11-16 12:06:07 +01:00
Paolo Tranquilli
bafb9ae020 Swift: add upgrade/downgrade scripts 2022-11-16 12:00:26 +01:00
Tamas Vajk
55dc929a1f Kotlin: Add test case for confusing overloading query 2022-11-16 11:57:05 +01:00
Joe Farebrother
cc960377ac Apply suggestion from docs review
Co-authored-by: Sam Browning <106113886+sabrowning1@users.noreply.github.com>
2022-11-16 10:54:14 +00:00
Joe Farebrother
255123cbf9 Apply suggestions from docs review
Co-authored-by: Sam Browning <106113886+sabrowning1@users.noreply.github.com>
2022-11-16 10:54:14 +00:00
Joe Farebrother
7ae41ff165 Invert the xml logic to be consistent with the dataflow logic 2022-11-16 10:54:14 +00:00
Joe Farebrother
6d465aaf52 Apply code review suggestions 2022-11-16 10:54:14 +00:00
Joe Farebrother
63f715e650 fix implicit this 2022-11-16 10:54:14 +00:00
Joe Farebrother
dd4e1d0ac3 Add tests and fix issues 2022-11-16 10:54:14 +00:00
Joe Farebrother
10a3b3bd14 Cover cases in which input type is set via code 2022-11-16 10:54:14 +00:00
Joe Farebrother
359d703ded More precise layout xml handling 2022-11-16 10:54:13 +00:00
Joe Farebrother
f48b57c95a Apply review suggestions 2022-11-16 10:54:13 +00:00
Joe Farebrother
e6dd3673a1 Fix qldoc 2022-11-16 10:54:13 +00:00
Joe Farebrother
b4216767ad Add change note 2022-11-16 10:54:13 +00:00
Joe Farebrother
775a5507a6 Add security severity 2022-11-16 10:54:13 +00:00
Joe Farebrother
c085c1f3ad Fix typos 2022-11-16 10:54:13 +00:00
Joe Farebrother
0bce1894ae Remove redundant import 2022-11-16 10:54:13 +00:00
Joe Farebrother
92190e5095 Add docs 2022-11-16 10:54:13 +00:00
Joe Farebrother
706858e211 Add test cases; fix the regex used 2022-11-16 10:54:13 +00:00
Joe Farebrother
85fe226256 Add sensitive keyboard cache query 2022-11-16 10:54:13 +00:00
Tamas Vajk
3d21f89f1d Exclude .kt files from autoboxing query 2022-11-16 11:52:17 +01:00
Tamas Vajk
0d9e28012e Kotlin: Add FP test cases for autoboxing query 2022-11-16 11:51:36 +01:00
Tamas Vajk
3d11e5bb32 Exclude .kt files from empty block query 2022-11-16 11:47:35 +01:00
Tamas Vajk
c91e20c6b5 Kotlin: Add FP test cases for empty blocks 2022-11-16 11:47:07 +01:00
Paolo Tranquilli
a3d33e27e2 Swift: ignore IPA classes in dbscheme 2022-11-16 11:39:10 +01:00
Joe Farebrother
3ebb7cfa1b Merge pull request #11269 from joefarebrother/stub-gen-invalid-ids
Java: Stub generator: Exclude invalid identifiers from generated stubs
2022-11-16 10:26:22 +00:00
Paolo Tranquilli
88a0c4053b Swift: move hierarchy IPA logic to schema.py 2022-11-16 11:14:17 +01:00
Mauro Baluda
784475dd66 Merge branch 'main' into main 2022-11-16 11:06:27 +01:00
Mauro Baluda
84cb59b942 Create 2022-11-08-hapi-glue.md 2022-11-16 11:05:23 +01:00
AlexDenisov
0c14759e86 Merge pull request #11285 from github/redsun82/swift-fix-generated-artifact
Swift: fix path of generated C++ files artifact
2022-11-16 10:47:01 +01:00
Paolo Tranquilli
6d1421a6f9 Swift: fix workflow mention in CODEOWNERS 2022-11-16 10:04:19 +01:00
Tamas Vajk
307d2d5dc1 Exclude .kt files from resource leak queries 2022-11-16 09:52:39 +01:00
Tamas Vajk
acab8e8632 Kotlin: Add FP test cases for resource leaks 2022-11-16 09:52:13 +01:00
Paolo Tranquilli
d4f3e38062 Swift: fix path of generated C++ files artifact 2022-11-16 09:49:57 +01:00
Tamas Vajk
ac85d2eb3e Exclude .kt files from java/complex-boolean-expression 2022-11-16 09:38:42 +01:00
Tamas Vajk
de833d620e Kotlin: Add FP test case for unnecessarily complex bool expression 2022-11-16 09:35:18 +01:00
Ed Minnix
38d47d63ec Java: Add change note for addJavascriptInterface query 2022-11-15 23:40:03 -05:00
Ed Minnix
eb8ef72e47 Java: addJavascriptInterface query test case 2022-11-15 23:28:18 -05:00
Ed Minnix
3b96fefc71 Java: Add Android stubs to options file for CWE-079 test cases 2022-11-15 23:26:49 -05:00
tiferet
13cb0ab554 Fix CodeQL warning 2022-11-15 17:32:30 -08:00
tiferet
2ecdfd1ff6 Delete some code that's no longer in use 2022-11-15 17:29:03 -08:00
tiferet
fedb98ddb5 Implement the standard getAReasonSinkExcluded using StandardEndpointFilterCharacteristics 2022-11-15 17:22:00 -08:00
tiferet
cf4e37a0ab Implement the standard endpoint filters as EndpointCharacteristics 2022-11-15 17:20:20 -08:00
tiferet
cb632b3534 Delete the file ExtractEndpointData.expected which was leftover in the last PR 2022-11-15 17:11:34 -08:00
Harry Maclean
ed3270fb04 Ruby: Update for upstream changes 2022-11-16 14:06:32 +13:00
Harry Maclean
2e2fcd49bf Ruby: Consider Object#inspect a log sanitizer
The behaviour of `Object#inspect` depends on whether it has been
overridden by a subclass, but it will typically produce output on a
single line. Calling `inspect` on a String will replace newlines with
`\n`, which is then safe for interpolation into a log line.
2022-11-16 13:46:51 +13:00
Harry Maclean
762ebad66e Ruby: Add change note 2022-11-16 13:46:51 +13:00
Harry Maclean
d0521f15f1 Ruby: Update tests 2022-11-16 13:46:51 +13:00
Harry Maclean
d2c0250b41 Ruby: Model ActionDispatch::Request#body_stream 2022-11-16 13:46:51 +13:00
Harry Maclean
9f357837fa Ruby: Model send_data as an HTTP response 2022-11-16 13:46:51 +13:00
Harry Maclean
5cfc494e16 Ruby: Test render inside redirect_to
This test shows that we correctly identify redirect_to and render calls
inside respond_to blocks.
2022-11-16 13:46:51 +13:00
Harry Maclean
155b64d3fc Ruby: Add test for render calls 2022-11-16 13:46:51 +13:00
Harry Maclean
b7e14311be Ruby: Model ActionController logger 2022-11-16 13:46:50 +13:00
Harry Maclean
27681ac987 Ruby: Move ActionController tests to own directory 2022-11-16 13:46:49 +13:00
Erik Krogh Kristensen
c70f3d35d0 Merge pull request #11256 from erik-krogh/ts49
JS: Add support for TypeScript 4.9
2022-11-16 01:05:40 +01:00
Mauro Baluda
ec04f0c88f hapi/glue tests 2022-11-15 23:45:27 +01:00
erik-krogh
8cb68b79c1 bump extractor version 2022-11-15 22:09:09 +01:00
erik-krogh
b0b5761a8c update TS from 4.9.2-rc to 4.9.3 2022-11-15 22:08:54 +01:00
erik-krogh
364336e22a add downgrade script 2022-11-15 22:07:25 +01:00
erik-krogh
1f90f7dd4d add upgrade script 2022-11-15 22:07:25 +01:00
erik-krogh
d4c6f873af add test for auto-accessors 2022-11-15 22:07:25 +01:00
erik-krogh
65567fa1ce add test for the more precise type-narrowing with the in operator 2022-11-15 22:07:25 +01:00
erik-krogh
e98d1df5f4 add dataflow support 2022-11-15 22:07:25 +01:00
erik-krogh
a8973c1147 add test for dataflow 2022-11-15 22:07:24 +01:00
erik-krogh
75ef5b1b0b add support for satisfies-expressions 2022-11-15 22:07:24 +01:00
erik-krogh
30c66303ba initial skeleton for TypeScript 4.9 2022-11-15 22:07:24 +01:00
Nora Dimitrijević
09b669a584 Swift: Add direct call to remote source to a test
Strangely, there are two separate paths to each of the JSEvaluateScript
sinks: one passing through the JSString constructor, one omitting this
step.
2022-11-15 21:57:46 +01:00
Nora Dimitrijević
52e5d541ef Update swift/ql/src/queries/Security/CWE-094/UnsafeJsEval.qhelp
Co-authored-by: Sam Browning <106113886+sabrowning1@users.noreply.github.com>
2022-11-15 21:15:04 +01:00
Nora Dimitrijević
fccb581765 Update swift/ql/src/queries/Security/CWE-094/UnsafeJsEval.qhelp
Co-authored-by: Sam Browning <106113886+sabrowning1@users.noreply.github.com>
2022-11-15 21:14:56 +01:00
Nora Dimitrijević
cb7d9d5f3f Update swift/ql/src/queries/Security/CWE-094/UnsafeJsEval.qhelp
Co-authored-by: Sam Browning <106113886+sabrowning1@users.noreply.github.com>
2022-11-15 21:14:50 +01:00
Nora Dimitrijević
8db8f14f99 Update swift/ql/src/queries/Security/CWE-094/UnsafeJsEval.qhelp
Co-authored-by: Sam Browning <106113886+sabrowning1@users.noreply.github.com>
2022-11-15 21:14:37 +01:00
Nora Dimitrijević
b42482c960 Update swift/ql/src/queries/Security/CWE-094/UnsafeJsEval.qhelp
Co-authored-by: Sam Browning <106113886+sabrowning1@users.noreply.github.com>
2022-11-15 21:14:18 +01:00
Tiferet Gazit
710b215c38 Merge pull request #11263 from github/tiferet/extract-training-data
ATM: Extract training data
2022-11-15 12:08:13 -08:00
tiferet
fc078a47fd Apply suggestion from code review 2022-11-15 11:14:01 -08:00
Ed Minnix
013ff79d17 Java: Check the value of parameter in WebView file access query 2022-11-15 13:50:56 -05:00
Ed Minnix
10875568ec Java: add negative test cases for WebView file access query 2022-11-15 13:50:31 -05:00
Tiferet Gazit
092e019de9 Apply suggestions from code review
Co-authored-by: Stephan Brandauer <kaeluka@github.com>
2022-11-15 10:48:32 -08:00
Andrew Eisenberg
2ffb4b6480 Merge pull request #11279 from github/aeisenberg/atm-readme
Add more information about ATM queries for external users
2022-11-15 10:46:03 -08:00
Geoffrey White
e81c62e402 Swift: Correct comment. 2022-11-15 18:34:51 +00:00
Geoffrey White
7c1fb5d4a6 Swift: Add qldoc for AutoClosureExpr. 2022-11-15 18:31:30 +00:00
Geoffrey White
4eee375296 Swift: Add AutoClosureExpr.getExpr. 2022-11-15 18:31:30 +00:00
Geoffrey White
13d6deb9c4 Swift: Make similar enhancements to unary operations. 2022-11-15 18:31:30 +00:00
Geoffrey White
70075e2832 Swift: Add qldoc for BinaryExpr. 2022-11-15 18:31:21 +00:00
Andrew Eisenberg
88750a7000 Add more information about ATM queries for external users 2022-11-15 10:17:56 -08:00
Geoffrey White
3c46b0cad1 Swift: Add BinaryExpr.getOperator(). 2022-11-15 18:04:48 +00:00
Geoffrey White
fa86e75330 Update swift/ql/lib/codeql/swift/dataflow/internal/DataFlowPrivate.qll
Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
2022-11-15 17:49:23 +00:00
Ed Minnix
1d71c38a8f Java: Fix formatting of WebView file access query 2022-11-15 12:43:20 -05:00
Ed Minnix
694930556b Java: documentation cleanup 2022-11-15 12:35:57 -05:00
AlexDenisov
f069802abb Merge pull request #11277 from github/redsun82/swift-remove-ipa-from-dbscheme-cpp
Swift: remove IPA classes from `cppgen`
2022-11-15 18:34:59 +01:00
AlexDenisov
eb2f1ff559 Merge pull request #11274 from github/redsun82/swift-remove-double-newlines-in-schema
Swift: remove double newlines in schema
2022-11-15 18:34:32 +01:00
Erik Krogh Kristensen
6f4fd3ef72 Merge pull request #11175 from erik-krogh/erb
JS: extract .erb files as html
2022-11-15 18:21:48 +01:00
Arthur Baars
0ce4500b48 Apply suggestions from code review
Co-authored-by: Pierre <turbo@github.com>
2022-11-15 18:20:28 +01:00
Geoffrey White
1b6317d584 Update swift/ql/lib/codeql/swift/dataflow/internal/DataFlowPrivate.qll
Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
2022-11-15 17:19:32 +00:00
Jeroen Ketema
d79c722d95 Merge pull request #11278 from jketema/dataflow-test-typo
C++: Fix typo in dataflow test comment
2022-11-15 17:33:06 +01:00
Jeroen Ketema
98176007d8 C++: Fix type in dataflow test comment 2022-11-15 17:18:08 +01:00
erik-krogh
cec5045b52 Merge branch 'main' into erb 2022-11-15 17:16:05 +01:00
erik-krogh
e4dbf0acff use instead of a fixed version number 2022-11-15 17:14:38 +01:00
erik-krogh
39938b4dad add change-note 2022-11-15 17:14:38 +01:00
erik-krogh
29cf695b07 update expected output of the queries (some sorting changed due to locations being used slightly differently in the shared pack) 2022-11-15 17:14:38 +01:00
erik-krogh
e18ceba49e port the JS regex/redos queries to use the shared pack 2022-11-15 17:14:38 +01:00
erik-krogh
031a910989 add a JS implementation of RegexTreeViewSig 2022-11-15 17:14:38 +01:00
erik-krogh
4a2472a078 add hasLocationInfo predicate to regexp terms 2022-11-15 17:14:37 +01:00
erik-krogh
e928777cb7 add codeql/regex as a dependency 2022-11-15 17:14:37 +01:00
erik-krogh
f6255e497b Merge branch 'main' into rb-redosMod 2022-11-15 17:14:19 +01:00
Erik Krogh Kristensen
68e513c6a4 Merge pull request #11246 from erik-krogh/java-redosMod
Java: use the shared regex pack
2022-11-15 17:12:52 +01:00
Paolo Tranquilli
56b207e41f Swift: remove IPA classes from cppgen 2022-11-15 17:07:52 +01:00
Arthur Baars
da7788dd64 CodeQL: add 'False positive' issue template 2022-11-15 16:53:53 +01:00
Tony Torralba
89a8ccb828 Merge pull request #11273 from atorralba/atorralba/swift/string-utf8-step
Swift: Add `AdditionalTaintStep`
2022-11-15 16:46:26 +01:00
Tony Torralba
0570610765 Merge pull request #11138 from atorralba/atorralba/swift/xxe-query-aexml-sinks
Swift: Add AEXML sinks to XXE query
2022-11-15 16:42:17 +01:00
Mauro Baluda
8109a7b67a Update javascript/ql/lib/semmle/javascript/frameworks/Hapi.qll
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2022-11-15 16:27:21 +01:00
Mauro Baluda
e5e3bb3705 Generalize the server definition in plugin registration 2022-11-15 16:27:14 +01:00
Erik Krogh Kristensen
f7b5a4d170 Merge pull request #11203 from erik-krogh/shouldBePath
C#: update cs/assembly-path-injection cs/hardcoded-key to path-problems
2022-11-15 16:24:05 +01:00
Tony Torralba
8ca004fde1 Add AdditionalTaintStep 2022-11-15 16:14:22 +01:00
Mauro Baluda
563a56af9d Update Hapi.qll 2022-11-15 15:46:34 +01:00
Paolo Tranquilli
635391eae8 Swift: autopep8 integration tests 2022-11-15 15:43:05 +01:00
Paolo Tranquilli
c2171c01e1 Swift: remove double newlines in schema
While PEP8 mandates those, they look bad in the schema file.

`autopep8` already ignores those, and they were single newlines at some
point until an overeager IDE has "fixed" them at some point without me
realizing.

Also, the pre-commit configuration was updated to take `schema.py` into
account.
2022-11-15 15:00:30 +01:00
erik-krogh
65c1e239eb clean up the cache when compiling on main 2022-11-15 14:49:06 +01:00
Asger F
dc440aaee6 Merge pull request #11255 from asgerf/js/dynamic-import-type-expr
JS: Handle DynamicImport in the context of a type
2022-11-15 13:31:08 +01:00
Geoffrey White
9887e2b53b Merge branch 'main' into alamofire2 2022-11-15 12:19:54 +00:00
Geoffrey White
403f3caf4b Merge branch 'main' into optionals2 2022-11-15 12:12:01 +00:00
Geoffrey White
ae5689b295 Swift: Update comment. 2022-11-15 12:04:10 +00:00
Geoffrey White
4c806a442a Swift: Dataflow through ? :. 2022-11-15 12:01:09 +00:00
Stephan Brandauer
4b9b35d1c2 Merge pull request #11267 from github/atm/fix-non-sink-characteristics-hierarchy
ATM: remove superfluous class in EndpointCharacteristics hierarchy
2022-11-15 12:59:42 +01:00
Geoffrey White
52d5578fb5 Swift: Dataflow through second argument of ??. 2022-11-15 11:43:43 +00:00
Geoffrey White
2dbb891942 Swift: Dataflow through ??. 2022-11-15 11:42:43 +00:00
Geoffrey White
9b38e1102a Swift: Add more tests of optionals. 2022-11-15 11:41:04 +00:00
Joe Farebrother
8d9b106be1 Exclude invalid identifiers from generated stubs 2022-11-15 11:19:40 +00:00
erik-krogh
dff7b475fb make the top-level comment in SuperlinearBackTracking.qll a QLDoc 2022-11-15 11:46:44 +01:00
Tom Hvitved
67f31ffdf0 Ruby: Add tests for phi reads 2022-11-15 11:45:32 +01:00
Tom Hvitved
bd78e73131 C#: Add tests for phi reads 2022-11-15 11:45:32 +01:00
Tom Hvitved
81a1fa167a SSA: Expose phi-reads 2022-11-15 11:45:32 +01:00
Tom Hvitved
32f60fd112 Ruby: Add more local flow tests for use-use flow 2022-11-15 11:45:31 +01:00
Nick Rolfe
8d854e0a6b Merge pull request #11252 from github/nickrolfe/active_support_enumerable
Ruby: add flow summary for Enumerable#index_by
2022-11-15 10:40:42 +00:00
Tom Hvitved
dc2cd994d4 C#: Update expected test output 2022-11-15 11:22:48 +01:00
Tom Hvitved
a749212707 C#: Handle op_Checked* operators in the extractor 2022-11-15 11:22:19 +01:00
Rasmus Wriedt Larsen
e886b53a94 Python: CallGraph tests: remove rest of old annotations 2022-11-15 11:16:10 +01:00
Rasmus Wriedt Larsen
98bf3adc72 Python: Add enclosing-callable test 2022-11-15 11:11:59 +01:00
Rasmus Wriedt Larsen
7ca32ee2b5 Python: Fieldflow: merge assignment tests 2022-11-15 11:11:59 +01:00
Gustav Munkby
65c9d8cb78 Run go linux tests with fast package extraction
To ensure this code path is actively tested.
2022-11-15 10:40:27 +01:00
Gustav Munkby
a293239bd5 Accelerating go-extractor by using 'go list -deps'
Resurrect https://github.com/github/codeql-go/pull/554, but behind an environment variable as to avoid the broken builds noted in https://github.com/github/codeql/issues/9304, but still allowing some people to opt in to the much faster approach.
2022-11-15 10:30:56 +01:00
Stephan Brandauer
ec3578364e remove superfluous class in EndpointCharacteristics hierarchy 2022-11-15 10:17:38 +01:00
Gustav Munkby
279ba60eb1 Refactor package path extraction
In preparation for pulling all package information at once.
2022-11-15 10:10:39 +01:00
Tom Hvitved
eda028721e C#: Update all nuget packages 2022-11-15 09:19:33 +01:00
tiferet
9ecff0723c Fix non-ascii character in docs 2022-11-14 16:34:24 -08:00
tiferet
6b7612fed7 Fix import errors in DebugResultInclusion.ql 2022-11-14 15:33:46 -08:00
tiferet
b47723d607 Delete ExtractEndpointData.
Also remove the associated test files.
2022-11-14 14:57:59 -08:00
tiferet
9d7e7735d5 Extract training data:
Implement the new query that selects data for training. For now we include clauses that implement logic that is identical to the old queries.

Include a temporary wrapper query that converts the resulting data into the format expected by the endpoint pipeline.

Move the small pieces of `ExtractEndpointData` that are still needed into `ExtractEndpointDataTraining.qll`.
2022-11-14 14:33:08 -08:00
Mauro Baluda
3260c81397 Merge branch 'github:main' into main 2022-11-14 22:59:06 +01:00
Mauro Baluda
5ea03b1ded Update Hapi.qll
Add `server` definitions in plugin registration and plugin dependency declaration
2022-11-14 22:56:06 +01:00
Robert Marsh
5bbdaad0e5 C++: deprecate AST-based GVN 2022-11-14 16:50:39 -05:00
erik-krogh
10fff4e2ef Merge branch 'main' into rb-redosMod 2022-11-14 21:31:10 +01:00
erik-krogh
b59a9bc95c use instead of a fixed version number 2022-11-14 21:29:41 +01:00
erik-krogh
a4acea9adf add change-note 2022-11-14 21:29:41 +01:00
erik-krogh
c029048306 port the Java regex/redos queries to use the shared pack 2022-11-14 21:29:41 +01:00
erik-krogh
d5b066636f use namespace in PrintAst.qll to avoid conflict with Top 2022-11-14 21:29:41 +01:00
erik-krogh
b737bdbca0 add a Java implementation of RegexTreeViewSig 2022-11-14 21:29:41 +01:00
erik-krogh
20254dfc08 move existing regex-tree into a module 2022-11-14 21:29:41 +01:00
erik-krogh
af1470de07 add codeql/regex as a dependency 2022-11-14 21:29:41 +01:00
Ed Minnix
2fb9536847 Java: documentation cleanup for WebView file access query 2022-11-14 15:14:09 -05:00
Ed Minnix
7a0544d80e Java: test files for WebView file access query 2022-11-14 15:11:15 -05:00
Erik Krogh Kristensen
d2857006cf Merge pull request #11247 from erik-krogh/py-redosMod
Python: use the shared regex pack
2022-11-14 21:10:43 +01:00
Ed Minnix
73d6360eee Java: add setAllowFileAccess to CrossOriginAccessMethod in WebView.qll
Local file access is enabled using the `WebSettings#setAllowFileAccess`
method.
2022-11-14 15:07:46 -05:00
Ed Minnix
89411a1db2 Fix alert message style 2022-11-14 14:41:06 -05:00
Ed Minnix
1132572620 Java: add test cases for setJavaScriptEnabled query 2022-11-14 14:33:12 -05:00
Tiferet Gazit
855eddab80 Merge pull request #11174 from github/tiferet/non-sink-endpoint-characteristics
Non-sink endpoint characteristics
2022-11-14 09:37:25 -08:00
Erik Krogh Kristensen
99636ba344 fix typo
Co-authored-by: yoff <lerchedahl@gmail.com>
2022-11-14 17:35:55 +01:00
erik-krogh
324e0e8f90 always sort both by location and by term tostring 2022-11-14 17:33:48 +01:00
Ed Minnix
a7e7334f0f Java: Documentation cleanup for setJavascriptEnabled 2022-11-14 11:10:43 -05:00
Rasmus Lerchedahl Petersen
4f159371f9 Python: add change notes 2022-11-14 17:01:45 +01:00
Rasmus Lerchedahl Petersen
9c7fee225c Python: remove redundant override 2022-11-14 16:45:34 +01:00
Rasmus Lerchedahl Petersen
3ee756694f Python: add missing qldoc
also add to ordinary `except`
2022-11-14 16:45:22 +01:00
Ian Lynagh
7bf55c5846 Merge pull request #11251 from igfoo/igfoo/total
Kotlin: Add total number of diagnostics to telemetry
2022-11-14 15:09:57 +00:00
Edward Minnix III
55fad8ab23 Java: Fix description of setJavascriptEnabled query
Co-authored-by: Tony Torralba <atorralba@users.noreply.github.com>
2022-11-14 10:04:01 -05:00
Edward Minnix III
7e5970f338 Java: Fix typos/formatting in setJavascriptEnabled query
Typos and formatting changes.

Co-authored-by: Tony Torralba <atorralba@users.noreply.github.com>
2022-11-14 10:02:20 -05:00
Tony Torralba
5791e8b9a2 Slight renaming 2022-11-14 15:46:44 +01:00
Tony Torralba
07de92cdb6 Move AEXML.qll to avoid nesting 2022-11-14 15:46:44 +01:00
Tony Torralba
f2888dcb1e Add sinks and tests for the AEXML library. 2022-11-14 15:46:44 +01:00
Tony Torralba
3ef7f3f44d Merge pull request #11120 from atorralba/atorralba/swift/xxe-query-xmldocument-sinks
Swift: Adds XMLDocument sinks to the XXE query
2022-11-14 15:46:02 +01:00
Geoffrey White
3e6eedec30 Swift: Fix test output after merge. 2022-11-14 14:42:56 +00:00
Asger F
2bcf9b86cf JS: Bump extractor version string 2022-11-14 15:09:50 +01:00
Asger F
5f18484fa9 JS: Change note 2022-11-14 15:09:30 +01:00
Asger F
b028d72d51 JS: Handle DynamicImport in the context of a type 2022-11-14 15:07:59 +01:00
Chris Smowton
61149f297c Merge pull request #11232 from grddev/patch-1
Go: Optimize trap.Writer by buffering gzip writes
2022-11-14 14:01:47 +00:00
Ian Lynagh
fab2d30f38 Kotlin: Make emitDiagnostic private 2022-11-14 13:53:16 +00:00
Ian Lynagh
1e6ef99a50 Merge pull request #11249 from igfoo/igfoo/telem-compilation-info
Java/Kotlin: Add compilation info to telemetry
2022-11-14 13:51:35 +00:00
Geoffrey White
5460004223 Merge branch 'main' into HEAD 2022-11-14 13:44:39 +00:00
Tom Hvitved
b242bd6468 Merge pull request #11080 from github/revert-11074-revert-10576-ssa/consistency-queries
Revert "Revert "SSA: Turn consistency predicates into `query` predicates""
2022-11-14 14:43:58 +01:00
Ian Lynagh
847ecd1eec Java/Kotlin: Small refactoring of ExtractorInformation 2022-11-14 13:09:49 +00:00
Nick Rolfe
c80fbff648 Ruby: add changenote for Enumerable#index_by flow summary 2022-11-14 12:47:50 +00:00
Ian Lynagh
b20f8fc8c9 Kotlin: Add total number of diagnostics to telemetry 2022-11-14 12:27:54 +00:00
Nick Rolfe
c660ea100b Ruby: add changenote for rb/stack-trace-exposure 2022-11-14 12:26:40 +00:00
Nick Rolfe
b39e2ef71c Ruby: add stacktrace exposure query 2022-11-14 12:26:40 +00:00
Tony Torralba
52bd140213 Fix test expectations 2022-11-14 12:41:13 +01:00
Tony Torralba
c03eab2410 Add XMLDocument sinks 2022-11-14 12:41:13 +01:00
Tony Torralba
a21db3b3c2 Merge pull request #11086 from atorralba/atorralba/swift/xxe-query
Swift: Add new query for XML External Entities (XML) vulnerabilities
2022-11-14 12:34:30 +01:00
Ian Lynagh
87ee979a12 Java/Kotlin: Add compilation info to telemetry
This will give info about which kotlinc versions are used.
2022-11-14 11:31:37 +00:00
Nora Dimitrijević
16ba5b1bb5 Swift: update doctests 2022-11-14 12:30:16 +01:00
Ian Lynagh
3afd895d41 Merge pull request #11217 from igfoo/igfoo/kotlin_version_rec
Java/Kotlin: Write Kotlin version information to the database
2022-11-14 10:55:46 +00:00
Nick Rolfe
83b3312467 Merge pull request #11207 from github/nickrolfe/arel-sql
Ruby: add `SqlConstruction` concept, and implement it for calls to `Arel.sql`
2022-11-14 10:21:37 +00:00
Nick Rolfe
0dadf0bbb4 Ruby: add flow summary for Enumerable#index_by 2022-11-14 10:01:24 +00:00
Arthur Baars
dd519cc9bf Ruby: also treat included/prepended modules as subclasses 2022-11-14 10:56:56 +01:00
yoff
dd525a4f9b Merge pull request #11061 from erik-krogh/shared-redosMod
ReDoS: add a shared regex pack
2022-11-14 10:53:05 +01:00
AlexDenisov
d19bde8cb1 Merge pull request #11205 from github/alexdenisov/swift-db-upgrades-infra
Swift: db up/downgrade scripts
2022-11-14 09:51:15 +01:00
Alex Denisov
b5400f6dc9 Swift: remove rebase artifact 2022-11-14 08:55:44 +01:00
Ed Minnix
a8e67bdfc5 Java: Removed typo in Android WebView file access documentation 2022-11-12 10:15:15 -05:00
Ed Minnix
631a08496e Java: WebView file access query change note 2022-11-12 10:09:35 -05:00
Ed Minnix
ea358f0698 Java: WebView file access query description 2022-11-12 10:01:30 -05:00
Ed Minnix
b4cd1ee34d Java: Added description to query 2022-11-12 09:56:45 -05:00
Ed Minnix
7712ec2523 Java: setJavascriptEnabled query change notes 2022-11-12 09:54:26 -05:00
Ed Minnix
b9c2ee75be Java: Query for Android WebView File Access
Query for Android WebView file access settings
2022-11-12 09:44:12 -05:00
Ed Minnix
e09f0861f3 Java: documentation for WebView#addJavascriptInterface query 2022-11-12 09:40:49 -05:00
Ed Minnix
e1ff04cd95 Java: Query for android.webkit.WebView#addJavascriptInterface 2022-11-12 09:40:49 -05:00
Ed Minnix
30cd447f69 Java: Add class to represent android.webkit.WebView#addJavascriptInterface 2022-11-12 09:40:49 -05:00
Ed Minnix
4d3a837310 Java: query for detecting enabling Javascript in Android WebSettings 2022-11-11 23:13:44 -05:00
Gustav
3514694cdf Fix direct access to trap.Writer from trap.Labeler 2022-11-11 18:39:25 +01:00
Jeroen Ketema
5c109cdef1 Merge pull request #11234 from jketema/std-iterator-fix
C++: Recognize `basic_string::iterator` as an iterator
2022-11-11 17:21:42 +01:00
Gustav
fea4b816af Fix double close
Co-authored-by: Chris Smowton <smowton@github.com>
2022-11-11 17:12:13 +01:00
Taus
f92d836607 Python: Fix test failure
Casting to `ImportExpr` caused the `typetracking_imports` test to fail.
2022-11-11 16:03:14 +00:00
Ian Lynagh
b5c7d6bfcd Kotlin: Fix build on OS X 2022-11-11 14:57:36 +00:00
Alex Denisov
d49015a7e6 Swift: infrastructure for upgrade/downgrade scripts 2022-11-11 15:51:23 +01:00
AlexDenisov
e69d003d8f Merge pull request #11196 from github/redsun82/swift-error-element
Swift: create common `ErrorElement` superclass and tests
2022-11-11 15:50:58 +01:00
Taus
a08253b6d0 Python: Fix typo 2022-11-11 14:50:04 +00:00
Taus
a8a7a59ae8 Python: Add test for attribute name clash 2022-11-11 14:47:35 +00:00
Alex Denisov
ce1fb4c018 Swift: accept test changes 2022-11-11 15:22:58 +01:00
Mathias Vorreiter Pedersen
38acdaabfa Merge pull request #11111 from geoffw0/tuples
Swift: Content flow through tuples
2022-11-11 14:20:26 +00:00
Henry Mercer
edaf64c254 Merge pull request #11233 from github/codeql-ci/atm/release-0.4.1
JS: Bump version numbers of ML-powered packs after 0.4.1 release
2022-11-11 14:20:08 +00:00
Erik Krogh Kristensen
2291f18695 Merge pull request #9827 from erik-krogh/overrideAny
QL: Query for detecting unused parameter in override methods
2022-11-11 15:17:48 +01:00
Ian Lynagh
7d54b542b5 Kotlin: Put extractor name in a resource rather than generating code 2022-11-11 14:04:14 +00:00
Taus
b540eb094c Python: Various small fixes
- Swaps `module_reference_in_scope` and `module_name_in_scope`.
- uses `AttrRead::accesses` instead of `getObject`, etc.
- Removes an errant `none()`.
- Expands the QLDoc for some of the predicates.
2022-11-11 14:00:36 +00:00
Rasmus Wriedt Larsen
ddbcdcb4ba Merge pull request #11160 from RasmusWL/dataflow-consistency-read-store
DataFlow: Add read/store stepIsLocal consistency checks
2022-11-11 14:51:45 +01:00
Taus
7f790432cc Python: More review suggestions
I could have sworn I added all of them to the batch, but somehow these slipped through.

Co-authored-by: yoff <lerchedahl@gmail.com>
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
2022-11-11 14:40:58 +01:00
Paolo Tranquilli
eb14348153 Merge branch 'main' into redsun82/swift-error-element 2022-11-11 14:36:02 +01:00
AlexDenisov
7b6cb70cc8 Merge pull request #11213 from github/redsun82/swift-types
Swift: extract or ignore last remaining types
2022-11-11 14:22:29 +01:00
Henry Mercer
afbd05d41a Merge branch 'main' into codeql-ci/atm/release-0.4.1 2022-11-11 13:19:35 +00:00
Paolo Tranquilli
d3ff4908e6 Merge branch 'main' into redsun82/swift-error-element 2022-11-11 14:05:47 +01:00
Jeroen Ketema
612624d241 C++: Recognize basic_string::iterator as an iterator 2022-11-11 14:04:50 +01:00
Paolo Tranquilli
3816361c15 Merge branch 'main' into redsun82/swift-types 2022-11-11 13:54:12 +01:00
Taus
131fc986b4 Python: Apply suggestions from code review
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
Co-authored-by: yoff <lerchedahl@gmail.com>
2022-11-11 13:49:46 +01:00
github-actions[bot]
b5b69e9357 JS: Bump version of ML-powered library and query packs to 0.4.2 2022-11-11 12:48:00 +00:00
github-actions[bot]
3e5e695325 JS: Bump patch version of ML-powered library and query packs 2022-11-11 12:36:19 +00:00
Paolo Tranquilli
d567ab3569 Merge pull request #11231 from github/redsun82/swift-fix-synthesized-wrapper-decls
Swift: fix synthesized wrapper decls
2022-11-11 13:32:32 +01:00
Erik Krogh Kristensen
6dfa57a7b1 Merge pull request #11226 from erik-krogh/fixFormatCheck
CI: use `find` in the format check to fix it
2022-11-11 13:07:52 +01:00
Gustav
f659ee3e0b Go: Optimize trap.Writer by buffering gzip writes
The TRAP writer already buffers writes before emitting to file, but running gzip compression is also fairly costly (especially if you only do it a couple of bytes at a time). Thus, this injects another buffer that collects the emitted tuples in string form, and only triggers gzip compression once the buffer is full. In my local testing, this buffering was actually more beneficial than the one between gzip and file (likely because the gzip writer already emits data in chunks), but that one is still beneficial.
2022-11-11 13:07:30 +01:00
Nick Rolfe
be60a871a3 Ruby: tweak comment 2022-11-11 12:01:23 +00:00
Paolo Tranquilli
3bb5505063 Swift: expand and fix VarDecl tests 2022-11-11 12:49:48 +01:00
Paolo Tranquilli
41977d1dbb Swift: implement extraction of new properties 2022-11-11 12:49:48 +01:00
Paolo Tranquilli
3de650e19d Swift: make toBeTested and shouldPrint propagate to children 2022-11-11 12:49:18 +01:00
Paolo Tranquilli
fc98fd3094 Swift: add var to the list of doc expanded abbreviations 2022-11-11 12:34:40 +01:00
Paolo Tranquilli
85233b3cbf Swift: add new children to VarDecl 2022-11-11 12:34:40 +01:00
Nick Rolfe
e3ebf1c668 Merge pull request #11187 from github/nickrolfe/actioncable
Ruby: add ActionCable channel RPC params as remote flow sources
2022-11-11 11:32:13 +00:00
Nora Dimitrijević
4b7a89e754 Merge branch 'main' into swift/js-injection 2022-11-11 12:23:26 +01:00
Michael Nebel
176405cd7c Merge pull request #11223 from github/workflow/coverage/update
Update CSV framework coverage reports
2022-11-11 11:49:50 +01:00
Jeroen Ketema
5dec08b9a3 Merge pull request #11212 from jketema/std-string-fixes
C++: Improve handling of `std::string::insert` with iterator return type and do some cleanup
2022-11-11 11:41:59 +01:00
Bas van Schaik
8147d2048e Remove issue template for LGTM.com false positive reports 2022-11-11 10:36:26 +00:00
Mauro Baluda
25ac3499c2 Merge branch 'github:main' into main 2022-11-11 11:20:01 +01:00
Michael Nebel
ef50e57317 Merge pull request #11083 from michaelnebel/csharp/telemetry
C#: Telemetry query updates.
2022-11-11 10:57:54 +01:00
erik-krogh
887062d339 update cs/assembly-path-injection and cs/hardcoded-key to path-problems 2022-11-11 10:55:36 +01:00
erik-krogh
03a479fd60 use find in the format check to fix it 2022-11-11 10:50:42 +01:00
Rasmus Wriedt Larsen
ab42521906 Python: Port CallGraph-implicit-init tests
to the new call-graph test setup. Nice that we can write `MISSING:` now!
2022-11-11 10:34:28 +01:00
Rasmus Wriedt Larsen
b60504f404 Python: Delete CallGraph-xfail
No longer needed since we're using an established testing framework now
2022-11-11 10:34:28 +01:00
Rasmus Wriedt Larsen
6d9745e5c3 Python: Rewrite call-graph tests to be inline expectation (2/2)
I ported the predicates showing difference between points-to and
type-tracking, since it's helpful to see the list of differences,
instead of having to parse expectations!
2022-11-11 10:34:28 +01:00
Erik Krogh Kristensen
313f600432 Merge pull request #11214 from erik-krogh/oneFormatToRuleThemAll
CI: remove langauge specific format checks
2022-11-11 10:10:36 +01:00
Jeroen Ketema
ba00a0f370 C++: Share parameter logic in std::string model 2022-11-11 08:48:11 +01:00
Jeroen Ketema
23e29e993b C++: Split std::string::insert off in a separate class
The `insert` function has two different return types: `iterator` and
`basic_string&`.
2022-11-11 08:48:01 +01:00
AlexDenisov
ecd8921dcd Merge pull request #11211 from github/redsun82/swift-drop-impossible-nodes
Swift: fix printing of unextracted entities
2022-11-11 08:06:54 +01:00
Harry Maclean
2b4217b8a4 Ruby: Update test fixture 2022-11-11 18:41:55 +13:00
Harry Maclean
b16cecc8db Ruby: Add missing doc 2022-11-11 18:41:42 +13:00
Harry Maclean
62ea1f0a05 Ruby: Fix performance of string comparison guard
The `or` case ran extremely slowly before this change. Also exclude
string interpolations from consideration, for correctness, and add some
more tests.
2022-11-11 18:24:20 +13:00
github-actions[bot]
dcebe930e7 Add changed framework coverage reports 2022-11-11 00:21:31 +00:00
Harry Maclean
e25e192ef3 Ruby: Change the CFG for while clauses
The `when` node now acts as a join point for patterns in the when
clause, with match/no-match completions. This is similar to how `or`
expressions work.

The result of this is that the `when` clause "controls" the body of the
`when`, which allows us to model barrier guards for multi-pattern when
clauses.

For this code

case x
when 1, 2
  y
end

The old CFG was

x --> when --> 1 --no-match--> 2 ---no-match---> case
                \               \                  ^
                  \               \                |
                   \                --match----+   |
                     \                         |   |
                       \                       |   |
                         ------match---------> y --+

The new CFG is

x --> 1 --no-match--> 2 --no-match--> [no-match] when --no-match--> case
       \               \                                             ^
         \               \                                           |
           \               --match--> [match] when --match--> y -----+
             \                       /
               \                   /
                 -------match-----

i.e. all patterns flow to the `when` node, which is split based on
whether the pattern matched or not. The body of the when clause then has
a single predecessor `[match] when`, which acts as condition block that
controls `y`.
2022-11-11 11:52:27 +13:00
Rasmus Lerchedahl Petersen
71335a1a97 python: update users of try 2022-11-10 22:20:28 +01:00
Rasmus Lerchedahl Petersen
7d05ba38d5 python: convenience methods for handler types 2022-11-10 22:20:28 +01:00
Rasmus Lerchedahl Petersen
e67515fae7 python: dataflow tests names in exception handlers 2022-11-10 22:20:28 +01:00
Rasmus Lerchedahl Petersen
a7e394b2be python: SSA for names in except* 2022-11-10 22:20:28 +01:00
Rasmus Lerchedahl Petersen
30b58e7921 python: control flow node ExceptGroupStmt
- wrap `getType` and `getName`, considering dominance
- do not implement all the handles predicates
2022-11-10 22:20:27 +01:00
Rasmus Lerchedahl Petersen
9f9a962c03 python: wrap autogenerated ExceptGroupStmt_
also widen type of `Try::getHandler` to `Stmt`.
`ExceptStmt` is now too narrow,
as a handler can also be of type `ExceptGroupStmt`.
2022-11-10 22:20:27 +01:00
Rasmus Lerchedahl Petersen
24d22ccb6e python: regenerated AST 2022-11-10 22:20:27 +01:00
Rasmus Lerchedahl Petersen
9f89325ca7 python: dummy stats for ExceptGroupStmt 2022-11-10 22:20:27 +01:00
Rasmus Lerchedahl Petersen
1fd76f02fd python: db uprade and downgrade scripts 2022-11-10 22:20:27 +01:00
Rasmus Lerchedahl Petersen
856e48c414 python: new dbscheme 2022-11-10 22:20:27 +01:00
Rasmus Wriedt Larsen
88f703af1f DataFlow: Accept changes to .expected 2022-11-10 22:13:34 +01:00
Ian Lynagh
e00f87045e Java: Add up/downgrade scripts 2022-11-10 20:31:13 +00:00
Ian Lynagh
fac839f481 Java/Kotlin: Add a changenote for Compilation.getInfo 2022-11-10 20:29:04 +00:00
Ian Lynagh
a6b8f4b674 Java/Kotlin: Update stats 2022-11-10 20:29:04 +00:00
Ian Lynagh
2fb78565a7 Kotlin: Write version information to the database 2022-11-10 20:29:04 +00:00
Ian Lynagh
d0dfb4926b Kotlin/Java: Add compilation_info table 2022-11-10 20:29:04 +00:00
Rasmus Wriedt Larsen
4caaa3a396 Python: Rewrite call-graph tests to be inline expectation (1/2)
This adds inline expectations, next commit will remove old annotations
code... but I thought it would be easier to review like this.
2022-11-10 21:08:29 +01:00
Erik Krogh Kristensen
90382c4d1c Merge pull request #11178 from erik-krogh/passcode
JS/RB/PY: Recognize `passcode` as sensitive
2022-11-10 17:58:34 +01:00
erik-krogh
866e92558c broaden the file pattern used in the format check to ensure js-ml is included 2022-11-10 17:57:45 +01:00
Paolo Tranquilli
f5b198b8b7 Swift: fix dangling test reference 2022-11-10 17:50:22 +01:00
erik-krogh
fbb2dcf7a8 remove langauge specific format checks 2022-11-10 17:47:14 +01:00
Paolo Tranquilli
88dc65cb3c Swift: extract or ignore last remaining types 2022-11-10 17:38:32 +01:00
Paolo Tranquilli
04d042308b Swift: fix QL compilation 2022-11-10 17:05:03 +01:00
Tom Hvitved
bda4b52395 Merge pull request #11206 from hvitved/ruby/self-toplevel-def
Ruby: Fix SSA entry definitions for `self` in top-level
2022-11-10 17:01:59 +01:00
Jeroen Ketema
f7c55a3258 Merge pull request #11202 from jketema/fix-accept-prototype
C++: Fix the `accept` prototype in the dataflow taint tests
2022-11-10 17:00:07 +01:00
Nick Rolfe
20f76e50c3 Ruby: actually call the isPublic() predicate I added 2022-11-10 15:53:04 +00:00
Geoffrey White
887d1893e7 Swift: Make ql-for-ql happy. 2022-11-10 15:51:02 +00:00
Paolo Tranquilli
458fb3a4a2 Swift: fix printing of unextracted entities
This was still printing explicitly ignored classes.
2022-11-10 16:49:32 +01:00
Paolo Tranquilli
30bbae3c22 Merge pull request #11209 from github/redsun82/swift-drop-impossible-nodes
Swift: drop impossible nodes from schema
2022-11-10 16:47:23 +01:00
Michael Nebel
2a26c8f340 Merge pull request #10628 from michaelnebel/java/typebasedmodels
Java: Type based summary models.
2022-11-10 16:34:52 +01:00
Geoffrey White
d97682991d Swift: Add Alamofire sink for cpp/cleartext-transmission. 2022-11-10 15:33:00 +00:00
Nick Rolfe
b91b3148a4 Ruby: add missing qldoc comments for SQL injection query 2022-11-10 15:26:42 +00:00
Paolo Tranquilli
a54853d3b4 Swift: cleanup orphaned test files 2022-11-10 16:20:28 +01:00
Paolo Tranquilli
6a816ba700 Swift: create common error test directory 2022-11-10 16:20:28 +01:00
Paolo Tranquilli
c5bb32d6d2 Swift: create common ErrorElement superclass 2022-11-10 16:20:28 +01:00
Jeroen Ketema
62f5d10d03 C++: Fix localTaint expected results 2022-11-10 16:08:07 +01:00
Erik Krogh Kristensen
724a31b746 fix comment that wasn't updated in test
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
2022-11-10 15:56:44 +01:00
Ian Lynagh
a2c0d47e9c Merge pull request #11199 from igfoo/igfoo/kotlin_default
Kotlin: Update docs and tests
2022-11-10 14:53:06 +00:00
erik-krogh
676327d9e4 Merge branch 'main' into erb 2022-11-10 15:39:58 +01:00
erik-krogh
012fb28e25 only extract .html.erb files instead of all .erb files 2022-11-10 15:38:51 +01:00
Karim Ali
b209cac2e2 Merge pull request #11063 from karimhamdanali/swift-pbe-constant-password
Swift: detect the use of constant passwords for password-based encryption
2022-11-10 16:36:27 +02:00
Karim Ali
e18b2cfa39 Merge pull request #11084 from karimhamdanali/swift-static-iv
Swift: detect the use of static initialization vectors
2022-11-10 16:35:21 +02:00
Geoffrey White
23ff3769ac Swift: Add Alamofire tests for swift/cleartext-transmission. 2022-11-10 14:31:53 +00:00
Nick Rolfe
511fb97273 Ruby: remove redundant import 2022-11-10 14:30:06 +00:00
Paolo Tranquilli
5b9e89acd3 Swift: implement ignoring of removed classes 2022-11-10 15:26:55 +01:00
Paolo Tranquilli
e26e0ec809 Swift: remove imposible nodes from schema
We don't expect these AST types to really appear during an extraction
run, even in an unsuccessful compilation.
2022-11-10 15:26:55 +01:00
Nick Rolfe
0337ccb93a Ruby: add change notes for Arel.sql / SqlConstruction changes 2022-11-10 14:11:14 +00:00
Nick Rolfe
5a15558355 Ruby: treat an Arel.sql call as a SqlConstruction 2022-11-10 14:11:14 +00:00
Tom Hvitved
e18442069b Ruby: Fix SSA entry definitions for self in top-level 2022-11-10 15:08:17 +01:00
Ian Lynagh
3d17c8f1ab Merge pull request #11200 from igfoo/igfoo/extractor-info
Java/Kotlin: Add ExtractorInformation query
2022-11-10 13:51:13 +00:00
Paolo Tranquilli
7f36f65ab0 Merge pull request #11190 from github/redsun82/swift-exprs
Swift: extract some more `Expr`
2022-11-10 14:36:42 +01:00
Jeroen Ketema
62a0bcddd9 C++: Fix the accept prototype in the dataflow taint tests 2022-11-10 14:23:26 +01:00
Erik Krogh Kristensen
5d2ab8adfb Merge pull request #11191 from erik-krogh/arrJoin
RB: add join(" ") calls as a sink for rb/shell-command-constructed-from-input
2022-11-10 14:20:42 +01:00
Erik Krogh Kristensen
54958fd502 Merge pull request #11201 from erik-krogh/no-set-output
QL-for-QL: don't use the deprecated set-output feature in github-actions
2022-11-10 14:07:40 +01:00
Michael Nebel
8041542f92 Java: Make sure that IterableTypes has a unique iterator. 2022-11-10 14:06:18 +01:00
Karim Ali
7d473fb265 address docs review 2022-11-10 15:01:05 +02:00
Michael Nebel
2f12ccc803 C#: Delete incorrect comment. 2022-11-10 13:59:50 +01:00
erik-krogh
a2ce764c82 update codeql-action version used in QL-for-QL, as the old version still used the deprecated set-output feature 2022-11-10 13:58:07 +01:00
Michael Nebel
9b5318876d Java: Improve tests and allow spurious models. 2022-11-10 13:57:44 +01:00
Michael Nebel
91aa75da0e Java: Rename IterableType to IterableClass. 2022-11-10 13:57:44 +01:00
Michael Nebel
ce8ab0e66e Simplify test predicate implementation.
Co-authored-by: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
2022-11-10 13:57:44 +01:00
Michael Nebel
0e7179ca85 Simplify functional predicate implementation.
Co-authored-by: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
2022-11-10 13:57:44 +01:00
Michael Nebel
9d34ce9776 Adjust the co-variant claim comment.
Co-authored-by: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
2022-11-10 13:57:44 +01:00
Michael Nebel
decfcdd82a Improve IterableType implementation.
Co-authored-by: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
2022-11-10 13:57:43 +01:00
Michael Nebel
d6ae1ef6f2 Java/C#: Move C# internal implementation for model generation. 2022-11-10 13:57:43 +01:00
Michael Nebel
4cb82ad5a7 Java: Explicit import of needed classes from stream and some improvements to comments. 2022-11-10 13:57:43 +01:00
Michael Nebel
62603dd2bc Java: Inline expectations for type based model test case. 2022-11-10 13:57:43 +01:00
Michael Nebel
2011685e89 Java: Move internal model generator code to another folder. 2022-11-10 13:57:43 +01:00
Michael Nebel
ceef9cf276 C#: Fix spelling error in ql doc. 2022-11-10 13:57:43 +01:00
Michael Nebel
5b9ae5e6db Java: Update ql doc comments. 2022-11-10 13:57:43 +01:00
Michael Nebel
8352925257 Java: Minor re-factorings. 2022-11-10 13:57:43 +01:00
Michael Nebel
9f783b018d Java: Type based summaries are now also for Java. 2022-11-10 13:57:43 +01:00
Michael Nebel
8a0f00a5c9 Java: Update expected test output. 2022-11-10 13:57:43 +01:00
Michael Nebel
0c09f78142 Java: Comment in method for converting stream to Array. 2022-11-10 13:57:43 +01:00
Michael Nebel
84743ec87d Java: Make support for array parameter and return values. 2022-11-10 13:57:43 +01:00
Michael Nebel
5b65f5c185 Java: Change test implementation to avoid failing CFG dead end consistency test. 2022-11-10 13:57:43 +01:00
Michael Nebel
8c1de5958b Java: Make better QL docs and add some missing 'this'. 2022-11-10 13:57:43 +01:00
Michael Nebel
b80c533fb0 Java: Update expected test output. 2022-11-10 13:57:43 +01:00
Michael Nebel
937404892f Java: Add further examples that are now supported. 2022-11-10 13:57:42 +01:00
Michael Nebel
39ee1e28cf Java: Get the correct type of the instantiated iterator type. 2022-11-10 13:57:42 +01:00
Michael Nebel
dc79ed8192 Java: Update expected test output. 2022-11-10 13:57:42 +01:00
Michael Nebel
d1b8bef248 Java: Add more stream functions. Comment methods out, where we are not happy with the generated result. 2022-11-10 13:57:42 +01:00
Michael Nebel
62de3e4ab6 Java: Update expected test output. 2022-11-10 13:57:42 +01:00
Michael Nebel
716d6aeeee Java: Add stream concat example. 2022-11-10 13:57:42 +01:00
Michael Nebel
96414034f9 Java: Support wildcards in paramters and generic collection like parameters. 2022-11-10 13:57:42 +01:00
Michael Nebel
efe802dac0 Java: Updated expected test output. 2022-11-10 13:57:42 +01:00
Michael Nebel
52f69f77bc Java: Add stream example methods using wildcards. 2022-11-10 13:57:42 +01:00
Michael Nebel
b8922b0270 Java: Support wildcards for functional interfaces. 2022-11-10 13:57:42 +01:00
Michael Nebel
0caee16eb0 Java: Update expected test output. 2022-11-10 13:57:42 +01:00
Michael Nebel
0cfd7787f4 Java: Add some examples of functional interfaces for functions with two parameters. 2022-11-10 13:57:42 +01:00
Michael Nebel
3b109db2d1 Java: Generalize the support perceiving functional interfaces as functions. 2022-11-10 13:57:42 +01:00
Michael Nebel
3a5d06272f Java: Update expected test output. 2022-11-10 13:57:42 +01:00
Michael Nebel
9ccff656bd Java: Add some initial stubs for methods like java.util.stream.Stream. 2022-11-10 13:57:42 +01:00
Michael Nebel
8bc92320d4 Java: Consider classes that has a method that returns an iterator as container like types. 2022-11-10 13:57:42 +01:00
Michael Nebel
309b6e0810 Java: Add expected test output. 2022-11-10 13:57:42 +01:00
Michael Nebel
f22e1db33f Java: Add test case for capturing type based summaries. 2022-11-10 13:57:41 +01:00
Michael Nebel
207191f987 Java: Move dataflow based model generation testcases to a subfolder. 2022-11-10 13:57:41 +01:00
Michael Nebel
0cab131c51 Java: Add type based summary model generation query. 2022-11-10 13:57:41 +01:00
Michael Nebel
bdc569feea Java: Initial implementation of type based model generation. 2022-11-10 13:57:41 +01:00
erik-krogh
ac32f27fdc don't use the deprecated set-output feature in github-actions 2022-11-10 13:49:29 +01:00
Paolo Tranquilli
de8e7b0f27 Swift: remove debug test and fix generation 2022-11-10 13:42:37 +01:00
Karim Ali
d229d6a7cb address docs review 2022-11-10 14:30:04 +02:00
Mauro Baluda
53f1985e77 Merge branch 'github:main' into main 2022-11-10 13:27:20 +01:00
Ian Lynagh
31a1667fda Java/Kotlin: Add ExtractorInformation query 2022-11-10 12:22:09 +00:00
Nick Rolfe
c9d34947b7 Ruby: add SqlConstruction concept 2022-11-10 12:17:56 +00:00
Ian Lynagh
eea062d357 Merge pull request #11053 from igfoo/igfoo/java-interface-redeclares-tostring
Kotlin: Run java-interface-redeclares-tostring on all platforms
2022-11-10 12:14:49 +00:00
Michael Nebel
9c6875ec0f Merge pull request #10777 from michaelnebel/csharp/generatedataextensions
C#: Generate data extension files
2022-11-10 13:08:31 +01:00
Ian Lynagh
56f8100f16 Kotlin: Add to versions-compilers.rst 2022-11-10 12:01:06 +00:00
Paolo Tranquilli
edfecddca1 Swift: extract AppliedPropertyWrapperExpr 2022-11-10 12:55:28 +01:00
Nick Rolfe
9f31ef851f Python: fix spelling of SqlExecution class in comment 2022-11-10 11:53:12 +00:00
Nick Rolfe
4a98ef064e Ruby: use the 'customizations' pattern for the SQL injection query 2022-11-10 11:51:47 +00:00
Nick Rolfe
2b5e2ed282 Ruby: factor out some code into a helper predicate 2022-11-10 11:41:52 +00:00
Ian Lynagh
72a26865b5 Kotlin: Add a changenote for enabled-by-default 2022-11-10 11:36:15 +00:00
Mauro Baluda
ee02265ac2 Add property params to RequestInputAccess 2022-11-10 12:24:39 +01:00
Jeroen Ketema
e7576fdd1a Merge pull request #11197 from jketema/simplify-taint-test
C++: Simplify dataflow taint test query
2022-11-10 11:58:50 +01:00
Paolo Tranquilli
28c9d6b6b5 Swift: extract PropertyWrapperValuePlaceholderExpr 2022-11-10 11:28:05 +01:00
Tom Hvitved
06f619875b Merge pull request #11194 from github/post-release-prep/codeql-cli-2.11.3
Post-release preparation for codeql-cli-2.11.3
2022-11-10 11:27:51 +01:00
Nick Rolfe
2f9f1f73b7 Merge pull request #11166 from github/nickrolfe/active_support_flow_summaries
Ruby: generalise summaries for ActiveSupport Hash extensions
2022-11-10 10:11:48 +00:00
Anders Schack-Mulligen
a8ed6bad34 Merge pull request #11188 from aschackmull/java/mad-gen-sinks-precision
Java: Improve sink model generation precision by excluding variable capture.
2022-11-10 10:49:56 +01:00
Jeroen Ketema
4d7aeced3f C++: Simplify dataflow taint test query
The complexity seems a left-over from before these tests were turned into
inline expectation tests, where the aim seems to have been to have exactly
one sink node for each `sink` call. Multiple sink nodes for the same `sink`
call are not made visible in the inline expecation tests, and I am not
conviced this was very useful before, so remove the complexity.
2022-11-10 10:38:22 +01:00
AlexDenisov
24ba51d11e Merge pull request #11193 from github/redsun82/swift-avoid-doc-instead-of-desc
Swift: avoid wrongly using `doc` instead of `desc` for properties
2022-11-10 09:53:44 +01:00
Paolo Tranquilli
d7bbf74e49 Swift: fix ObjectLiteralExpr tests 2022-11-10 09:45:59 +01:00
Paolo Tranquilli
3b9ec2b9eb Swift: fix ObjectLiteralExpr docs 2022-11-10 09:44:07 +01:00
github-actions[bot]
f795025f13 Post-release preparation for codeql-cli-2.11.3 2022-11-10 08:31:58 +00:00
Paolo Tranquilli
a8e6dc7a54 Swift: avoid wrongly using doc instead of desc for properties 2022-11-10 09:29:02 +01:00
Harry Maclean
a8b0d298ff Ruby: More string comparison guards
Recognise if statements with conditionals made up or logical `and` or
`or` clauses as barrier guards.
2022-11-10 16:38:09 +13:00
tiferet
dbcdc2209e Use names constants for confidence levels 2022-11-09 14:25:08 -08:00
tiferet
b6532fa9a0 Fix QLDoc style warning 2022-11-09 13:10:54 -08:00
tiferet
243980ef73 Documentation improvements 2022-11-09 13:04:16 -08:00
Tiferet Gazit
6cb01a210f Apply suggestions from code review
Co-authored-by: Stephan Brandauer <kaeluka@github.com>
2022-11-09 12:53:52 -08:00
erik-krogh
88de299e12 add join(" ") calls as a sink for rb/shell-command-constructed-from-input 2022-11-09 21:46:25 +01:00
Nick Rolfe
eb2a487433 Ruby: update expected test output 2022-11-09 17:38:33 +00:00
Nick Rolfe
0d9aa0cdac Ruby: fix clashing method names from merge conflict 2022-11-09 17:06:43 +00:00
Nick Rolfe
c8c53cb424 Merge remote-tracking branch 'origin/main' into nickrolfe/active_support_flow_summaries 2022-11-09 17:02:05 +00:00
Nick Rolfe
cfde7e9edc Ruby: more accurate modeling of which ActionCable channel methods become endpoints 2022-11-09 16:14:11 +00:00
Ian Lynagh
fd6ae3a216 Kotlin: Accept test output 2022-11-09 15:59:15 +00:00
Paolo Tranquilli
0ccf81e67c Swift: extract UnresolvedSpecializeExpr 2022-11-09 16:42:22 +01:00
Paolo Tranquilli
1a062823ee Swift: extract DynamicLookupExpr 2022-11-09 16:31:59 +01:00
Paolo Tranquilli
e2bdef2fba Swift: extract DynamicMemberRefExpr 2022-11-09 16:22:22 +01:00
Nick Rolfe
611ed93e39 Ruby: add is{Public,Protected,Private} to DataFlow::MethodNode 2022-11-09 15:18:16 +00:00
Erik Krogh Kristensen
d35e5ac752 Merge pull request #11180 from erik-krogh/yetMoreCi
CI: compile-queries: use cache when running on main, and support more base-branches
2022-11-09 16:16:30 +01:00
Paolo Tranquilli
4770ad3177 Swift: extract OverloadedDeclRefExpr 2022-11-09 16:06:23 +01:00
Asger F
83291f378b Merge pull request #11157 from asgerf/js/yaml-locations
JS: fix issue with zero-column yaml locations
2022-11-09 15:57:54 +01:00
Andrew Eisenberg
df2e259944 Merge pull request #11073 from github/aeisenberg/vscode-ttl-docs 2022-11-09 06:53:50 -08:00
Paolo Tranquilli
5f8e7e67b4 Swift: extract ObjectLiteralExpr 2022-11-09 15:51:08 +01:00
Anders Schack-Mulligen
151f12ef5e Java: Improve sink model generation precision by excluding variable capture. 2022-11-09 15:32:30 +01:00
Nick Rolfe
199b3f4d71 Ruby: add change note for ActionCable channel remote flow sources 2022-11-09 14:18:44 +00:00
Nick Rolfe
db20e7d143 Ruby: add ActionCable channel RPC params as remote-flow sources 2022-11-09 14:16:04 +00:00
Anders Schack-Mulligen
07f50e275d Merge pull request #11182 from aschackmull/mad/split-configs
Java/C#: Split active configurations for model generator
2022-11-09 15:06:43 +01:00
Asger F
859dc7beb7 Merge pull request #11024 from asgerf/rb/data-flow-layer-capture2
Ruby: expand DataFlow API
2022-11-09 15:06:03 +01:00
erik-krogh
5ba694e909 remember to run on PRs 2022-11-09 14:55:08 +01:00
Paolo Tranquilli
a05706d89d Merge pull request #11177 from github/redsun82/swift-decls
Swift: extract `PoundDiagnosticDecl` and `MissingMemberDecl`
2022-11-09 14:54:57 +01:00
Michael Nebel
57e31c11da C#: Add change note. 2022-11-09 14:54:37 +01:00
erik-krogh
57ad491356 adjust the triggers, run on all PRs, and more branches 2022-11-09 14:50:53 +01:00
erik-krogh
8d51aaa403 add another fallback to main 2022-11-09 14:44:10 +01:00
erik-krogh
7e522770f6 simplify the cache keys 2022-11-09 14:43:30 +01:00
erik-krogh
1b9653827f do a quicker merge-base calculation 2022-11-09 14:38:55 +01:00
Anders Schack-Mulligen
b3b7711149 Dataflow: Sync. 2022-11-09 14:23:15 +01:00
Anders Schack-Mulligen
ade83b3cfe Dataflow: Introduce support for src/sink grouping in path results. 2022-11-09 14:22:24 +01:00
Anders Schack-Mulligen
fc4f93c87a Java/C#: Undo configuration footgun firing. 2022-11-09 13:20:39 +01:00
Nora Dimitrijević
5940f17b83 Swift: Docs + doctests 2022-11-09 13:10:08 +01:00
erik-krogh
53917e506e add refs/heads/ to make the ref fully-formed 2022-11-09 12:58:31 +01:00
Nick Rolfe
97e939ae2b Ruby: refine summaries for Hash#reverse_merge etc.
- revert the changes to the taint summaries specific to ActionController
  params
- make the general flow summaries value-preserving and use
  WithElement[any]
2022-11-09 11:56:07 +00:00
erik-krogh
f0b09ee16c fallback to main 2022-11-09 12:55:21 +01:00
erik-krogh
b3b13bdd43 use base_ref to calculate the cache-keys when running in a PR. 2022-11-09 12:55:02 +01:00
Mathias Vorreiter Pedersen
50c2683be0 Merge pull request #11181 from github/alexdenisov/extractor-errors-suite
Swift: add an internal query-suite for listing all the compiler errors
2022-11-09 11:52:59 +00:00
erik-krogh
ad7fc34efd extract .erb files as html 2022-11-09 12:43:19 +01:00
Erik Krogh Kristensen
c537c80ed6 Merge pull request #11095 from erik-krogh/exportRead
JS: recognize more re-exported values as exported
2022-11-09 12:39:41 +01:00
Alex Denisov
dacbf4e798 Swift: use more common name for the query 2022-11-09 12:29:50 +01:00
Alex Denisov
4ee6ae67d6 Swift: use explicit this to conform to the coding style 2022-11-09 12:17:11 +01:00
Alex Denisov
a1fa424ec1 Swift: add an internal query-suite for listing all the compiler errors 2022-11-09 12:05:41 +01:00
Paolo Tranquilli
9d4a208c0d Swift: extract MissingMemberDecl 2022-11-09 12:04:42 +01:00
Paolo Tranquilli
235181fb21 Swift: share translateDiagnosticsKind with SwiftDiagnosticsConsumer 2022-11-09 12:00:43 +01:00
Paolo Tranquilli
7bcee6e9a8 Merge branch 'main' into redsun82/swift-decls 2022-11-09 11:59:16 +01:00
erik-krogh
aede9c3467 support general base-branches, not just main 2022-11-09 11:55:19 +01:00
erik-krogh
484dc4ad3a restore from another cache when running on main. Otherwise that workflow always takes an hour 2022-11-09 11:45:21 +01:00
AlexDenisov
8756989b4b Merge pull request #11101 from github/alexdenisov/extractor-errors
Swift: extract diagnostics
2022-11-09 11:33:54 +01:00
erik-krogh
c8b7eccc6f sync files 2022-11-09 11:31:13 +01:00
erik-krogh
23add8a72b recognize passcode as sensitive 2022-11-09 11:30:57 +01:00
erik-krogh
e0bcfe2afb add failing test 2022-11-09 11:30:31 +01:00
Paolo Tranquilli
73ad1307ae Swift: extract PoundDiagnosticDecl 2022-11-09 11:13:55 +01:00
Paolo Tranquilli
c95a6ea5d1 Merge pull request #11176 from github/redsun82/swift-opaque-types
Swift: extract opaque types and their decls
2022-11-09 10:47:32 +01:00
Asger F
ac5a1d68ea Merge pull request #11170 from asgerf/rb/taint-known-or-unknown
Ruby: handle knownOrUnkown in default taint step
2022-11-09 10:42:02 +01:00
Erik Krogh Kristensen
138a16f0b3 use getImportedModuleNode()
Co-authored-by: Asger F <asgerf@github.com>
2022-11-09 09:53:23 +01:00
Asger F
694d987365 JS: Update test output 2022-11-09 09:36:03 +01:00
Asger F
f4b2af730d Update ruby/ql/lib/codeql/ruby/dataflow/internal/TaintTrackingPrivate.qll
Co-authored-by: Tom Hvitved <hvitved@github.com>
2022-11-09 09:28:07 +01:00
Paolo Tranquilli
b399d8df7e Swift: extract opaque types and their decls 2022-11-09 09:27:25 +01:00
Harry Maclean
ad7b5ae7ed Ruby: Add inline barrier guard test 2022-11-09 16:35:28 +13:00
Harry Maclean
f1b63c4df3 Ruby: Fix in clause barrier guard 2022-11-09 16:10:17 +13:00
Harry Maclean
0ab88c2e29 Ruby: Handle simple in clauses in barrier guard 2022-11-09 16:01:33 +13:00
Harry Maclean
87944a3a75 Ruby: Add test for another case guard variant 2022-11-09 15:05:03 +13:00
Harry Maclean
25ceeaf241 Ruby: Fix SplatExprCfgNode 2022-11-09 15:03:15 +13:00
Harry Maclean
4bc9096446 Ruby: Add case string comparison barrier guard
This recognises barriers of the form

    STRINGS = ["foo", "bar"]

    case foo
    when "some string literal"
      foo
    when *["other", "strings"]
      foo
    when *STRINGS
      foo
    end

where the reads of `foo` inside each `when` are guarded by the comparison
of `foo` with the string literals.

We don't yet recognise this construct:

    case foo
    when "foo", "bar"
      foo
    end

This is due to a limitation in the shared barrier guard logic.
2022-11-09 15:03:13 +13:00
Jami
cfbaf5e53b Merge pull request #10785 from jcogs33/insuff-key-size-globalflow-keysize
Java: Promote insufficient key size query from experimental
2022-11-08 18:05:01 -05:00
Geoffrey White
af9ad7b699 Merge branch 'main' into tuples 2022-11-08 21:38:38 +00:00
tiferet
ac14b6d685 Create EndpointCharacteristics to replace all existing NotASinkReasons and LikelyNotASinkReasons 2022-11-08 13:37:49 -08:00
Jami Cogswell
13decd38d9 update sink 2022-11-08 15:29:33 -05:00
Jami Cogswell
bada986433 apply review comments 2022-11-08 15:29:33 -05:00
Jami Cogswell
b99a1d2cd9 update sink and tests 2022-11-08 15:29:33 -05:00
Jami Cogswell
e49c5213ca update change note 2022-11-08 15:29:33 -05:00
Jami Cogswell
0e93e71127 update tests 2022-11-08 15:29:33 -05:00
Jami Cogswell
695d6f0e4e move files to regexp directory 2022-11-08 15:29:33 -05:00
Jami Cogswell
5402001362 remove original sanitizer 2022-11-08 15:29:33 -05:00
Jami Cogswell
be548c13e1 switch sink to use csv models 2022-11-08 15:29:33 -05:00
Jami Cogswell
5dcd3b2c0f clean up files 2022-11-08 15:29:33 -05:00
Jami Cogswell
32f7348d30 update help file 2022-11-08 15:29:33 -05:00
Jami Cogswell
eb30e8fe9e move Pattern.quote and Pattern.LITERAL models to Regex.qll 2022-11-08 15:29:33 -05:00
Jami Cogswell
81ad10bab5 update sink names 2022-11-08 15:29:33 -05:00
Jami Cogswell
5b089bbb9c split sanitizer into three 2022-11-08 15:29:33 -05:00
Jami Cogswell
91491d9a7b refactor into more classes; add more test cases; add LITERAL sanitizer 2022-11-08 15:29:33 -05:00
Jami Cogswell
50d638d1b6 create RegexInjection.qll file 2022-11-08 15:29:33 -05:00
Jami Cogswell
f6f26fe6c5 refactor code; add change note 2022-11-08 15:29:33 -05:00
Jami Cogswell
037a05cd66 add classes for Pattern, Matcher, and RegExUtils 2022-11-08 15:29:33 -05:00
Jami Cogswell
6ba7449df7 adjust imports 2022-11-08 15:29:33 -05:00
Jami Cogswell
6545cff0ef add Pattern.quote sanitizer 2022-11-08 15:29:33 -05:00
Jami Cogswell
833c5edf06 move to .qll file and switch to InlineExpectations tests 2022-11-08 15:29:32 -05:00
Jami Cogswell
25436fe555 update options and qlref files 2022-11-08 15:29:32 -05:00
Jami Cogswell
32b140045e move files out of experimental 2022-11-08 15:29:32 -05:00
Paolo Tranquilli
53b7584a90 Merge pull request #11169 from github/redsun82/swift-extract-last-stmts
Swift: extract remaining `Stmt`s
2022-11-08 20:51:10 +01:00
Paolo Tranquilli
7939b84380 Merge pull request #11168 from github/redsun82/swift-postfix-expr
Swift: extract `PostfixUnaryExpr`
2022-11-08 20:50:45 +01:00
tiferet
fadbdc1f63 Documentation improvements suggested by Andrew 2022-11-08 11:45:33 -08:00
Jeroen Ketema
6a5f37b1b7 Merge pull request #11149 from geoffw0/wrong-number-msg
C++: Clearer messages for the format args queries
2022-11-08 20:44:10 +01:00
erik-krogh
c1727ba005 lower precision to high in ql/override-any 2022-11-08 20:35:07 +01:00
erik-krogh
107cbb29b1 guide users towards using exists(variable) in ql/override-any 2022-11-08 20:34:58 +01:00
erik-krogh
c5fece7a87 QL: improve the dead-code query 2022-11-08 20:20:34 +01:00
Erik Krogh Kristensen
8b11e98d42 Merge pull request #11162 from erik-krogh/ciCache
CI: try only to fill the compilation cache from main in the compile-queries workflow
2022-11-08 19:24:14 +01:00
Asger F
43769ad464 Ruby: update test output 2022-11-08 19:20:57 +01:00
Nick Rolfe
a9ff0bdbbf Ruby: accept changed test output 2022-11-08 17:36:31 +00:00
Paolo Tranquilli
cbae72d9da Swift: remove emoji in test 2022-11-08 17:41:40 +01:00
Paolo Tranquilli
9ee4f8b388 Swift: extract remaining Stmts
`FailStmt` are `return nil` in fallible initializers.

`PoundAssertStmt` are an experimental feature for compile time
assertions.
2022-11-08 17:38:17 +01:00
Mathias Vorreiter Pedersen
4cdcebf022 Merge pull request #11161 from geoffw0/localflowsource
Swift: Add LocalFlowSource class and a few sources.
2022-11-08 16:12:32 +00:00
Paolo Tranquilli
00d3ff8a18 Swift: extract UnaryPostfixExpr 2022-11-08 17:10:33 +01:00
Michael Nebel
d8889f2d1f C#: Make a dummy project as a part of running the conversion script. 2022-11-08 17:02:57 +01:00
Nick Rolfe
865d0ca64a Ruby: add changenote for ActiveSupport Hash extension summaries 2022-11-08 15:52:21 +00:00
Nick Rolfe
04575674db Ruby: generalise summaries for ActiveSupport Hash extensions 2022-11-08 15:48:20 +00:00
Michael Nebel
0b04505e04 C#: Update all data extensions files. 2022-11-08 16:47:02 +01:00
Michael Nebel
d3a458ef1a C#: Remove blank lines in generated converted models. 2022-11-08 16:46:38 +01:00
Asger F
271de66f01 Ruby: rename getConst -> getConstant 2022-11-08 16:41:04 +01:00
Andrew Eisenberg
e674759860 Add documentation about the codeQL.queryHistory.ttl setting
Update docs/codeql/codeql-for-visual-studio-code/customizing-settings.rst

Co-authored-by: Felicity Chapman <felicitymay@github.com>
2022-11-08 07:22:20 -08:00
Mauro Baluda
8e546e8496 Add req.url.origin to RequestInputAccess 2022-11-08 16:14:10 +01:00
Asger F
a60f510c85 Ruby: handle knownOrUnkown in default taint step 2022-11-08 16:11:55 +01:00
AlexDenisov
6fb021a5bc Merge pull request #11164 from github/redsun82/swift-print-unextracted
Swift: print unextracted entities
2022-11-08 16:07:44 +01:00
Michael Nebel
f1b5ed1cba C#: Remove [source|sink|summary|negativeSummary]Model/1 predicates. 2022-11-08 16:01:43 +01:00
Jeroen Ketema
2bef82babc Merge pull request #11163 from jketema/missing-return
C++: Add dataflow test that deliberately omits the return of a non-void function
2022-11-08 16:00:36 +01:00
Geoffrey White
c8426776fc Merge branch 'main' into wrong-number-msg 2022-11-08 14:47:19 +00:00
Tony Torralba
eef4fc3a0a Apply suggestions from code review
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
2022-11-08 15:44:26 +01:00
Paolo Tranquilli
d325a42890 Swift: print unextracted entities 2022-11-08 15:38:53 +01:00
Alex Denisov
3f2f328d87 Swift: put invocation files into a separate folder 2022-11-08 15:32:51 +01:00
Jeroen Ketema
d93bda21c2 Merge pull request #11159 from jketema/strcat-return-deref-taint
C++: Also taint the return value dereference in the `strcat` model
2022-11-08 15:27:07 +01:00
Alex Denisov
096469c6fe Swift: use timestamp + getpid for the invocation filename 2022-11-08 15:26:35 +01:00
Jeroen Ketema
fa2d58adff C++: Add dataflow test that deliberately omits the return of a non-void function 2022-11-08 15:12:34 +01:00
Alex Denisov
42004d93f0 Swift: cleanup diagnostic message construction 2022-11-08 15:07:01 +01:00
erik-krogh
22d7f3cfe5 try only to fill the cache from main 2022-11-08 15:06:00 +01:00
Alex Denisov
d9b3104c78 Swift: remove unneeded include 2022-11-08 15:03:43 +01:00
Alex Denisov
4f05f083a5 Swift: split SwiftLocationExtractor into h/cpp 2022-11-08 15:02:22 +01:00
Alex Denisov
609c7cf84d Swift: Rename diagnostics consumer 2022-11-08 14:56:50 +01:00
Geoffrey White
25b4296045 Swift: Rename predicate to avoid confusion. 2022-11-08 13:52:33 +00:00
Alex Denisov
2b8b6d3dc3 Swift: ignore diagnostics for PrintAst 2022-11-08 14:45:56 +01:00
Alex Denisov
e9c4cb227f Swift: add more diagnostics tests 2022-11-08 14:41:10 +01:00
Alex Denisov
680b7a16fb Swift: extract location extraction into a separate entity 2022-11-08 14:41:10 +01:00
Alex Denisov
e9da5eecf2 Swift: update test expectations 2022-11-08 14:41:06 +01:00
Geoffrey White
24c8f1d8b5 Swift: Add some local (and remote) flow sources for String. 2022-11-08 13:38:25 +00:00
Alex Denisov
b62a4aae1a Swift: include null terminators into the invocation file hash 2022-11-08 14:36:28 +01:00
Alex Denisov
433f4e0cb5 Swift: use DbFile/DbLocation 2022-11-08 14:36:28 +01:00
Alex Denisov
288bdc2ee9 Swift: add diagnostics test case 2022-11-08 14:36:28 +01:00
Alex Denisov
b39cf7ea11 Swift: diagnostics: fix bazel build 2022-11-08 14:36:28 +01:00
Alex Denisov
1574e855eb Swift: consume and store compiler frontend diagnostics 2022-11-08 14:36:28 +01:00
Alex Denisov
62c26f8f27 Swift: add diagnostics to dbscheme 2022-11-08 14:36:25 +01:00
Erik Krogh Kristensen
e01cbb2ffa Merge pull request #10378 from erik-krogh/aliasFlow
JS: expand localFieldStep to use access-paths, and build access-paths in more cases
2022-11-08 14:26:12 +01:00
Geoffrey White
e669754d0b Swift: Also add local flow sources to summary queries. 2022-11-08 13:05:41 +00:00
Geoffrey White
be05b807cd Swift: Add models-as-data local flow sources as well. 2022-11-08 13:05:41 +00:00
Geoffrey White
0dcb5546a1 Swift: Add a LocalFlowSource and FlowSource class. 2022-11-08 13:05:41 +00:00
Geoffrey White
c5285acb04 Swift: Add more tests for String flow sources. 2022-11-08 13:05:40 +00:00
Paolo Tranquilli
552c5249ac Merge pull request #11131 from github/redsun82/swift-incomplete-ast
Swift: deal with incomplete ASTs
2022-11-08 14:01:58 +01:00
Tom Hvitved
f0554fcdee Merge pull request #11155 from hvitved/ruby/avoid-stage-recomputation
Ruby: Avoid stage recomputation
2022-11-08 13:46:53 +01:00
Tom Hvitved
edde3defed Merge pull request #11153 from hvitved/ruby/basic-block-at-conditions
Ruby: Split basic blocks around constant conditionals
2022-11-08 13:35:52 +01:00
Rasmus Wriedt Larsen
4895daba85 DataFlow: Add read/store stepIsLocal consistency checks 2022-11-08 13:32:49 +01:00
Asger F
69f5879384 JS: Update TRAP test output 2022-11-08 13:02:26 +01:00
Jeroen Ketema
c61a9c5911 C++: Also taint the return value dereference in the strcat model 2022-11-08 12:08:44 +01:00
Asger F
44e94f6615 JS: Change note 2022-11-08 11:51:26 +01:00
Paolo Tranquilli
9731048836 Swift: remove an assert from swift headers
An interesting byproduct was finding a problematic `assert` in the
Swift headers. An incomplete `FallthroughStmt` was asserting on having
a destination. I did not find any other sensible way of getting rid of
the crash when running in debug mode than to patch the header.
2022-11-08 11:47:12 +01:00
Paolo Tranquilli
fda9d19a97 Swift: replace undefined labels with UnspecifiedElement 2022-11-08 11:47:12 +01:00
Paolo Tranquilli
8d3e6ff8a7 Swift: add label iteration 2022-11-08 11:47:12 +01:00
Paolo Tranquilli
450a4a04af Swift: add incomplete ast test
The test was inspired by locally running the query against files in
https://github.com/apple/swift/tree/main/test/Parse

A query for missing elements was also added to the AST tests, expecting
nothing to be found.
2022-11-08 11:46:07 +01:00
Asger F
fef922e417 JS: Bump extractor version string 2022-11-08 11:44:40 +01:00
Paolo Tranquilli
d6fb6bf036 Swift: customize UnspecifiedElement 2022-11-08 11:40:27 +01:00
Paolo Tranquilli
e17bc6c581 Swift: add UnspecifiedElement 2022-11-08 11:40:27 +01:00
Asger F
92e8f059c8 JS: Avoid emitting column zero in yaml files 2022-11-08 11:38:26 +01:00
Paolo Tranquilli
2aa528852e Swift: add possibility to specify null class 2022-11-08 11:27:14 +01:00
Nora Dimitrijević
7585541514 Merge branch 'main' into swift/js-injection 2022-11-08 11:25:54 +01:00
Nora Dimitrijević
d37ed02e79 Swift: basic Data-related taint flow in query
Still TODO: a more comprehensive taint flow model for Data in the libs.
2022-11-08 11:24:53 +01:00
Nora Dimitrijević
66291d3575 Swift: sync tests pass with additional flow steps
TODO: Convert those flow steps to taint flow models in the library.
2022-11-08 11:09:55 +01:00
Tom Hvitved
f0b9ca4bf9 Ruby: Add more guards tests 2022-11-08 11:09:54 +01:00
Asger F
a75c50620c Ruby: update more SSA test output 2022-11-08 11:03:24 +01:00
Tom Hvitved
37a69b4569 Ruby: Avoid stage recomputation 2022-11-08 10:51:30 +01:00
Karim Ali
c794fef9cb update qhelp with more details about the use of constant passwords 2022-11-08 11:26:52 +02:00
Karim Ali
b1679df3d2 tighten check against the "iv" argument only 2022-11-08 11:22:18 +02:00
Karim Ali
b077fc5e91 add more details in qhelp about the use of hardcoded/constant IVs 2022-11-08 11:19:41 +02:00
Tom Hvitved
7ba0682297 Ruby: Split basic blocks around constant conditionals 2022-11-08 09:07:23 +01:00
Tom Hvitved
c86f597153 Ruby: Add test for disjunctive guard 2022-11-08 09:01:22 +01:00
Nora Dimitrijević
7c515bbef7 Swift: _ as in _ = ... is a CFG leaf node.
This enables DataFlow to skip over it and not get stuck.
2022-11-07 18:02:06 +01:00
Geoffrey White
d72ea52f68 C++: More accurate test tags. 2022-11-07 16:32:46 +00:00
Geoffrey White
55a7adff20 C++: Make the message clearer. 2022-11-07 16:32:45 +00:00
Geoffrey White
b911556896 C++: Add a test showing the motivation. 2022-11-07 16:17:32 +00:00
Felicity Chapman
cfb0ff2618 Merge pull request #11145 from github/felicitymay-ruby-docs-updates
Ruby: add a couple of missing links to a new article
2022-11-07 16:09:48 +00:00
Mauro Baluda
8b33e6d175 Improved Hapi support
- server defined by Glue
2022-11-07 16:29:44 +01:00
Felicity Chapman
418a245ea9 Add missing link to Ruby guide 2022-11-07 15:28:14 +00:00
Felicity Chapman
f20bfacc5a Add missing link to general articles 2022-11-07 15:27:14 +00:00
Arthur Baars
0b3d55e6ab Merge pull request #11140 from github/codeql-cli-2.11.2
Merge documentation changes of 2.11.2 into 2.11.3
2022-11-07 16:07:20 +01:00
Asger F
a887ff4f09 JS: Add test cases to include results with column-zero end locations 2022-11-07 15:13:25 +01:00
erik-krogh
7a8e7150f0 add change-note 2022-11-07 14:36:55 +01:00
erik-krogh
f2d980b132 update ruby build to include the regex pack (depend on #10668) 2022-11-07 14:36:53 +01:00
erik-krogh
860c3c443c update expected output of the queries (some sorting changed due to locations being used slightly differently in the shared pack) 2022-11-07 14:34:20 +01:00
erik-krogh
40e4359173 port the Ruby regex/redos queries to use the shared pack 2022-11-07 14:34:18 +01:00
erik-krogh
3432e814c5 add a Ruby implementation of RegexTreeViewSig 2022-11-07 14:33:46 +01:00
erik-krogh
af922702c7 move existing regex-tree into a module 2022-11-07 14:33:46 +01:00
erik-krogh
dddf550593 add codeql/regex as a dependency 2022-11-07 14:33:45 +01:00
erik-krogh
c89016b181 use instead of a fixed version number 2022-11-07 14:32:20 +01:00
erik-krogh
c733648dc6 add change-note 2022-11-07 14:31:53 +01:00
erik-krogh
618438642a update expected output of the queries (some sorting changed due to locations being used slightly differently in the shared pack) 2022-11-07 14:31:52 +01:00
erik-krogh
4f11e2d25f port the Python regex/redos queries to use the shared pack 2022-11-07 14:31:51 +01:00
erik-krogh
05605480ae drive-by simplification of the python regex-tree 2022-11-07 14:31:27 +01:00
erik-krogh
1aeaefca7f add a Python implementation of RegexTreeViewSig 2022-11-07 14:31:27 +01:00
erik-krogh
5fbcbbc584 move existing regex-tree into a module 2022-11-07 14:31:27 +01:00
erik-krogh
2b139924cd add codeql/regex as a dependency 2022-11-07 14:31:27 +01:00
erik-krogh
f5daee2483 port canonicalization fix from #11071 to the shared pack 2022-11-07 14:26:55 +01:00
erik-krogh
09275a56c1 remove files from identical files that soon won't be identical 2022-11-07 14:22:46 +01:00
erik-krogh
5ec22bc180 add a shared regex pack 2022-11-07 14:22:46 +01:00
JarLob
d865f2ecf5 Remove import 2022-11-07 14:19:24 +01:00
Asger F
edc5d8d644 Ruby: update test output 2022-11-07 14:17:50 +01:00
Geoffrey White
645906a7d7 Merge branch 'main' into tuples 2022-11-07 13:17:12 +00:00
Asger F
a213e9e55d Merge pull request #1 from hvitved/rb/data-flow-layer-capture2
Ruby: Make sure to always generate SSA definitions for namespace self-variables
2022-11-07 14:12:48 +01:00
Asger F
f991991474 Ruby: fix incomplete renaming of getCanonicalEnclosing/Nested module 2022-11-07 14:04:10 +01:00
Arthur Baars
4d50543d70 Merge pull request #11141 from aibaars/docs-update
Ruby: expand explanation of desugaring
2022-11-07 14:03:07 +01:00
Tom Hvitved
2737255705 Ruby: Make sure to always generate SSA definitions for namespace self-variables 2022-11-07 14:02:09 +01:00
Asger F
a39cefe40f Ruby: fix broken test 2022-11-07 14:01:11 +01:00
JarLob
e122f94c1c Move to isBooleanConstant 2022-11-07 13:38:05 +01:00
Arthur Baars
33b1c8471c Apply suggestions from code review
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2022-11-07 13:35:58 +01:00
Arthur Baars
aad3e06027 Apply suggestions from code review
Co-authored-by: Nick Rolfe <nickrolfe@github.com>
2022-11-07 13:08:57 +01:00
JarLob
74ee101592 Extend Constant Condition query with String.IsNullOrEmpty. 2022-11-07 13:05:37 +01:00
Arthur Baars
6a0a81b3be Ruby: expand explanation of desugaring 2022-11-07 12:57:01 +01:00
Karim Ali
53055bc8b6 add another reference to RFC 2898 2022-11-07 13:44:25 +02:00
Karim Ali
2a22c69a64 remove unused variable from test + updated expected output 2022-11-07 13:31:55 +02:00
Arthur Baars
9d55cd7658 Merge pull request #11139 from aibaars/docs-update
Ruby: docs add missing entry
2022-11-07 12:10:23 +01:00
Arthur Baars
63dc0445a8 Ruby: docs add missing entry 2022-11-07 11:54:37 +01:00
Arthur Baars
16c3da3a27 Merge pull request #11056 from alexrford/ruby/ast-ref-table-docs
Ruby: add an AST reference guide
2022-11-07 11:48:37 +01:00
Asger F
334d5b1b17 Ruby: fix stale qldoc 2022-11-07 11:23:40 +01:00
Asger F
27e1a8bd7a Ruby: cache predicates related to getConst 2022-11-07 11:18:29 +01:00
Asger F
d4b018f242 Ruby: typo: found up -> looked up 2022-11-07 09:58:00 +01:00
erik-krogh
fc38bf0429 Merge branch 'main' into aliasFlow 2022-11-07 09:46:48 +01:00
Asger F
25f0382fce Ruby: replace asMethod with asCallableAstNode 2022-11-07 09:38:48 +01:00
Asger F
af5a378572 Ruby: fix typo in qldoc 2022-11-07 09:20:35 +01:00
Asger F
9a38e31baa Ruby: add explicit 'this' 2022-11-07 09:20:28 +01:00
Asger F
ff20908bbd Ruby: Assignment -> AssignExpr 2022-11-07 09:20:16 +01:00
erik-krogh
40032f295a treat arrays that gets executed with shell:true as a sink for js/shell-command-constructed-from-input 2022-11-07 09:19:05 +01:00
Asger F
25dd8db423 Ruby: Refactor out getAnElementWriteCall 2022-11-07 09:18:18 +01:00
Asger F
5fa49b3319 Ruby: asExpr() -> getExprNode() 2022-11-07 09:18:00 +01:00
Asger F
8b85744d3e Ruby: use lambdaCreation and handle "proc" in there 2022-11-07 09:14:55 +01:00
erik-krogh
bc5b7455cf add failing test 2022-11-07 09:14:52 +01:00
Arthur Baars
9992ecc317 Merge branch 'codeql-cli-2.11.2' into ruby/ast-ref-table-docs 2022-11-04 17:59:35 +01:00
Calum Grant
e9e94dcb0f Merge pull request #10932 from github/nickrolfe/ruby-dataflow-docs
Ruby: data flow docs
2022-11-04 16:47:00 +00:00
erik-krogh
d7f1491f41 fix non-attached annotations for newtype branches 2022-11-04 17:19:42 +01:00
Alex Ford
53e83ff048 Ruby: AST ref docs - add futher reading section 2022-11-04 16:01:31 +00:00
Alex Ford
13aad99194 Ruby: AST ref docs - add Calls section intro 2022-11-04 16:01:31 +00:00
Alex Ford
a77fc96067 Ruby: AST ref docs - note about desugaring and synthesized AstNodes 2022-11-04 16:01:31 +00:00
Alex Ford
530b29ccdf Ruby: AST ref docs - note AssignExpr 2022-11-04 16:01:31 +00:00
Alex Ford
9cf3284371 Ruby: AST ref docs - add a missing space 2022-11-04 16:01:31 +00:00
Arthur Baars
5aee96d907 Merge branch 'codeql-cli-2.11.2' into ruby/ast-ref-table-docs 2022-11-04 16:39:29 +01:00
Arthur Baars
a11de9b145 Merge branch 'codeql-cli-2.11.2' into nickrolfe/ruby-dataflow-docs 2022-11-04 16:38:19 +01:00
Arthur Baars
20bebba1ff Merge pull request #10957 from aibaars/doc-api-graph
Ruby: document API graphs
2022-11-04 16:36:38 +01:00
Arthur Baars
610bbeee97 Update docs/codeql/codeql-language-guides/using-api-graphs-in-ruby.rst
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2022-11-04 16:21:57 +01:00
Alex Ford
d218572c72 Ruby: Apply review suggestions for AST reference guide
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2022-11-04 14:42:33 +00:00
Arthur Baars
fadc278485 Merge branch 'codeql-cli-2.11.2' into nickrolfe/ruby-dataflow-docs 2022-11-04 13:05:26 +01:00
Michael Nebel
d580722164 C#: Modify unsupported external library meta query to use call instead of dispatchcall. 2022-11-04 11:20:33 +01:00
Michael Nebel
187ece610b C#: Only evaluate api name and namespace strings if they are needed. 2022-11-04 11:20:33 +01:00
Michael Nebel
366b94addc C#: Implement override for getAPrimaryQlClass for AnonymousClass. 2022-11-04 11:20:33 +01:00
Michael Nebel
e0d7e277fb C#: Align counting with Java and only count calls and not all possible dispatch calls. 2022-11-04 11:20:33 +01:00
Michael Nebel
be1129e782 C#: Only consider effectively public methods. 2022-11-04 11:20:33 +01:00
Michael Nebel
fec4d1992d C#: Update telemetry expected output. 2022-11-04 11:20:33 +01:00
Michael Nebel
f0b5058760 C#: Remove filename from telemetry output. 2022-11-04 11:20:33 +01:00
Geoffrey White
3c07ff592a Swift: Fix result expectations. 2022-11-04 09:44:48 +00:00
Geoffrey White
20147e87b2 Swift: Correct var names. 2022-11-04 09:38:12 +00:00
Asger F
4ae90e35d5 Ruby: inline transitive class-hierarchy getters 2022-11-04 08:50:33 +01:00
Asger F
472a10fd54 Ruby: direct -> immediate 2022-11-04 08:49:01 +01:00
Michael Nebel
3c8fb0520e C#: Sync files. 2022-11-04 08:20:53 +01:00
Michael Nebel
cee06140e2 C#: Deprecate ModelCsv classes. 2022-11-04 08:20:53 +01:00
Michael Nebel
990a898cc7 C#: Remove the Csv name where appropriate. 2022-11-04 08:20:53 +01:00
Michael Nebel
d11bca0cdc C#: Migrate unit tests to data extensions. 2022-11-04 08:20:53 +01:00
Michael Nebel
e432e6576a C#: Add missing import of tainted member definition. 2022-11-04 08:20:53 +01:00
Michael Nebel
5acfc22442 C#: Bi-directional import of synthetic field declarations. 2022-11-04 08:20:53 +01:00
Michael Nebel
afb604ee5f C#: Remove all generated models. 2022-11-04 08:20:53 +01:00
Michael Nebel
44e4cf6556 C#: Delete all the manually created models. 2022-11-04 08:20:53 +01:00
Michael Nebel
43af1e4b42 C#: Add generated models for .NET Runtime. 2022-11-04 08:20:52 +01:00
Michael Nebel
8fa6140a0d C#: Add data extensions version of the model generator scripts. 2022-11-04 08:20:52 +01:00
Michael Nebel
f181d66003 C#: Add data extensions files for handwritten models. 2022-11-04 08:20:52 +01:00
Michael Nebel
7be79290e8 C#: Define extensible predicates. 2022-11-04 08:20:52 +01:00
Michael Nebel
eb27e8acc5 C#: Prepare ExternalFlow for converting model predicates into extensible predicates. 2022-11-04 08:20:52 +01:00
Michael Nebel
ac47b56566 C#: Update the library qlpack to pick up data extensions. 2022-11-04 08:20:47 +01:00
Michael Nebel
e6a8019c2b C#: Add python script for generating YAML files containing data extensions. 2022-11-04 08:19:05 +01:00
Michael Nebel
4972839b69 C#: Add queries for extracting hand written MaD models. 2022-11-04 08:19:05 +01:00
Michael Nebel
2a0c3636c7 C#: Add small dummy project. 2022-11-04 08:19:05 +01:00
Michael Nebel
4b649e0bad C#: Update flowsummaries test expected output. 2022-11-04 08:19:05 +01:00
Michael Nebel
3c02d614fa C#: Re-generate the .NET Runtime models. 2022-11-04 08:19:05 +01:00
Geoffrey White
86cbf1b82c Swift: Add comments. 2022-11-03 18:45:43 +00:00
Jami Cogswell
910eebcf5d update change note 2022-11-03 14:44:04 -04:00
Geoffrey White
24f0eeb6df Swift: Better assigning to tuple values. 2022-11-03 15:52:01 +00:00
Geoffrey White
6dc51edb4c Swift: Assigning to tuple values. 2022-11-03 15:51:58 +00:00
Geoffrey White
472ece45e7 Swift: Basic content flow through tuples. 2022-11-03 15:51:33 +00:00
Geoffrey White
a7ecdef2a6 Swift: Add dataflow tests for tuples. 2022-11-03 15:50:27 +00:00
Nora Dimitrijević
fdd7d76ffd Swift: use FreeFunctionDecl/.has(Qualified)Name
Instead of hand-rolled predicates.
2022-11-03 16:14:43 +01:00
Arthur Baars
6891b52216 Merge branch 'codeql-cli-2.11.2' into doc-api-graph 2022-11-03 13:29:03 +01:00
Arthur Baars
a42f3fdfbc Merge pull request #10873 from aibaars/ruby-beta-notice
Ruby: drop beta notice
2022-11-03 13:28:01 +01:00
Tony Torralba
da67b1059c Remove (now unnecessary) import 2022-11-03 12:38:45 +01:00
Arthur Baars
7c577ae1d1 Address review feedback 2022-11-03 12:37:50 +01:00
Tony Torralba
3e1819f25d Model XMLParser constructor init(contentsOf:) 2022-11-03 12:01:42 +01:00
Tony Torralba
fe138dc0a1 Add explicitly safe test cases 2022-11-03 12:01:42 +01:00
Tony Torralba
0c6957ea78 Adjust test expectations of a query affected by new summaries 2022-11-03 12:01:42 +01:00
Tony Torralba
f4047e016c Address QL-for-QL alert
Use an alert message consistent with the other languages
2022-11-03 12:01:42 +01:00
Tony Torralba
dc6f60a501 Add new XXE query
Only XMLParser sinks for the time being
2022-11-03 12:01:42 +01:00
Nora Dimitrijević
3d24e0a2eb Swift: enable VSCode to build extractor via CMake
The `-arch=x86_64` from `swift/rules.bzl` turns out to be unnecessary,
even on Arm-based Macs.
2022-11-03 11:16:48 +01:00
Nora Dimitrijević
28b7f0884f Swift: UnsafeJsEval test finally compiles 2022-11-03 11:16:48 +01:00
Nora Dimitrijević
7b599f5fef Swift: Add async varant of WKWebView evaluateJavaScript(_:)
See concurrency note here: https://developer.apple.com/documentation/webkit/wkwebview/1415017-evaluatejavascript

See also https://developer.apple.com/documentation/swift/calling-objective-c-apis-asynchronously
2022-11-03 11:16:48 +01:00
Nora Dimitrijević
5c905c42b2 Swift: Initial UnsafeJsEval query 2022-11-03 11:16:48 +01:00
erik-krogh
655b4a4d17 recognize more re-exported values as exported 2022-11-03 11:08:00 +01:00
erik-krogh
94e864e933 add failing test 2022-11-03 11:04:04 +01:00
Asger F
0f1b3486de Ruby: Use another join order for nested constant lookup 2022-11-03 10:47:39 +01:00
Asger F
a195ea942e Ruby: only drop to CFG layer for getConstantValue() 2022-11-03 10:18:31 +01:00
Asger F
cf4a3e0bbe Ruby: 'a' -> 'an' in a qldoc 2022-11-03 10:13:39 +01:00
Asger F
fe8945b5c9 Ruby: Rename getCanonicalEnclosing/Nested module
getCanonicalEnclosingModule -> getParentModule
getCanonicalNestedModule -> getNestedModule
2022-11-03 10:10:47 +01:00
Asger F
bd2a065562 Ruby: rename ConstantValue::getX -> fromX 2022-11-03 10:03:40 +01:00
Dave Bartolomeo
966be2727e Use correct bundle version for second init 2022-11-02 12:22:39 -04:00
Dave Bartolomeo
3507cdc796 Stop using latest for second init 2022-11-02 12:17:24 -04:00
Alex Ford
3b015eef51 Merge pull request #11057 from alexrford/ruby/ast-doc-table-whitespace
Ruby: fix whitespace in basic query doc table
2022-11-02 15:43:06 +00:00
Dave Bartolomeo
906f2f5e0f Add repo 2022-11-02 11:42:39 -04:00
Dave Bartolomeo
631b8fed30 Add token 2022-11-02 11:40:01 -04:00
Dave Bartolomeo
bb0b0801dd Try again 2022-11-02 11:38:11 -04:00
Rasmus Lerchedahl Petersen
0a7cfad048 python: inline query tests for command injection
note how the test file is partially annotated
and those annotations can now be expressed

In this particular test file, absolute line numbers
might have been better than relative ones.
We might remove line numbers altogether,
but should check more querries to see how it looks.
2022-11-02 16:21:59 +01:00
Rasmus Lerchedahl Petersen
f486c44b00 python: library for inline query tests
similar to the consistency queires used in js
but based on the inline expectations framework
2022-11-02 16:18:36 +01:00
Dave Bartolomeo
5d288d321a Use latest released bundle for QL-for-QL 2022-11-02 11:10:04 -04:00
Karim Ali
f6484e6e6b cleanup old code comments 2022-11-02 16:21:51 +02:00
Karim Ali
27d2dc6d9e update expected results 2022-11-02 16:13:50 +02:00
Karim Ali
eefda61445 add a query that checks for the use of static IVs 2022-11-02 16:09:00 +02:00
erik-krogh
6bc12e8f2b Merge branch 'main' into formatTaint 2022-11-02 13:39:30 +01:00
Alex Ford
727b5aebd1 Ruby: AST ref docs - add too toctree 2022-11-02 12:36:52 +00:00
Nick Rolfe
8786c700c2 Expand explanations of example global data-flow queries 2022-11-02 11:30:37 +00:00
Nick Rolfe
9998752147 Accept suggested wording improvements
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2022-11-02 10:53:21 +00:00
Tom Hvitved
1e3adcd14e Revert "Revert "SSA: Turn consistency predicates into query predicates"" 2022-11-02 11:37:37 +01:00
erik-krogh
33cca29a8e drop down to the CFG instead of the AST to better support de-sugaring 2022-11-02 11:23:01 +01:00
Alex Ford
e6f91b91e0 Ruby: AST ref docs - initial draft 2022-11-01 23:48:23 +00:00
erik-krogh
851d53d56b don't sanitize calls through substring calls that just remove the start 2022-11-01 22:51:07 +01:00
erik-krogh
08bc14f598 add failing test 2022-11-01 22:50:13 +01:00
Felicity Chapman
1a702bfd50 Add new article to toctree to fix test 2022-11-01 17:26:36 +00:00
Alex Ford
d061df2e12 Ruby: AST ref docs - Module.qll 2022-11-01 15:24:23 +00:00
Karim Ali
8be4d47178 fix typos 2022-11-01 16:03:36 +02:00
Karim Ali
fe408cfb41 add a query that detects the use of constant passwords 2022-11-01 14:03:27 +02:00
Arthur Baars
ab963fef82 Apply suggestions from code review
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2022-11-01 11:35:26 +01:00
Asger F
2619f3f667 Ruby: include overridden methods in getAnInstanceSelf 2022-11-01 08:32:55 +01:00
Alex Ford
f5c2ed9e45 Ruby: AST ref docs - fix table formatting and some misnamed classes 2022-10-31 22:35:00 +00:00
Alex Ford
a7ebbfb139 Ruby: WIP AST reference guide 2022-10-31 22:14:09 +00:00
Nick Rolfe
23db9c573f Ruby docs: add LocalSourceNode and remove CfgNode from class list 2022-10-31 16:25:34 +00:00
Ian Lynagh
d3934c97ed Kotlin: Run java-interface-redeclares-tostring on all platforms 2022-10-31 14:52:19 +00:00
Asger F
ab4e341e65 Ruby: fix handling of namespaces with no 'self' 2022-10-31 14:05:11 +01:00
Asger F
9da5ec79c5 Ruby: Drive-by fix a QL4QL alert 2022-10-31 14:05:11 +01:00
Asger F
e549f15b1c Ruby: fix implicit 'this' 2022-10-31 14:05:11 +01:00
Asger F
056b1e8d63 Ruby: add some basic tests 2022-10-31 14:05:11 +01:00
Asger F
9be2512050 Ruby: rename one of the PostsController2 classes
These had the same name and ended up being unified
2022-10-31 13:33:41 +01:00
Asger F
b4b34cc994 Ruby: port part of ActionController model 2022-10-31 13:33:41 +01:00
Asger F
12ce46e4b1 Ruby: port part of Railties model 2022-10-31 13:33:41 +01:00
Asger F
38955d1761 Ruby: port part of the Rails model 2022-10-31 13:33:41 +01:00
Asger F
9f59b6b439 Update type-tracking test 2022-10-31 13:33:41 +01:00
Asger F
0a8f39fe96 Ruby: recover some incomplete capture flow 2022-10-31 13:33:41 +01:00
Asger F
ff02ba5965 Ruby: include SSA param input step for flowsTo 2022-10-31 13:33:41 +01:00
Asger F
017157820a Ruby: make ParameterNode extend LocalSourceNode 2022-10-31 13:33:41 +01:00
Asger F
b29ac5249e Ruby: add type-tracking inline test in global flow test 2022-10-31 13:33:41 +01:00
Asger F
4ed61c13f8 Ruby: add some captured-variable flow tests 2022-10-31 13:33:41 +01:00
Asger F
b632e21ba0 Ruby: add ConstRef 2022-10-31 13:33:41 +01:00
Nick Rolfe
5369ba1d83 ruby docs: remove distracting sentence 2022-10-31 11:24:30 +00:00
Asger F
06ec03de74 Ruby: add convenience-accessors for ConstantValue 2022-10-28 15:16:14 +02:00
Asger F
046e669c78 Ruby: add getAncestorExpr 2022-10-28 15:16:14 +02:00
Asger F
77d1788619 Ruby: add data flow versions of ArrayLiteral, HashLiteral, Pair 2022-10-28 15:16:14 +02:00
Asger F
2546d09fe2 Ruby: add SetterCallNode 2022-10-28 15:16:14 +02:00
Asger F
515b8366d2 Ruby: add getAnAncestor, getADescendent 2022-10-28 15:16:14 +02:00
Asger F
c8f7519cee Ruby: add Module.getNamespaceOrTopLevel 2022-10-28 15:16:14 +02:00
Asger F
1f644a9c1d Ruby: add getEnclosingToplevel 2022-10-28 15:16:14 +02:00
Asger F
436cc60138 Ruby: update some uses of getConstantValue() 2022-10-28 15:16:14 +02:00
Asger F
156964bfc9 Ruby: add getEnclosingModule and getNestedModule 2022-10-28 15:16:14 +02:00
Asger F
67772bbc43 Ruby: Accessors for attributes and elements 2022-10-28 15:16:14 +02:00
Asger F
8976ba5583 Ruby: Add CallableNode, MethodNode, and accessors 2022-10-28 15:16:13 +02:00
Alex Ford
bb9205226a Ruby: fix whitespace in basic query doc table 2022-10-28 13:36:45 +01:00
Rasmus Wriedt Larsen
e8fdff7a3b Python: Expand ExternalAPIs test
We never had a showcase of how keyword arguments were handled
2022-10-28 09:38:02 +02:00
Rasmus Wriedt Larsen
6577281bed Python: Add crosstalk fieldflow test 2022-10-28 09:31:16 +02:00
Rasmus Wriedt Larsen
c1b2561598 Python: Extend fieldflow tests with bound method call 2022-10-28 09:31:16 +02:00
Rasmus Wriedt Larsen
0f34752f8f Python: Delete classesCallGraph.ql
I don't see the value from this, so just going to outright delete it.
(it actually stayed alive for quite some time in the original git history,
but never seemed to be that useful.)
2022-10-28 09:31:01 +02:00
Rasmus Wriedt Larsen
7d8c0c663f Python: Remove dataflow/coverage/dataflow.ql
The selected edges is covered by `NormalDataflowTest.ql` now... and
reading the test-output changes in `edges` is just going to make commits
larger while not providing any real value.
2022-10-28 09:29:32 +02:00
Rasmus Wriedt Larsen
609a4cfd42 Python: validate tests in datamodel.py
And adopt argument passing tests as well.

turns out that `C.staticmethod.__func__` doesn't actually work :O
2022-10-28 09:29:32 +02:00
Rasmus Wriedt Larsen
39081e9c1c Python: Fix staticmethod datamodel test 2022-10-28 09:29:32 +02:00
Jami Cogswell
f40eefce57 use CompileTimeConstantExpr instead of StringLiteral 2022-10-27 17:11:07 -04:00
Jami Cogswell
65f7474110 simplify algorithm.matches 2022-10-27 16:44:03 -04:00
Nick Rolfe
b1da636be0 Ruby: first draft of data flow docs 2022-10-27 11:42:39 +02:00
Arthur Baars
6f646be733 Ruby: document API graphs 2022-10-27 10:59:35 +02:00
Jami Cogswell
1bfdfc954b shorten class/predicate names 2022-10-26 16:30:14 -04:00
Jami Cogswell
1e80fa118c add modules 2022-10-25 18:26:00 -04:00
Alvaro Muñoz
9830d2bebc Format Restify.qll 2022-10-25 12:53:44 +02:00
Alvaro Muñoz
a80b691358 Remove unnecessary TaggedTemplateEntryPoint 2022-10-25 11:44:45 +02:00
Alvaro Muñoz
37ea3f23f1 Refactored ReplySource to ReplyCall. Got rid of unnecessary ref() 2022-10-25 11:42:48 +02:00
Jami Cogswell
1a1245343d remove getNodeIntValue 2022-10-24 17:09:24 -04:00
Jami Cogswell
c742a09def remove AlgoSpec class 2022-10-24 16:15:18 -04:00
Jami Cogswell
d569f93e78 update getAlgoSpec 2022-10-24 16:05:57 -04:00
Jami Cogswell
09829d7f7a simplify instanceof usage 2022-10-24 15:49:41 -04:00
Jami Cogswell
8bc0a64863 remove KeyGenInitMethodAccess class 2022-10-24 15:42:36 -04:00
Jami Cogswell
eb69b98dff remove separators 2022-10-24 15:28:31 -04:00
Jami Cogswell
2ee23f004e update qldoc for AlgorithmParameterSpec 2022-10-24 15:22:33 -04:00
Jami Cogswell
4c8e0a7648 update qldoc of JavaSecurityKeyPairGenerator and JavaSecurityAlgoParamGenerator 2022-10-24 15:05:05 -04:00
erik-krogh
aafef382dc refactor StringPercentCall#getFormatArgument 2022-10-24 18:57:24 +02:00
Alvaro Muñoz
742e4aa471 Apply suggestions from code review
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2022-10-24 16:17:11 +02:00
Asger F
ac4cac889f Ruby: add DataFlow::ModuleNode
sdf
2022-10-24 15:35:17 +02:00
Asger F
65add15416 Ruby: add getALocalUse()
This is the inverse of getALocalSource()
2022-10-24 15:35:17 +02:00
Asger F
aab1e1f5b4 Ruby: add some helpers at the AST level 2022-10-24 15:35:17 +02:00
Jami Cogswell
345e4e0e8f remove unnecessary 'exists' 2022-10-20 23:52:31 -04:00
erik-krogh
c13e8e4f48 Merge branch 'main' into formatTaint 2022-10-20 10:46:16 +02:00
Alvaro Muñoz
c7ac237968 Update test results after merging new XSS improvements 2022-10-19 23:41:37 +02:00
Alvaro Muñoz
c10087b9a3 Merge branch 'restify_improvements' of https://github.com/pwntester/codeql into restify_improvements 2022-10-19 22:18:29 +02:00
Alvaro Muñoz
009403b61e Add QLDoc for FormatterSetup.getAFormatterHandler 2022-10-19 22:18:13 +02:00
Alvaro Muñoz
2ad5a70cf1 Merge branch 'main' into restify_improvements 2022-10-19 21:57:37 +02:00
Alvaro Muñoz
976dd7f99f Fix format errors 2022-10-19 18:14:25 +02:00
Jami Cogswell
b7f360647e rename change note 2022-10-19 11:37:42 -04:00
Alvaro Muñoz
31d271b8e1 Fix format errors 2022-10-19 17:32:34 +02:00
Jami Cogswell
e5982f19fa minor updates 2022-10-19 11:05:40 -04:00
Jami Cogswell
961e5c72a3 minor updates 2022-10-19 08:44:35 -04:00
Jami Cogswell
4df0fbcce1 update tests 2022-10-19 01:17:57 -04:00
Jami Cogswell
dc8b62baa0 add support for AlgorithmParameterGenerator 2022-10-19 00:11:59 -04:00
Jami Cogswell
ff557a287f add min key size predicates 2022-10-18 23:08:54 -04:00
Jami Cogswell
383b8a84e9 update select statement to be closer to cpp's 2022-10-18 21:55:11 -04:00
Alvaro Muñoz
b79f7f3e95 Address code review comments
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2022-10-18 21:42:15 +02:00
Alvaro Muñoz
6ab62da015 Add Restify/Spife support 2022-10-18 21:41:34 +02:00
Arthur Baars
55bda34a45 Ruby: drop beta notice 2022-10-18 15:07:35 +02:00
Jami Cogswell
5f39888a2d minor code restructure 2022-10-17 16:28:06 -04:00
Taus
58754982ce Python: Update type tracking tests
No longer missing! 🎉
2022-10-17 14:34:10 +00:00
Taus
ad13fbaeb6 Python: Add tests
A slightly complicated test setup. I wanted to both make sure I captured
the semantics of Python and also the fact that the kinds of global flow
we expect to see are indeed present.

The code is executable, and prints out both when the execution reaches
certain files, and also what values are assigned to the various
attributes that are referenced throughout the program. These values are
validated in the test as well.

My original version used introspection to avoid referencing attributes
directly (thus enabling better error diagnostics), but unfortunately
that made it so that the model couldn't follow what was going on.

The current setup is a bit clunky (and Python's scoping rules makes it
especially so -- cf. the explicit calls to `globals` and `locals`), but
I think it does the job okay.
2022-10-17 14:29:41 +00:00
Taus
651afaf11b Python: Hook up new implementation
Left as its own commit, as otherwise the diff would have been very
confusing.
2022-10-17 14:29:41 +00:00
Taus
0051ba1596 Python: Add new module resolution implementation
A fairly complicated bit of modelling, mostly due to the quirks of
how imports are handled in Python.

A few notes:

- The handling of `__all__` is not actually needed (and perhaps not
  desirable, as it only pertains to `import *`, though it does match
  the current behaviour), but it might become useful at a later date,
  so I left it in.
- Ideally, we would represent `foo as bar` in an `import` as a
  `DefinitionNode` in the CFG. I opted _not_ to do this, as it would
  also affect points-to, and I did not want to deal with any fallout
  arising from that.
2022-10-17 14:29:41 +00:00
erik-krogh
bb4bc55c6a update expected output 2022-10-17 15:52:21 +02:00
erik-krogh
f09e3bd3ac add String#% as a printf like call 2022-10-17 13:51:43 +02:00
erik-krogh
d4919d04ba add a taint-step for format-calls 2022-10-17 13:16:38 +02:00
erik-krogh
f222cc1f3e refactor the existing taint-step for string interpolation into StringFormatters.qll 2022-10-17 13:16:38 +02:00
erik-krogh
6de1abcb0e add a returnsFormatted predicate to the printf model, similar to the JS implementation 2022-10-17 13:16:38 +02:00
erik-krogh
a2b924bbdf move model of printf style calls to StringFormatters.qll 2022-10-17 13:16:34 +02:00
erik-krogh
dbf2673a91 add returnsFormatted predicate to PrintfStyleCall (similar to JS) 2022-10-17 12:15:31 +02:00
erik-krogh
46627a737e add an AdditionalTaintStep class for Ruby 2022-10-17 12:15:30 +02:00
Jami Cogswell
2714c7fdcf update tests 2022-10-14 16:45:13 -04:00
Jami Cogswell
da218fdbf1 clean up code 2022-10-14 13:03:34 -04:00
Jami Cogswell
0334470f33 remove commented out predicates that relied on typeFlag 2022-10-14 10:55:30 -04:00
Jami Cogswell
47030df8ac remove commented-out 3 configs 2022-10-14 09:26:44 -04:00
Jami Cogswell
6eb58d832c remove dependence on typeFlag 2022-10-14 00:47:57 -04:00
Jami Cogswell
c61f23baae experiment with more code condensing 2022-10-13 23:24:06 -04:00
Jami Cogswell
2daa3457d7 combine three configs into one 2022-10-13 17:57:56 -04:00
Jami Cogswell
e0f0d554cb condense code 2022-10-12 22:18:07 -04:00
Jami Cogswell
bcb506b637 add placeholder qldocs 2022-10-12 17:04:51 -04:00
Jami Cogswell
bfbb6db436 clean up code 2022-10-12 16:58:34 -04:00
Jami Cogswell
37d85587e0 refactor code into InsufficientKeySize.qll 2022-10-12 15:39:57 -04:00
Jami Cogswell
0fc4a33d43 remove commented-out code 2022-10-12 08:54:06 -04:00
Jami Cogswell
01c2a8cbba add symm to the single config; still seems to work 2022-10-12 08:51:22 -04:00
Jami Cogswell
29de0c6748 make one config for asymm with flow states; seems to work... 2022-10-11 22:29:48 -04:00
Jami Cogswell
3e8748e639 add path-graph back to query alerts 2022-10-11 16:56:11 -04:00
Jami Cogswell
26f4abf12b remove globalflow for key(pair)gen 2022-10-11 16:56:11 -04:00
Jami Cogswell
e64825ff7a fix code-scanning bot problems 2022-10-11 16:56:11 -04:00
Jami Cogswell
b6a8c27d48 delete experimental files 2022-10-11 16:56:11 -04:00
Jami Cogswell
bd76b1fcc0 clean-up and update configurations to have specs as sink 2022-10-11 16:56:10 -04:00
Jami Cogswell
0c2cff253f updates from discussing with Tony 2022-10-11 16:56:10 -04:00
Jami Cogswell
3cc7f143b2 clean up code somewhat 2022-10-11 16:56:10 -04:00
Jami Cogswell
f5a2fef7a3 update tests for non-path version 2022-10-11 16:56:10 -04:00
Jami Cogswell
b0af9f936c added kg taintracking config to all 2022-10-11 16:56:10 -04:00
Jami Cogswell
b7123c17f8 draft of adding kpg tracking into dataflow config 2022-10-11 16:56:10 -04:00
Jami Cogswell
cdac0e2b52 add local algo name tracking, still need to add ability to track algo name when KeyGen obj is param to other method 2022-10-11 16:56:10 -04:00
Jami Cogswell
c414ee0e25 add ECC dataflow config; passes all test cases; still don't have algo name tracking 2022-10-11 16:56:10 -04:00
Jami Cogswell
5e2ef66014 refactoring to use both dataflow configs; commit before deleting unused code 2022-10-11 16:56:10 -04:00
Jami Cogswell
ac707198d5 commit before adding taint flow back (since no taint flow doesn't capture all cases) 2022-10-11 16:56:10 -04:00
Jami Cogswell
8ffd2522e7 add draft code to find algo type to replace tainttracking configs 2022-10-11 16:56:10 -04:00
Jami Cogswell
d3b1a04c13 handle FN case with simple VarAccess; add draft of dataflow config to handle complex VarAccess 2022-10-11 16:56:10 -04:00
Jami Cogswell
7de9c05c9d use CompileTimeConstantExpr for FN with VarAccess, and remove KeyGeneratorInitConfiguration 2022-10-11 16:56:10 -04:00
Jami Cogswell
75794ec7a7 false negative testing - before rewrite for variable dataflow 2022-10-11 16:56:10 -04:00
Jami Cogswell
7d94590d79 add change note 2022-10-11 16:56:10 -04:00
Jami Cogswell
9eb45c3787 refactor tests and code, update help file 2022-10-11 16:56:10 -04:00
Jami Cogswell
657e1e62ca start refactoring query logic into lib file 2022-10-11 16:56:10 -04:00
Jami Cogswell
3643c9e658 update metadata 2022-10-11 16:56:10 -04:00
Jami Cogswell
9b7df354e6 move files 2022-10-11 16:56:10 -04:00
erik-krogh
dcdff7a995 Merge branch 'main' into aliasFlow 2022-09-22 16:01:31 +02:00
erik-krogh
5fb44e9dd8 simplify and improve the example for getLaterBaseAccess 2022-09-22 15:57:54 +02:00
Erik Krogh Kristensen
fedf8fc575 correct the qldoc
Co-authored-by: Asger F <asgerf@github.com>
2022-09-22 15:49:29 +02:00
erik-krogh
843fce4bcd expand localFieldStep to use access-paths, and build access-paths in more cases 2022-09-13 21:43:06 +02:00
erik-krogh
460eddd781 add ql/override-any 2022-08-24 09:26:34 +02:00
ihsinme
65c9a7b278 Update BufferAccessWithIncorrectLengthValue.ql 2022-06-26 13:49:44 +03:00
ihsinme
c1f0940b6a Update cpp/ql/src/experimental/Security/CWE/CWE-805/BufferAccessWithIncorrectLengthValue.ql
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2022-06-23 12:50:59 +03:00
ihsinme
5609d5200b Update cpp/ql/src/experimental/Security/CWE/CWE-805/BufferAccessWithIncorrectLengthValue.ql
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2022-05-30 20:41:39 +03:00
ihsinme
9499961a9c Update BufferAccessWithIncorrectLengthValue.ql 2022-05-30 12:43:28 +03:00
ihsinme
d489c12014 Update BufferAccessWithIncorrectLengthValue.ql 2022-05-30 12:26:26 +03:00
ihsinme
475e36e6fc Update BufferAccessWithIncorrectLengthValue.ql 2022-05-29 09:58:16 +03:00
ihsinme
df1ea5b679 Update BufferAccessWithIncorrectLengthValue.qhelp 2022-05-29 09:56:29 +03:00
ihsinme
5a9061e45b create new branchihsinme-patch-102 in fork 2022-05-21 14:19:34 +00:00
5130 changed files with 629418 additions and 229978 deletions

View File

@@ -1,24 +0,0 @@
---
name: LGTM.com - false positive
about: Tell us about an alert that shouldn't be reported
title: LGTM.com - false positive
labels: false-positive
assignees: ''
---
**Description of the false positive**
<!-- Please explain briefly why you think it shouldn't be included. -->
**URL to the alert on the project page on LGTM.com**
<!--
1. Open the project on LGTM.com.
For example, https://lgtm.com/projects/g/pallets/click/.
2. Switch to the `Alerts` tab. For example, https://lgtm.com/projects/g/pallets/click/alerts/.
3. Scroll to the alert that you would like to report.
4. Click on the right most icon `View this alert within the complete file`.
5. A new browser tab opens. Copy and paste the page URL here.
For example, https://lgtm.com/projects/g/pallets/click/snapshot/719fb7d8322b0767cdd1e5903ba3eb3233ba8dd5/files/click/_winconsole.py#xa08d213ab3289f87:1.
-->

View File

@@ -10,5 +10,5 @@ assignees: ''
**Description of the issue**
<!-- Please explain briefly what is the problem.
If it is about an LGTM project, please include its URL.-->
If it is about a GitHub project, please include its URL. -->

View File

@@ -0,0 +1,36 @@
---
name: CodeQL false positive
about: Report CodeQL alerts that you think should not have been detected (not applicable, not exploitable, etc.)
title: False positive
labels: false-positive
assignees: ''
---
**Description of the false positive**
<!-- Please explain briefly why you think it shouldn't be included. -->
**Code samples or links to source code**
<!--
For open source code: file links with line numbers on GitHub, for example:
https://github.com/github/codeql/blob/dc440aaee6695deb0d9676b87e06ea984e1b4ae5/javascript/ql/test/query-tests/Security/CWE-078/CommandInjection/exec-sh2.js#L10
For closed source code: (redacted) code samples that illustrate the problem, for example:
```
function execSh(command, options) {
return cp.spawn(getShell(), ["-c", command], options) // <- command line injection
};
```
-->
**URL to the alert on GitHub code scanning (optional)**
<!--
1. Open the project on GitHub.com.
2. Switch to the `Security` tab.
3. Browse to the alert that you would like to report.
4. Copy and paste the page URL here.
-->

View File

@@ -0,0 +1,54 @@
name: Cache query compilation
description: Caches CodeQL compilation caches - should be run both on PRs and pushes to main.
inputs:
key:
description: 'The cache key to use - should be unique to the workflow'
required: true
outputs:
cache-dir:
description: "The directory where the cache was stored"
value: ${{ steps.fill-compilation-dir.outputs.compdir }}
runs:
using: composite
steps:
# calculate the merge-base with main, in a way that works both on PRs and pushes to main.
- name: Calculate merge-base
shell: bash
if: ${{ github.event_name == 'pull_request' }}
env:
BASE_BRANCH: ${{ github.base_ref }}
run: |
MERGE_BASE=$(git cat-file commit $GITHUB_SHA | grep '^parent ' | head -1 | cut -f 2 -d " ")
echo "merge_base=$MERGE_BASE" >> $GITHUB_ENV
- name: Restore cache (PR)
if: ${{ github.event_name == 'pull_request' }}
uses: actions/cache/restore@v3
with:
path: '**/.cache'
key: codeql-compile-${{ inputs.key }}-pr-${{ github.sha }}
restore-keys: |
codeql-compile-${{ inputs.key }}-${{ github.base_ref }}-${{ env.merge_base }}
codeql-compile-${{ inputs.key }}-${{ github.base_ref }}-
codeql-compile-${{ inputs.key }}-main-
- name: Fill cache (only branch push)
if: ${{ github.event_name != 'pull_request' }}
uses: actions/cache@v3
with:
path: '**/.cache'
key: codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-${{ github.sha }} # just fill on main
restore-keys: | # restore the latest cache if the exact cache is unavailable, to speed up compilation.
codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-
codeql-compile-${{ inputs.key }}-main-
- name: Fill compilation cache directory
id: fill-compilation-dir
shell: bash
run: |
# Move all the existing cache into another folder, so we only preserve the cache for the current queries.
node $GITHUB_WORKSPACE/.github/actions/cache-query-compilation/move-caches.js ${COMBINED_CACHE_DIR}
echo "compdir=${COMBINED_CACHE_DIR}" >> $GITHUB_OUTPUT
env:
COMBINED_CACHE_DIR: ${{ runner.temp }}/compilation-dir

View File

@@ -0,0 +1,75 @@
// # Move all the existing cache into another folder, so we only preserve the cache for the current queries.
// mkdir -p ${COMBINED_CACHE_DIR}
// rm -f **/.cache/{lock,size} # -f to avoid errors if the cache is empty.
// # copy the contents of the .cache folders into the combined cache folder.
// cp -r **/.cache/* ${COMBINED_CACHE_DIR}/ || : # ignore missing files
// # clean up the .cache folders
// rm -rf **/.cache/*
const fs = require("fs");
const path = require("path");
// the first argv is the cache folder to create.
const COMBINED_CACHE_DIR = process.argv[2];
function* walkCaches(dir) {
const files = fs.readdirSync(dir, { withFileTypes: true });
for (const file of files) {
if (file.isDirectory()) {
const filePath = path.join(dir, file.name);
yield* walkCaches(filePath);
if (file.name === ".cache") {
yield filePath;
}
}
}
}
async function copyDir(src, dest) {
for await (const file of await fs.promises.readdir(src, { withFileTypes: true })) {
const srcPath = path.join(src, file.name);
const destPath = path.join(dest, file.name);
if (file.isDirectory()) {
if (!fs.existsSync(destPath)) {
fs.mkdirSync(destPath);
}
await copyDir(srcPath, destPath);
} else {
await fs.promises.copyFile(srcPath, destPath);
}
}
}
async function main() {
const cacheDirs = [...walkCaches(".")];
for (const dir of cacheDirs) {
console.log(`Found .cache dir at ${dir}`);
}
// mkdir -p ${COMBINED_CACHE_DIR}
fs.mkdirSync(COMBINED_CACHE_DIR, { recursive: true });
// rm -f **/.cache/{lock,size} # -f to avoid errors if the cache is empty.
await Promise.all(
cacheDirs.map((cacheDir) =>
(async function () {
await fs.promises.rm(path.join(cacheDir, "lock"), { force: true });
await fs.promises.rm(path.join(cacheDir, "size"), { force: true });
})()
)
);
// # copy the contents of the .cache folders into the combined cache folder.
// cp -r **/.cache/* ${COMBINED_CACHE_DIR}/ || : # ignore missing files
await Promise.all(
cacheDirs.map((cacheDir) => copyDir(cacheDir, COMBINED_CACHE_DIR))
);
// # clean up the .cache folders
// rm -rf **/.cache/*
await Promise.all(
cacheDirs.map((cacheDir) => fs.promises.rm(cacheDir, { recursive: true }))
);
}
main();

View File

@@ -19,4 +19,6 @@ runs:
gh extension install github/gh-codeql
gh codeql set-channel "$CHANNEL"
gh codeql version
printf "CODEQL_FETCHED_CODEQL_PATH=" >> "${GITHUB_ENV}"
gh codeql version --format=json | jq -r .unpackedLocation >> "${GITHUB_ENV}"
gh codeql version --format=json | jq -r .unpackedLocation >> "${GITHUB_PATH}"

32
.github/actions/os-version/action.yml vendored Normal file
View File

@@ -0,0 +1,32 @@
name: OS Version
description: Get OS version.
outputs:
version:
description: "OS version"
value: ${{ steps.version.outputs.version }}
runs:
using: composite
steps:
- if: runner.os == 'Linux'
shell: bash
run: |
. /etc/os-release
echo "VERSION=${NAME} ${VERSION}" >> $GITHUB_ENV
- if: runner.os == 'Windows'
shell: powershell
run: |
$objects = systeminfo.exe /FO CSV | ConvertFrom-Csv
"VERSION=$($objects.'OS Name') $($objects.'OS Version')" >> $env:GITHUB_ENV
- if: runner.os == 'macOS'
shell: bash
run: |
echo "VERSION=$(sw_vers -productName) $(sw_vers -productVersion)" >> $GITHUB_ENV
- name: Emit OS version
id: version
shell: bash
run: |
echo "$VERSION"
echo "version=${VERSION}" >> $GITHUB_OUTPUT

View File

@@ -1,19 +1,12 @@
version: 2
updates:
- package-ecosystem: "cargo"
directory: "ruby/node-types"
directory: "ruby"
schedule:
interval: "daily"
- package-ecosystem: "cargo"
directory: "ruby/generator"
schedule:
interval: "daily"
- package-ecosystem: "cargo"
directory: "ruby/extractor"
schedule:
interval: "daily"
- package-ecosystem: "cargo"
directory: "ruby/autobuilder"
directory: "ql"
schedule:
interval: "daily"

View File

@@ -13,7 +13,7 @@ on:
jobs:
atm-check-query-suite:
runs-on: ubuntu-latest
runs-on: ubuntu-latest-xl
steps:
- uses: actions/checkout@v3
@@ -23,6 +23,12 @@ jobs:
with:
channel: release
- name: Cache compilation cache
id: query-cache
uses: ./.github/actions/cache-query-compilation
with:
key: atm-suite
- name: Install ATM model
run: |
set -exu
@@ -50,10 +56,13 @@ jobs:
echo "SARIF_PATH=${SARIF_PATH}" >> "${GITHUB_ENV}"
codeql database analyze \
--threads=0 \
--ram 50000 \
--format sarif-latest \
--output "${SARIF_PATH}" \
--sarif-group-rules-by-pack \
-vv \
--compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" \
-- \
"${DB_PATH}" \
"${QUERY_PACK}/${QUERY_SUITE}"

View File

@@ -26,3 +26,9 @@ jobs:
run: |
gh api 'repos/${{github.repository}}/pulls/${{github.event.number}}/files' --paginate --jq 'any(.[].filename ; test("/change-notes/.*[.]md$"))' |
grep true -c
- name: Fail if the change note filename doesn't match the expected format. The file name must be of the form 'YYYY-MM-DD.md' or 'YYYY-MM-DD-{title}.md', where '{title}' is arbitrary text.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api 'repos/${{github.repository}}/pulls/${{github.event.number}}/files' --paginate --jq '[.[].filename | select(test("/change-notes/.*[.]md$"))] | all(test("/change-notes/[0-9]{4}-[0-9]{2}-[0-9]{2}.*[.]md$"))' |
grep true -c

21
.github/workflows/check-query-ids.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Check query IDs
on:
pull_request:
paths:
- "**/src/**/*.ql"
- misc/scripts/check-query-ids.py
- .github/workflows/check-query-ids.yml
branches:
- main
- "rc/*"
workflow_dispatch:
jobs:
check:
name: Check query IDs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check for duplicate query IDs
run: python3 misc/scripts/check-query-ids.py

View File

@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v6
- uses: actions/stale@v7
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 14 days with no activity. Comment or remove the `Stale` label in order to avoid having this issue closed in 7 days.'

View File

@@ -28,9 +28,9 @@ jobs:
steps:
- name: Setup dotnet
uses: actions/setup-dotnet@v2
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.202
dotnet-version: 7.0.102
- name: Checkout repository
uses: actions/checkout@v3

View File

@@ -2,11 +2,11 @@ name: "Compile all queries using the latest stable CodeQL CLI"
on:
push:
branches: [main] # makes sure the cache gets populated
pull_request:
branches:
branches: # makes sure the cache gets populated - running on the branches people tend to merge into.
- main
- "rc/*"
- "codeql-cli-*"
pull_request:
jobs:
compile-queries:
@@ -14,44 +14,24 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
# calculate the merge-base with main, in a way that works both on PRs and pushes to main.
- name: Calculate merge-base
if: ${{ github.event_name == 'pull_request' }}
env:
BASE_BRANCH: ${{ github.base_ref }}
run: |
MERGE_BASE=$(git merge-base --fork-point origin/$BASE_BRANCH)
echo "merge-base=$MERGE_BASE" >> $GITHUB_ENV
- name: Calculate merge-base - branch
if: ${{ github.event_name != 'pull_request' }}
# using github.sha instead, since we're directly on a branch, and not in a PR
run: |
MERGE_BASE=${{ github.sha }}
echo "merge-base=$MERGE_BASE" >> $GITHUB_ENV
- name: Cache CodeQL query compilation
uses: actions/cache@v3
with:
path: '*/ql/src/.cache'
# current GH HEAD first, merge-base second, generic third
key: codeql-stable-compile-${{ github.sha }}
restore-keys: |
codeql-stable-compile-${{ env.merge-base }}
codeql-stable-compile-
- name: Setup CodeQL
uses: ./.github/actions/fetch-codeql
with:
channel: 'release'
- name: Cache compilation cache
id: query-cache
uses: ./.github/actions/cache-query-compilation
with:
key: all-queries
- name: check formatting
run: codeql query format */ql/{src,lib,test}/**/*.{qll,ql} --check-only
run: find */ql -type f \( -name "*.qll" -o -name "*.ql" \) -print0 | xargs -0 codeql query format --check-only
- name: compile queries - check-only
# run with --check-only if running in a PR (github.sha != main)
if : ${{ github.event_name == 'pull_request' }}
shell: bash
run: codeql query compile -j0 */ql/src --keep-going --warnings=error --check-only
run: codeql query compile -j0 */ql/{src,examples} --keep-going --warnings=error --check-only --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
- name: compile queries - full
# do full compile if running on main - this populates the cache
if : ${{ github.event_name != 'pull_request' }}
shell: bash
run: codeql query compile -j0 */ql/src --keep-going --warnings=error
run: codeql query compile -j0 */ql/{src,examples} --keep-going --warnings=error --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"

86
.github/workflows/csharp-qltest.yml vendored Normal file
View File

@@ -0,0 +1,86 @@
name: "C#: Run QL Tests"
on:
push:
paths:
- "csharp/**"
- "shared/**"
- .github/actions/fetch-codeql/action.yml
- codeql-workspace.yml
branches:
- main
- "rc/*"
pull_request:
paths:
- "csharp/**"
- "shared/**"
- .github/workflows/csharp-qltest.yml
- .github/actions/fetch-codeql/action.yml
- codeql-workspace.yml
branches:
- main
- "rc/*"
defaults:
run:
working-directory: csharp
jobs:
qlupgrade:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/fetch-codeql
- name: Check DB upgrade scripts
run: |
echo >empty.trap
codeql dataset import -S ql/lib/upgrades/initial/semmlecode.csharp.dbscheme testdb empty.trap
codeql dataset upgrade testdb --additional-packs ql/lib
diff -q testdb/semmlecode.csharp.dbscheme ql/lib/semmlecode.csharp.dbscheme
- name: Check DB downgrade scripts
run: |
echo >empty.trap
rm -rf testdb; codeql dataset import -S ql/lib/semmlecode.csharp.dbscheme testdb empty.trap
codeql resolve upgrades --format=lines --allow-downgrades --additional-packs downgrades \
--dbscheme=ql/lib/semmlecode.csharp.dbscheme --target-dbscheme=downgrades/initial/semmlecode.csharp.dbscheme |
xargs codeql execute upgrades testdb
diff -q testdb/semmlecode.csharp.dbscheme downgrades/initial/semmlecode.csharp.dbscheme
qltest:
runs-on: ubuntu-latest-xl
strategy:
fail-fast: false
matrix:
slice: ["1/2", "2/2"]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/fetch-codeql
- uses: ./csharp/actions/create-extractor-pack
- name: Cache compilation cache
id: query-cache
uses: ./.github/actions/cache-query-compilation
with:
key: csharp-qltest-${{ matrix.slice }}
- name: Run QL tests
run: |
CODEQL_PATH=$(gh codeql version --format=json | jq -r .unpackedLocation)
# The legacy ASP extractor is not in this repo, so take the one from the nightly build
mv "$CODEQL_PATH/csharp/tools/extractor-asp.jar" "${{ github.workspace }}/csharp/extractor-pack/tools"
# Safe guard against using the bundled extractor
rm -rf "$CODEQL_PATH/csharp"
codeql test run --threads=0 --ram 50000 --slice ${{ matrix.slice }} --search-path "${{ github.workspace }}/csharp/extractor-pack" --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
env:
GITHUB_TOKEN: ${{ github.token }}
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.102
- name: Extractor unit tests
run: |
dotnet test -p:RuntimeFrameworkVersion=7.0.2 "${{ github.workspace }}/csharp/extractor/Semmle.Util.Tests"
dotnet test -p:RuntimeFrameworkVersion=7.0.2 "${{ github.workspace }}/csharp/extractor/Semmle.Extraction.Tests"
dotnet test -p:RuntimeFrameworkVersion=7.0.2 "${{ github.workspace }}/csharp/autobuilder/Semmle.Autobuild.CSharp.Tests"
dotnet test -p:RuntimeFrameworkVersion=7.0.2 "${{ github.workspace }}/cpp/autobuilder/Semmle.Autobuild.Cpp.Tests"

80
.github/workflows/go-tests-other-os.yml vendored Normal file
View File

@@ -0,0 +1,80 @@
name: "Go: Run Tests - Other OS"
on:
pull_request:
paths:
- "go/**"
- "!go/ql/**" # don't run other-os if only ql/ files changed
- .github/workflows/go-tests-other-os.yml
- .github/actions/**
- codeql-workspace.yml
jobs:
test-mac:
name: Test MacOS
runs-on: macos-latest
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v3
with:
go-version: 1.19
id: go
- name: Check out code
uses: actions/checkout@v2
- name: Set up CodeQL CLI
uses: ./.github/actions/fetch-codeql
- name: Enable problem matchers in repository
shell: bash
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
- name: Build
run: |
cd go
make
- name: Cache compilation cache
id: query-cache
uses: ./.github/actions/cache-query-compilation
with:
key: go-qltest
- name: Test
run: |
cd go
make test cache="${{ steps.query-cache.outputs.cache-dir }}"
test-win:
name: Test Windows
runs-on: windows-latest-xl
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v3
with:
go-version: 1.19
id: go
- name: Check out code
uses: actions/checkout@v2
- name: Set up CodeQL CLI
uses: ./.github/actions/fetch-codeql
- name: Enable problem matchers in repository
shell: bash
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
- name: Build
run: |
cd go
make
- name: Cache compilation cache
id: query-cache
uses: ./.github/actions/cache-query-compilation
with:
key: go-qltest
- name: Test
run: |
cd go
make test cache="${{ steps.query-cache.outputs.cache-dir }}"

View File

@@ -1,15 +1,24 @@
name: "Go: Run Tests"
on:
push:
paths:
- "go/**"
- .github/workflows/go-tests.yml
- .github/actions/**
- codeql-workspace.yml
branches:
- main
- "rc/*"
pull_request:
paths:
- "go/**"
- .github/workflows/go-tests.yml
- .github/actions/fetch-codeql/action.yml
- .github/actions/**
- codeql-workspace.yml
jobs:
test-linux:
name: Test Linux (Ubuntu)
runs-on: ubuntu-latest
runs-on: ubuntu-latest-xl
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v3
@@ -32,7 +41,7 @@ jobs:
cd go
make
- name: Check that all QL and Go code is autoformatted
- name: Check that all Go code is autoformatted
run: |
cd go
make check-formatting
@@ -48,67 +57,13 @@ jobs:
name: qhelp-markdown
path: go/qhelp-out/**/*.md
- name: Test
run: |
cd go
make test
test-mac:
name: Test MacOS
runs-on: macos-latest
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v3
- name: Cache compilation cache
id: query-cache
uses: ./.github/actions/cache-query-compilation
with:
go-version: 1.19
id: go
- name: Check out code
uses: actions/checkout@v2
- name: Set up CodeQL CLI
uses: ./.github/actions/fetch-codeql
- name: Enable problem matchers in repository
shell: bash
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
- name: Build
run: |
cd go
make
key: go-qltest
- name: Test
run: |
cd go
make test
test-win:
name: Test Windows
runs-on: windows-2019
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v3
with:
go-version: 1.19
id: go
- name: Check out code
uses: actions/checkout@v2
- name: Set up CodeQL CLI
uses: ./.github/actions/fetch-codeql
- name: Enable problem matchers in repository
shell: bash
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
- name: Build
run: |
cd go
make
- name: Test
run: |
cd go
make test
make test cache="${{ steps.query-cache.outputs.cache-dir }}"

View File

@@ -23,22 +23,9 @@ defaults:
working-directory: javascript/ql/experimental/adaptivethreatmodeling
jobs:
qlformat:
name: Check QL formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/fetch-codeql
- name: Check QL formatting
run: |
find . "(" -name "*.ql" -or -name "*.qll" ")" -print0 | \
xargs -0 codeql query format --check-only
qlcompile:
name: Check QL compilation
runs-on: ubuntu-latest
qltest:
name: Test QL
runs-on: ubuntu-latest-xl
steps:
- uses: actions/checkout@v3
@@ -46,36 +33,33 @@ jobs:
- name: Install pack dependencies
run: |
for pack in modelbuilding src; do
for pack in modelbuilding src test; do
codeql pack install --mode verify -- "${pack}"
done
- name: Cache compilation cache
id: query-cache
uses: ./.github/actions/cache-query-compilation
with:
key: js-ml-test
- name: Check QL compilation
run: |
codeql query compile \
--check-only \
--ram 5120 \
--ram 50000 \
--additional-packs "${{ github.workspace }}" \
--threads=0 \
--compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" \
-- \
lib modelbuilding src
qltest:
name: Run QL tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/fetch-codeql
- name: Install pack dependencies
run: codeql pack install -- test
- name: Run QL tests
run: |
codeql test run \
--threads=0 \
--ram 5120 \
--ram 50000 \
--additional-packs "${{ github.workspace }}" \
--compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" \
-- \
test
test

View File

@@ -11,7 +11,7 @@ on:
branches:
- main
paths:
- "java/ql/src/utils/model-generator/**/*.*"
- "java/ql/src/utils/modelgenerator/**/*.*"
- ".github/workflows/mad_modelDiff.yml"
permissions:
@@ -40,12 +40,12 @@ jobs:
- name: Download database
env:
SLUG: ${{ matrix.slug }}
GH_TOKEN: ${{ github.token }}
run: |
set -x
mkdir lib-dbs
SHORTNAME=${SLUG//[^a-zA-Z0-9_]/}
projectId=`curl -s https://lgtm.com/api/v1.0/projects/g/${SLUG} | jq .id`
curl -L "https://lgtm.com/api/v1.0/snapshots/$projectId/java" -o "$SHORTNAME.zip"
gh api -H "Accept: application/zip" "/repos/${SLUG}/code-scanning/codeql/databases/java" > "$SHORTNAME.zip"
unzip -q -d "${SHORTNAME}-db" "${SHORTNAME}.zip"
mkdir "lib-dbs/$SHORTNAME/"
mv "${SHORTNAME}-db/"$(ls -1 "${SHORTNAME}"-db)/* "lib-dbs/${SHORTNAME}/"
@@ -61,8 +61,8 @@ jobs:
DATABASE=$2
cd codeql-$QL_VARIANT
SHORTNAME=`basename $DATABASE`
python java/ql/src/utils/model-generator/GenerateFlowModel.py --with-summaries --with-sinks $DATABASE $MODELS/${SHORTNAME}.qll
mv $MODELS/${SHORTNAME}.qll $MODELS/${SHORTNAME}Generated_${QL_VARIANT}.qll
python java/ql/src/utils/modelgenerator/GenerateFlowModel.py --with-summaries --with-sinks $DATABASE ${SHORTNAME}.temp.model.yml
mv java/ql/lib/ext/generated/${SHORTNAME}.temp.model.yml $MODELS/${SHORTNAME}Generated_${QL_VARIANT}.model.yml
cd ..
}
@@ -85,19 +85,21 @@ jobs:
set -x
MODELS=`pwd`/tmp-models
ls -1 tmp-models/
for m in $MODELS/*_main.qll ; do
for m in $MODELS/*_main.model.yml ; do
t="${m/main/"pr"}"
basename=`basename $m`
name="diff_${basename/_main.qll/""}"
name="diff_${basename/_main.model.yml/""}"
(diff -w -u $m $t | diff2html -i stdin -F $MODELS/$name.html) || true
done
- uses: actions/upload-artifact@v3
with:
name: models
path: tmp-models/*.qll
path: tmp-models/*.model.yml
retention-days: 20
- uses: actions/upload-artifact@v3
with:
name: diffs
path: tmp-models/*.html
# An html file is only produced if the generated models differ.
if-no-files-found: ignore
retention-days: 20

View File

@@ -50,10 +50,10 @@ jobs:
SLUG: ${{ matrix.slug }}
run: |
SHORTNAME=${SLUG//[^a-zA-Z0-9_]/}
java/ql/src/utils/model-generator/RegenerateModels.py "${SLUG}" dbs/${SHORTNAME}
java/ql/src/utils/modelgenerator/RegenerateModels.py "${SLUG}" dbs/${SHORTNAME}
- name: Stage changes
run: |
find java -name "*.qll" -print0 | xargs -0 git add
find java -name "*.model.yml" -print0 | xargs -0 git add
git status
git diff --cached > models.patch
- uses: actions/upload-artifact@v3

View File

@@ -24,135 +24,52 @@ jobs:
- uses: actions/checkout@v3
- name: Find codeql
id: find-codeql
uses: github/codeql-action/init@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
uses: github/codeql-action/init@v2
with:
languages: javascript # does not matter
- name: Get CodeQL version
id: get-codeql-version
run: |
echo "::set-output name=version::$("${CODEQL}" --version | head -n 1 | rev | cut -d " " -f 1 | rev)"
shell: bash
env:
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
- name: Cache entire pack
id: cache-pack
uses: actions/cache@v3
with:
path: ${{ runner.temp }}/pack
key: ${{ runner.os }}-pack-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}-${{ hashFiles('ql/**/*.ql*') }}-${{ hashFiles('ql/**/qlpack.yml') }}-${{ hashFiles('ql/ql/src/ql.dbscheme*') }}-${{ steps.get-codeql-version.outputs.version }}--${{ hashFiles('.github/workflows/ql-for-ql-build.yml') }}
- name: Cache queries
if: steps.cache-pack.outputs.cache-hit != 'true'
id: cache-queries
uses: actions/cache@v3
with:
path: ${{ runner.temp }}/queries
key: queries-${{ hashFiles('ql/**/*.ql*') }}-${{ hashFiles('ql/**/qlpack.yml') }}-${{ hashFiles('ql/ql/src/ql.dbscheme*') }}-${{ steps.get-codeql-version.outputs.version }}--${{ hashFiles('.github/workflows/ql-for-ql-build.yml') }}
- name: Build query pack
if: steps.cache-queries.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
run: |
cd ql/ql/src
"${CODEQL}" pack create -j 16
mv .codeql/pack/codeql/ql/0.0.0 ${{ runner.temp }}/queries
env:
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
- name: Move cache queries to pack
if: steps.cache-pack.outputs.cache-hit != 'true'
run: |
cp -r ${{ runner.temp }}/queries ${{ runner.temp }}/pack
env:
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
- uses: ./.github/actions/os-version
id: os_version
### Build the extractor ###
- name: Cache entire extractor
if: steps.cache-pack.outputs.cache-hit != 'true'
id: cache-extractor
uses: actions/cache@v3
with:
path: |
ql/target/release/ql-autobuilder
ql/target/release/ql-autobuilder.exe
ql/target/release/ql-extractor
ql/target/release/ql-extractor.exe
key: ${{ runner.os }}-extractor-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}
path: ql/extractor-pack/
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-extractor-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}
- name: Cache cargo
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
if: steps.cache-extractor.outputs.cache-hit != 'true'
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
ql/target
key: ${{ runner.os }}-rust-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
- name: Check formatting
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
run: cd ql; cargo fmt --all -- --check
- name: Build
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
run: cd ql; cargo build --verbose
- name: Run tests
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
run: cd ql; cargo test --verbose
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-rust-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
- name: Release build
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
run: cd ql; cargo build --release
- name: Generate dbscheme
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
run: ql/target/release/ql-generator --dbscheme ql/ql/src/ql.dbscheme --library ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll
### Package the queries and extractor ###
- name: Package pack
if: steps.cache-pack.outputs.cache-hit != 'true'
run: |
cp -r ql/codeql-extractor.yml ql/tools ql/ql/src/ql.dbscheme.stats ${PACK}/
mkdir -p ${PACK}/tools/linux64
cp ql/target/release/ql-autobuilder ${PACK}/tools/linux64/autobuilder
cp ql/target/release/ql-extractor ${PACK}/tools/linux64/extractor
chmod +x ${PACK}/tools/linux64/autobuilder
chmod +x ${PACK}/tools/linux64/extractor
if: steps.cache-extractor.outputs.cache-hit != 'true'
run: cd ql; ./scripts/create-extractor-pack.sh
env:
PACK: ${{ runner.temp }}/pack
### Run the analysis ###
- name: Hack codeql-action options
GH_TOKEN: ${{ github.token }}
- name: Cache compilation cache
id: query-cache
uses: ./.github/actions/cache-query-compilation
with:
key: run-ql-for-ql
- name: Make database and analyze
run: |
JSON=$(jq -nc --arg pack "${PACK}" '.database."run-queries"=["--search-path", $pack] | .resolve.queries=["--search-path", $pack] | .resolve.extractor=["--search-path", $pack] | .resolve.languages=["--search-path", $pack] | .database.init=["--search-path", $pack]')
echo "CODEQL_ACTION_EXTRA_OPTIONS=${JSON}" >> ${GITHUB_ENV}
env:
PACK: ${{ runner.temp }}/pack
- name: Create CodeQL config file
run: |
echo "paths-ignore:" >> ${CONF}
echo " - ql/ql/test" >> ${CONF}
echo " - \"*/ql/lib/upgrades/\"" >> ${CONF}
echo "disable-default-queries: true" >> ${CONF}
echo "queries:" >> ${CONF}
echo " - uses: ./ql/ql/src/codeql-suites/ql-code-scanning.qls" >> ${CONF}
echo "Config file: "
cat ${CONF}
env:
CONF: ./ql-for-ql-config.yml
- name: Initialize CodeQL
uses: github/codeql-action/init@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
${CODEQL} database create -l=ql --search-path ql/extractor-pack ${DB}
${CODEQL} database analyze -j0 --format=sarif-latest --output=ql-for-ql.sarif ${DB} ql/ql/src/codeql-suites/ql-code-scanning.qls --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
env:
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
DB: ${{ runner.temp }}/DB
LGTM_INDEX_FILTERS: |
exclude:ql/ql/test
exclude:*/ql/lib/upgrades/
- name: Upload sarif to code-scanning
uses: github/codeql-action/upload-sarif@v2
with:
languages: ql
db-location: ${{ runner.temp }}/db
config-file: ./ql-for-ql-config.yml
- name: Move pack cache
run: |
cp -r ${PACK}/.cache ql/ql/src/.cache
env:
PACK: ${{ runner.temp }}/pack
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
with:
category: "ql-for-ql"
- name: Copy sarif file to CWD
run: cp ../results/ql.sarif ./ql-for-ql.sarif
- name: Fixup the $scema in sarif # Until https://github.com/microsoft/sarif-vscode-extension/pull/436/ is part in a stable release
run: |
sed -i 's/\$schema.*/\$schema": "https:\/\/raw.githubusercontent.com\/oasis-tcs\/sarif-spec\/master\/Schemata\/sarif-schema-2.1.0",/' ql-for-ql.sarif
sarif_file: ql-for-ql.sarif
category: ql-for-ql
- name: Sarif as artifact
uses: actions/upload-artifact@v3
with:
@@ -167,4 +84,4 @@ jobs:
with:
name: ql-for-ql-langs
path: split-sarif
retention-days: 1
retention-days: 1

View File

@@ -25,16 +25,18 @@ jobs:
- name: Find codeql
id: find-codeql
uses: github/codeql-action/init@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
uses: github/codeql-action/init@v2
with:
languages: javascript # does not matter
- uses: ./.github/actions/os-version
id: os_version
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
ql/target
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
- name: Build Extractor
run: cd ql; env "PATH=$PATH:`dirname ${CODEQL}`" ./scripts/create-extractor-pack.sh
env:

View File

@@ -6,11 +6,13 @@ on:
paths:
- "ql/**"
- codeql-workspace.yml
- .github/workflows/ql-for-ql-tests.yml
pull_request:
branches: [main]
paths:
- "ql/**"
- codeql-workspace.yml
- .github/workflows/ql-for-ql-tests.yml
env:
CARGO_TERM_COLOR: always
@@ -22,33 +24,86 @@ jobs:
- uses: actions/checkout@v3
- name: Find codeql
id: find-codeql
uses: github/codeql-action/init@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
uses: github/codeql-action/init@v2
with:
languages: javascript # does not matter
- uses: ./.github/actions/os-version
id: os_version
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
ql/target
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/rust-toolchain.toml', 'ql/**/Cargo.lock') }}
- name: Check formatting
run: cd ql; cargo fmt --all -- --check
- name: Build extractor
run: |
cd ql;
codeqlpath=$(dirname ${{ steps.find-codeql.outputs.codeql-path }});
env "PATH=$PATH:$codeqlpath" ./scripts/create-extractor-pack.sh
- name: Cache compilation cache
id: query-cache
uses: ./.github/actions/cache-query-compilation
with:
key: ql-for-ql-tests
- name: Run QL tests
run: |
"${CODEQL}" test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path "${{ github.workspace }}/ql/extractor-pack" --consistency-queries ql/ql/consistency-queries ql/ql/test
"${CODEQL}" test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path "${{ github.workspace }}/ql/extractor-pack" --consistency-queries ql/ql/consistency-queries --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" ql/ql/test
env:
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
- name: Check QL formatting
other-os:
strategy:
matrix:
os: [macos-latest, windows-latest]
needs: [qltest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install GNU tar
if: runner.os == 'macOS'
run: |
find ql/ql/src "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 "${CODEQL}" query format --check-only
env:
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
- name: Check QL compilation
brew install gnu-tar
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
- name: Find codeql
id: find-codeql
uses: github/codeql-action/init@v2
with:
languages: javascript # does not matter
- uses: ./.github/actions/os-version
id: os_version
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
ql/target
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/rust-toolchain.toml', 'ql/**/Cargo.lock') }}
- name: Build extractor
if: runner.os != 'Windows'
run: |
"${CODEQL}" query compile --check-only --threads=4 --warnings=error --search-path "${{ github.workspace }}/ql/extractor-pack" "ql/ql/src" "ql/ql/examples"
cd ql;
codeqlpath=$(dirname ${{ steps.find-codeql.outputs.codeql-path }});
env "PATH=$PATH:$codeqlpath" ./scripts/create-extractor-pack.sh
- name: Build extractor (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd ql;
$Env:PATH += ";$(dirname ${{ steps.find-codeql.outputs.codeql-path }})"
pwsh ./scripts/create-extractor-pack.ps1
- name: Run a single QL tests - Unix
if: runner.os != 'Windows'
run: |
"${CODEQL}" test run --check-databases --search-path "${{ github.workspace }}/ql/extractor-pack" ql/ql/test/queries/style/DeadCode/DeadCode.qlref
env:
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
- name: Run a single QL tests - Windows
if: runner.os == 'Windows'
shell: pwsh
run: |
$Env:PATH += ";$(dirname ${{ steps.find-codeql.outputs.codeql-path }})"
codeql test run --check-databases --search-path "${{ github.workspace }}/ql/extractor-pack" ql/ql/test/queries/style/DeadCode/DeadCode.qlref

View File

@@ -48,23 +48,41 @@ jobs:
run: |
brew install gnu-tar
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
- uses: ./.github/actions/os-version
id: os_version
- name: Cache entire extractor
uses: actions/cache@v3
id: cache-extractor
with:
path: |
ruby/target/release/ruby-autobuilder
ruby/target/release/ruby-autobuilder.exe
ruby/target/release/ruby-extractor
ruby/target/release/ruby-extractor.exe
ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-extractor-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}--${{ hashFiles('ruby/**/*.rs') }}
- uses: actions/cache@v3
if: steps.cache-extractor.outputs.cache-hit != 'true'
with:
path: |
~/.cargo/registry
~/.cargo/git
ruby/target
key: ${{ runner.os }}-ruby-rust-cargo-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-rust-cargo-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}
- name: Check formatting
if: steps.cache-extractor.outputs.cache-hit != 'true'
run: cargo fmt --all -- --check
- name: Build
if: steps.cache-extractor.outputs.cache-hit != 'true'
run: cargo build --verbose
- name: Run tests
if: steps.cache-extractor.outputs.cache-hit != 'true'
run: cargo test --verbose
- name: Release build
if: steps.cache-extractor.outputs.cache-hit != 'true'
run: cargo build --release
- name: Generate dbscheme
if: ${{ matrix.os == 'ubuntu-latest' }}
if: ${{ matrix.os == 'ubuntu-latest' && steps.cache-extractor.outputs.cache-hit != 'true'}}
run: target/release/ruby-generator --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
- uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'ubuntu-latest' }}
@@ -86,19 +104,25 @@ jobs:
ruby/target/release/ruby-extractor.exe
retention-days: 1
compile-queries:
runs-on: ubuntu-latest
env:
CODEQL_THREADS: 4 # TODO: remove this once it's set by the CLI
runs-on: ubuntu-latest-xl
steps:
- uses: actions/checkout@v3
- name: Fetch CodeQL
uses: ./.github/actions/fetch-codeql
- name: Cache compilation cache
id: query-cache
uses: ./.github/actions/cache-query-compilation
with:
key: ruby-build
- name: Build Query Pack
run: |
codeql pack create ../shared/ssa --output target/packs
rm -rf target/packs
codeql pack create ../misc/suite-helpers --output target/packs
codeql pack create ../shared/regex --output target/packs
codeql pack create ../shared/ssa --output target/packs
codeql pack create ../shared/tutorial --output target/packs
codeql pack create ql/lib --output target/packs
codeql pack create ql/src --output target/packs
codeql pack create -j0 ql/src --output target/packs --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
PACK_FOLDER=$(readlink -f target/packs/codeql/ruby-queries/*)
codeql generate query-help --format=sarifv2.1.0 --output="${PACK_FOLDER}/rules.sarif" ql/src
(cd ql/src; find queries \( -name '*.qhelp' -o -name '*.rb' -o -name '*.erb' \) -exec bash -c 'mkdir -p "'"${PACK_FOLDER}"'/$(dirname "{}")"' \; -exec cp "{}" "${PACK_FOLDER}/{}" \;)
@@ -181,11 +205,6 @@ jobs:
- name: Fetch CodeQL
uses: ./.github/actions/fetch-codeql
- uses: actions/checkout@v3
with:
repository: Shopify/example-ruby-app
ref: 67a0decc5eb550f3a9228eda53925c3afd40dfe9
- name: Download Ruby bundle
uses: actions/download-artifact@v3
with:
@@ -194,26 +213,15 @@ jobs:
- name: Unzip Ruby bundle
shell: bash
run: unzip -q -d "${{ runner.temp }}/ruby-bundle" "${{ runner.temp }}/codeql-ruby-bundle.zip"
- name: Prepare test files
shell: bash
run: |
echo "import codeql.ruby.AST select count(File f)" > "test.ql"
echo "| 4 |" > "test.expected"
echo 'name: sample-tests
version: 0.0.0
dependencies:
codeql/ruby-all: "*"
extractor: ruby
tests: .
' > qlpack.yml
- name: Run QL test
shell: bash
run: |
codeql test run --search-path "${{ runner.temp }}/ruby-bundle" --additional-packs "${{ runner.temp }}/ruby-bundle" .
codeql test run --search-path "${{ runner.temp }}/ruby-bundle" --additional-packs "${{ runner.temp }}/ruby-bundle" ruby/ql/test/library-tests/ast/constants/
- name: Create database
shell: bash
run: |
codeql database create --search-path "${{ runner.temp }}/ruby-bundle" --language ruby --source-root . ../database
codeql database create --search-path "${{ runner.temp }}/ruby-bundle" --language ruby --source-root ruby/ql/test/library-tests/ast/constants/ ../database
- name: Analyze database
shell: bash
run: |

View File

@@ -4,7 +4,7 @@ on:
push:
paths:
- "ruby/**"
- .github/workflows/ruby-qltest.yml
- .github/workflows/ruby-build.yml
- .github/actions/fetch-codeql/action.yml
- codeql-workspace.yml
branches:
@@ -28,23 +28,6 @@ defaults:
working-directory: ruby
jobs:
qlformat:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/fetch-codeql
- name: Check QL formatting
run: find ql "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 codeql query format --check-only
qlcompile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/fetch-codeql
- name: Check QL compilation
run: |
codeql query compile --check-only --threads=0 --ram 5000 --warnings=error "ql/src" "ql/examples"
env:
GITHUB_TOKEN: ${{ github.token }}
qlupgrade:
runs-on: ubuntu-latest
steps:
@@ -65,17 +48,20 @@ jobs:
xargs codeql execute upgrades testdb
diff -q testdb/ruby.dbscheme downgrades/initial/ruby.dbscheme
qltest:
runs-on: ubuntu-latest
runs-on: ubuntu-latest-xl
strategy:
fail-fast: false
matrix:
slice: ["1/2", "2/2"]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/fetch-codeql
- uses: ./ruby/actions/create-extractor-pack
- name: Cache compilation cache
id: query-cache
uses: ./.github/actions/cache-query-compilation
with:
key: ruby-qltest
- name: Run QL tests
run: |
codeql test run --threads=0 --ram 5000 --slice ${{ matrix.slice }} --search-path "${{ github.workspace }}/ruby/extractor-pack" --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --consistency-queries ql/consistency-queries ql/test
codeql test run --threads=0 --ram 50000 --search-path "${{ github.workspace }}/ruby/extractor-pack" --check-databases --check-undefined-labels --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
env:
GITHUB_TOKEN: ${{ github.token }}

View File

@@ -7,93 +7,77 @@ on:
- "misc/bazel/**"
- "*.bazel*"
- .github/workflows/swift.yml
- .github/actions/fetch-codeql/action.yml
- .github/actions/**
- codeql-workspace.yml
- .pre-commit-config.yaml
- "!**/*.md"
- "!**/*.qhelp"
branches:
- main
- rc/*
push:
paths:
- "swift/**"
- "misc/bazel/**"
- "*.bazel*"
- .github/workflows/swift.yml
- .github/actions/**
- codeql-workspace.yml
- "!**/*.md"
- "!**/*.qhelp"
branches:
- main
- rc/*
jobs:
changes:
runs-on: ubuntu-latest
outputs:
codegen: ${{ steps.filter.outputs.codegen }}
ql: ${{ steps.filter.outputs.ql }}
steps:
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50
id: filter
with:
filters: |
codegen:
- 'github/workflows/swift.yml'
- "misc/bazel/**"
- "*.bazel*"
- 'swift/actions/setup-env/**'
- '.pre-commit-config.yaml'
- 'swift/codegen/**'
- 'swift/schema.py'
- 'swift/**/*.dbscheme'
- 'swift/ql/lib/codeql/swift/elements.qll'
- 'swift/ql/lib/codeql/swift/elements/**'
- 'swift/ql/lib/codeql/swift/generated/**'
- 'swift/ql/test/extractor-tests/generated/**'
ql:
- 'github/workflows/swift.yml'
- 'swift/**/*.ql'
- 'swift/**/*.qll'
# not using a matrix as you cannot depend on a specific job in a matrix, and we want to start linux checks
# without waiting for the macOS build
build-and-test-macos:
runs-on: macos-12-xl
steps:
- uses: actions/checkout@v3
- uses: ./swift/actions/create-extractor-pack
- uses: ./swift/actions/run-quick-tests
- uses: ./swift/actions/build-and-test
build-and-test-linux:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest-xl
steps:
- uses: actions/checkout@v3
- uses: ./swift/actions/create-extractor-pack
- uses: ./swift/actions/run-quick-tests
- uses: ./swift/actions/build-and-test
qltests-linux:
needs: build-and-test-linux
runs-on: ubuntu-latest
runs-on: ubuntu-latest-xl
steps:
- uses: actions/checkout@v3
- uses: ./swift/actions/run-ql-tests
qltests-macos:
if : ${{ github.event_name == 'pull_request' }}
needs: build-and-test-macos
runs-on: macos-12-xl
strategy:
fail-fast: false
matrix:
slice: ["1/2", "2/2"]
steps:
- uses: actions/checkout@v3
- uses: ./swift/actions/run-ql-tests
with:
flags: --slice ${{ matrix.slice }}
integration-tests-linux:
needs: build-and-test-linux
runs-on: ubuntu-latest
runs-on: ubuntu-latest-xl
steps:
- uses: actions/checkout@v3
- uses: ./swift/actions/run-integration-tests
integration-tests-macos:
if : ${{ github.event_name == 'pull_request' }}
needs: build-and-test-macos
runs-on: macos-12-xl
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: ./swift/actions/run-integration-tests
codegen:
if : ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.codegen == 'true' }}
steps:
- uses: actions/checkout@v3
- uses: ./swift/actions/setup-env
- uses: bazelbuild/setup-bazelisk@v2
- uses: actions/setup-python@v4
with:
python-version-file: 'swift/.python-version'
- uses: pre-commit/action@v3.0.0
name: Check that python code is properly formatted
with:
@@ -109,13 +93,11 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: swift-generated-cpp-files
path: swift/generated-cpp-files/**
qlformat:
path: generated-cpp-files/**
database-upgrade-scripts:
if : ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.ql == 'true' }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/fetch-codeql
- name: Check QL formatting
run: find swift/ql "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 codeql query format --check-only
- uses: ./swift/actions/database-upgrade-scripts

2
.gitignore vendored
View File

@@ -27,8 +27,6 @@
# It's useful (though not required) to be able to unpack codeql in the ql checkout itself
/codeql/
csharp/extractor/Semmle.Extraction.CSharp.Driver/Properties/launchSettings.json
# Avoid committing cached package components
.codeql

View File

@@ -19,7 +19,7 @@ repos:
rev: v1.6.0
hooks:
- id: autopep8
files: ^swift/codegen/.*\.py
files: ^swift/.*\.py
- repo: local
hooks:
@@ -44,7 +44,7 @@ repos:
- id: swift-codegen
name: Run Swift checked in code generation
files: ^swift/(codegen/|.*/generated/|ql/lib/(swift\.dbscheme$|codeql/swift/elements))
files: ^swift/(schema.py$|codegen/|.*/generated/|ql/lib/(swift\.dbscheme$|codeql/swift/elements)|ql/\.generated.list)
language: system
entry: bazel run //swift/codegen -- --quiet
pass_filenames: false

View File

@@ -1,3 +1,5 @@
{
"omnisharp.autoStart": false
"omnisharp.autoStart": false,
"cmake.sourceDirectory": "${workspaceFolder}/swift",
"cmake.buildDirectory": "${workspaceFolder}/bazel-cmake-build"
}

View File

@@ -5,20 +5,13 @@
/javascript/ @github/codeql-javascript
/python/ @github/codeql-python
/ruby/ @github/codeql-ruby
/swift/ @github/codeql-c
/swift/ @github/codeql-swift
/java/kotlin-extractor/ @github/codeql-kotlin
/java/kotlin-explorer/ @github/codeql-kotlin
# ML-powered queries
/javascript/ql/experimental/adaptivethreatmodeling/ @github/codeql-ml-powered-queries-reviewers
# Notify members of codeql-go about PRs to the shared data-flow library files
/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll @github/codeql-java @github/codeql-go
/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl2.qll @github/codeql-java @github/codeql-go
/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll @github/codeql-java @github/codeql-go
/java/ql/src/semmle/code/java/dataflow/internal/tainttracking1/TaintTrackingImpl.qll @github/codeql-java @github/codeql-go
/java/ql/src/semmle/code/java/dataflow/internal/tainttracking2/TaintTrackingImpl.qll @github/codeql-java @github/codeql-go
# CodeQL tools and associated docs
/docs/codeql/codeql-cli/ @github/codeql-cli-reviewers
/docs/codeql/codeql-for-visual-studio-code/ @github/codeql-vscode-reviewers
@@ -45,4 +38,4 @@ WORKSPACE.bazel @github/codeql-ci-reviewers
/.github/workflows/js-ml-tests.yml @github/codeql-ml-powered-queries-reviewers
/.github/workflows/ql-for-ql-* @github/codeql-ql-for-ql-reviewers
/.github/workflows/ruby-* @github/codeql-ruby
/.github/workflows/swift-* @github/codeql-c
/.github/workflows/swift.yml @github/codeql-swift

View File

@@ -25,6 +25,7 @@ If you have an idea for a query that you would like to share with other CodeQL u
Each language-specific directory contains further subdirectories that group queries based on their `@tags` or purpose.
- Experimental queries and libraries are stored in the `experimental` subdirectory within each language-specific directory in the [CodeQL repository](https://github.com/github/codeql). For example, experimental Java queries and libraries are stored in `java/ql/src/experimental` and any corresponding tests in `java/ql/test/experimental`.
- Experimental queries need to include `experimental` in their `@tags`
- The structure of an `experimental` subdirectory mirrors the structure of its parent directory.
- Select or create an appropriate directory in `experimental` based on the existing directory structure of `experimental` or its parent directory.

View File

@@ -10,6 +10,8 @@ There is [extensive documentation](https://codeql.github.com/docs/) on getting s
We welcome contributions to our standard library and standard checks. Do you have an idea for a new check, or how to improve an existing query? Then please go ahead and open a pull request! Before you do, though, please take the time to read our [contributing guidelines](CONTRIBUTING.md). You can also consult our [style guides](https://github.com/github/codeql/tree/main/docs) to learn how to format your code for consistency and clarity, how to write query metadata, and how to write query help documentation for your query.
For information on contributing to CodeQL documentation, see the "[contributing guide](docs/codeql/CONTRIBUTING.md)" for docs.
## License
The code in this repository is licensed under the [MIT License](LICENSE) by [GitHub](https://github.com).

View File

@@ -25,7 +25,8 @@ provide:
- "misc/suite-helpers/qlpack.yml"
- "ruby/extractor-pack/codeql-extractor.yml"
- "swift/extractor-pack/codeql-extractor.yml"
- "ql/extractor-pack/codeql-extractor.ym"
- "swift/integration-tests/qlpack.yml"
- "ql/extractor-pack/codeql-extractor.yml"
versionPolicies:
default:

View File

@@ -1,5 +1,5 @@
{
"DataFlow Java/C++/C#/Python": [
"DataFlow Java/C++/C#/Go/Python/Ruby/Swift": [
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImpl.qll",
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImpl2.qll",
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImpl3.qll",
@@ -27,28 +27,32 @@
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll",
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll",
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplForContentDataFlow.qll",
"go/ql/lib/semmle/go/dataflow/internal/DataFlowImpl.qll",
"go/ql/lib/semmle/go/dataflow/internal/DataFlowImpl2.qll",
"go/ql/lib/semmle/go/dataflow/internal/DataFlowImplForStringsNewReplacer.qll",
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImpl.qll",
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImpl2.qll",
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImpl3.qll",
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImpl4.qll",
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplForRegExp.qll",
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImpl.qll",
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImpl2.qll",
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForRegExp.qll",
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForHttpClientLibraries.qll",
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForPathname.qll",
"swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImpl.qll"
],
"DataFlow Java/C++/C#/Python Common": [
"DataFlow Java/C++/C#/Go/Python/Ruby/Swift Common": [
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll",
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplCommon.qll",
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll",
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll",
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplCommon.qll",
"go/ql/lib/semmle/go/dataflow/internal/DataFlowImplCommon.qll",
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplCommon.qll",
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplCommon.qll",
"swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplCommon.qll"
],
"TaintTracking::Configuration Java/C++/C#/Python": [
"TaintTracking::Configuration Java/C++/C#/Go/Python/Ruby/Swift": [
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
@@ -62,6 +66,8 @@
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/tainttracking3/TaintTrackingImpl.qll",
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/tainttracking4/TaintTrackingImpl.qll",
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/tainttracking5/TaintTrackingImpl.qll",
"go/ql/lib/semmle/go/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
"go/ql/lib/semmle/go/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
"java/ql/lib/semmle/code/java/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
"java/ql/lib/semmle/code/java/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
"java/ql/lib/semmle/code/java/dataflow/internal/tainttracking3/TaintTrackingImpl.qll",
@@ -72,7 +78,7 @@
"ruby/ql/lib/codeql/ruby/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
"swift/ql/lib/codeql/swift/dataflow/internal/tainttracking1/TaintTrackingImpl.qll"
],
"DataFlow Java/C++/C#/Python Consistency checks": [
"DataFlow Java/C++/C#/Python/Ruby/Swift Consistency checks": [
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplConsistency.qll",
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplConsistency.qll",
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll",
@@ -82,9 +88,10 @@
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplConsistency.qll",
"swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplConsistency.qll"
],
"DataFlow Java/C#/Ruby/Python/Swift Flow Summaries": [
"DataFlow Java/C#/Go/Ruby/Python/Swift Flow Summaries": [
"java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImpl.qll",
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImpl.qll",
"go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImpl.qll",
"ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImpl.qll",
"python/ql/lib/semmle/python/dataflow/new/internal/FlowSummaryImpl.qll",
"swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImpl.qll"
@@ -94,8 +101,8 @@
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SsaReadPositionCommon.qll"
],
"Model as Data Generation Java/C# - CaptureModels": [
"java/ql/src/utils/model-generator/internal/CaptureModels.qll",
"csharp/ql/src/utils/model-generator/internal/CaptureModels.qll"
"java/ql/src/utils/modelgenerator/internal/CaptureModels.qll",
"csharp/ql/src/utils/modelgenerator/internal/CaptureModels.qll"
],
"Sign Java/C#": [
"java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/Sign.qll",
@@ -396,16 +403,6 @@
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/ControlFlowReachability.qll",
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/ControlFlowReachability.qll"
],
"Inline Test Expectations": [
"cpp/ql/test/TestUtilities/InlineExpectationsTest.qll",
"csharp/ql/test/TestUtilities/InlineExpectationsTest.qll",
"java/ql/test/TestUtilities/InlineExpectationsTest.qll",
"python/ql/test/TestUtilities/InlineExpectationsTest.qll",
"ruby/ql/test/TestUtilities/InlineExpectationsTest.qll",
"ql/ql/test/TestUtilities/InlineExpectationsTest.qll",
"go/ql/test/TestUtilities/InlineExpectationsTest.qll",
"swift/ql/test/TestUtilities/InlineExpectationsTest.qll"
],
"C++ ExternalAPIs": [
"cpp/ql/src/Security/CWE/CWE-020/ExternalAPIs.qll",
"cpp/ql/src/Security/CWE/CWE-020/ir/ExternalAPIs.qll"
@@ -464,6 +461,10 @@
"javascript/ql/src/Comments/CommentedOutCodeReferences.inc.qhelp",
"python/ql/src/Lexical/CommentedOutCodeReferences.inc.qhelp"
],
"ThreadResourceAbuse qhelp": [
"java/ql/src/experimental/Security/CWE/CWE-400/LocalThreadResourceAbuse.qhelp",
"java/ql/src/experimental/Security/CWE/CWE-400/ThreadResourceAbuse.qhelp"
],
"IDE Contextual Queries": [
"cpp/ql/lib/IDEContextual.qll",
"csharp/ql/lib/IDEContextual.qll",
@@ -486,40 +487,6 @@
"python/ql/lib/semmle/python/security/internal/SensitiveDataHeuristics.qll",
"ruby/ql/lib/codeql/ruby/security/internal/SensitiveDataHeuristics.qll"
],
"ReDoS Util Python/JS/Ruby/Java": [
"javascript/ql/lib/semmle/javascript/security/regexp/NfaUtils.qll",
"python/ql/lib/semmle/python/security/regexp/NfaUtils.qll",
"ruby/ql/lib/codeql/ruby/security/regexp/NfaUtils.qll",
"java/ql/lib/semmle/code/java/security/regexp/NfaUtils.qll"
],
"ReDoS Exponential Python/JS/Ruby/Java": [
"javascript/ql/lib/semmle/javascript/security/regexp/ExponentialBackTracking.qll",
"python/ql/lib/semmle/python/security/regexp/ExponentialBackTracking.qll",
"ruby/ql/lib/codeql/ruby/security/regexp/ExponentialBackTracking.qll",
"java/ql/lib/semmle/code/java/security/regexp/ExponentialBackTracking.qll"
],
"ReDoS Polynomial Python/JS/Ruby/Java": [
"javascript/ql/lib/semmle/javascript/security/regexp/SuperlinearBackTracking.qll",
"python/ql/lib/semmle/python/security/regexp/SuperlinearBackTracking.qll",
"ruby/ql/lib/codeql/ruby/security/regexp/SuperlinearBackTracking.qll",
"java/ql/lib/semmle/code/java/security/regexp/SuperlinearBackTracking.qll"
],
"RegexpMatching Python/JS/Ruby": [
"javascript/ql/lib/semmle/javascript/security/regexp/RegexpMatching.qll",
"python/ql/lib/semmle/python/security/regexp/RegexpMatching.qll",
"ruby/ql/lib/codeql/ruby/security/regexp/RegexpMatching.qll"
],
"BadTagFilterQuery Python/JS/Ruby": [
"javascript/ql/lib/semmle/javascript/security/BadTagFilterQuery.qll",
"python/ql/lib/semmle/python/security/BadTagFilterQuery.qll",
"ruby/ql/lib/codeql/ruby/security/BadTagFilterQuery.qll"
],
"OverlyLargeRange Python/JS/Ruby/Java": [
"javascript/ql/lib/semmle/javascript/security/OverlyLargeRangeQuery.qll",
"python/ql/lib/semmle/python/security/OverlyLargeRangeQuery.qll",
"ruby/ql/lib/codeql/ruby/security/OverlyLargeRangeQuery.qll",
"java/ql/lib/semmle/code/java/security/OverlyLargeRangeQuery.qll"
],
"CFG": [
"csharp/ql/lib/semmle/code/csharp/controlflow/internal/ControlFlowGraphImplShared.qll",
"ruby/ql/lib/codeql/ruby/controlflow/internal/ControlFlowGraphImplShared.qll",
@@ -529,16 +496,9 @@
"python/ql/lib/semmle/python/dataflow/new/internal/TypeTracker.qll",
"ruby/ql/lib/codeql/ruby/typetracking/TypeTracker.qll"
],
"CodeQL Tutorial": [
"cpp/ql/lib/tutorial.qll",
"csharp/ql/lib/tutorial.qll",
"java/ql/lib/tutorial.qll",
"javascript/ql/lib/tutorial.qll",
"python/ql/lib/tutorial.qll",
"ruby/ql/lib/tutorial.qll"
],
"AccessPathSyntax": [
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/AccessPathSyntax.qll",
"go/ql/lib/semmle/go/dataflow/internal/AccessPathSyntax.qll",
"java/ql/lib/semmle/code/java/dataflow/internal/AccessPathSyntax.qll",
"javascript/ql/lib/semmle/javascript/frameworks/data/internal/AccessPathSyntax.qll",
"ruby/ql/lib/codeql/ruby/dataflow/internal/AccessPathSyntax.qll",
@@ -554,16 +514,16 @@
"ruby/ql/lib/codeql/ruby/internal/ConceptsShared.qll",
"javascript/ql/lib/semmle/javascript/internal/ConceptsShared.qll"
],
"Hostname Regexp queries": [
"javascript/ql/src/Security/CWE-020/HostnameRegexpShared.qll",
"python/ql/src/Security/CWE-020/HostnameRegexpShared.qll",
"ruby/ql/src/queries/security/cwe-020/HostnameRegexpShared.qll"
],
"ApiGraphModels": [
"javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModels.qll",
"ruby/ql/lib/codeql/ruby/frameworks/data/internal/ApiGraphModels.qll",
"python/ql/lib/semmle/python/frameworks/data/internal/ApiGraphModels.qll"
],
"ApiGraphModelsExtensions": [
"javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModelsExtensions.qll",
"ruby/ql/lib/codeql/ruby/frameworks/data/internal/ApiGraphModelsExtensions.qll",
"python/ql/lib/semmle/python/frameworks/data/internal/ApiGraphModelsExtensions.qll"
],
"TaintedFormatStringQuery Ruby/JS": [
"javascript/ql/lib/semmle/javascript/security/dataflow/TaintedFormatStringQuery.qll",
"ruby/ql/lib/codeql/ruby/security/TaintedFormatStringQuery.qll"
@@ -607,5 +567,9 @@
"IncompleteMultiCharacterSanitization JS/Ruby": [
"javascript/ql/lib/semmle/javascript/security/IncompleteMultiCharacterSanitizationQuery.qll",
"ruby/ql/lib/codeql/ruby/security/IncompleteMultiCharacterSanitizationQuery.qll"
],
"EncryptionKeySizes Python/Java": [
"python/ql/lib/semmle/python/security/internal/EncryptionKeySizes.qll",
"java/ql/lib/semmle/code/java/security/internal/EncryptionKeySizes.qll"
]
}

View File

@@ -257,11 +257,11 @@ namespace Semmle.Autobuild.Cpp.Tests
Actions.GetCurrentDirectory = cwd;
Actions.IsWindows = isWindows;
var options = new AutobuildOptions(Actions, Language.Cpp);
var options = new CppAutobuildOptions(Actions);
return new CppAutobuilder(Actions, options);
}
void TestAutobuilderScript(Autobuilder autobuilder, int expectedOutput, int commandsRun)
void TestAutobuilderScript(CppAutobuilder autobuilder, int expectedOutput, int commandsRun)
{
Assert.Equal(expectedOutput, autobuilder.GetBuildScript().Run(Actions, StartCallback, EndCallback));
@@ -299,7 +299,7 @@ namespace Semmle.Autobuild.Cpp.Tests
{
Actions.RunProcess[@"cmd.exe /C nuget restore C:\Project\test.sln -DisableParallelProcessing"] = 1;
Actions.RunProcess[@"cmd.exe /C C:\Project\.nuget\nuget.exe restore C:\Project\test.sln -DisableParallelProcessing"] = 0;
Actions.RunProcess[@"cmd.exe /C CALL ^""C:\Program Files ^(x86^)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat^"" && set Platform=&& type NUL && C:\odasa\tools\odasa index --auto msbuild C:\Project\test.sln /t:rebuild /p:Platform=""x86"" /p:Configuration=""Release"" /p:MvcBuildViews=true"] = 0;
Actions.RunProcess[@"cmd.exe /C CALL ^""C:\Program Files ^(x86^)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat^"" && set Platform=&& type NUL && msbuild C:\Project\test.sln /t:rebuild /p:Platform=""x86"" /p:Configuration=""Release"""] = 0;
Actions.RunProcessOut[@"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -prerelease -legacy -property installationPath"] = "";
Actions.RunProcess[@"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -prerelease -legacy -property installationPath"] = 1;
Actions.RunProcess[@"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -prerelease -legacy -property installationVersion"] = 0;

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
<Nullable>enable</Nullable>
@@ -11,11 +11,12 @@
<ItemGroup>
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
</ItemGroup>
<ItemGroup>

View File

@@ -2,9 +2,26 @@
namespace Semmle.Autobuild.Cpp
{
public class CppAutobuilder : Autobuilder
/// <summary>
/// Encapsulates C++ build options.
/// </summary>
public class CppAutobuildOptions : AutobuildOptionsShared
{
public CppAutobuilder(IBuildActions actions, AutobuildOptions options) : base(actions, options) { }
public override Language Language => Language.Cpp;
/// <summary>
/// Reads options from environment variables.
/// Throws ArgumentOutOfRangeException for invalid arguments.
/// </summary>
public CppAutobuildOptions(IBuildActions actions) : base(actions)
{
}
}
public class CppAutobuilder : Autobuilder<CppAutobuildOptions>
{
public CppAutobuilder(IBuildActions actions, CppAutobuildOptions options) : base(actions, options) { }
public override BuildScript GetBuildScript()
{

View File

@@ -11,14 +11,14 @@ namespace Semmle.Autobuild.Cpp
try
{
var actions = SystemBuildActions.Instance;
var options = new AutobuildOptions(actions, Language.Cpp);
var options = new CppAutobuildOptions(actions);
try
{
Console.WriteLine("CodeQL C++ autobuilder");
var builder = new CppAutobuilder(actions, options);
return builder.AttemptBuild();
}
catch(InvalidEnvironmentException ex)
catch (InvalidEnvironmentException ex)
{
Console.WriteLine("The environment is invalid: {0}", ex.Message);
}

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AssemblyName>Semmle.Autobuild.Cpp</AssemblyName>
<RootNamespace>Semmle.Autobuild.Cpp</RootNamespace>
<ApplicationIcon />
@@ -17,7 +17,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build" Version="16.11.0" />
<PackageReference Include="Microsoft.Build" Version="17.3.2" />
</ItemGroup>
<ItemGroup>

View File

@@ -13,5 +13,5 @@ predicate isExprWithNewBuiltin(Expr expr) {
from Expr expr, int kind, int kind_new, Location location
where
exprs(expr, kind, location) and
if isExprWithNewBuiltin(expr) then kind_new = 0 else kind_new = kind
if isExprWithNewBuiltin(expr) then kind_new = 1 else kind_new = kind
select expr, kind_new, location

View File

@@ -9,5 +9,5 @@ class Location extends @location_expr {
from Expr expr, int kind, int kind_new, Location location
where
exprs(expr, kind, location) and
if expr instanceof @blockassignexpr then kind_new = 0 else kind_new = kind
if expr instanceof @blockassignexpr then kind_new = 1 else kind_new = kind
select expr, kind_new, location

View File

@@ -0,0 +1,11 @@
class BuiltinType extends @builtintype {
string toString() { none() }
}
from BuiltinType type, string name, int kind, int kind_new, int size, int sign, int alignment
where
builtintypes(type, name, kind, size, sign, alignment) and
if type instanceof @float16 or type instanceof @complex_float16
then kind_new = 2
else kind_new = kind
select type, name, kind_new, size, sign, alignment

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
description: Introduce (_Complex) _Float16 type
compatibility: backwards
builtintypes.rel: run builtintypes.qlo

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: Uncomment case splits in dbscheme
compatibility: full

View File

@@ -1,3 +1,44 @@
## 0.5.2
No user-facing changes.
## 0.5.1
No user-facing changes.
## 0.5.0
### Breaking Changes
The predicates in the `MustFlow::Configuration` class used by the `MustFlow` library (`semmle.code.cpp.ir.dataflow.MustFlow`) have changed to be defined directly in terms of the C++ IR instead of IR dataflow nodes.
### Deprecated APIs
* Deprecated `semmle.code.cpp.ir.dataflow.DefaultTaintTracking`. Use `semmle.code.cpp.ir.dataflow.TaintTracking`.
* Deprecated `semmle.code.cpp.security.TaintTrackingImpl`. Use `semmle.code.cpp.ir.dataflow.TaintTracking`.
* Deprecated `semmle.code.cpp.valuenumbering.GlobalValueNumberingImpl`. Use `semmle.code.cpp.valuenumbering.GlobalValueNumbering`, which exposes the same API.
### Minor Analysis Improvements
* The `ArgvSource` flow source now uses the second parameter of `main` as its source instead of the uses of this parameter.
* The `ArgvSource` flow source has been generalized to handle cases where the argument vector of `main` is not named `argv`.
* The `getaddrinfo` function is now recognized as a flow source.
* The `secure_getenv` and `_wgetenv` functions are now recognized as local flow sources.
* The `scanf` and `fscanf` functions and their variants are now recognized as flow sources.
* Deleted the deprecated `getName` and `getShortName` predicates from the `Folder` class.
## 0.4.6
No user-facing changes.
## 0.4.5
No user-facing changes.
## 0.4.4
No user-facing changes.
## 0.4.3
### Minor Analysis Improvements

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,20 @@
## 0.5.0
### Breaking Changes
The predicates in the `MustFlow::Configuration` class used by the `MustFlow` library (`semmle.code.cpp.ir.dataflow.MustFlow`) have changed to be defined directly in terms of the C++ IR instead of IR dataflow nodes.
### Deprecated APIs
* Deprecated `semmle.code.cpp.ir.dataflow.DefaultTaintTracking`. Use `semmle.code.cpp.ir.dataflow.TaintTracking`.
* Deprecated `semmle.code.cpp.security.TaintTrackingImpl`. Use `semmle.code.cpp.ir.dataflow.TaintTracking`.
* Deprecated `semmle.code.cpp.valuenumbering.GlobalValueNumberingImpl`. Use `semmle.code.cpp.valuenumbering.GlobalValueNumbering`, which exposes the same API.
### Minor Analysis Improvements
* The `ArgvSource` flow source now uses the second parameter of `main` as its source instead of the uses of this parameter.
* The `ArgvSource` flow source has been generalized to handle cases where the argument vector of `main` is not named `argv`.
* The `getaddrinfo` function is now recognized as a flow source.
* The `secure_getenv` and `_wgetenv` functions are now recognized as local flow sources.
* The `scanf` and `fscanf` functions and their variants are now recognized as flow sources.
* Deleted the deprecated `getName` and `getShortName` predicates from the `Folder` class.

View File

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

View File

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

View File

@@ -1,2 +1,2 @@
---
lastReleaseVersion: 0.4.3
lastReleaseVersion: 0.5.2

View File

@@ -12,8 +12,8 @@ import IDEContextual
*
* In some cases it is preferable to modify locations (the
* `hasLocationInfo()` predicate) so that they are short, and
* non-overlapping with other locations that might be highlighted in
* the LGTM interface.
* non-overlapping with other locations that might be reported as
* code scanning alerts on GitHub.
*
* We need to give locations that may not be in the database, so
* we use `hasLocationInfo()` rather than `getLocation()`.
@@ -123,6 +123,13 @@ private predicate constructorCallTypeMention(ConstructorCall cc, TypeMention tm)
)
}
/** Holds if `loc` has the container `container` and is on the line starting at `startLine`. */
pragma[nomagic]
private predicate hasContainerAndStartLine(Location loc, Container container, int startLine) {
loc.getStartLine() = startLine and
loc.getContainer() = container
}
/**
* Gets an element, of kind `kind`, that element `e` uses, if any.
* Attention: This predicate yields multiple definitions for a single location.
@@ -159,9 +166,9 @@ Top definitionOf(Top e, string kind) {
// Multiple type mentions can be generated when a typedef is used, and
// in such cases we want to exclude all but the originating typedef.
not exists(Type secondary |
exists(TypeMention tm, File f, int startline, int startcol |
exists(File f, int startline, int startcol |
typeMentionStartLoc(e, result, f, startline, startcol) and
typeMentionStartLoc(tm, secondary, f, startline, startcol) and
typeMentionStartLoc(_, secondary, f, startline, startcol) and
(
result = secondary.(TypedefType).getBaseType() or
result = secondary.(TypedefType).getBaseType().(SpecifiedType).getBaseType()
@@ -184,11 +191,9 @@ Top definitionOf(Top e, string kind) {
kind = "I" and
result = e.(Include).getIncludedFile() and
// exclude `#include` directives containing macros
not exists(MacroInvocation mi, Location l1, Location l2 |
l1 = e.(Include).getLocation() and
l2 = mi.getLocation() and
l1.getContainer() = l2.getContainer() and
l1.getStartLine() = l2.getStartLine()
not exists(MacroInvocation mi, Container container, int startLine |
hasContainerAndStartLine(e.(Include).getLocation(), container, startLine) and
hasContainerAndStartLine(mi.getLocation(), container, startLine)
// (an #include directive must be always on it's own line)
)
) and

View File

@@ -915,18 +915,57 @@ private module Cached {
TDataFlowCallNone() or
TDataFlowCallSome(DataFlowCall call)
cached
newtype TParamNodeOption =
TParamNodeNone() or
TParamNodeSome(ParamNode p)
cached
newtype TReturnCtx =
TReturnCtxNone() or
TReturnCtxNoFlowThrough() or
TReturnCtxMaybeFlowThrough(ReturnPosition pos)
cached
newtype TTypedContentApprox =
MkTypedContentApprox(ContentApprox c, DataFlowType t) {
exists(Content cont |
c = getContentApprox(cont) and
store(_, cont, _, _, t)
)
}
cached
newtype TTypedContent = MkTypedContent(Content c, DataFlowType t) { store(_, c, _, _, t) }
cached
TypedContent getATypedContent(TypedContentApprox c) {
exists(ContentApprox cls, DataFlowType t, Content cont |
c = MkTypedContentApprox(cls, pragma[only_bind_into](t)) and
result = MkTypedContent(cont, pragma[only_bind_into](t)) and
cls = getContentApprox(cont)
)
}
cached
newtype TAccessPathFront =
TFrontNil(DataFlowType t) or
TFrontHead(TypedContent tc)
cached
newtype TApproxAccessPathFront =
TApproxFrontNil(DataFlowType t) or
TApproxFrontHead(TypedContentApprox tc)
cached
newtype TAccessPathFrontOption =
TAccessPathFrontNone() or
TAccessPathFrontSome(AccessPathFront apf)
cached
newtype TApproxAccessPathFrontOption =
TApproxAccessPathFrontNone() or
TApproxAccessPathFrontSome(ApproxAccessPathFront apf)
}
/**
@@ -1304,6 +1343,118 @@ class DataFlowCallOption extends TDataFlowCallOption {
}
}
/** An optional `ParamNode`. */
class ParamNodeOption extends TParamNodeOption {
string toString() {
this = TParamNodeNone() and
result = "(none)"
or
exists(ParamNode p |
this = TParamNodeSome(p) and
result = p.toString()
)
}
}
/**
* A return context used to calculate flow summaries in reverse flow.
*
* The possible values are:
*
* - `TReturnCtxNone()`: no return flow.
* - `TReturnCtxNoFlowThrough()`: return flow, but flow through is not possible.
* - `TReturnCtxMaybeFlowThrough(ReturnPosition pos)`: return flow, of kind `pos`, and
* flow through may be possible.
*/
class ReturnCtx extends TReturnCtx {
string toString() {
this = TReturnCtxNone() and
result = "(none)"
or
this = TReturnCtxNoFlowThrough() and
result = "(no flow through)"
or
exists(ReturnPosition pos |
this = TReturnCtxMaybeFlowThrough(pos) and
result = pos.toString()
)
}
}
/** An approximated `Content` tagged with the type of a containing object. */
class TypedContentApprox extends MkTypedContentApprox {
private ContentApprox c;
private DataFlowType t;
TypedContentApprox() { this = MkTypedContentApprox(c, t) }
/** Gets a typed content approximated by this value. */
TypedContent getATypedContent() { result = getATypedContent(this) }
/** Gets the content. */
ContentApprox getContent() { result = c }
/** Gets the container type. */
DataFlowType getContainerType() { result = t }
/** Gets a textual representation of this approximated content. */
string toString() { result = c.toString() }
}
/**
* The front of an approximated access path. This is either a head or a nil.
*/
abstract class ApproxAccessPathFront extends TApproxAccessPathFront {
abstract string toString();
abstract DataFlowType getType();
abstract boolean toBoolNonEmpty();
TypedContentApprox getHead() { this = TApproxFrontHead(result) }
pragma[nomagic]
TypedContent getAHead() {
exists(TypedContentApprox cont |
this = TApproxFrontHead(cont) and
result = cont.getATypedContent()
)
}
}
class ApproxAccessPathFrontNil extends ApproxAccessPathFront, TApproxFrontNil {
private DataFlowType t;
ApproxAccessPathFrontNil() { this = TApproxFrontNil(t) }
override string toString() { result = ppReprType(t) }
override DataFlowType getType() { result = t }
override boolean toBoolNonEmpty() { result = false }
}
class ApproxAccessPathFrontHead extends ApproxAccessPathFront, TApproxFrontHead {
private TypedContentApprox tc;
ApproxAccessPathFrontHead() { this = TApproxFrontHead(tc) }
override string toString() { result = tc.toString() }
override DataFlowType getType() { result = tc.getContainerType() }
override boolean toBoolNonEmpty() { result = true }
}
/** An optional approximated access path front. */
class ApproxAccessPathFrontOption extends TApproxAccessPathFrontOption {
string toString() {
this = TApproxAccessPathFrontNone() and result = "<none>"
or
this = TApproxAccessPathFrontSome(any(ApproxAccessPathFront apf | result = apf.toString()))
}
}
/** A `Content` tagged with the type of a containing object. */
class TypedContent extends MkTypedContent {
private Content c;
@@ -1336,7 +1487,7 @@ abstract class AccessPathFront extends TAccessPathFront {
abstract DataFlowType getType();
abstract boolean toBoolNonEmpty();
abstract ApproxAccessPathFront toApprox();
TypedContent getHead() { this = TFrontHead(result) }
}
@@ -1350,7 +1501,7 @@ class AccessPathFrontNil extends AccessPathFront, TFrontNil {
override DataFlowType getType() { result = t }
override boolean toBoolNonEmpty() { result = false }
override ApproxAccessPathFront toApprox() { result = TApproxFrontNil(t) }
}
class AccessPathFrontHead extends AccessPathFront, TFrontHead {
@@ -1362,7 +1513,7 @@ class AccessPathFrontHead extends AccessPathFront, TFrontHead {
override DataFlowType getType() { result = tc.getContainerType() }
override boolean toBoolNonEmpty() { result = true }
override ApproxAccessPathFront toApprox() { result.getAHead() = tc }
}
/** An optional access path front. */

View File

@@ -45,6 +45,16 @@ module Consistency {
) {
none()
}
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodeAtPosition`. */
predicate uniqueParameterNodeAtPositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
none()
}
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodePosition`. */
predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
none()
}
}
private class RelevantNode extends Node {
@@ -101,9 +111,7 @@ module Consistency {
exists(int c |
c =
strictcount(Node n |
not exists(string filepath, int startline, int startcolumn, int endline, int endcolumn |
n.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
) and
not n.hasLocationInfo(_, _, _, _, _) and
not any(ConsistencyConfiguration conf).missingLocationExclude(n)
) and
msg = "Nodes without location: " + c
@@ -136,6 +144,18 @@ module Consistency {
msg = "Local flow step does not preserve enclosing callable."
}
query predicate readStepIsLocal(Node n1, Node n2, string msg) {
readStep(n1, _, n2) and
nodeGetEnclosingCallable(n1) != nodeGetEnclosingCallable(n2) and
msg = "Read step does not preserve enclosing callable."
}
query predicate storeStepIsLocal(Node n1, Node n2, string msg) {
storeStep(n1, _, n2) and
nodeGetEnclosingCallable(n1) != nodeGetEnclosingCallable(n2) and
msg = "Store step does not preserve enclosing callable."
}
private DataFlowType typeRepr() { result = getNodeType(_) }
query predicate compatibleTypesReflexive(DataFlowType t, string msg) {
@@ -232,4 +252,27 @@ module Consistency {
not callable = viableCallable(call) and
not any(ConsistencyConfiguration c).viableImplInCallContextTooLargeExclude(call, ctx, callable)
}
query predicate uniqueParameterNodeAtPosition(
DataFlowCallable c, ParameterPosition pos, Node p, string msg
) {
not any(ConsistencyConfiguration conf).uniqueParameterNodeAtPositionExclude(c, pos, p) and
isParameterNode(p, c, pos) and
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
msg = "Parameters with overlapping positions."
}
query predicate uniqueParameterNodePosition(
DataFlowCallable c, ParameterPosition pos, Node p, string msg
) {
not any(ConsistencyConfiguration conf).uniqueParameterNodePositionExclude(c, pos, p) and
isParameterNode(p, c, pos) and
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
msg = "Parameter node with multiple positions."
}
query predicate uniqueContentApprox(Content c, string msg) {
not exists(unique(ContentApprox approx | approx = getContentApprox(c))) and
msg = "Non-unique content approximation."
}
}

View File

@@ -551,6 +551,13 @@ predicate additionalLambdaFlowStep(Node nodeFrom, Node nodeTo, boolean preserves
*/
predicate allowParameterReturnInSelf(ParameterNode p) { none() }
/** An approximated `Content`. */
class ContentApprox = Unit;
/** Gets an approximated value for content `c`. */
pragma[inline]
ContentApprox getContentApprox(Content c) { any() }
private class MyConsistencyConfiguration extends Consistency::ConsistencyConfiguration {
override predicate argHasPostUpdateExclude(ArgumentNode n) {
// The rules for whether an IR argument gets a post-update node are too

View File

@@ -218,7 +218,7 @@ private predicate allocation(Instruction array, Length length, int delta) {
length.(VNLength).getInstruction().getConvertedResultExpression() = lengthExpr
)
or
not exists(int d | deconstructMallocSizeExpr(alloc.getSizeExpr(), _, d)) and
not deconstructMallocSizeExpr(alloc.getSizeExpr(), _, _) and
length.(VNLength).getInstruction().getConvertedResultExpression() = alloc.getSizeExpr() and
delta = 0
)

View File

@@ -543,9 +543,7 @@ private predicate boundedPhiCand(
PhiInstruction phi, boolean upper, Bound b, int delta, boolean fromBackEdge, int origdelta,
Reason reason
) {
exists(PhiInputOperand op |
boundedPhiInp(phi, op, b, delta, upper, fromBackEdge, origdelta, reason)
)
boundedPhiInp(phi, _, b, delta, upper, fromBackEdge, origdelta, reason)
}
/**

View File

@@ -0,0 +1,263 @@
private import cpp
private import experimental.semmle.code.cpp.models.interfaces.SimpleRangeAnalysisExpr
private import semmle.code.cpp.rangeanalysis.RangeAnalysisUtils
float evaluateConstantExpr(Expr e) {
result = e.getValue().toFloat()
or
// This handles when a constant value is put into a variable
// and the variable is used later
exists(SsaDefinition defn, StackVariable sv |
defn.getAUse(sv) = e and
result = defn.getDefiningValue(sv).getValue().toFloat()
)
}
// If the constant right operand is negative or is greater than or equal to the number of
// bits in the left operands type, then the result is undefined (except on the IA-32
// architecture where the shift value is masked with 0b00011111, but we can't
// assume the architecture).
bindingset[val]
private predicate isValidShiftExprShift(float val, Expr l) {
val >= 0 and
// We use getFullyConverted because the spec says to use the *promoted* left operand
val < (l.getFullyConverted().getUnderlyingType().getSize() * 8)
}
bindingset[val, shift, max_val]
private predicate canLShiftOverflow(int val, int shift, int max_val) {
// val << shift = val * 2^shift > max_val => val > max_val/2^shift = max_val >> b
val > max_val.bitShiftRight(shift)
}
/**
* A range analysis expression consisting of the `>>` or `>>=` operator when at least
* one operand is a constant (and if the right operand is a constant, it must be "valid"
* (see `isValidShiftExprShift`)). When handling any undefined behavior, it leaves the
* values unconstrained. From the C++ standard: "The behavior is undefined if the right
* operand is negative, or greater than or equal to the length in bits of the promoted
* left operand. The value of E1 >> E2 is E1 right-shifted E2 bit positions. If E1 has an
* unsigned type or if E1 has a signed type and a non-negative value, the value of the
* result is the integral part of the quotient of E1/2^E2. If E1 has a signed type and a
* negative value, the resulting value is implementation-defined."
*/
class ConstantRShiftExprRange extends SimpleRangeAnalysisExpr {
/**
* Holds for `a >> b` or `a >>= b` in one of the following two cases:
* 1. `a` is a constant and `b` is not
* 2. `b` is constant
*
* We don't handle the case where `a` and `b` are both non-constant values.
*/
ConstantRShiftExprRange() {
getUnspecifiedType() instanceof IntegralType and
exists(Expr l, Expr r |
l = this.(RShiftExpr).getLeftOperand() and
r = this.(RShiftExpr).getRightOperand()
or
l = this.(AssignRShiftExpr).getLValue() and
r = this.(AssignRShiftExpr).getRValue()
|
l.getUnspecifiedType() instanceof IntegralType and
r.getUnspecifiedType() instanceof IntegralType and
(
// If the left operand is a constant, verify that the right operand is not a constant
exists(evaluateConstantExpr(l)) and not exists(evaluateConstantExpr(r))
or
// If the right operand is a constant, check if it is a valid shift expression
exists(float constROp |
constROp = evaluateConstantExpr(r) and isValidShiftExprShift(constROp, l)
)
)
)
}
Expr getLeftOperand() {
result = this.(RShiftExpr).getLeftOperand() or
result = this.(AssignRShiftExpr).getLValue()
}
Expr getRightOperand() {
result = this.(RShiftExpr).getRightOperand() or
result = this.(AssignRShiftExpr).getRValue()
}
override float getLowerBounds() {
exists(int lLower, int lUpper, int rLower, int rUpper |
lLower = getFullyConvertedLowerBounds(getLeftOperand()) and
lUpper = getFullyConvertedUpperBounds(getLeftOperand()) and
rLower = getFullyConvertedLowerBounds(getRightOperand()) and
rUpper = getFullyConvertedUpperBounds(getRightOperand()) and
lLower <= lUpper and
rLower <= rUpper
|
if
lLower < 0
or
not (
isValidShiftExprShift(rLower, getLeftOperand()) and
isValidShiftExprShift(rUpper, getLeftOperand())
)
then
// We don't want to deal with shifting negative numbers at the moment,
// and a negative shift is implementation defined, so we set the result
// to the minimum value
result = exprMinVal(this)
else
// We can get the smallest value by shifting the smallest bound by the largest bound
result = lLower.bitShiftRight(rUpper)
)
}
override float getUpperBounds() {
exists(int lLower, int lUpper, int rLower, int rUpper |
lLower = getFullyConvertedLowerBounds(getLeftOperand()) and
lUpper = getFullyConvertedUpperBounds(getLeftOperand()) and
rLower = getFullyConvertedLowerBounds(getRightOperand()) and
rUpper = getFullyConvertedUpperBounds(getRightOperand()) and
lLower <= lUpper and
rLower <= rUpper
|
if
lLower < 0
or
not (
isValidShiftExprShift(rLower, getLeftOperand()) and
isValidShiftExprShift(rUpper, getLeftOperand())
)
then
// We don't want to deal with shifting negative numbers at the moment,
// and a negative shift is implementation defined, so we set the result
// to the maximum value
result = exprMaxVal(this)
else
// We can get the largest value by shifting the largest bound by the smallest bound
result = lUpper.bitShiftRight(rLower)
)
}
override predicate dependsOnChild(Expr child) {
child = getLeftOperand() or child = getRightOperand()
}
}
/**
* A range analysis expression consisting of the `<<` or `<<=` operator when at least
* one operand is a constant (and if the right operand is a constant, it must be "valid"
* (see `isValidShiftExprShift`)). When handling any undefined behavior, it leaves the
* values unconstrained. From the C++ standard: "The behavior is undefined if the right
* operand is negative, or greater than or equal to the length in bits of the promoted left operand.
* The value of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are zero-filled. If E1
* has an unsigned type, the value of the result is E1 x 2 E2, reduced modulo one more than the
* maximum value representable in the result type. Otherwise, if E1 has a signed type and
* non-negative value, and E1 x 2 E2 is representable in the corresponding unsigned type of the
* result type, then that value, converted to the result type, is the resulting value; otherwise,
* the behavior is undefined."
*/
class ConstantLShiftExprRange extends SimpleRangeAnalysisExpr {
/**
* Holds for `a << b` or `a <<= b` in one of the following two cases:
* 1. `a` is a constant and `b` is not
* 2. `b` is constant
*
* We don't handle the case where `a` and `b` are both non-constant values.
*/
ConstantLShiftExprRange() {
getUnspecifiedType() instanceof IntegralType and
exists(Expr l, Expr r |
l = this.(LShiftExpr).getLeftOperand() and
r = this.(LShiftExpr).getRightOperand()
or
l = this.(AssignLShiftExpr).getLValue() and
r = this.(AssignLShiftExpr).getRValue()
|
l.getUnspecifiedType() instanceof IntegralType and
r.getUnspecifiedType() instanceof IntegralType and
(
// If the left operand is a constant, verify that the right operand is not a constant
exists(evaluateConstantExpr(l)) and not exists(evaluateConstantExpr(r))
or
// If the right operand is a constant, check if it is a valid shift expression
exists(float constROp |
constROp = evaluateConstantExpr(r) and isValidShiftExprShift(constROp, l)
)
)
)
}
Expr getLeftOperand() {
result = this.(LShiftExpr).getLeftOperand() or
result = this.(AssignLShiftExpr).getLValue()
}
Expr getRightOperand() {
result = this.(LShiftExpr).getRightOperand() or
result = this.(AssignLShiftExpr).getRValue()
}
override float getLowerBounds() {
exists(int lLower, int lUpper, int rLower, int rUpper |
lLower = getFullyConvertedLowerBounds(getLeftOperand()) and
lUpper = getFullyConvertedUpperBounds(getLeftOperand()) and
rLower = getFullyConvertedLowerBounds(getRightOperand()) and
rUpper = getFullyConvertedUpperBounds(getRightOperand()) and
lLower <= lUpper and
rLower <= rUpper
|
if
lLower < 0
or
not (
isValidShiftExprShift(rLower, getLeftOperand()) and
isValidShiftExprShift(rUpper, getLeftOperand())
)
then
// We don't want to deal with shifting negative numbers at the moment,
// and a negative shift is undefined, so we set to the minimum value
result = exprMinVal(this)
else
// If we have `0b01010000 << [0, 2]`, the max value for 8 bits is 0b10100000
// (a shift of 1) but doing a shift by the upper bound would give 0b01000000.
// So if the left shift operation causes an overflow, we just assume the max value
// If necessary, we may be able to improve this bound in the future
if canLShiftOverflow(lUpper, rUpper, exprMaxVal(this))
then result = exprMinVal(this)
else result = lLower.bitShiftLeft(rLower)
)
}
override float getUpperBounds() {
exists(int lLower, int lUpper, int rLower, int rUpper |
lLower = getFullyConvertedLowerBounds(getLeftOperand()) and
lUpper = getFullyConvertedUpperBounds(getLeftOperand()) and
rLower = getFullyConvertedLowerBounds(getRightOperand()) and
rUpper = getFullyConvertedUpperBounds(getRightOperand()) and
lLower <= lUpper and
rLower <= rUpper
|
if
lLower < 0
or
not (
isValidShiftExprShift(rLower, getLeftOperand()) and
isValidShiftExprShift(rUpper, getLeftOperand())
)
then
// We don't want to deal with shifting negative numbers at the moment,
// and a negative shift is undefined, so we set it to the maximum value
result = exprMaxVal(this)
else
// If we have `0b01010000 << [0, 2]`, the max value for 8 bits is 0b10100000
// (a shift of 1) but doing a shift by the upper bound would give 0b01000000.
// So if the left shift operation causes an overflow, we just assume the max value
// If necessary, we may be able to improve this bound in the future
if canLShiftOverflow(lUpper, rUpper, exprMaxVal(this))
then result = exprMaxVal(this)
else result = lUpper.bitShiftLeft(rUpper)
)
}
override predicate dependsOnChild(Expr child) {
child = getLeftOperand() or child = getRightOperand()
}
}

View File

@@ -292,12 +292,8 @@ module SemanticExprConfig {
final Location getLocation() { result = super.getLocation() }
}
private class ValueNumberBound extends Bound {
IRBound::ValueNumberBound bound;
ValueNumberBound() { bound = this }
override string toString() { result = bound.toString() }
private class ValueNumberBound extends Bound instanceof IRBound::ValueNumberBound {
override string toString() { result = IRBound::ValueNumberBound.super.toString() }
}
predicate zeroBound(Bound bound) { bound instanceof IRBound::ZeroBound }

View File

@@ -0,0 +1,29 @@
private import RangeAnalysisStage
module FloatDelta implements DeltaSig {
class Delta = float;
bindingset[d]
bindingset[result]
float toFloat(Delta d) { result = d }
bindingset[d]
bindingset[result]
int toInt(Delta d) { result = d }
bindingset[n]
bindingset[result]
Delta fromInt(int n) { result = n }
bindingset[f]
Delta fromFloat(float f) {
result =
min(float diff, float res |
diff = (res - f) and res = f.ceil()
or
diff = (f - res) and res = f.floor()
|
res order by diff
)
}
}

View File

@@ -14,321 +14,328 @@ private import ModulusAnalysisSpecific::Private
private import experimental.semmle.code.cpp.semantic.Semantic
private import ConstantAnalysis
private import RangeUtils
private import RangeAnalysisStage
/**
* Holds if `e + delta` equals `v` at `pos`.
*/
private predicate valueFlowStepSsa(SemSsaVariable v, SemSsaReadPosition pos, SemExpr e, int delta) {
semSsaUpdateStep(v, e, delta) and pos.hasReadOfVar(v)
or
exists(SemGuard guard, boolean testIsTrue |
pos.hasReadOfVar(v) and
guard = semEqFlowCond(v, e, delta, true, testIsTrue) and
semGuardDirectlyControlsSsaRead(guard, pos, testIsTrue)
)
}
/**
* Holds if `add` is the addition of `larg` and `rarg`, neither of which are
* `ConstantIntegerExpr`s.
*/
private predicate nonConstAddition(SemExpr add, SemExpr larg, SemExpr rarg) {
exists(SemAddExpr a | a = add |
larg = a.getLeftOperand() and
rarg = a.getRightOperand()
) and
not larg instanceof SemConstantIntegerExpr and
not rarg instanceof SemConstantIntegerExpr
}
/**
* Holds if `sub` is the subtraction of `larg` and `rarg`, where `rarg` is not
* a `ConstantIntegerExpr`.
*/
private predicate nonConstSubtraction(SemExpr sub, SemExpr larg, SemExpr rarg) {
exists(SemSubExpr s | s = sub |
larg = s.getLeftOperand() and
rarg = s.getRightOperand()
) and
not rarg instanceof SemConstantIntegerExpr
}
/** Gets an expression that is the remainder modulo `mod` of `arg`. */
private SemExpr modExpr(SemExpr arg, int mod) {
exists(SemRemExpr rem |
result = rem and
arg = rem.getLeftOperand() and
rem.getRightOperand().(SemConstantIntegerExpr).getIntValue() = mod and
mod >= 2
)
or
exists(SemConstantIntegerExpr c |
mod = 2.pow([1 .. 30]) and
c.getIntValue() = mod - 1 and
result.(SemBitAndExpr).hasOperands(arg, c)
)
}
/**
* Gets a guard that tests whether `v` is congruent with `val` modulo `mod` on
* its `testIsTrue` branch.
*/
private SemGuard moduloCheck(SemSsaVariable v, int val, int mod, boolean testIsTrue) {
exists(SemExpr rem, SemConstantIntegerExpr c, int r, boolean polarity |
result.isEquality(rem, c, polarity) and
c.getIntValue() = r and
rem = modExpr(v.getAUse(), mod) and
(
testIsTrue = polarity and val = r
or
testIsTrue = polarity.booleanNot() and
mod = 2 and
val = 1 - r and
(r = 0 or r = 1)
)
)
}
/**
* Holds if a guard ensures that `v` at `pos` is congruent with `val` modulo `mod`.
*/
private predicate moduloGuardedRead(SemSsaVariable v, SemSsaReadPosition pos, int val, int mod) {
exists(SemGuard guard, boolean testIsTrue |
pos.hasReadOfVar(v) and
guard = moduloCheck(v, val, mod, testIsTrue) and
semGuardControlsSsaRead(guard, pos, testIsTrue)
)
}
/** Holds if `factor` is a power of 2 that divides `mask`. */
bindingset[mask]
private predicate andmaskFactor(int mask, int factor) {
mask % factor = 0 and
factor = 2.pow([1 .. 30])
}
/** Holds if `e` is evenly divisible by `factor`. */
private predicate evenlyDivisibleExpr(SemExpr e, int factor) {
exists(SemConstantIntegerExpr c, int k | k = c.getIntValue() |
e.(SemMulExpr).getAnOperand() = c and factor = k.abs() and factor >= 2
or
e.(SemShiftLeftExpr).getRightOperand() = c and factor = 2.pow(k) and k > 0
or
e.(SemBitAndExpr).getAnOperand() = c and factor = max(int f | andmaskFactor(k, f))
)
}
/**
* Holds if `rix` is the number of input edges to `phi`.
*/
private predicate maxPhiInputRank(SemSsaPhiNode phi, int rix) {
rix = max(int r | rankedPhiInput(phi, _, _, r))
}
/**
* Gets the remainder of `val` modulo `mod`.
*
* For `mod = 0` the result equals `val` and for `mod > 1` the result is within
* the range `[0 .. mod-1]`.
*/
bindingset[val, mod]
private int remainder(int val, int mod) {
mod = 0 and result = val
or
mod > 1 and result = ((val % mod) + mod) % mod
}
/**
* Holds if `inp` is an input to `phi` and equals `phi` modulo `mod` along `edge`.
*/
private predicate phiSelfModulus(
SemSsaPhiNode phi, SemSsaVariable inp, SemSsaReadPositionPhiInputEdge edge, int mod
) {
exists(SemSsaBound phibound, int v, int m |
edge.phiInput(phi, inp) and
phibound.getAVariable() = phi and
ssaModulus(inp, edge, phibound, v, m) and
mod = m.gcd(v) and
mod != 1
)
}
/**
* Holds if `b + val` modulo `mod` is a candidate congruence class for `phi`.
*/
private predicate phiModulusInit(SemSsaPhiNode phi, SemBound b, int val, int mod) {
exists(SemSsaVariable inp, SemSsaReadPositionPhiInputEdge edge |
edge.phiInput(phi, inp) and
ssaModulus(inp, edge, b, val, mod)
)
}
/**
* Holds if all inputs to `phi` numbered `1` to `rix` are equal to `b + val` modulo `mod`.
*/
pragma[nomagic]
private predicate phiModulusRankStep(SemSsaPhiNode phi, SemBound b, int val, int mod, int rix) {
/*
* base case. If any phi input is equal to `b + val` modulo `mod`, that's a potential congruence
* class for the phi node.
module ModulusAnalysis<DeltaSig D, BoundSig<D> Bounds, UtilSig<D> U> {
/**
* Holds if `e + delta` equals `v` at `pos`.
*/
private predicate valueFlowStepSsa(SemSsaVariable v, SemSsaReadPosition pos, SemExpr e, int delta) {
U::semSsaUpdateStep(v, e, D::fromInt(delta)) and pos.hasReadOfVar(v)
or
exists(SemGuard guard, boolean testIsTrue |
pos.hasReadOfVar(v) and
guard = U::semEqFlowCond(v, e, D::fromInt(delta), true, testIsTrue) and
semGuardDirectlyControlsSsaRead(guard, pos, testIsTrue)
)
}
rix = 0 and
phiModulusInit(phi, b, val, mod)
or
exists(SemSsaVariable inp, SemSsaReadPositionPhiInputEdge edge, int v1, int m1 |
mod != 1 and
val = remainder(v1, mod)
|
/**
* Holds if `add` is the addition of `larg` and `rarg`, neither of which are
* `ConstantIntegerExpr`s.
*/
private predicate nonConstAddition(SemExpr add, SemExpr larg, SemExpr rarg) {
exists(SemAddExpr a | a = add |
larg = a.getLeftOperand() and
rarg = a.getRightOperand()
) and
not larg instanceof SemConstantIntegerExpr and
not rarg instanceof SemConstantIntegerExpr
}
/**
* Holds if `sub` is the subtraction of `larg` and `rarg`, where `rarg` is not
* a `ConstantIntegerExpr`.
*/
private predicate nonConstSubtraction(SemExpr sub, SemExpr larg, SemExpr rarg) {
exists(SemSubExpr s | s = sub |
larg = s.getLeftOperand() and
rarg = s.getRightOperand()
) and
not rarg instanceof SemConstantIntegerExpr
}
/** Gets an expression that is the remainder modulo `mod` of `arg`. */
private SemExpr modExpr(SemExpr arg, int mod) {
exists(SemRemExpr rem |
result = rem and
arg = rem.getLeftOperand() and
rem.getRightOperand().(SemConstantIntegerExpr).getIntValue() = mod and
mod >= 2
)
or
exists(SemConstantIntegerExpr c |
mod = 2.pow([1 .. 30]) and
c.getIntValue() = mod - 1 and
result.(SemBitAndExpr).hasOperands(arg, c)
)
}
/**
* Gets a guard that tests whether `v` is congruent with `val` modulo `mod` on
* its `testIsTrue` branch.
*/
private SemGuard moduloCheck(SemSsaVariable v, int val, int mod, boolean testIsTrue) {
exists(SemExpr rem, SemConstantIntegerExpr c, int r, boolean polarity |
result.isEquality(rem, c, polarity) and
c.getIntValue() = r and
rem = modExpr(v.getAUse(), mod) and
(
testIsTrue = polarity and val = r
or
testIsTrue = polarity.booleanNot() and
mod = 2 and
val = 1 - r and
(r = 0 or r = 1)
)
)
}
/**
* Holds if a guard ensures that `v` at `pos` is congruent with `val` modulo `mod`.
*/
private predicate moduloGuardedRead(SemSsaVariable v, SemSsaReadPosition pos, int val, int mod) {
exists(SemGuard guard, boolean testIsTrue |
pos.hasReadOfVar(v) and
guard = moduloCheck(v, val, mod, testIsTrue) and
semGuardControlsSsaRead(guard, pos, testIsTrue)
)
}
/** Holds if `factor` is a power of 2 that divides `mask`. */
bindingset[mask]
private predicate andmaskFactor(int mask, int factor) {
mask % factor = 0 and
factor = 2.pow([1 .. 30])
}
/** Holds if `e` is evenly divisible by `factor`. */
private predicate evenlyDivisibleExpr(SemExpr e, int factor) {
exists(SemConstantIntegerExpr c, int k | k = c.getIntValue() |
e.(SemMulExpr).getAnOperand() = c and factor = k.abs() and factor >= 2
or
e.(SemShiftLeftExpr).getRightOperand() = c and factor = 2.pow(k) and k > 0
or
e.(SemBitAndExpr).getAnOperand() = c and factor = max(int f | andmaskFactor(k, f))
)
}
/**
* Holds if `rix` is the number of input edges to `phi`.
*/
private predicate maxPhiInputRank(SemSsaPhiNode phi, int rix) {
rix = max(int r | rankedPhiInput(phi, _, _, r))
}
/**
* Gets the remainder of `val` modulo `mod`.
*
* For `mod = 0` the result equals `val` and for `mod > 1` the result is within
* the range `[0 .. mod-1]`.
*/
bindingset[val, mod]
private int remainder(int val, int mod) {
mod = 0 and result = val
or
mod > 1 and result = ((val % mod) + mod) % mod
}
/**
* Holds if `inp` is an input to `phi` and equals `phi` modulo `mod` along `edge`.
*/
private predicate phiSelfModulus(
SemSsaPhiNode phi, SemSsaVariable inp, SemSsaReadPositionPhiInputEdge edge, int mod
) {
exists(Bounds::SemSsaBound phibound, int v, int m |
edge.phiInput(phi, inp) and
phibound.getAVariable() = phi and
ssaModulus(inp, edge, phibound, v, m) and
mod = m.gcd(v) and
mod != 1
)
}
/**
* Holds if `b + val` modulo `mod` is a candidate congruence class for `phi`.
*/
private predicate phiModulusInit(SemSsaPhiNode phi, Bounds::SemBound b, int val, int mod) {
exists(SemSsaVariable inp, SemSsaReadPositionPhiInputEdge edge |
edge.phiInput(phi, inp) and
ssaModulus(inp, edge, b, val, mod)
)
}
/**
* Holds if all inputs to `phi` numbered `1` to `rix` are equal to `b + val` modulo `mod`.
*/
pragma[nomagic]
private predicate phiModulusRankStep(
SemSsaPhiNode phi, Bounds::SemBound b, int val, int mod, int rix
) {
/*
* Recursive case. If `inp` = `b + v2` mod `m2`, we combine that with the preceding potential
* congruence class `b + v1` mod `m1`. The result will be the congruence class of `v1` modulo
* the greatest common denominator of `m1`, `m2`, and `v1 - v2`.
* base case. If any phi input is equal to `b + val` modulo `mod`, that's a potential congruence
* class for the phi node.
*/
exists(int v2, int m2 |
rankedPhiInput(pragma[only_bind_out](phi), inp, edge, rix) and
phiModulusRankStep(phi, b, v1, m1, rix - 1) and
ssaModulus(inp, edge, b, v2, m2) and
mod = m1.gcd(m2).gcd(v1 - v2)
rix = 0 and
phiModulusInit(phi, b, val, mod)
or
exists(SemSsaVariable inp, SemSsaReadPositionPhiInputEdge edge, int v1, int m1 |
mod != 1 and
val = remainder(v1, mod)
|
/*
* Recursive case. If `inp` = `b + v2` mod `m2`, we combine that with the preceding potential
* congruence class `b + v1` mod `m1`. The result will be the congruence class of `v1` modulo
* the greatest common denominator of `m1`, `m2`, and `v1 - v2`.
*/
exists(int v2, int m2 |
rankedPhiInput(pragma[only_bind_out](phi), inp, edge, rix) and
phiModulusRankStep(phi, b, v1, m1, rix - 1) and
ssaModulus(inp, edge, b, v2, m2) and
mod = m1.gcd(m2).gcd(v1 - v2)
)
or
/*
* Recursive case. If `inp` = `phi` mod `m2`, we combine that with the preceding potential
* congruence class `b + v1` mod `m1`. The result will be a congruence class modulo the greatest
* common denominator of `m1` and `m2`.
*/
exists(int m2 |
rankedPhiInput(phi, inp, edge, rix) and
phiModulusRankStep(phi, b, v1, m1, rix - 1) and
phiSelfModulus(phi, inp, edge, m2) and
mod = m1.gcd(m2)
)
)
or
/*
* Recursive case. If `inp` = `phi` mod `m2`, we combine that with the preceding potential
* congruence class `b + v1` mod `m1`. The result will be a congruence class modulo the greatest
* common denominator of `m1` and `m2`.
*/
}
exists(int m2 |
rankedPhiInput(phi, inp, edge, rix) and
phiModulusRankStep(phi, b, v1, m1, rix - 1) and
phiSelfModulus(phi, inp, edge, m2) and
mod = m1.gcd(m2)
/**
* Holds if `phi` is equal to `b + val` modulo `mod`.
*/
private predicate phiModulus(SemSsaPhiNode phi, Bounds::SemBound b, int val, int mod) {
exists(int r |
maxPhiInputRank(phi, r) and
phiModulusRankStep(phi, b, val, mod, r)
)
)
}
}
/**
* Holds if `phi` is equal to `b + val` modulo `mod`.
*/
private predicate phiModulus(SemSsaPhiNode phi, SemBound b, int val, int mod) {
exists(int r |
maxPhiInputRank(phi, r) and
phiModulusRankStep(phi, b, val, mod, r)
)
}
/**
* Holds if `v` at `pos` is equal to `b + val` modulo `mod`.
*/
private predicate ssaModulus(SemSsaVariable v, SemSsaReadPosition pos, SemBound b, int val, int mod) {
phiModulus(v, b, val, mod) and pos.hasReadOfVar(v)
or
b.(SemSsaBound).getAVariable() = v and pos.hasReadOfVar(v) and val = 0 and mod = 0
or
exists(SemExpr e, int val0, int delta |
semExprModulus(e, b, val0, mod) and
valueFlowStepSsa(v, pos, e, delta) and
val = remainder(val0 + delta, mod)
)
or
moduloGuardedRead(v, pos, val, mod) and b instanceof SemZeroBound
}
/**
* Holds if `e` is equal to `b + val` modulo `mod`.
*
* There are two cases for the modulus:
* - `mod = 0`: The equality `e = b + val` is an ordinary equality.
* - `mod > 1`: `val` lies within the range `[0 .. mod-1]`.
*/
cached
predicate semExprModulus(SemExpr e, SemBound b, int val, int mod) {
not ignoreExprModulus(e) and
(
e = b.getExpr(val) and mod = 0
/**
* Holds if `v` at `pos` is equal to `b + val` modulo `mod`.
*/
private predicate ssaModulus(
SemSsaVariable v, SemSsaReadPosition pos, Bounds::SemBound b, int val, int mod
) {
phiModulus(v, b, val, mod) and pos.hasReadOfVar(v)
or
evenlyDivisibleExpr(e, mod) and
val = 0 and
b instanceof SemZeroBound
b.(Bounds::SemSsaBound).getAVariable() = v and pos.hasReadOfVar(v) and val = 0 and mod = 0
or
exists(SemSsaVariable v, SemSsaReadPositionBlock bb |
ssaModulus(v, bb, b, val, mod) and
e = v.getAUse() and
bb.getAnExpr() = e
)
or
exists(SemExpr mid, int val0, int delta |
semExprModulus(mid, b, val0, mod) and
semValueFlowStep(e, mid, delta) and
exists(SemExpr e, int val0, int delta |
semExprModulus(e, b, val0, mod) and
valueFlowStepSsa(v, pos, e, delta) and
val = remainder(val0 + delta, mod)
)
or
exists(SemConditionalExpr cond, int v1, int v2, int m1, int m2 |
cond = e and
condExprBranchModulus(cond, true, b, v1, m1) and
condExprBranchModulus(cond, false, b, v2, m2) and
mod = m1.gcd(m2).gcd(v1 - v2) and
mod != 1 and
val = remainder(v1, mod)
)
or
exists(SemBound b1, SemBound b2, int v1, int v2, int m1, int m2 |
addModulus(e, true, b1, v1, m1) and
addModulus(e, false, b2, v2, m2) and
mod = m1.gcd(m2) and
mod != 1 and
val = remainder(v1 + v2, mod)
|
b = b1 and b2 instanceof SemZeroBound
moduloGuardedRead(v, pos, val, mod) and b instanceof Bounds::SemZeroBound
}
/**
* Holds if `e` is equal to `b + val` modulo `mod`.
*
* There are two cases for the modulus:
* - `mod = 0`: The equality `e = b + val` is an ordinary equality.
* - `mod > 1`: `val` lies within the range `[0 .. mod-1]`.
*/
cached
predicate semExprModulus(SemExpr e, Bounds::SemBound b, int val, int mod) {
not ignoreExprModulus(e) and
(
e = b.getExpr(D::fromInt(val)) and mod = 0
or
b = b2 and b1 instanceof SemZeroBound
evenlyDivisibleExpr(e, mod) and
val = 0 and
b instanceof Bounds::SemZeroBound
or
exists(SemSsaVariable v, SemSsaReadPositionBlock bb |
ssaModulus(v, bb, b, val, mod) and
e = v.getAUse() and
bb.getAnExpr() = e
)
or
exists(SemExpr mid, int val0, int delta |
semExprModulus(mid, b, val0, mod) and
U::semValueFlowStep(e, mid, D::fromInt(delta)) and
val = remainder(val0 + delta, mod)
)
or
exists(SemConditionalExpr cond, int v1, int v2, int m1, int m2 |
cond = e and
condExprBranchModulus(cond, true, b, v1, m1) and
condExprBranchModulus(cond, false, b, v2, m2) and
mod = m1.gcd(m2).gcd(v1 - v2) and
mod != 1 and
val = remainder(v1, mod)
)
or
exists(Bounds::SemBound b1, Bounds::SemBound b2, int v1, int v2, int m1, int m2 |
addModulus(e, true, b1, v1, m1) and
addModulus(e, false, b2, v2, m2) and
mod = m1.gcd(m2) and
mod != 1 and
val = remainder(v1 + v2, mod)
|
b = b1 and b2 instanceof Bounds::SemZeroBound
or
b = b2 and b1 instanceof Bounds::SemZeroBound
)
or
exists(int v1, int v2, int m1, int m2 |
subModulus(e, true, b, v1, m1) and
subModulus(e, false, any(Bounds::SemZeroBound zb), v2, m2) and
mod = m1.gcd(m2) and
mod != 1 and
val = remainder(v1 - v2, mod)
)
)
or
exists(int v1, int v2, int m1, int m2 |
subModulus(e, true, b, v1, m1) and
subModulus(e, false, any(SemZeroBound zb), v2, m2) and
mod = m1.gcd(m2) and
mod != 1 and
val = remainder(v1 - v2, mod)
}
private predicate condExprBranchModulus(
SemConditionalExpr cond, boolean branch, Bounds::SemBound b, int val, int mod
) {
semExprModulus(cond.getBranchExpr(branch), b, val, mod)
}
private predicate addModulus(SemExpr add, boolean isLeft, Bounds::SemBound b, int val, int mod) {
exists(SemExpr larg, SemExpr rarg | nonConstAddition(add, larg, rarg) |
semExprModulus(larg, b, val, mod) and isLeft = true
or
semExprModulus(rarg, b, val, mod) and isLeft = false
)
)
}
}
private predicate condExprBranchModulus(
SemConditionalExpr cond, boolean branch, SemBound b, int val, int mod
) {
semExprModulus(cond.getBranchExpr(branch), b, val, mod)
}
private predicate addModulus(SemExpr add, boolean isLeft, SemBound b, int val, int mod) {
exists(SemExpr larg, SemExpr rarg | nonConstAddition(add, larg, rarg) |
semExprModulus(larg, b, val, mod) and isLeft = true
or
semExprModulus(rarg, b, val, mod) and isLeft = false
)
}
private predicate subModulus(SemExpr sub, boolean isLeft, SemBound b, int val, int mod) {
exists(SemExpr larg, SemExpr rarg | nonConstSubtraction(sub, larg, rarg) |
semExprModulus(larg, b, val, mod) and isLeft = true
or
semExprModulus(rarg, b, val, mod) and isLeft = false
)
}
/**
* Holds if `inp` is an input to `phi` along `edge` and this input has index `r`
* in an arbitrary 1-based numbering of the input edges to `phi`.
*/
private predicate rankedPhiInput(
SemSsaPhiNode phi, SemSsaVariable inp, SemSsaReadPositionPhiInputEdge edge, int r
) {
edge.phiInput(phi, inp) and
edge =
rank[r](SemSsaReadPositionPhiInputEdge e |
e.phiInput(phi, _)
|
e order by e.getOrigBlock().getUniqueId()
private predicate subModulus(SemExpr sub, boolean isLeft, Bounds::SemBound b, int val, int mod) {
exists(SemExpr larg, SemExpr rarg | nonConstSubtraction(sub, larg, rarg) |
semExprModulus(larg, b, val, mod) and isLeft = true
or
semExprModulus(rarg, b, val, mod) and isLeft = false
)
}
/**
* Holds if `inp` is an input to `phi` along `edge` and this input has index `r`
* in an arbitrary 1-based numbering of the input edges to `phi`.
*/
private predicate rankedPhiInput(
SemSsaPhiNode phi, SemSsaVariable inp, SemSsaReadPositionPhiInputEdge edge, int r
) {
edge.phiInput(phi, inp) and
edge =
rank[r](SemSsaReadPositionPhiInputEdge e |
e.phiInput(phi, _)
|
e order by e.getOrigBlock().getUniqueId()
)
}
}

View File

@@ -1,832 +1,24 @@
/**
* Provides classes and predicates for range analysis.
*
* An inferred bound can either be a specific integer, the abstract value of an
* SSA variable, or the abstract value of an interesting expression. The latter
* category includes array lengths that are not SSA variables.
*
* If an inferred bound relies directly on a condition, then this condition is
* reported as the reason for the bound.
*/
/*
* This library tackles range analysis as a flow problem. Consider e.g.:
* ```
* len = arr.length;
* if (x < len) { ... y = x-1; ... y ... }
* ```
* In this case we would like to infer `y <= arr.length - 2`, and this is
* accomplished by tracking the bound through a sequence of steps:
* ```
* arr.length --> len = .. --> x < len --> x-1 --> y = .. --> y
* ```
*
* In its simplest form the step relation `E1 --> E2` relates two expressions
* such that `E1 <= B` implies `E2 <= B` for any `B` (with a second separate
* step relation handling lower bounds). Examples of such steps include
* assignments `E2 = E1` and conditions `x <= E1` where `E2` is a use of `x`
* guarded by the condition.
*
* In order to handle subtractions and additions with constants, and strict
* comparisons, the step relation is augmented with an integer delta. With this
* generalization `E1 --(delta)--> E2` relates two expressions and an integer
* such that `E1 <= B` implies `E2 <= B + delta` for any `B`. This corresponds
* to the predicate `boundFlowStep`.
*
* The complete range analysis is then implemented as the transitive closure of
* the step relation summing the deltas along the way. If `E1` transitively
* steps to `E2`, `delta` is the sum of deltas along the path, and `B` is an
* interesting bound equal to the value of `E1` then `E2 <= B + delta`. This
* corresponds to the predicate `bounded`.
*
* Phi nodes need a little bit of extra handling. Consider `x0 = phi(x1, x2)`.
* There are essentially two cases:
* - If `x1 <= B + d1` and `x2 <= B + d2` then `x0 <= B + max(d1,d2)`.
* - If `x1 <= B + d1` and `x2 <= x0 + d2` with `d2 <= 0` then `x0 <= B + d1`.
* The first case is for whenever a bound can be proven without taking looping
* into account. The second case is relevant when `x2` comes from a back-edge
* where we can prove that the variable has been non-increasing through the
* loop-iteration as this means that any upper bound that holds prior to the
* loop also holds for the variable during the loop.
* This generalizes to a phi node with `n` inputs, so if
* `x0 = phi(x1, ..., xn)` and `xi <= B + delta` for one of the inputs, then we
* also have `x0 <= B + delta` if we can prove either:
* - `xj <= B + d` with `d <= delta` or
* - `xj <= x0 + d` with `d <= 0`
* for each input `xj`.
*
* As all inferred bounds can be related directly to a path in the source code
* the only source of non-termination is if successive redundant (and thereby
* increasingly worse) bounds are calculated along a loop in the source code.
* We prevent this by weakening the bound to a small finite set of bounds when
* a path follows a second back-edge (we postpone weakening till the second
* back-edge as a precise bound might require traversing a loop once).
*/
private import RangeAnalysisSpecific as Specific
private import RangeAnalysisStage
private import RangeAnalysisSpecific
private import experimental.semmle.code.cpp.semantic.analysis.FloatDelta
private import RangeUtils
private import SignAnalysisCommon
private import ModulusAnalysis
private import experimental.semmle.code.cpp.semantic.Semantic
private import ConstantAnalysis
private import experimental.semmle.code.cpp.semantic.SemanticBound as SemanticBound
cached
private module RangeAnalysisCache {
cached
module RangeAnalysisPublic {
/**
* Holds if `b + delta` is a valid bound for `e`.
* - `upper = true` : `e <= b + delta`
* - `upper = false` : `e >= b + delta`
*
* The reason for the bound is given by `reason` and may be either a condition
* or `NoReason` if the bound was proven directly without the use of a bounding
* condition.
*/
cached
predicate semBounded(SemExpr e, SemBound b, int delta, boolean upper, SemReason reason) {
bounded(e, b, delta, upper, _, _, reason) and
bestBound(e, b, delta, upper)
}
module Bounds implements BoundSig<FloatDelta> {
class SemBound instanceof SemanticBound::SemBound {
string toString() { result = super.toString() }
SemExpr getExpr(float delta) { result = super.getExpr(delta) }
}
/**
* Holds if `guard = boundFlowCond(_, _, _, _, _) or guard = eqFlowCond(_, _, _, _, _)`.
*/
cached
predicate possibleReason(SemGuard guard) {
guard = boundFlowCond(_, _, _, _, _) or guard = semEqFlowCond(_, _, _, _, _)
class SemZeroBound extends SemBound instanceof SemanticBound::SemZeroBound { }
class SemSsaBound extends SemBound instanceof SemanticBound::SemSsaBound {
SemSsaVariable getAVariable() { result = this.(SemanticBound::SemSsaBound).getAVariable() }
}
}
private import RangeAnalysisCache
import RangeAnalysisPublic
private module CppRangeAnalysis =
RangeStage<FloatDelta, Bounds, CppLangImpl, RangeUtil<FloatDelta, CppLangImpl>>;
/**
* Holds if `b + delta` is a valid bound for `e` and this is the best such delta.
* - `upper = true` : `e <= b + delta`
* - `upper = false` : `e >= b + delta`
*/
private predicate bestBound(SemExpr e, SemBound b, int delta, boolean upper) {
delta = min(int d | bounded(e, b, d, upper, _, _, _)) and upper = true
or
delta = max(int d | bounded(e, b, d, upper, _, _, _)) and upper = false
}
/**
* Holds if `comp` corresponds to:
* - `upper = true` : `v <= e + delta` or `v < e + delta`
* - `upper = false` : `v >= e + delta` or `v > e + delta`
*/
private predicate boundCondition(
SemRelationalExpr comp, SemSsaVariable v, SemExpr e, int delta, boolean upper
) {
comp.getLesserOperand() = semSsaRead(v, delta) and e = comp.getGreaterOperand() and upper = true
or
comp.getGreaterOperand() = semSsaRead(v, delta) and e = comp.getLesserOperand() and upper = false
or
exists(SemSubExpr sub, SemConstantIntegerExpr c, int d |
// (v - d) - e < c
comp.getLesserOperand() = sub and
comp.getGreaterOperand() = c and
sub.getLeftOperand() = semSsaRead(v, d) and
sub.getRightOperand() = e and
upper = true and
delta = d + c.getIntValue()
or
// (v - d) - e > c
comp.getGreaterOperand() = sub and
comp.getLesserOperand() = c and
sub.getLeftOperand() = semSsaRead(v, d) and
sub.getRightOperand() = e and
upper = false and
delta = d + c.getIntValue()
or
// e - (v - d) < c
comp.getLesserOperand() = sub and
comp.getGreaterOperand() = c and
sub.getLeftOperand() = e and
sub.getRightOperand() = semSsaRead(v, d) and
upper = false and
delta = d - c.getIntValue()
or
// e - (v - d) > c
comp.getGreaterOperand() = sub and
comp.getLesserOperand() = c and
sub.getLeftOperand() = e and
sub.getRightOperand() = semSsaRead(v, d) and
upper = true and
delta = d - c.getIntValue()
)
}
/**
* Holds if `comp` is a comparison between `x` and `y` for which `y - x` has a
* fixed value modulo some `mod > 1`, such that the comparison can be
* strengthened by `strengthen` when evaluating to `testIsTrue`.
*/
private predicate modulusComparison(SemRelationalExpr comp, boolean testIsTrue, int strengthen) {
exists(
SemBound b, int v1, int v2, int mod1, int mod2, int mod, boolean resultIsStrict, int d, int k
|
// If `x <= y` and `x =(mod) b + v1` and `y =(mod) b + v2` then
// `0 <= y - x =(mod) v2 - v1`. By choosing `k =(mod) v2 - v1` with
// `0 <= k < mod` we get `k <= y - x`. If the resulting comparison is
// strict then the strengthening amount is instead `k - 1` modulo `mod`:
// `x < y` means `0 <= y - x - 1 =(mod) k - 1` so `k - 1 <= y - x - 1` and
// thus `k - 1 < y - x` with `0 <= k - 1 < mod`.
semExprModulus(comp.getLesserOperand(), b, v1, mod1) and
semExprModulus(comp.getGreaterOperand(), b, v2, mod2) and
mod = mod1.gcd(mod2) and
mod != 1 and
(testIsTrue = true or testIsTrue = false) and
(
if comp.isStrict()
then resultIsStrict = testIsTrue
else resultIsStrict = testIsTrue.booleanNot()
) and
(
resultIsStrict = true and d = 1
or
resultIsStrict = false and d = 0
) and
(
testIsTrue = true and k = v2 - v1
or
testIsTrue = false and k = v1 - v2
) and
strengthen = (((k - d) % mod) + mod) % mod
)
}
/**
* Gets a condition that tests whether `v` is bounded by `e + delta`.
*
* If the condition evaluates to `testIsTrue`:
* - `upper = true` : `v <= e + delta`
* - `upper = false` : `v >= e + delta`
*/
private SemGuard boundFlowCond(
SemSsaVariable v, SemExpr e, int delta, boolean upper, boolean testIsTrue
) {
exists(
SemRelationalExpr comp, int d1, int d2, int d3, int strengthen, boolean compIsUpper,
boolean resultIsStrict
|
comp = result.asExpr() and
boundCondition(comp, v, e, d1, compIsUpper) and
(testIsTrue = true or testIsTrue = false) and
upper = compIsUpper.booleanXor(testIsTrue.booleanNot()) and
(
if comp.isStrict()
then resultIsStrict = testIsTrue
else resultIsStrict = testIsTrue.booleanNot()
) and
(
if
getTrackedTypeForSsaVariable(v) instanceof SemIntegerType or
getTrackedTypeForSsaVariable(v) instanceof SemAddressType
then
upper = true and strengthen = -1
or
upper = false and strengthen = 1
else strengthen = 0
) and
(
exists(int k | modulusComparison(comp, testIsTrue, k) and d2 = strengthen * k)
or
not modulusComparison(comp, testIsTrue, _) and d2 = 0
) and
// A strict inequality `x < y` can be strengthened to `x <= y - 1`.
(
resultIsStrict = true and d3 = strengthen
or
resultIsStrict = false and d3 = 0
) and
delta = d1 + d2 + d3
)
or
exists(boolean testIsTrue0 |
semImplies_v2(result, testIsTrue, boundFlowCond(v, e, delta, upper, testIsTrue0), testIsTrue0)
)
or
result = semEqFlowCond(v, e, delta, true, testIsTrue) and
(upper = true or upper = false)
or
// guard that tests whether `v2` is bounded by `e + delta + d1 - d2` and
// exists a guard `guardEq` such that `v = v2 - d1 + d2`.
exists(SemSsaVariable v2, SemGuard guardEq, boolean eqIsTrue, int d1, int d2 |
guardEq = semEqFlowCond(v, semSsaRead(v2, d1), d2, true, eqIsTrue) and
result = boundFlowCond(v2, e, delta + d1 - d2, upper, testIsTrue) and
// guardEq needs to control guard
guardEq.directlyControls(result.getBasicBlock(), eqIsTrue)
)
}
private newtype TSemReason =
TSemNoReason() or
TSemCondReason(SemGuard guard) { possibleReason(guard) }
/**
* A reason for an inferred bound. This can either be `CondReason` if the bound
* is due to a specific condition, or `NoReason` if the bound is inferred
* without going through a bounding condition.
*/
abstract class SemReason extends TSemReason {
/** Gets a textual representation of this reason. */
abstract string toString();
}
/**
* A reason for an inferred bound that indicates that the bound is inferred
* without going through a bounding condition.
*/
class SemNoReason extends SemReason, TSemNoReason {
override string toString() { result = "NoReason" }
}
/** A reason for an inferred bound pointing to a condition. */
class SemCondReason extends SemReason, TSemCondReason {
/** Gets the condition that is the reason for the bound. */
SemGuard getCond() { this = TSemCondReason(result) }
override string toString() { result = getCond().toString() }
}
/**
* Holds if `e + delta` is a valid bound for `v` at `pos`.
* - `upper = true` : `v <= e + delta`
* - `upper = false` : `v >= e + delta`
*/
private predicate boundFlowStepSsa(
SemSsaVariable v, SemSsaReadPosition pos, SemExpr e, int delta, boolean upper, SemReason reason
) {
semSsaUpdateStep(v, e, delta) and
pos.hasReadOfVar(v) and
(upper = true or upper = false) and
reason = TSemNoReason()
or
exists(SemGuard guard, boolean testIsTrue |
pos.hasReadOfVar(v) and
guard = boundFlowCond(v, e, delta, upper, testIsTrue) and
semGuardDirectlyControlsSsaRead(guard, pos, testIsTrue) and
reason = TSemCondReason(guard)
)
}
/** Holds if `v != e + delta` at `pos` and `v` is of integral type. */
private predicate unequalFlowStepIntegralSsa(
SemSsaVariable v, SemSsaReadPosition pos, SemExpr e, int delta, SemReason reason
) {
getTrackedTypeForSsaVariable(v) instanceof SemIntegerType and
exists(SemGuard guard, boolean testIsTrue |
pos.hasReadOfVar(v) and
guard = semEqFlowCond(v, e, delta, false, testIsTrue) and
semGuardDirectlyControlsSsaRead(guard, pos, testIsTrue) and
reason = TSemCondReason(guard)
)
}
/**
* An expression that does conversion, boxing, or unboxing
*/
private class ConvertOrBoxExpr extends SemUnaryExpr {
ConvertOrBoxExpr() {
this instanceof SemConvertExpr
or
this instanceof SemBoxExpr
or
this instanceof SemUnboxExpr
}
}
/**
* A cast that can be ignored for the purpose of range analysis.
*/
private class SafeCastExpr extends ConvertOrBoxExpr {
SafeCastExpr() {
conversionCannotOverflow(getTrackedType(pragma[only_bind_into](getOperand())),
getTrackedType(this))
}
}
/**
* Holds if `typ` is a small integral type with the given lower and upper bounds.
*/
private predicate typeBound(SemIntegerType typ, int lowerbound, int upperbound) {
exists(int bitSize | bitSize = typ.getByteSize() * 8 |
bitSize < 32 and
(
if typ.isSigned()
then (
upperbound = 1.bitShiftLeft(bitSize - 1) - 1 and
lowerbound = -upperbound - 1
) else (
lowerbound = 0 and
upperbound = 1.bitShiftLeft(bitSize) - 1
)
)
)
}
/**
* A cast to a small integral type that may overflow or underflow.
*/
private class NarrowingCastExpr extends ConvertOrBoxExpr {
NarrowingCastExpr() {
not this instanceof SafeCastExpr and
typeBound(getTrackedType(this), _, _)
}
/** Gets the lower bound of the resulting type. */
int getLowerBound() { typeBound(getTrackedType(this), result, _) }
/** Gets the upper bound of the resulting type. */
int getUpperBound() { typeBound(getTrackedType(this), _, result) }
}
/** Holds if `e >= 1` as determined by sign analysis. */
private predicate strictlyPositiveIntegralExpr(SemExpr e) {
semStrictlyPositive(e) and getTrackedType(e) instanceof SemIntegerType
}
/** Holds if `e <= -1` as determined by sign analysis. */
private predicate strictlyNegativeIntegralExpr(SemExpr e) {
semStrictlyNegative(e) and getTrackedType(e) instanceof SemIntegerType
}
/**
* Holds if `e1 + delta` is a valid bound for `e2`.
* - `upper = true` : `e2 <= e1 + delta`
* - `upper = false` : `e2 >= e1 + delta`
*/
private predicate boundFlowStep(SemExpr e2, SemExpr e1, int delta, boolean upper) {
semValueFlowStep(e2, e1, delta) and
(upper = true or upper = false)
or
e2.(SafeCastExpr).getOperand() = e1 and
delta = 0 and
(upper = true or upper = false)
or
exists(SemExpr x | e2.(SemAddExpr).hasOperands(e1, x) |
// `x instanceof ConstantIntegerExpr` is covered by valueFlowStep
not x instanceof SemConstantIntegerExpr and
not e1 instanceof SemConstantIntegerExpr and
if strictlyPositiveIntegralExpr(x)
then upper = false and delta = 1
else
if semPositive(x)
then upper = false and delta = 0
else
if strictlyNegativeIntegralExpr(x)
then upper = true and delta = -1
else
if semNegative(x)
then upper = true and delta = 0
else none()
)
or
exists(SemExpr x, SemSubExpr sub |
e2 = sub and
sub.getLeftOperand() = e1 and
sub.getRightOperand() = x
|
// `x instanceof ConstantIntegerExpr` is covered by valueFlowStep
not x instanceof SemConstantIntegerExpr and
if strictlyPositiveIntegralExpr(x)
then upper = true and delta = -1
else
if semPositive(x)
then upper = true and delta = 0
else
if strictlyNegativeIntegralExpr(x)
then upper = false and delta = 1
else
if semNegative(x)
then upper = false and delta = 0
else none()
)
or
e2.(SemRemExpr).getRightOperand() = e1 and
semPositive(e1) and
delta = -1 and
upper = true
or
e2.(SemRemExpr).getLeftOperand() = e1 and semPositive(e1) and delta = 0 and upper = true
or
e2.(SemBitAndExpr).getAnOperand() = e1 and
semPositive(e1) and
delta = 0 and
upper = true
or
e2.(SemBitOrExpr).getAnOperand() = e1 and
semPositive(e2) and
delta = 0 and
upper = false
or
Specific::hasBound(e2, e1, delta, upper)
}
/** Holds if `e2 = e1 * factor` and `factor > 0`. */
private predicate boundFlowStepMul(SemExpr e2, SemExpr e1, int factor) {
exists(SemConstantIntegerExpr c, int k | k = c.getIntValue() and k > 0 |
e2.(SemMulExpr).hasOperands(e1, c) and factor = k
or
exists(SemShiftLeftExpr e |
e = e2 and e.getLeftOperand() = e1 and e.getRightOperand() = c and factor = 2.pow(k)
)
)
}
/**
* Holds if `e2 = e1 / factor` and `factor > 0`.
*
* This conflates division, right shift, and unsigned right shift and is
* therefore only valid for non-negative numbers.
*/
private predicate boundFlowStepDiv(SemExpr e2, SemExpr e1, int factor) {
exists(SemConstantIntegerExpr c, int k | k = c.getIntValue() and k > 0 |
exists(SemDivExpr e |
e = e2 and e.getLeftOperand() = e1 and e.getRightOperand() = c and factor = k
)
or
exists(SemShiftRightExpr e |
e = e2 and e.getLeftOperand() = e1 and e.getRightOperand() = c and factor = 2.pow(k)
)
or
exists(SemShiftRightUnsignedExpr e |
e = e2 and e.getLeftOperand() = e1 and e.getRightOperand() = c and factor = 2.pow(k)
)
)
}
/**
* Holds if `b + delta` is a valid bound for `v` at `pos`.
* - `upper = true` : `v <= b + delta`
* - `upper = false` : `v >= b + delta`
*/
private predicate boundedSsa(
SemSsaVariable v, SemSsaReadPosition pos, SemBound b, int delta, boolean upper,
boolean fromBackEdge, int origdelta, SemReason reason
) {
exists(SemExpr mid, int d1, int d2, SemReason r1, SemReason r2 |
boundFlowStepSsa(v, pos, mid, d1, upper, r1) and
bounded(mid, b, d2, upper, fromBackEdge, origdelta, r2) and
// upper = true: v <= mid + d1 <= b + d1 + d2 = b + delta
// upper = false: v >= mid + d1 >= b + d1 + d2 = b + delta
delta = d1 + d2 and
(if r1 instanceof SemNoReason then reason = r2 else reason = r1)
)
or
exists(int d, SemReason r1, SemReason r2 |
boundedSsa(v, pos, b, d, upper, fromBackEdge, origdelta, r2) or
boundedPhi(v, b, d, upper, fromBackEdge, origdelta, r2)
|
unequalIntegralSsa(v, pos, b, d, r1) and
(
upper = true and delta = d - 1
or
upper = false and delta = d + 1
) and
(
reason = r1
or
reason = r2 and not r2 instanceof SemNoReason
)
)
}
/**
* Holds if `v != b + delta` at `pos` and `v` is of integral type.
*/
private predicate unequalIntegralSsa(
SemSsaVariable v, SemSsaReadPosition pos, SemBound b, int delta, SemReason reason
) {
exists(SemExpr e, int d1, int d2 |
unequalFlowStepIntegralSsa(v, pos, e, d1, reason) and
boundedUpper(e, b, d1) and
boundedLower(e, b, d2) and
delta = d2 + d1
)
}
/**
* Holds if `b + delta` is an upper bound for `e`.
*
* This predicate only exists to prevent a bad standard order in `unequalIntegralSsa`.
*/
pragma[nomagic]
private predicate boundedUpper(SemExpr e, SemBound b, int delta) {
bounded(e, b, delta, true, _, _, _)
}
/**
* Holds if `b + delta` is a lower bound for `e`.
*
* This predicate only exists to prevent a bad standard order in `unequalIntegralSsa`.
*/
pragma[nomagic]
private predicate boundedLower(SemExpr e, SemBound b, int delta) {
bounded(e, b, delta, false, _, _, _)
}
/** Weakens a delta to lie in the range `[-1..1]`. */
bindingset[delta, upper]
private int weakenDelta(boolean upper, int delta) {
delta in [-1 .. 1] and result = delta
or
upper = true and result = -1 and delta < -1
or
upper = false and result = 1 and delta > 1
}
/**
* Holds if `b + delta` is a valid bound for `inp` when used as an input to
* `phi` along `edge`.
* - `upper = true` : `inp <= b + delta`
* - `upper = false` : `inp >= b + delta`
*/
private predicate boundedPhiInp(
SemSsaPhiNode phi, SemSsaVariable inp, SemSsaReadPositionPhiInputEdge edge, SemBound b, int delta,
boolean upper, boolean fromBackEdge, int origdelta, SemReason reason
) {
edge.phiInput(phi, inp) and
exists(int d, boolean fromBackEdge0 |
boundedSsa(inp, edge, b, d, upper, fromBackEdge0, origdelta, reason)
or
boundedPhi(inp, b, d, upper, fromBackEdge0, origdelta, reason)
or
b.(SemSsaBound).getAVariable() = inp and
d = 0 and
(upper = true or upper = false) and
fromBackEdge0 = false and
origdelta = 0 and
reason = TSemNoReason()
|
if semBackEdge(phi, inp, edge)
then
fromBackEdge = true and
(
fromBackEdge0 = true and delta = weakenDelta(upper, d - origdelta) + origdelta
or
fromBackEdge0 = false and delta = d
)
else (
delta = d and fromBackEdge = fromBackEdge0
)
)
}
/**
* Holds if `b + delta` is a valid bound for `inp` when used as an input to
* `phi` along `edge`.
* - `upper = true` : `inp <= b + delta`
* - `upper = false` : `inp >= b + delta`
*
* Equivalent to `boundedPhiInp(phi, inp, edge, b, delta, upper, _, _, _)`.
*/
pragma[noinline]
private predicate boundedPhiInp1(
SemSsaPhiNode phi, SemBound b, boolean upper, SemSsaVariable inp,
SemSsaReadPositionPhiInputEdge edge, int delta
) {
boundedPhiInp(phi, inp, edge, b, delta, upper, _, _, _)
}
/**
* Holds if `phi` is a valid bound for `inp` when used as an input to `phi`
* along `edge`.
* - `upper = true` : `inp <= phi`
* - `upper = false` : `inp >= phi`
*/
private predicate selfBoundedPhiInp(
SemSsaPhiNode phi, SemSsaVariable inp, SemSsaReadPositionPhiInputEdge edge, boolean upper
) {
exists(int d, SemSsaBound phibound |
phibound.getAVariable() = phi and
boundedPhiInp(phi, inp, edge, phibound, d, upper, _, _, _) and
(
upper = true and d <= 0
or
upper = false and d >= 0
)
)
}
/**
* Holds if `b + delta` is a valid bound for some input, `inp`, to `phi`, and
* thus a candidate bound for `phi`.
* - `upper = true` : `inp <= b + delta`
* - `upper = false` : `inp >= b + delta`
*/
pragma[noinline]
private predicate boundedPhiCand(
SemSsaPhiNode phi, boolean upper, SemBound b, int delta, boolean fromBackEdge, int origdelta,
SemReason reason
) {
exists(SemSsaVariable inp, SemSsaReadPositionPhiInputEdge edge |
boundedPhiInp(phi, inp, edge, b, delta, upper, fromBackEdge, origdelta, reason)
)
}
/**
* Holds if the candidate bound `b + delta` for `phi` is valid for the phi input
* `inp` along `edge`.
*/
private predicate boundedPhiCandValidForEdge(
SemSsaPhiNode phi, SemBound b, int delta, boolean upper, boolean fromBackEdge, int origdelta,
SemReason reason, SemSsaVariable inp, SemSsaReadPositionPhiInputEdge edge
) {
boundedPhiCand(phi, upper, b, delta, fromBackEdge, origdelta, reason) and
(
exists(int d | boundedPhiInp1(phi, b, upper, inp, edge, d) | upper = true and d <= delta)
or
exists(int d | boundedPhiInp1(phi, b, upper, inp, edge, d) | upper = false and d >= delta)
or
selfBoundedPhiInp(phi, inp, edge, upper)
)
}
/**
* Holds if `b + delta` is a valid bound for `phi`.
* - `upper = true` : `phi <= b + delta`
* - `upper = false` : `phi >= b + delta`
*/
private predicate boundedPhi(
SemSsaPhiNode phi, SemBound b, int delta, boolean upper, boolean fromBackEdge, int origdelta,
SemReason reason
) {
forex(SemSsaVariable inp, SemSsaReadPositionPhiInputEdge edge | edge.phiInput(phi, inp) |
boundedPhiCandValidForEdge(phi, b, delta, upper, fromBackEdge, origdelta, reason, inp, edge)
)
}
/**
* Holds if `e` has an upper (for `upper = true`) or lower
* (for `upper = false`) bound of `b`.
*/
private predicate baseBound(SemExpr e, int b, boolean upper) {
Specific::hasConstantBound(e, b, upper)
or
upper = false and
b = 0 and
semPositive(e.(SemBitAndExpr).getAnOperand()) and
// REVIEW: We let the language opt out here to preserve original results.
not Specific::ignoreZeroLowerBound(e)
}
/**
* Holds if the value being cast has an upper (for `upper = true`) or lower
* (for `upper = false`) bound within the bounds of the resulting type.
* For `upper = true` this means that the cast will not overflow and for
* `upper = false` this means that the cast will not underflow.
*/
private predicate safeNarrowingCast(NarrowingCastExpr cast, boolean upper) {
exists(int bound | bounded(cast.getOperand(), any(SemZeroBound zb), bound, upper, _, _, _) |
upper = true and bound <= cast.getUpperBound()
or
upper = false and bound >= cast.getLowerBound()
)
}
pragma[noinline]
private predicate boundedCastExpr(
NarrowingCastExpr cast, SemBound b, int delta, boolean upper, boolean fromBackEdge, int origdelta,
SemReason reason
) {
bounded(cast.getOperand(), b, delta, upper, fromBackEdge, origdelta, reason)
}
/**
* Holds if `b + delta` is a valid bound for `e`.
* - `upper = true` : `e <= b + delta`
* - `upper = false` : `e >= b + delta`
*/
private predicate bounded(
SemExpr e, SemBound b, int delta, boolean upper, boolean fromBackEdge, int origdelta,
SemReason reason
) {
not Specific::ignoreExprBound(e) and
(
e = b.getExpr(delta) and
(upper = true or upper = false) and
fromBackEdge = false and
origdelta = delta and
reason = TSemNoReason()
or
baseBound(e, delta, upper) and
b instanceof SemZeroBound and
fromBackEdge = false and
origdelta = delta and
reason = TSemNoReason()
or
exists(SemSsaVariable v, SemSsaReadPositionBlock bb |
boundedSsa(v, bb, b, delta, upper, fromBackEdge, origdelta, reason) and
e = v.getAUse() and
bb.getBlock() = e.getBasicBlock()
)
or
exists(SemExpr mid, int d1, int d2 |
boundFlowStep(e, mid, d1, upper) and
// Constants have easy, base-case bounds, so let's not infer any recursive bounds.
not e instanceof SemConstantIntegerExpr and
bounded(mid, b, d2, upper, fromBackEdge, origdelta, reason) and
// upper = true: e <= mid + d1 <= b + d1 + d2 = b + delta
// upper = false: e >= mid + d1 >= b + d1 + d2 = b + delta
delta = d1 + d2
)
or
exists(SemSsaPhiNode phi |
boundedPhi(phi, b, delta, upper, fromBackEdge, origdelta, reason) and
e = phi.getAUse()
)
or
exists(SemExpr mid, int factor, int d |
boundFlowStepMul(e, mid, factor) and
not e instanceof SemConstantIntegerExpr and
bounded(mid, b, d, upper, fromBackEdge, origdelta, reason) and
b instanceof SemZeroBound and
delta = d * factor
)
or
exists(SemExpr mid, int factor, int d |
boundFlowStepDiv(e, mid, factor) and
not e instanceof SemConstantIntegerExpr and
bounded(mid, b, d, upper, fromBackEdge, origdelta, reason) and
b instanceof SemZeroBound and
d >= 0 and
delta = d / factor
)
or
exists(NarrowingCastExpr cast |
cast = e and
safeNarrowingCast(cast, upper.booleanNot()) and
boundedCastExpr(cast, b, delta, upper, fromBackEdge, origdelta, reason)
)
or
exists(
SemConditionalExpr cond, int d1, int d2, boolean fbe1, boolean fbe2, int od1, int od2,
SemReason r1, SemReason r2
|
cond = e and
boundedConditionalExpr(cond, b, upper, true, d1, fbe1, od1, r1) and
boundedConditionalExpr(cond, b, upper, false, d2, fbe2, od2, r2) and
(
delta = d1 and fromBackEdge = fbe1 and origdelta = od1 and reason = r1
or
delta = d2 and fromBackEdge = fbe2 and origdelta = od2 and reason = r2
)
|
upper = true and delta = d1.maximum(d2)
or
upper = false and delta = d1.minimum(d2)
)
)
}
private predicate boundedConditionalExpr(
SemConditionalExpr cond, SemBound b, boolean upper, boolean branch, int delta,
boolean fromBackEdge, int origdelta, SemReason reason
) {
bounded(cond.getBranchExpr(branch), b, delta, upper, fromBackEdge, origdelta, reason)
}
import CppRangeAnalysis

View File

@@ -3,86 +3,90 @@
*/
private import experimental.semmle.code.cpp.semantic.Semantic
private import RangeAnalysisStage
private import experimental.semmle.code.cpp.semantic.analysis.FloatDelta
/**
* Holds if the specified expression should be excluded from the result of `ssaRead()`.
*
* This predicate is to keep the results identical to the original Java implementation. It should be
* removed once we have the new implementation matching the old results exactly.
*/
predicate ignoreSsaReadCopy(SemExpr e) { none() }
module CppLangImpl implements LangSig<FloatDelta> {
/**
* Holds if the specified expression should be excluded from the result of `ssaRead()`.
*
* This predicate is to keep the results identical to the original Java implementation. It should be
* removed once we have the new implementation matching the old results exactly.
*/
predicate ignoreSsaReadCopy(SemExpr e) { none() }
/**
* Ignore the bound on this expression.
*
* This predicate is to keep the results identical to the original Java implementation. It should be
* removed once we have the new implementation matching the old results exactly.
*/
predicate ignoreExprBound(SemExpr e) { none() }
/**
* Ignore the bound on this expression.
*
* This predicate is to keep the results identical to the original Java implementation. It should be
* removed once we have the new implementation matching the old results exactly.
*/
predicate ignoreExprBound(SemExpr e) { none() }
/**
* Ignore any inferred zero lower bound on this expression.
*
* This predicate is to keep the results identical to the original Java implementation. It should be
* removed once we have the new implementation matching the old results exactly.
*/
predicate ignoreZeroLowerBound(SemExpr e) { none() }
/**
* Ignore any inferred zero lower bound on this expression.
*
* This predicate is to keep the results identical to the original Java implementation. It should be
* removed once we have the new implementation matching the old results exactly.
*/
predicate ignoreZeroLowerBound(SemExpr e) { none() }
/**
* Holds if the specified expression should be excluded from the result of `ssaRead()`.
*
* This predicate is to keep the results identical to the original Java implementation. It should be
* removed once we have the new implementation matching the old results exactly.
*/
predicate ignoreSsaReadArithmeticExpr(SemExpr e) { none() }
/**
* Holds if the specified expression should be excluded from the result of `ssaRead()`.
*
* This predicate is to keep the results identical to the original Java implementation. It should be
* removed once we have the new implementation matching the old results exactly.
*/
predicate ignoreSsaReadArithmeticExpr(SemExpr e) { none() }
/**
* Holds if the specified variable should be excluded from the result of `ssaRead()`.
*
* This predicate is to keep the results identical to the original Java implementation. It should be
* removed once we have the new implementation matching the old results exactly.
*/
predicate ignoreSsaReadAssignment(SemSsaVariable v) { none() }
/**
* Holds if the specified variable should be excluded from the result of `ssaRead()`.
*
* This predicate is to keep the results identical to the original Java implementation. It should be
* removed once we have the new implementation matching the old results exactly.
*/
predicate ignoreSsaReadAssignment(SemSsaVariable v) { none() }
/**
* Adds additional results to `ssaRead()` that are specific to Java.
*
* This predicate handles propagation of offsets for post-increment and post-decrement expressions
* in exactly the same way as the old Java implementation. Once the new implementation matches the
* old one, we should remove this predicate and propagate deltas for all similar patterns, whether
* or not they come from a post-increment/decrement expression.
*/
SemExpr specificSsaRead(SemSsaVariable v, int delta) { none() }
/**
* Adds additional results to `ssaRead()` that are specific to Java.
*
* This predicate handles propagation of offsets for post-increment and post-decrement expressions
* in exactly the same way as the old Java implementation. Once the new implementation matches the
* old one, we should remove this predicate and propagate deltas for all similar patterns, whether
* or not they come from a post-increment/decrement expression.
*/
SemExpr specificSsaRead(SemSsaVariable v, float delta) { none() }
/**
* Holds if `e >= bound` (if `upper = false`) or `e <= bound` (if `upper = true`).
*/
predicate hasConstantBound(SemExpr e, int bound, boolean upper) { none() }
/**
* Holds if `e >= bound` (if `upper = false`) or `e <= bound` (if `upper = true`).
*/
predicate hasConstantBound(SemExpr e, float bound, boolean upper) { none() }
/**
* Holds if `e >= bound + delta` (if `upper = false`) or `e <= bound + delta` (if `upper = true`).
*/
predicate hasBound(SemExpr e, SemExpr bound, int delta, boolean upper) { none() }
/**
* Holds if `e >= bound + delta` (if `upper = false`) or `e <= bound + delta` (if `upper = true`).
*/
predicate hasBound(SemExpr e, SemExpr bound, float delta, boolean upper) { none() }
/**
* Holds if the value of `dest` is known to be `src + delta`.
*/
predicate additionalValueFlowStep(SemExpr dest, SemExpr src, int delta) { none() }
/**
* Holds if the value of `dest` is known to be `src + delta`.
*/
predicate additionalValueFlowStep(SemExpr dest, SemExpr src, float delta) { none() }
/**
* Gets the type that range analysis should use to track the result of the specified expression,
* if a type other than the original type of the expression is to be used.
*
* This predicate is commonly used in languages that support immutable "boxed" types that are
* actually references but whose values can be tracked as the type contained in the box.
*/
SemType getAlternateType(SemExpr e) { none() }
/**
* Gets the type that range analysis should use to track the result of the specified expression,
* if a type other than the original type of the expression is to be used.
*
* This predicate is commonly used in languages that support immutable "boxed" types that are
* actually references but whose values can be tracked as the type contained in the box.
*/
SemType getAlternateType(SemExpr e) { none() }
/**
* Gets the type that range analysis should use to track the result of the specified source
* variable, if a type other than the original type of the expression is to be used.
*
* This predicate is commonly used in languages that support immutable "boxed" types that are
* actually references but whose values can be tracked as the type contained in the box.
*/
SemType getAlternateTypeForSsaVariable(SemSsaVariable var) { none() }
/**
* Gets the type that range analysis should use to track the result of the specified source
* variable, if a type other than the original type of the expression is to be used.
*
* This predicate is commonly used in languages that support immutable "boxed" types that are
* actually references but whose values can be tracked as the type contained in the box.
*/
SemType getAlternateTypeForSsaVariable(SemSsaVariable var) { none() }
}

File diff suppressed because it is too large Load Diff

View File

@@ -3,133 +3,138 @@
*/
private import experimental.semmle.code.cpp.semantic.Semantic
private import RangeAnalysisSpecific as Specific
private import RangeAnalysisSpecific
private import RangeAnalysisStage as Range
private import ConstantAnalysis
/**
* Gets an expression that equals `v - d`.
*/
SemExpr semSsaRead(SemSsaVariable v, int delta) {
// There are various language-specific extension points that can be removed once we no longer
// expect to match the original Java implementation's results exactly.
result = v.getAUse() and delta = 0
or
exists(int d1, SemConstantIntegerExpr c |
result.(SemAddExpr).hasOperands(semSsaRead(v, d1), c) and
delta = d1 - c.getIntValue() and
not Specific::ignoreSsaReadArithmeticExpr(result)
)
or
exists(SemSubExpr sub, int d1, SemConstantIntegerExpr c |
result = sub and
sub.getLeftOperand() = semSsaRead(v, d1) and
sub.getRightOperand() = c and
delta = d1 + c.getIntValue() and
not Specific::ignoreSsaReadArithmeticExpr(result)
)
or
result = v.(SemSsaExplicitUpdate).getSourceExpr() and
delta = 0 and
not Specific::ignoreSsaReadAssignment(v)
or
result = Specific::specificSsaRead(v, delta)
or
result.(SemCopyValueExpr).getOperand() = semSsaRead(v, delta) and
not Specific::ignoreSsaReadCopy(result)
or
result.(SemStoreExpr).getOperand() = semSsaRead(v, delta)
}
/**
* Gets a condition that tests whether `v` equals `e + delta`.
*
* If the condition evaluates to `testIsTrue`:
* - `isEq = true` : `v == e + delta`
* - `isEq = false` : `v != e + delta`
*/
SemGuard semEqFlowCond(SemSsaVariable v, SemExpr e, int delta, boolean isEq, boolean testIsTrue) {
exists(boolean eqpolarity |
result.isEquality(semSsaRead(v, delta), e, eqpolarity) and
(testIsTrue = true or testIsTrue = false) and
eqpolarity.booleanXor(testIsTrue).booleanNot() = isEq
)
or
exists(boolean testIsTrue0 |
semImplies_v2(result, testIsTrue, semEqFlowCond(v, e, delta, isEq, testIsTrue0), testIsTrue0)
)
}
/**
* Holds if `v` is an `SsaExplicitUpdate` that equals `e + delta`.
*/
predicate semSsaUpdateStep(SemSsaExplicitUpdate v, SemExpr e, int delta) {
exists(SemExpr defExpr | defExpr = v.getSourceExpr() |
defExpr.(SemCopyValueExpr).getOperand() = e and delta = 0
module RangeUtil<Range::DeltaSig D, Range::LangSig<D> Lang> implements Range::UtilSig<D> {
/**
* Gets an expression that equals `v - d`.
*/
SemExpr semSsaRead(SemSsaVariable v, D::Delta delta) {
// There are various language-specific extension points that can be removed once we no longer
// expect to match the original Java implementation's results exactly.
result = v.getAUse() and delta = D::fromInt(0)
or
defExpr.(SemStoreExpr).getOperand() = e and delta = 0
exists(D::Delta d1, SemConstantIntegerExpr c |
result.(SemAddExpr).hasOperands(semSsaRead(v, d1), c) and
delta = D::fromFloat(D::toFloat(d1) - c.getIntValue()) and
not Lang::ignoreSsaReadArithmeticExpr(result)
)
or
defExpr.(SemAddOneExpr).getOperand() = e and delta = 1
exists(SemSubExpr sub, D::Delta d1, SemConstantIntegerExpr c |
result = sub and
sub.getLeftOperand() = semSsaRead(v, d1) and
sub.getRightOperand() = c and
delta = D::fromFloat(D::toFloat(d1) + c.getIntValue()) and
not Lang::ignoreSsaReadArithmeticExpr(result)
)
or
defExpr.(SemSubOneExpr).getOperand() = e and delta = -1
result = v.(SemSsaExplicitUpdate).getSourceExpr() and
delta = D::fromFloat(0) and
not Lang::ignoreSsaReadAssignment(v)
or
e = defExpr and
not (
defExpr instanceof SemCopyValueExpr or
defExpr instanceof SemStoreExpr or
defExpr instanceof SemAddOneExpr or
defExpr instanceof SemSubOneExpr
) and
delta = 0
)
}
result = Lang::specificSsaRead(v, delta)
or
result.(SemCopyValueExpr).getOperand() = semSsaRead(v, delta) and
not Lang::ignoreSsaReadCopy(result)
or
result.(SemStoreExpr).getOperand() = semSsaRead(v, delta)
}
/**
* Holds if `e1 + delta` equals `e2`.
*/
predicate semValueFlowStep(SemExpr e2, SemExpr e1, int delta) {
e2.(SemCopyValueExpr).getOperand() = e1 and delta = 0
or
e2.(SemStoreExpr).getOperand() = e1 and delta = 0
or
e2.(SemAddOneExpr).getOperand() = e1 and delta = 1
or
e2.(SemSubOneExpr).getOperand() = e1 and delta = -1
or
Specific::additionalValueFlowStep(e2, e1, delta)
or
exists(SemExpr x | e2.(SemAddExpr).hasOperands(e1, x) |
x.(SemConstantIntegerExpr).getIntValue() = delta
)
or
exists(SemExpr x, SemSubExpr sub |
e2 = sub and
sub.getLeftOperand() = e1 and
sub.getRightOperand() = x
|
x.(SemConstantIntegerExpr).getIntValue() = -delta
)
}
/**
* Gets a condition that tests whether `v` equals `e + delta`.
*
* If the condition evaluates to `testIsTrue`:
* - `isEq = true` : `v == e + delta`
* - `isEq = false` : `v != e + delta`
*/
SemGuard semEqFlowCond(
SemSsaVariable v, SemExpr e, D::Delta delta, boolean isEq, boolean testIsTrue
) {
exists(boolean eqpolarity |
result.isEquality(semSsaRead(v, delta), e, eqpolarity) and
(testIsTrue = true or testIsTrue = false) and
eqpolarity.booleanXor(testIsTrue).booleanNot() = isEq
)
or
exists(boolean testIsTrue0 |
semImplies_v2(result, testIsTrue, semEqFlowCond(v, e, delta, isEq, testIsTrue0), testIsTrue0)
)
}
/**
* Gets the type used to track the specified expression's range information.
*
* Usually, this just `e.getSemType()`, but the language can override this to track immutable boxed
* primitive types as the underlying primitive type.
*/
SemType getTrackedType(SemExpr e) {
result = Specific::getAlternateType(e)
or
not exists(Specific::getAlternateType(e)) and result = e.getSemType()
}
/**
* Holds if `v` is an `SsaExplicitUpdate` that equals `e + delta`.
*/
predicate semSsaUpdateStep(SemSsaExplicitUpdate v, SemExpr e, D::Delta delta) {
exists(SemExpr defExpr | defExpr = v.getSourceExpr() |
defExpr.(SemCopyValueExpr).getOperand() = e and delta = D::fromFloat(0)
or
defExpr.(SemStoreExpr).getOperand() = e and delta = D::fromFloat(0)
or
defExpr.(SemAddOneExpr).getOperand() = e and delta = D::fromFloat(1)
or
defExpr.(SemSubOneExpr).getOperand() = e and delta = D::fromFloat(-1)
or
e = defExpr and
not (
defExpr instanceof SemCopyValueExpr or
defExpr instanceof SemStoreExpr or
defExpr instanceof SemAddOneExpr or
defExpr instanceof SemSubOneExpr
) and
delta = D::fromFloat(0)
)
}
/**
* Gets the type used to track the specified source variable's range information.
*
* Usually, this just `e.getType()`, but the language can override this to track immutable boxed
* primitive types as the underlying primitive type.
*/
SemType getTrackedTypeForSsaVariable(SemSsaVariable var) {
result = Specific::getAlternateTypeForSsaVariable(var)
or
not exists(Specific::getAlternateTypeForSsaVariable(var)) and result = var.getType()
/**
* Holds if `e1 + delta` equals `e2`.
*/
predicate semValueFlowStep(SemExpr e2, SemExpr e1, D::Delta delta) {
e2.(SemCopyValueExpr).getOperand() = e1 and delta = D::fromFloat(0)
or
e2.(SemStoreExpr).getOperand() = e1 and delta = D::fromFloat(0)
or
e2.(SemAddOneExpr).getOperand() = e1 and delta = D::fromFloat(1)
or
e2.(SemSubOneExpr).getOperand() = e1 and delta = D::fromFloat(-1)
or
Lang::additionalValueFlowStep(e2, e1, delta)
or
exists(SemExpr x | e2.(SemAddExpr).hasOperands(e1, x) |
D::fromInt(x.(SemConstantIntegerExpr).getIntValue()) = delta
)
or
exists(SemExpr x, SemSubExpr sub |
e2 = sub and
sub.getLeftOperand() = e1 and
sub.getRightOperand() = x
|
D::fromInt(-x.(SemConstantIntegerExpr).getIntValue()) = delta
)
}
/**
* Gets the type used to track the specified expression's range information.
*
* Usually, this just `e.getSemType()`, but the language can override this to track immutable boxed
* primitive types as the underlying primitive type.
*/
SemType getTrackedType(SemExpr e) {
result = Lang::getAlternateType(e)
or
not exists(Lang::getAlternateType(e)) and result = e.getSemType()
}
/**
* Gets the type used to track the specified source variable's range information.
*
* Usually, this just `e.getType()`, but the language can override this to track immutable boxed
* primitive types as the underlying primitive type.
*/
SemType getTrackedTypeForSsaVariable(SemSsaVariable var) {
result = Lang::getAlternateTypeForSsaVariable(var)
or
not exists(Lang::getAlternateTypeForSsaVariable(var)) and result = var.getType()
}
}

View File

@@ -6,496 +6,494 @@
* three-valued domain `{negative, zero, positive}`.
*/
private import RangeAnalysisStage
private import SignAnalysisSpecific as Specific
private import experimental.semmle.code.cpp.semantic.Semantic
private import ConstantAnalysis
private import RangeUtils
private import Sign
/**
* An SSA definition for which the analysis can compute the sign.
*
* The actual computation of the sign is done in an override of the `getSign()` predicate. The
* charpred of any subclass must _not_ invoke `getSign()`, directly or indirectly. This ensures
* that the charpred does not introduce negative recursion. The `getSign()` predicate may be
* recursive.
*/
abstract private class SignDef instanceof SemSsaVariable {
final string toString() { result = super.toString() }
module SignAnalysis<DeltaSig D, UtilSig<D> Utils> {
/**
* An SSA definition for which the analysis can compute the sign.
*
* The actual computation of the sign is done in an override of the `getSign()` predicate. The
* charpred of any subclass must _not_ invoke `getSign()`, directly or indirectly. This ensures
* that the charpred does not introduce negative recursion. The `getSign()` predicate may be
* recursive.
*/
abstract private class SignDef instanceof SemSsaVariable {
final string toString() { result = super.toString() }
/** Gets the possible signs of this SSA definition. */
abstract Sign getSign();
}
/** An SSA definition whose sign is computed based on standard flow. */
abstract private class FlowSignDef extends SignDef {
abstract override Sign getSign();
}
/** An SSA definition whose sign is determined by the sign of that definitions source expression. */
private class ExplicitSignDef extends FlowSignDef {
SemSsaExplicitUpdate update;
ExplicitSignDef() { update = this }
final override Sign getSign() { result = semExprSign(update.getSourceExpr()) }
}
/** An SSA Phi definition, whose sign is the union of the signs of its inputs. */
private class PhiSignDef extends FlowSignDef {
SemSsaPhiNode phi;
PhiSignDef() { phi = this }
final override Sign getSign() {
exists(SemSsaVariable inp, SemSsaReadPositionPhiInputEdge edge |
edge.phiInput(phi, inp) and
result = semSsaSign(inp, edge)
)
}
}
/** An SSA definition whose sign is computed by a language-specific implementation. */
abstract class CustomSignDef extends SignDef {
abstract override Sign getSign();
}
/**
* An expression for which the analysis can compute the sign.
*
* The actual computation of the sign is done in an override of the `getSign()` predicate. The
* charpred of any subclass must _not_ invoke `getSign()`, directly or indirectly. This ensures
* that the charpred does not introduce negative recursion. The `getSign()` predicate may be
* recursive.
*
* Concrete implementations extend one of the following subclasses:
* - `ConstantSignExpr`, for expressions with a compile-time constant value.
* - `FlowSignExpr`, for expressions whose sign can be computed from the signs of their operands.
* - `CustomsignExpr`, for expressions whose sign can be computed by a language-specific
* implementation.
*
* If the same expression matches more than one of the above subclasses, the sign is computed as
* follows:
* - The sign of a `ConstantSignExpr` is computed solely from `ConstantSignExpr.getSign()`,
* regardless of any other subclasses.
* - If a non-`ConstantSignExpr` expression matches exactly one of `FlowSignExpr` or
* `CustomSignExpr`, the sign is computed by that class' `getSign()` predicate.
* - If a non-`ConstantSignExpr` expression matches both `FlowSignExpr` and `CustomSignExpr`, the
* sign is the _intersection_ of the signs of those two classes' `getSign()` predicates. Thus,
* both classes have the opportunity to _restrict_ the set of possible signs, not to generate new
* possible signs.
* - If an expression does not match any of the three subclasses, then it can have any sign.
*
* Note that the `getSign()` predicate is introduced only in subclasses of `SignExpr`.
*/
abstract class SignExpr instanceof SemExpr {
SignExpr() { not Specific::ignoreExprSign(this) }
final string toString() { result = super.toString() }
abstract Sign getSign();
}
/** An expression whose sign is determined by its constant numeric value. */
private class ConstantSignExpr extends SignExpr {
ConstantSignExpr() {
this instanceof SemConstantIntegerExpr or
exists(this.(SemNumericLiteralExpr).getApproximateFloatValue())
/** Gets the possible signs of this SSA definition. */
abstract Sign getSign();
}
final override Sign getSign() {
exists(int i | this.(SemConstantIntegerExpr).getIntValue() = i |
i < 0 and result = TNeg()
/** An SSA definition whose sign is computed based on standard flow. */
abstract private class FlowSignDef extends SignDef {
abstract override Sign getSign();
}
/** An SSA definition whose sign is determined by the sign of that definitions source expression. */
private class ExplicitSignDef extends FlowSignDef instanceof SemSsaExplicitUpdate {
final override Sign getSign() { result = semExprSign(super.getSourceExpr()) }
}
/** An SSA Phi definition, whose sign is the union of the signs of its inputs. */
private class PhiSignDef extends FlowSignDef instanceof SemSsaPhiNode {
final override Sign getSign() {
exists(SemSsaVariable inp, SemSsaReadPositionPhiInputEdge edge |
edge.phiInput(this, inp) and
result = semSsaSign(inp, edge)
)
}
}
/** An SSA definition whose sign is computed by a language-specific implementation. */
abstract class CustomSignDef extends SignDef {
abstract override Sign getSign();
}
/**
* An expression for which the analysis can compute the sign.
*
* The actual computation of the sign is done in an override of the `getSign()` predicate. The
* charpred of any subclass must _not_ invoke `getSign()`, directly or indirectly. This ensures
* that the charpred does not introduce negative recursion. The `getSign()` predicate may be
* recursive.
*
* Concrete implementations extend one of the following subclasses:
* - `ConstantSignExpr`, for expressions with a compile-time constant value.
* - `FlowSignExpr`, for expressions whose sign can be computed from the signs of their operands.
* - `CustomsignExpr`, for expressions whose sign can be computed by a language-specific
* implementation.
*
* If the same expression matches more than one of the above subclasses, the sign is computed as
* follows:
* - The sign of a `ConstantSignExpr` is computed solely from `ConstantSignExpr.getSign()`,
* regardless of any other subclasses.
* - If a non-`ConstantSignExpr` expression matches exactly one of `FlowSignExpr` or
* `CustomSignExpr`, the sign is computed by that class' `getSign()` predicate.
* - If a non-`ConstantSignExpr` expression matches both `FlowSignExpr` and `CustomSignExpr`, the
* sign is the _intersection_ of the signs of those two classes' `getSign()` predicates. Thus,
* both classes have the opportunity to _restrict_ the set of possible signs, not to generate new
* possible signs.
* - If an expression does not match any of the three subclasses, then it can have any sign.
*
* Note that the `getSign()` predicate is introduced only in subclasses of `SignExpr`.
*/
abstract class SignExpr instanceof SemExpr {
SignExpr() { not Specific::ignoreExprSign(this) }
final string toString() { result = super.toString() }
abstract Sign getSign();
}
/** An expression whose sign is determined by its constant numeric value. */
private class ConstantSignExpr extends SignExpr {
ConstantSignExpr() {
this instanceof SemConstantIntegerExpr or
exists(this.(SemNumericLiteralExpr).getApproximateFloatValue())
}
final override Sign getSign() {
exists(int i | this.(SemConstantIntegerExpr).getIntValue() = i |
i < 0 and result = TNeg()
or
i = 0 and result = TZero()
or
i > 0 and result = TPos()
)
or
i = 0 and result = TZero()
or
i > 0 and result = TPos()
)
or
not exists(this.(SemConstantIntegerExpr).getIntValue()) and
exists(float f | f = this.(SemNumericLiteralExpr).getApproximateFloatValue() |
f < 0 and result = TNeg()
or
f = 0 and result = TZero()
or
f > 0 and result = TPos()
)
}
}
abstract private class NonConstantSignExpr extends SignExpr {
NonConstantSignExpr() { not this instanceof ConstantSignExpr }
final override Sign getSign() {
// The result is the _intersection_ of the signs computed from flow and by the language.
(result = this.(FlowSignExpr).getSignRestriction() or not this instanceof FlowSignExpr) and
(result = this.(CustomSignExpr).getSignRestriction() or not this instanceof CustomSignExpr)
}
}
/** An expression whose sign is computed from the signs of its operands. */
abstract private class FlowSignExpr extends NonConstantSignExpr {
abstract Sign getSignRestriction();
}
/** An expression whose sign is computed by a language-specific implementation. */
abstract class CustomSignExpr extends NonConstantSignExpr {
abstract Sign getSignRestriction();
}
/** An expression whose sign is unknown. */
private class UnknownSignExpr extends SignExpr {
UnknownSignExpr() {
not this instanceof FlowSignExpr and
not this instanceof CustomSignExpr and
not this instanceof ConstantSignExpr and
(
// Only track numeric types.
getTrackedType(this) instanceof SemNumericType
or
// Unless the language says to track this expression anyway.
Specific::trackUnknownNonNumericExpr(this)
)
not exists(this.(SemConstantIntegerExpr).getIntValue()) and
exists(float f | f = this.(SemNumericLiteralExpr).getApproximateFloatValue() |
f < 0 and result = TNeg()
or
f = 0 and result = TZero()
or
f > 0 and result = TPos()
)
}
}
final override Sign getSign() { semAnySign(result) }
}
abstract private class NonConstantSignExpr extends SignExpr {
NonConstantSignExpr() { not this instanceof ConstantSignExpr }
/**
* A `Load` expression whose sign is computed from the sign of its SSA definition, restricted by
* inference from any intervening guards.
*/
class UseSignExpr extends FlowSignExpr {
SemSsaVariable v;
UseSignExpr() { v.getAUse() = this }
override Sign getSignRestriction() {
// Propagate via SSA
// Propagate the sign from the def of `v`, incorporating any inference from guards.
result = semSsaSign(v, any(SemSsaReadPositionBlock bb | bb.getAnExpr() = this))
or
// No block for this read. Just use the sign of the def.
// REVIEW: How can this happen?
not exists(SemSsaReadPositionBlock bb | bb.getAnExpr() = this) and
result = semSsaDefSign(v)
final override Sign getSign() {
// The result is the _intersection_ of the signs computed from flow and by the language.
(result = this.(FlowSignExpr).getSignRestriction() or not this instanceof FlowSignExpr) and
(result = this.(CustomSignExpr).getSignRestriction() or not this instanceof CustomSignExpr)
}
}
}
/** A binary expression whose sign is computed from the signs of its operands. */
private class BinarySignExpr extends FlowSignExpr {
SemBinaryExpr binary;
/** An expression whose sign is computed from the signs of its operands. */
abstract private class FlowSignExpr extends NonConstantSignExpr {
abstract Sign getSignRestriction();
}
BinarySignExpr() { binary = this }
/** An expression whose sign is computed by a language-specific implementation. */
abstract class CustomSignExpr extends NonConstantSignExpr {
abstract Sign getSignRestriction();
}
override Sign getSignRestriction() {
exists(SemExpr left, SemExpr right |
binaryExprOperands(binary, left, right) and
/** An expression whose sign is unknown. */
private class UnknownSignExpr extends SignExpr {
UnknownSignExpr() {
not this instanceof FlowSignExpr and
not this instanceof CustomSignExpr and
not this instanceof ConstantSignExpr and
(
// Only track numeric types.
Utils::getTrackedType(this) instanceof SemNumericType
or
// Unless the language says to track this expression anyway.
Specific::trackUnknownNonNumericExpr(this)
)
}
final override Sign getSign() { semAnySign(result) }
}
/**
* A `Load` expression whose sign is computed from the sign of its SSA definition, restricted by
* inference from any intervening guards.
*/
class UseSignExpr extends FlowSignExpr {
SemSsaVariable v;
UseSignExpr() { v.getAUse() = this }
override Sign getSignRestriction() {
// Propagate via SSA
// Propagate the sign from the def of `v`, incorporating any inference from guards.
result = semSsaSign(v, any(SemSsaReadPositionBlock bb | bb.getAnExpr() = this))
or
// No block for this read. Just use the sign of the def.
// REVIEW: How can this happen?
not exists(SemSsaReadPositionBlock bb | bb.getAnExpr() = this) and
result = semSsaDefSign(v)
}
}
/** A binary expression whose sign is computed from the signs of its operands. */
private class BinarySignExpr extends FlowSignExpr {
SemBinaryExpr binary;
BinarySignExpr() { binary = this }
override Sign getSignRestriction() {
exists(SemExpr left, SemExpr right |
binaryExprOperands(binary, left, right) and
result =
semExprSign(pragma[only_bind_out](left))
.applyBinaryOp(semExprSign(pragma[only_bind_out](right)), binary.getOpcode())
)
or
exists(SemDivExpr div | div = binary |
result = semExprSign(div.getLeftOperand()) and
result != TZero() and
div.getRightOperand().(SemFloatingPointLiteralExpr).getFloatValue() = 0
)
}
}
pragma[nomagic]
private predicate binaryExprOperands(SemBinaryExpr binary, SemExpr left, SemExpr right) {
binary.getLeftOperand() = left and binary.getRightOperand() = right
}
/**
* A `Convert`, `Box`, or `Unbox` expression.
*/
private class SemCastExpr instanceof SemUnaryExpr {
string toString() { result = super.toString() }
SemCastExpr() {
this instanceof SemConvertExpr
or
this instanceof SemBoxExpr
or
this instanceof SemUnboxExpr
}
}
/** A unary expression whose sign is computed from the sign of its operand. */
private class UnarySignExpr extends FlowSignExpr {
SemUnaryExpr unary;
UnarySignExpr() { unary = this and not this instanceof SemCastExpr }
override Sign getSignRestriction() {
result =
semExprSign(pragma[only_bind_out](left))
.applyBinaryOp(semExprSign(pragma[only_bind_out](right)), binary.getOpcode())
)
or
exists(SemDivExpr div | div = binary |
result = semExprSign(div.getLeftOperand()) and
result != TZero() and
div.getRightOperand().(SemFloatingPointLiteralExpr).getFloatValue() = 0
semExprSign(pragma[only_bind_out](unary.getOperand())).applyUnaryOp(unary.getOpcode())
}
}
/**
* A `Convert`, `Box`, or `Unbox` expression, whose sign is computed based on
* the sign of its operand and the source and destination types.
*/
abstract private class CastSignExpr extends FlowSignExpr {
SemUnaryExpr cast;
CastSignExpr() { cast = this and cast instanceof SemCastExpr }
override Sign getSignRestriction() { result = semExprSign(cast.getOperand()) }
}
/**
* A `Convert` expression.
*/
private class ConvertSignExpr extends CastSignExpr {
override SemConvertExpr cast;
}
/**
* A `Box` expression.
*/
private class BoxSignExpr extends CastSignExpr {
override SemBoxExpr cast;
}
/**
* An `Unbox` expression.
*/
private class UnboxSignExpr extends CastSignExpr {
override SemUnboxExpr cast;
UnboxSignExpr() {
exists(SemType fromType | fromType = Utils::getTrackedType(cast.getOperand()) |
// Only numeric source types are handled here.
fromType instanceof SemNumericType
)
}
}
private predicate unknownSign(SemExpr e) { e instanceof UnknownSignExpr }
/**
* Holds if `lowerbound` is a lower bound for `v` at `pos`. This is restricted
* to only include bounds for which we might determine a sign.
*/
private predicate lowerBound(
SemExpr lowerbound, SemSsaVariable v, SemSsaReadPosition pos, boolean isStrict
) {
exists(boolean testIsTrue, SemRelationalExpr comp |
pos.hasReadOfVar(v) and
semGuardControlsSsaRead(semGetComparisonGuard(comp), pos, testIsTrue) and
not unknownSign(lowerbound)
|
testIsTrue = true and
comp.getLesserOperand() = lowerbound and
comp.getGreaterOperand() = Utils::semSsaRead(v, D::fromInt(0)) and
(if comp.isStrict() then isStrict = true else isStrict = false)
or
testIsTrue = false and
comp.getGreaterOperand() = lowerbound and
comp.getLesserOperand() = Utils::semSsaRead(v, D::fromInt(0)) and
(if comp.isStrict() then isStrict = false else isStrict = true)
)
}
}
pragma[nomagic]
private predicate binaryExprOperands(SemBinaryExpr binary, SemExpr left, SemExpr right) {
binary.getLeftOperand() = left and binary.getRightOperand() = right
}
/**
* A `Convert`, `Box`, or `Unbox` expression.
*/
private class SemCastExpr extends SemUnaryExpr {
SemCastExpr() {
this instanceof SemConvertExpr
or
this instanceof SemBoxExpr
or
this instanceof SemUnboxExpr
}
}
/** A unary expression whose sign is computed from the sign of its operand. */
private class UnarySignExpr extends FlowSignExpr {
SemUnaryExpr unary;
UnarySignExpr() { unary = this and not this instanceof SemCastExpr }
override Sign getSignRestriction() {
result = semExprSign(pragma[only_bind_out](unary.getOperand())).applyUnaryOp(unary.getOpcode())
}
}
/**
* A `Convert`, `Box`, or `Unbox` expression, whose sign is computed based on
* the sign of its operand and the source and destination types.
*/
abstract private class CastSignExpr extends FlowSignExpr {
SemUnaryExpr cast;
CastSignExpr() { cast = this and cast instanceof SemCastExpr }
override Sign getSignRestriction() { result = semExprSign(cast.getOperand()) }
}
/**
* A `Convert` expression.
*/
private class ConvertSignExpr extends CastSignExpr {
override SemConvertExpr cast;
}
/**
* A `Box` expression.
*/
private class BoxSignExpr extends CastSignExpr {
override SemBoxExpr cast;
}
/**
* An `Unbox` expression.
*/
private class UnboxSignExpr extends CastSignExpr {
override SemUnboxExpr cast;
UnboxSignExpr() {
exists(SemType fromType | fromType = getTrackedType(cast.getOperand()) |
// Only numeric source types are handled here.
fromType instanceof SemNumericType
/**
* Holds if `upperbound` is an upper bound for `v` at `pos`. This is restricted
* to only include bounds for which we might determine a sign.
*/
private predicate upperBound(
SemExpr upperbound, SemSsaVariable v, SemSsaReadPosition pos, boolean isStrict
) {
exists(boolean testIsTrue, SemRelationalExpr comp |
pos.hasReadOfVar(v) and
semGuardControlsSsaRead(semGetComparisonGuard(comp), pos, testIsTrue) and
not unknownSign(upperbound)
|
testIsTrue = true and
comp.getGreaterOperand() = upperbound and
comp.getLesserOperand() = Utils::semSsaRead(v, D::fromInt(0)) and
(if comp.isStrict() then isStrict = true else isStrict = false)
or
testIsTrue = false and
comp.getLesserOperand() = upperbound and
comp.getGreaterOperand() = Utils::semSsaRead(v, D::fromInt(0)) and
(if comp.isStrict() then isStrict = false else isStrict = true)
)
}
}
private predicate unknownSign(SemExpr e) { e instanceof UnknownSignExpr }
/**
* Holds if `eqbound` is an equality/inequality for `v` at `pos`. This is
* restricted to only include bounds for which we might determine a sign. The
* boolean `isEq` gives the polarity:
* - `isEq = true` : `v = eqbound`
* - `isEq = false` : `v != eqbound`
*/
private predicate eqBound(SemExpr eqbound, SemSsaVariable v, SemSsaReadPosition pos, boolean isEq) {
exists(SemGuard guard, boolean testIsTrue, boolean polarity |
pos.hasReadOfVar(v) and
semGuardControlsSsaRead(guard, pos, testIsTrue) and
guard.isEquality(eqbound, Utils::semSsaRead(v, D::fromInt(0)), polarity) and
isEq = polarity.booleanXor(testIsTrue).booleanNot() and
not unknownSign(eqbound)
)
}
/**
* Holds if `lowerbound` is a lower bound for `v` at `pos`. This is restricted
* to only include bounds for which we might determine a sign.
*/
private predicate lowerBound(
SemExpr lowerbound, SemSsaVariable v, SemSsaReadPosition pos, boolean isStrict
) {
exists(boolean testIsTrue, SemRelationalExpr comp |
pos.hasReadOfVar(v) and
semGuardControlsSsaRead(semGetComparisonGuard(comp), pos, testIsTrue) and
not unknownSign(lowerbound)
|
testIsTrue = true and
comp.getLesserOperand() = lowerbound and
comp.getGreaterOperand() = semSsaRead(v, 0) and
(if comp.isStrict() then isStrict = true else isStrict = false)
/**
* Holds if `bound` is a bound for `v` at `pos` that needs to be positive in
* order for `v` to be positive.
*/
private predicate posBound(SemExpr bound, SemSsaVariable v, SemSsaReadPosition pos) {
upperBound(bound, v, pos, _) or
eqBound(bound, v, pos, true)
}
/**
* Holds if `bound` is a bound for `v` at `pos` that needs to be negative in
* order for `v` to be negative.
*/
private predicate negBound(SemExpr bound, SemSsaVariable v, SemSsaReadPosition pos) {
lowerBound(bound, v, pos, _) or
eqBound(bound, v, pos, true)
}
/**
* Holds if `bound` is a bound for `v` at `pos` that can restrict whether `v`
* can be zero.
*/
private predicate zeroBound(SemExpr bound, SemSsaVariable v, SemSsaReadPosition pos) {
lowerBound(bound, v, pos, _) or
upperBound(bound, v, pos, _) or
eqBound(bound, v, pos, _)
}
/** Holds if `bound` allows `v` to be positive at `pos`. */
private predicate posBoundOk(SemExpr bound, SemSsaVariable v, SemSsaReadPosition pos) {
posBound(bound, v, pos) and TPos() = semExprSign(bound)
}
/** Holds if `bound` allows `v` to be negative at `pos`. */
private predicate negBoundOk(SemExpr bound, SemSsaVariable v, SemSsaReadPosition pos) {
negBound(bound, v, pos) and TNeg() = semExprSign(bound)
}
/** Holds if `bound` allows `v` to be zero at `pos`. */
private predicate zeroBoundOk(SemExpr bound, SemSsaVariable v, SemSsaReadPosition pos) {
lowerBound(bound, v, pos, _) and TNeg() = semExprSign(bound)
or
testIsTrue = false and
comp.getGreaterOperand() = lowerbound and
comp.getLesserOperand() = semSsaRead(v, 0) and
(if comp.isStrict() then isStrict = false else isStrict = true)
)
}
/**
* Holds if `upperbound` is an upper bound for `v` at `pos`. This is restricted
* to only include bounds for which we might determine a sign.
*/
private predicate upperBound(
SemExpr upperbound, SemSsaVariable v, SemSsaReadPosition pos, boolean isStrict
) {
exists(boolean testIsTrue, SemRelationalExpr comp |
pos.hasReadOfVar(v) and
semGuardControlsSsaRead(semGetComparisonGuard(comp), pos, testIsTrue) and
not unknownSign(upperbound)
|
testIsTrue = true and
comp.getGreaterOperand() = upperbound and
comp.getLesserOperand() = semSsaRead(v, 0) and
(if comp.isStrict() then isStrict = true else isStrict = false)
lowerBound(bound, v, pos, false) and TZero() = semExprSign(bound)
or
testIsTrue = false and
comp.getLesserOperand() = upperbound and
comp.getGreaterOperand() = semSsaRead(v, 0) and
(if comp.isStrict() then isStrict = false else isStrict = true)
)
}
upperBound(bound, v, pos, _) and TPos() = semExprSign(bound)
or
upperBound(bound, v, pos, false) and TZero() = semExprSign(bound)
or
eqBound(bound, v, pos, true) and TZero() = semExprSign(bound)
or
eqBound(bound, v, pos, false) and TZero() != semExprSign(bound)
}
/**
* Holds if `eqbound` is an equality/inequality for `v` at `pos`. This is
* restricted to only include bounds for which we might determine a sign. The
* boolean `isEq` gives the polarity:
* - `isEq = true` : `v = eqbound`
* - `isEq = false` : `v != eqbound`
*/
private predicate eqBound(SemExpr eqbound, SemSsaVariable v, SemSsaReadPosition pos, boolean isEq) {
exists(SemGuard guard, boolean testIsTrue, boolean polarity |
/**
* Holds if there is a bound that might restrict whether `v` has the sign `s`
* at `pos`.
*/
private predicate hasGuard(SemSsaVariable v, SemSsaReadPosition pos, Sign s) {
s = TPos() and posBound(_, v, pos)
or
s = TNeg() and negBound(_, v, pos)
or
s = TZero() and zeroBound(_, v, pos)
}
/**
* Gets a possible sign of `v` at `pos` based on its definition, where the sign
* might be ruled out by a guard.
*/
pragma[noinline]
private Sign guardedSsaSign(SemSsaVariable v, SemSsaReadPosition pos) {
result = semSsaDefSign(v) and
pos.hasReadOfVar(v) and
semGuardControlsSsaRead(guard, pos, testIsTrue) and
guard.isEquality(eqbound, semSsaRead(v, 0), polarity) and
isEq = polarity.booleanXor(testIsTrue).booleanNot() and
not unknownSign(eqbound)
)
}
/**
* Holds if `bound` is a bound for `v` at `pos` that needs to be positive in
* order for `v` to be positive.
*/
private predicate posBound(SemExpr bound, SemSsaVariable v, SemSsaReadPosition pos) {
upperBound(bound, v, pos, _) or
eqBound(bound, v, pos, true)
}
/**
* Holds if `bound` is a bound for `v` at `pos` that needs to be negative in
* order for `v` to be negative.
*/
private predicate negBound(SemExpr bound, SemSsaVariable v, SemSsaReadPosition pos) {
lowerBound(bound, v, pos, _) or
eqBound(bound, v, pos, true)
}
/**
* Holds if `bound` is a bound for `v` at `pos` that can restrict whether `v`
* can be zero.
*/
private predicate zeroBound(SemExpr bound, SemSsaVariable v, SemSsaReadPosition pos) {
lowerBound(bound, v, pos, _) or
upperBound(bound, v, pos, _) or
eqBound(bound, v, pos, _)
}
/** Holds if `bound` allows `v` to be positive at `pos`. */
private predicate posBoundOk(SemExpr bound, SemSsaVariable v, SemSsaReadPosition pos) {
posBound(bound, v, pos) and TPos() = semExprSign(bound)
}
/** Holds if `bound` allows `v` to be negative at `pos`. */
private predicate negBoundOk(SemExpr bound, SemSsaVariable v, SemSsaReadPosition pos) {
negBound(bound, v, pos) and TNeg() = semExprSign(bound)
}
/** Holds if `bound` allows `v` to be zero at `pos`. */
private predicate zeroBoundOk(SemExpr bound, SemSsaVariable v, SemSsaReadPosition pos) {
lowerBound(bound, v, pos, _) and TNeg() = semExprSign(bound)
or
lowerBound(bound, v, pos, false) and TZero() = semExprSign(bound)
or
upperBound(bound, v, pos, _) and TPos() = semExprSign(bound)
or
upperBound(bound, v, pos, false) and TZero() = semExprSign(bound)
or
eqBound(bound, v, pos, true) and TZero() = semExprSign(bound)
or
eqBound(bound, v, pos, false) and TZero() != semExprSign(bound)
}
/**
* Holds if there is a bound that might restrict whether `v` has the sign `s`
* at `pos`.
*/
private predicate hasGuard(SemSsaVariable v, SemSsaReadPosition pos, Sign s) {
s = TPos() and posBound(_, v, pos)
or
s = TNeg() and negBound(_, v, pos)
or
s = TZero() and zeroBound(_, v, pos)
}
/**
* Gets a possible sign of `v` at `pos` based on its definition, where the sign
* might be ruled out by a guard.
*/
pragma[noinline]
private Sign guardedSsaSign(SemSsaVariable v, SemSsaReadPosition pos) {
result = semSsaDefSign(v) and
pos.hasReadOfVar(v) and
hasGuard(v, pos, result)
}
/**
* Gets a possible sign of `v` at `pos` based on its definition, where no guard
* can rule it out.
*/
pragma[noinline]
private Sign unguardedSsaSign(SemSsaVariable v, SemSsaReadPosition pos) {
result = semSsaDefSign(v) and
pos.hasReadOfVar(v) and
not hasGuard(v, pos, result)
}
/**
* Gets a possible sign of `v` at read position `pos`, where a guard could have
* ruled out the sign but does not.
* This does not check that the definition of `v` also allows the sign.
*/
private Sign guardedSsaSignOk(SemSsaVariable v, SemSsaReadPosition pos) {
result = TPos() and
forex(SemExpr bound | posBound(bound, v, pos) | posBoundOk(bound, v, pos))
or
result = TNeg() and
forex(SemExpr bound | negBound(bound, v, pos) | negBoundOk(bound, v, pos))
or
result = TZero() and
forex(SemExpr bound | zeroBound(bound, v, pos) | zeroBoundOk(bound, v, pos))
}
/** Gets a possible sign for `v` at `pos`. */
private Sign semSsaSign(SemSsaVariable v, SemSsaReadPosition pos) {
result = unguardedSsaSign(v, pos)
or
result = guardedSsaSign(v, pos) and
result = guardedSsaSignOk(v, pos)
}
/** Gets a possible sign for `v`. */
pragma[nomagic]
Sign semSsaDefSign(SemSsaVariable v) { result = v.(SignDef).getSign() }
/** Gets a possible sign for `e`. */
cached
Sign semExprSign(SemExpr e) {
exists(Sign s | s = e.(SignExpr).getSign() |
if
getTrackedType(e) instanceof SemUnsignedIntegerType and
s = TNeg() and
not Specific::ignoreTypeRestrictions(e)
then result = TPos()
else result = s
)
}
/**
* Dummy predicate that holds for any sign. This is added to improve readability
* of cases where the sign is unrestricted.
*/
predicate semAnySign(Sign s) { any() }
/** Holds if `e` can be positive and cannot be negative. */
predicate semPositive(SemExpr e) {
semExprSign(e) = TPos() and
not semExprSign(e) = TNeg()
}
/** Holds if `e` can be negative and cannot be positive. */
predicate semNegative(SemExpr e) {
semExprSign(e) = TNeg() and
not semExprSign(e) = TPos()
}
/** Holds if `e` is strictly positive. */
predicate semStrictlyPositive(SemExpr e) {
semExprSign(e) = TPos() and
not semExprSign(e) = TNeg() and
not semExprSign(e) = TZero()
}
/** Holds if `e` is strictly negative. */
predicate semStrictlyNegative(SemExpr e) {
semExprSign(e) = TNeg() and
not semExprSign(e) = TPos() and
not semExprSign(e) = TZero()
hasGuard(v, pos, result)
}
/**
* Gets a possible sign of `v` at `pos` based on its definition, where no guard
* can rule it out.
*/
pragma[noinline]
private Sign unguardedSsaSign(SemSsaVariable v, SemSsaReadPosition pos) {
result = semSsaDefSign(v) and
pos.hasReadOfVar(v) and
not hasGuard(v, pos, result)
}
/**
* Gets a possible sign of `v` at read position `pos`, where a guard could have
* ruled out the sign but does not.
* This does not check that the definition of `v` also allows the sign.
*/
private Sign guardedSsaSignOk(SemSsaVariable v, SemSsaReadPosition pos) {
result = TPos() and
forex(SemExpr bound | posBound(bound, v, pos) | posBoundOk(bound, v, pos))
or
result = TNeg() and
forex(SemExpr bound | negBound(bound, v, pos) | negBoundOk(bound, v, pos))
or
result = TZero() and
forex(SemExpr bound | zeroBound(bound, v, pos) | zeroBoundOk(bound, v, pos))
}
/** Gets a possible sign for `v` at `pos`. */
private Sign semSsaSign(SemSsaVariable v, SemSsaReadPosition pos) {
result = unguardedSsaSign(v, pos)
or
result = guardedSsaSign(v, pos) and
result = guardedSsaSignOk(v, pos)
}
/** Gets a possible sign for `v`. */
pragma[nomagic]
Sign semSsaDefSign(SemSsaVariable v) { result = v.(SignDef).getSign() }
/** Gets a possible sign for `e`. */
cached
Sign semExprSign(SemExpr e) {
exists(Sign s | s = e.(SignExpr).getSign() |
if
Utils::getTrackedType(e) instanceof SemUnsignedIntegerType and
s = TNeg() and
not Specific::ignoreTypeRestrictions(e)
then result = TPos()
else result = s
)
}
/**
* Dummy predicate that holds for any sign. This is added to improve readability
* of cases where the sign is unrestricted.
*/
predicate semAnySign(Sign s) { any() }
/** Holds if `e` can be positive and cannot be negative. */
predicate semPositive(SemExpr e) {
semExprSign(e) = TPos() and
not semExprSign(e) = TNeg()
}
/** Holds if `e` can be negative and cannot be positive. */
predicate semNegative(SemExpr e) {
semExprSign(e) = TNeg() and
not semExprSign(e) = TPos()
}
/** Holds if `e` is strictly positive. */
predicate semStrictlyPositive(SemExpr e) {
semExprSign(e) = TPos() and
not semExprSign(e) = TNeg() and
not semExprSign(e) = TZero()
}
/** Holds if `e` is strictly negative. */
predicate semStrictlyNegative(SemExpr e) {
semExprSign(e) = TNeg() and
not semExprSign(e) = TPos() and
not semExprSign(e) = TZero()
}
}

View File

@@ -1,5 +1,5 @@
name: codeql/cpp-all
version: 0.4.4-dev
version: 0.5.3-dev
groups: cpp
dbscheme: semmlecode.cpp.dbscheme
extractor: cpp
@@ -7,3 +7,4 @@ library: true
upgrades: upgrades
dependencies:
codeql/ssa: ${workspace}
codeql/tutorial: ${workspace}

View File

@@ -189,18 +189,6 @@ class Folder extends Container, @folder {
* Gets the URL of this folder.
*/
deprecated override string getURL() { result = "file://" + this.getAbsolutePath() + ":0:0:0:0" }
/**
* DEPRECATED: use `getAbsolutePath` instead.
* Gets the name of this folder.
*/
deprecated string getName() { folders(underlyingElement(this), result) }
/**
* DEPRECATED: use `getBaseName` instead.
* Gets the last part of the folder name.
*/
deprecated string getShortName() { result = this.getBaseName() }
}
/**

View File

@@ -318,7 +318,7 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
MetricFunction getMetrics() { result = this }
/** Holds if this function calls the function `f`. */
predicate calls(Function f) { exists(Locatable l | this.calls(f, l)) }
predicate calls(Function f) { this.calls(f, _) }
/**
* Holds if this function calls the function `f` in the `FunctionCall`
@@ -335,7 +335,7 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
}
/** Holds if this function accesses a function or variable or enumerator `a`. */
predicate accesses(Declaration a) { exists(Locatable l | this.accesses(a, l)) }
predicate accesses(Declaration a) { this.accesses(a, _) }
/**
* Holds if this function accesses a function or variable or enumerator `a`

View File

@@ -10,12 +10,14 @@ import semmle.code.cpp.File
*/
class Location extends @location {
/** Gets the container corresponding to this location. */
pragma[nomagic]
Container getContainer() { this.fullLocationInfo(result, _, _, _, _) }
/** Gets the file corresponding to this location, if any. */
File getFile() { result = this.getContainer() }
/** Gets the 1-based line number (inclusive) where this location starts. */
pragma[nomagic]
int getStartLine() { this.fullLocationInfo(_, result, _, _, _) }
/** Gets the 1-based column number (inclusive) where this location starts. */

View File

@@ -816,6 +816,12 @@ private predicate floatingPointTypeMapping(
or
// _Float128x
kind = 50 and base = 2 and domain = TRealDomain() and realKind = 50 and extended = true
or
// _Float16
kind = 52 and base = 2 and domain = TRealDomain() and realKind = 52 and extended = false
or
// _Complex _Float16
kind = 53 and base = 2 and domain = TComplexDomain() and realKind = 52 and extended = false
}
/**

View File

@@ -33,7 +33,7 @@ DependencyOptions getDependencyOptions() { any() }
class DependsSource extends Element {
DependsSource() {
// not inside a template instantiation
not exists(Element other | this.isFromTemplateInstantiation(other)) or
not this.isFromTemplateInstantiation(_) or
// allow DeclarationEntrys of template specializations
this.(DeclarationEntry).getDeclaration().(Function).isConstructedFrom(_) or
this.(DeclarationEntry).getDeclaration().(Class).isConstructedFrom(_)

View File

@@ -69,12 +69,9 @@ predicate functionContainsDisabledCode(Function f) {
*/
predicate functionContainsPreprocCode(Function f) {
// `f` contains a preprocessor branch
exists(
PreprocessorBranchDirective pbd, string file, int pbdStartLine, int fBlockStartLine,
int fBlockEndLine
|
exists(string file, int pbdStartLine, int fBlockStartLine, int fBlockEndLine |
functionLocation(f, file, fBlockStartLine, fBlockEndLine) and
pbdLocation(pbd, file, pbdStartLine) and
pbdLocation(_, file, pbdStartLine) and
pbdStartLine <= fBlockEndLine and
pbdStartLine >= fBlockStartLine
)

View File

@@ -397,11 +397,8 @@ private int lengthInBase16(float f) {
/**
* A class to represent format strings that occur as arguments to invocations of formatting functions.
*/
class FormatLiteral extends Literal {
FormatLiteral() {
exists(FormattingFunctionCall ffc | ffc.getFormat() = this) and
this instanceof StringLiteral
}
class FormatLiteral extends Literal instanceof StringLiteral {
FormatLiteral() { exists(FormattingFunctionCall ffc | ffc.getFormat() = this) }
/**
* Gets the function call where this format string is used.

View File

@@ -30,15 +30,12 @@ abstract class ScanfFunction extends Function {
/**
* The standard function `scanf` (and variations).
*/
class Scanf extends ScanfFunction {
class Scanf extends ScanfFunction instanceof TopLevelFunction {
Scanf() {
this instanceof TopLevelFunction and
(
this.hasGlobalOrStdOrBslName("scanf") or // scanf(format, args...)
this.hasGlobalOrStdOrBslName("wscanf") or // wscanf(format, args...)
this.hasGlobalName("_scanf_l") or // _scanf_l(format, locale, args...)
this.hasGlobalName("_wscanf_l") // _wscanf_l(format, locale, args...)
)
this.hasGlobalOrStdOrBslName("scanf") or // scanf(format, args...)
this.hasGlobalOrStdOrBslName("wscanf") or // wscanf(format, args...)
this.hasGlobalName("_scanf_l") or // _scanf_l(format, locale, args...)
this.hasGlobalName("_wscanf_l")
}
override int getInputParameterIndex() { none() }
@@ -49,15 +46,12 @@ class Scanf extends ScanfFunction {
/**
* The standard function `fscanf` (and variations).
*/
class Fscanf extends ScanfFunction {
class Fscanf extends ScanfFunction instanceof TopLevelFunction {
Fscanf() {
this instanceof TopLevelFunction and
(
this.hasGlobalOrStdOrBslName("fscanf") or // fscanf(src_stream, format, args...)
this.hasGlobalOrStdOrBslName("fwscanf") or // fwscanf(src_stream, format, args...)
this.hasGlobalName("_fscanf_l") or // _fscanf_l(src_stream, format, locale, args...)
this.hasGlobalName("_fwscanf_l") // _fwscanf_l(src_stream, format, locale, args...)
)
this.hasGlobalOrStdOrBslName("fscanf") or // fscanf(src_stream, format, args...)
this.hasGlobalOrStdOrBslName("fwscanf") or // fwscanf(src_stream, format, args...)
this.hasGlobalName("_fscanf_l") or // _fscanf_l(src_stream, format, locale, args...)
this.hasGlobalName("_fwscanf_l")
}
override int getInputParameterIndex() { result = 0 }
@@ -68,15 +62,12 @@ class Fscanf extends ScanfFunction {
/**
* The standard function `sscanf` (and variations).
*/
class Sscanf extends ScanfFunction {
class Sscanf extends ScanfFunction instanceof TopLevelFunction {
Sscanf() {
this instanceof TopLevelFunction and
(
this.hasGlobalOrStdOrBslName("sscanf") or // sscanf(src_stream, format, args...)
this.hasGlobalOrStdOrBslName("swscanf") or // swscanf(src, format, args...)
this.hasGlobalName("_sscanf_l") or // _sscanf_l(src, format, locale, args...)
this.hasGlobalName("_swscanf_l") // _swscanf_l(src, format, locale, args...)
)
this.hasGlobalOrStdOrBslName("sscanf") or // sscanf(src_stream, format, args...)
this.hasGlobalOrStdOrBslName("swscanf") or // swscanf(src, format, args...)
this.hasGlobalName("_sscanf_l") or // _sscanf_l(src, format, locale, args...)
this.hasGlobalName("_swscanf_l")
}
override int getInputParameterIndex() { result = 0 }
@@ -87,17 +78,12 @@ class Sscanf extends ScanfFunction {
/**
* The standard(ish) function `snscanf` (and variations).
*/
class Snscanf extends ScanfFunction {
class Snscanf extends ScanfFunction instanceof TopLevelFunction {
Snscanf() {
this instanceof TopLevelFunction and
(
this.hasGlobalName("_snscanf") or // _snscanf(src, max_amount, format, args...)
this.hasGlobalName("_snwscanf") or // _snwscanf(src, max_amount, format, args...)
this.hasGlobalName("_snscanf_l") or // _snscanf_l(src, max_amount, format, locale, args...)
this.hasGlobalName("_snwscanf_l") // _snwscanf_l(src, max_amount, format, locale, args...)
// note that the max_amount is not a limit on the output length, it's an input length
// limit used with non null-terminated strings.
)
this.hasGlobalName("_snscanf") or // _snscanf(src, max_amount, format, args...)
this.hasGlobalName("_snwscanf") or // _snwscanf(src, max_amount, format, args...)
this.hasGlobalName("_snscanf_l") or // _snscanf_l(src, max_amount, format, locale, args...)
this.hasGlobalName("_snwscanf_l")
}
override int getInputParameterIndex() { result = 0 }
@@ -258,9 +244,7 @@ class ScanfFormatLiteral extends Expr {
/**
* Gets the maximum width option of the nth input (empty string if none is given).
*/
string getMaxWidthOpt(int n) {
exists(string spec, string len, string conv | this.parseConvSpec(n, spec, result, len, conv))
}
string getMaxWidthOpt(int n) { this.parseConvSpec(n, _, result, _, _) }
/**
* Gets the maximum width of the nth input.
@@ -270,18 +254,12 @@ class ScanfFormatLiteral extends Expr {
/**
* Gets the length flag of the nth conversion specifier.
*/
string getLength(int n) {
exists(string spec, string width, string conv |
this.parseConvSpec(n, spec, width, result, conv)
)
}
string getLength(int n) { this.parseConvSpec(n, _, _, result, _) }
/**
* Gets the conversion character of the nth conversion specifier.
*/
string getConversionChar(int n) {
exists(string spec, string width, string len | this.parseConvSpec(n, spec, width, len, result))
}
string getConversionChar(int n) { this.parseConvSpec(n, _, _, _, result) }
/**
* Gets the maximum length of the string that can be produced by the nth

View File

@@ -54,7 +54,7 @@ class SubBasicBlock extends ControlFlowNodeBase {
* only condition under which a `SubBasicBlock` may have multiple
* predecessors.
*/
predicate firstInBB() { exists(BasicBlock bb | this.getRankInBasicBlock(bb) = 1) }
predicate firstInBB() { this.getRankInBasicBlock(_) = 1 }
/**
* Holds if this `SubBasicBlock` comes last in its basic block. This is the

View File

@@ -441,8 +441,8 @@ library class ExprEvaluator extends int {
req = mid.(AssignExpr).getRValue()
)
or
exists(VariableAccess va, Variable v, boolean sub1 |
this.interestingVariableAccess(e, va, v, sub1) and
exists(Variable v, boolean sub1 |
this.interestingVariableAccess(e, _, v, sub1) and
req = v.getAnAssignedValue() and
(sub1 = true implies not this.ignoreVariableAssignment(e, v, req)) and
sub = false
@@ -876,7 +876,7 @@ private predicate nonAnalyzableVariableDefinition(Variable v, StmtParent def) {
* empirically to have effect only on a few rare and pathological examples.
*/
private predicate tractableVariable(Variable v) {
not exists(StmtParent def | nonAnalyzableVariableDefinition(v, def)) or
not nonAnalyzableVariableDefinition(v, _) or
strictcount(StmtParent def | nonAnalyzableVariableDefinition(v, def)) < 1000
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -915,18 +915,57 @@ private module Cached {
TDataFlowCallNone() or
TDataFlowCallSome(DataFlowCall call)
cached
newtype TParamNodeOption =
TParamNodeNone() or
TParamNodeSome(ParamNode p)
cached
newtype TReturnCtx =
TReturnCtxNone() or
TReturnCtxNoFlowThrough() or
TReturnCtxMaybeFlowThrough(ReturnPosition pos)
cached
newtype TTypedContentApprox =
MkTypedContentApprox(ContentApprox c, DataFlowType t) {
exists(Content cont |
c = getContentApprox(cont) and
store(_, cont, _, _, t)
)
}
cached
newtype TTypedContent = MkTypedContent(Content c, DataFlowType t) { store(_, c, _, _, t) }
cached
TypedContent getATypedContent(TypedContentApprox c) {
exists(ContentApprox cls, DataFlowType t, Content cont |
c = MkTypedContentApprox(cls, pragma[only_bind_into](t)) and
result = MkTypedContent(cont, pragma[only_bind_into](t)) and
cls = getContentApprox(cont)
)
}
cached
newtype TAccessPathFront =
TFrontNil(DataFlowType t) or
TFrontHead(TypedContent tc)
cached
newtype TApproxAccessPathFront =
TApproxFrontNil(DataFlowType t) or
TApproxFrontHead(TypedContentApprox tc)
cached
newtype TAccessPathFrontOption =
TAccessPathFrontNone() or
TAccessPathFrontSome(AccessPathFront apf)
cached
newtype TApproxAccessPathFrontOption =
TApproxAccessPathFrontNone() or
TApproxAccessPathFrontSome(ApproxAccessPathFront apf)
}
/**
@@ -1304,6 +1343,118 @@ class DataFlowCallOption extends TDataFlowCallOption {
}
}
/** An optional `ParamNode`. */
class ParamNodeOption extends TParamNodeOption {
string toString() {
this = TParamNodeNone() and
result = "(none)"
or
exists(ParamNode p |
this = TParamNodeSome(p) and
result = p.toString()
)
}
}
/**
* A return context used to calculate flow summaries in reverse flow.
*
* The possible values are:
*
* - `TReturnCtxNone()`: no return flow.
* - `TReturnCtxNoFlowThrough()`: return flow, but flow through is not possible.
* - `TReturnCtxMaybeFlowThrough(ReturnPosition pos)`: return flow, of kind `pos`, and
* flow through may be possible.
*/
class ReturnCtx extends TReturnCtx {
string toString() {
this = TReturnCtxNone() and
result = "(none)"
or
this = TReturnCtxNoFlowThrough() and
result = "(no flow through)"
or
exists(ReturnPosition pos |
this = TReturnCtxMaybeFlowThrough(pos) and
result = pos.toString()
)
}
}
/** An approximated `Content` tagged with the type of a containing object. */
class TypedContentApprox extends MkTypedContentApprox {
private ContentApprox c;
private DataFlowType t;
TypedContentApprox() { this = MkTypedContentApprox(c, t) }
/** Gets a typed content approximated by this value. */
TypedContent getATypedContent() { result = getATypedContent(this) }
/** Gets the content. */
ContentApprox getContent() { result = c }
/** Gets the container type. */
DataFlowType getContainerType() { result = t }
/** Gets a textual representation of this approximated content. */
string toString() { result = c.toString() }
}
/**
* The front of an approximated access path. This is either a head or a nil.
*/
abstract class ApproxAccessPathFront extends TApproxAccessPathFront {
abstract string toString();
abstract DataFlowType getType();
abstract boolean toBoolNonEmpty();
TypedContentApprox getHead() { this = TApproxFrontHead(result) }
pragma[nomagic]
TypedContent getAHead() {
exists(TypedContentApprox cont |
this = TApproxFrontHead(cont) and
result = cont.getATypedContent()
)
}
}
class ApproxAccessPathFrontNil extends ApproxAccessPathFront, TApproxFrontNil {
private DataFlowType t;
ApproxAccessPathFrontNil() { this = TApproxFrontNil(t) }
override string toString() { result = ppReprType(t) }
override DataFlowType getType() { result = t }
override boolean toBoolNonEmpty() { result = false }
}
class ApproxAccessPathFrontHead extends ApproxAccessPathFront, TApproxFrontHead {
private TypedContentApprox tc;
ApproxAccessPathFrontHead() { this = TApproxFrontHead(tc) }
override string toString() { result = tc.toString() }
override DataFlowType getType() { result = tc.getContainerType() }
override boolean toBoolNonEmpty() { result = true }
}
/** An optional approximated access path front. */
class ApproxAccessPathFrontOption extends TApproxAccessPathFrontOption {
string toString() {
this = TApproxAccessPathFrontNone() and result = "<none>"
or
this = TApproxAccessPathFrontSome(any(ApproxAccessPathFront apf | result = apf.toString()))
}
}
/** A `Content` tagged with the type of a containing object. */
class TypedContent extends MkTypedContent {
private Content c;
@@ -1336,7 +1487,7 @@ abstract class AccessPathFront extends TAccessPathFront {
abstract DataFlowType getType();
abstract boolean toBoolNonEmpty();
abstract ApproxAccessPathFront toApprox();
TypedContent getHead() { this = TFrontHead(result) }
}
@@ -1350,7 +1501,7 @@ class AccessPathFrontNil extends AccessPathFront, TFrontNil {
override DataFlowType getType() { result = t }
override boolean toBoolNonEmpty() { result = false }
override ApproxAccessPathFront toApprox() { result = TApproxFrontNil(t) }
}
class AccessPathFrontHead extends AccessPathFront, TFrontHead {
@@ -1362,7 +1513,7 @@ class AccessPathFrontHead extends AccessPathFront, TFrontHead {
override DataFlowType getType() { result = tc.getContainerType() }
override boolean toBoolNonEmpty() { result = true }
override ApproxAccessPathFront toApprox() { result.getAHead() = tc }
}
/** An optional access path front. */

View File

@@ -45,6 +45,16 @@ module Consistency {
) {
none()
}
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodeAtPosition`. */
predicate uniqueParameterNodeAtPositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
none()
}
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodePosition`. */
predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
none()
}
}
private class RelevantNode extends Node {
@@ -101,9 +111,7 @@ module Consistency {
exists(int c |
c =
strictcount(Node n |
not exists(string filepath, int startline, int startcolumn, int endline, int endcolumn |
n.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
) and
not n.hasLocationInfo(_, _, _, _, _) and
not any(ConsistencyConfiguration conf).missingLocationExclude(n)
) and
msg = "Nodes without location: " + c
@@ -136,6 +144,18 @@ module Consistency {
msg = "Local flow step does not preserve enclosing callable."
}
query predicate readStepIsLocal(Node n1, Node n2, string msg) {
readStep(n1, _, n2) and
nodeGetEnclosingCallable(n1) != nodeGetEnclosingCallable(n2) and
msg = "Read step does not preserve enclosing callable."
}
query predicate storeStepIsLocal(Node n1, Node n2, string msg) {
storeStep(n1, _, n2) and
nodeGetEnclosingCallable(n1) != nodeGetEnclosingCallable(n2) and
msg = "Store step does not preserve enclosing callable."
}
private DataFlowType typeRepr() { result = getNodeType(_) }
query predicate compatibleTypesReflexive(DataFlowType t, string msg) {
@@ -232,4 +252,27 @@ module Consistency {
not callable = viableCallable(call) and
not any(ConsistencyConfiguration c).viableImplInCallContextTooLargeExclude(call, ctx, callable)
}
query predicate uniqueParameterNodeAtPosition(
DataFlowCallable c, ParameterPosition pos, Node p, string msg
) {
not any(ConsistencyConfiguration conf).uniqueParameterNodeAtPositionExclude(c, pos, p) and
isParameterNode(p, c, pos) and
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
msg = "Parameters with overlapping positions."
}
query predicate uniqueParameterNodePosition(
DataFlowCallable c, ParameterPosition pos, Node p, string msg
) {
not any(ConsistencyConfiguration conf).uniqueParameterNodePositionExclude(c, pos, p) and
isParameterNode(p, c, pos) and
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
msg = "Parameter node with multiple positions."
}
query predicate uniqueContentApprox(Content c, string msg) {
not exists(unique(ContentApprox approx | approx = getContentApprox(c))) and
msg = "Non-unique content approximation."
}
}

View File

@@ -296,6 +296,13 @@ predicate additionalLambdaFlowStep(Node nodeFrom, Node nodeTo, boolean preserves
*/
predicate allowParameterReturnInSelf(ParameterNode p) { none() }
/** An approximated `Content`. */
class ContentApprox = Unit;
/** Gets an approximated value for content `c`. */
pragma[inline]
ContentApprox getContentApprox(Content c) { any() }
private class MyConsistencyConfiguration extends Consistency::ConsistencyConfiguration {
override predicate argHasPostUpdateExclude(ArgumentNode n) {
// Is the null pointer (or something that's not really a pointer)

View File

@@ -450,10 +450,8 @@ module FlowVar_internal {
}
override string toString() {
exists(Expr e |
this.definedByExpr(e, _) and
result = "assignment to " + v
)
this.definedByExpr(_, _) and
result = "assignment to " + v
or
this.definedByInitialValue(_) and
result = "initial value of " + v

View File

@@ -54,7 +54,7 @@ class SubBasicBlock extends ControlFlowNodeBase {
* only condition under which a `SubBasicBlock` may have multiple
* predecessors.
*/
predicate firstInBB() { exists(BasicBlock bb | this.getRankInBasicBlock(bb) = 1) }
predicate firstInBB() { this.getRankInBasicBlock(_) = 1 }
/**
* Holds if this `SubBasicBlock` comes last in its basic block. This is the

View File

@@ -70,8 +70,8 @@ module VirtualDispatch {
* that is, `c` or one of its supertypes overrides `f`.
*/
private predicate cannotInherit(Class c, MemberFunction f) {
exists(Class overridingType, MemberFunction override |
cannotInheritHelper(c, f, overridingType, override) and
exists(MemberFunction override |
cannotInheritHelper(c, f, _, override) and
override.overrides+(f)
)
}

View File

@@ -53,7 +53,7 @@ class Expr extends StmtParent, @expr {
Declaration getEnclosingDeclaration() { result = exprEnclosingElement(this) }
/** Gets a child of this expression. */
Expr getAChild() { exists(int n | result = this.getChild(n)) }
Expr getAChild() { result = this.getChild(_) }
/** Gets the parent of this expression, if any. */
Element getParent() { exprparents(underlyingElement(this), _, unresolveElement(result)) }

View File

@@ -1,642 +1,21 @@
/**
* DEPRECATED: Use `semmle.code.cpp.ir.dataflow.TaintTracking` as a replacement.
*
* An IR taint tracking library that uses an IR DataFlow configuration to track
* taint from user inputs as defined by `semmle.code.cpp.security.Security`.
*/
import cpp
import semmle.code.cpp.security.Security
private import semmle.code.cpp.ir.dataflow.DataFlow
private import semmle.code.cpp.ir.dataflow.internal.DataFlowUtil
private import semmle.code.cpp.ir.dataflow.DataFlow3
private import semmle.code.cpp.ir.IR
private import semmle.code.cpp.ir.dataflow.ResolveCall
private import semmle.code.cpp.controlflow.IRGuards
private import semmle.code.cpp.models.interfaces.Taint
private import semmle.code.cpp.models.interfaces.DataFlow
private import semmle.code.cpp.ir.dataflow.TaintTracking
private import semmle.code.cpp.ir.dataflow.TaintTracking2
private import semmle.code.cpp.ir.dataflow.TaintTracking3
private import semmle.code.cpp.ir.dataflow.internal.ModelUtil
private import semmle.code.cpp.ir.dataflow.internal.DefaultTaintTrackingImpl as DefaultTaintTrackingImpl
/**
* A predictable instruction is one where an external user can predict
* the value. For example, a literal in the source code is considered
* predictable.
*/
private predicate predictableInstruction(Instruction instr) {
instr instanceof ConstantInstruction
or
instr instanceof StringConstantInstruction
or
// This could be a conversion on a string literal
predictableInstruction(instr.(UnaryInstruction).getUnary())
}
deprecated predicate predictableOnlyFlow = DefaultTaintTrackingImpl::predictableOnlyFlow/1;
/**
* Functions that we should only allow taint to flow through (to the return
* value) if all but the source argument are 'predictable'. This is done to
* emulate the old security library's implementation rather than due to any
* strong belief that this is the right approach.
*
* Note that the list itself is not very principled; it consists of all the
* functions listed in the old security library's [default] `isPureFunction`
* that have more than one argument, but are not in the old taint tracking
* library's `returnArgument` predicate.
*/
predicate predictableOnlyFlow(string name) {
name =
[
"strcasestr", "strchnul", "strchr", "strchrnul", "strcmp", "strcspn", "strncmp", "strndup",
"strnlen", "strrchr", "strspn", "strstr", "strtod", "strtof", "strtol", "strtoll", "strtoq",
"strtoul"
]
}
deprecated predicate tainted = DefaultTaintTrackingImpl::tainted/2;
private DataFlow::Node getNodeForSource(Expr source) {
isUserInput(source, _) and
result = getNodeForExpr(source)
}
deprecated predicate taintedIncludingGlobalVars =
DefaultTaintTrackingImpl::taintedIncludingGlobalVars/3;
private DataFlow::Node getNodeForExpr(Expr node) {
result = DataFlow::exprNode(node)
or
// Some of the sources in `isUserInput` are intended to match the value of
// an expression, while others (those modeled below) are intended to match
// the taint that propagates out of an argument, like the `char *` argument
// to `gets`. It's impossible here to tell which is which, but the "access
// to argv" source is definitely not intended to match an output argument,
// and it causes false positives if we let it.
//
// This case goes together with the similar (but not identical) rule in
// `nodeIsBarrierIn`.
result = DataFlow::definitionByReferenceNodeFromArgument(node) and
not argv(node.(VariableAccess).getTarget())
}
deprecated predicate globalVarFromId = DefaultTaintTrackingImpl::globalVarFromId/1;
private class DefaultTaintTrackingCfg extends TaintTracking::Configuration {
DefaultTaintTrackingCfg() { this = "DefaultTaintTrackingCfg" }
override predicate isSource(DataFlow::Node source) { source = getNodeForSource(_) }
override predicate isSink(DataFlow::Node sink) { exists(adjustedSink(sink)) }
override predicate isSanitizer(DataFlow::Node node) { nodeIsBarrier(node) }
override predicate isSanitizerIn(DataFlow::Node node) { nodeIsBarrierIn(node) }
}
private class ToGlobalVarTaintTrackingCfg extends TaintTracking::Configuration {
ToGlobalVarTaintTrackingCfg() { this = "GlobalVarTaintTrackingCfg" }
override predicate isSource(DataFlow::Node source) { source = getNodeForSource(_) }
override predicate isSink(DataFlow::Node sink) {
sink.asVariable() instanceof GlobalOrNamespaceVariable
}
override predicate isAdditionalTaintStep(DataFlow::Node n1, DataFlow::Node n2) {
writesVariable(n1.asInstruction(), n2.asVariable().(GlobalOrNamespaceVariable))
or
readsVariable(n2.asInstruction(), n1.asVariable().(GlobalOrNamespaceVariable))
}
override predicate isSanitizer(DataFlow::Node node) { nodeIsBarrier(node) }
override predicate isSanitizerIn(DataFlow::Node node) { nodeIsBarrierIn(node) }
}
private class FromGlobalVarTaintTrackingCfg extends TaintTracking2::Configuration {
FromGlobalVarTaintTrackingCfg() { this = "FromGlobalVarTaintTrackingCfg" }
override predicate isSource(DataFlow::Node source) {
// This set of sources should be reasonably small, which is good for
// performance since the set of sinks is very large.
exists(ToGlobalVarTaintTrackingCfg otherCfg | otherCfg.hasFlowTo(source))
}
override predicate isSink(DataFlow::Node sink) { exists(adjustedSink(sink)) }
override predicate isAdditionalTaintStep(DataFlow::Node n1, DataFlow::Node n2) {
// Additional step for flow out of variables. There is no flow _into_
// variables in this configuration, so this step only serves to take flow
// out of a variable that's a source.
readsVariable(n2.asInstruction(), n1.asVariable())
}
override predicate isSanitizer(DataFlow::Node node) { nodeIsBarrier(node) }
override predicate isSanitizerIn(DataFlow::Node node) { nodeIsBarrierIn(node) }
}
private predicate readsVariable(LoadInstruction load, Variable var) {
load.getSourceAddress().(VariableAddressInstruction).getAstVariable() = var
}
private predicate writesVariable(StoreInstruction store, Variable var) {
store.getDestinationAddress().(VariableAddressInstruction).getAstVariable() = var
}
/**
* A variable that has any kind of upper-bound check anywhere in the program. This is
* biased towards being inclusive because there are a lot of valid ways of doing an
* upper bounds checks if we don't consider where it occurs, for example:
* ```
* if (x < 10) { sink(x); }
*
* if (10 > y) { sink(y); }
*
* if (z > 10) { z = 10; }
* sink(z);
* ```
*/
// TODO: This coarse overapproximation, ported from the old taint tracking
// library, could be replaced with an actual semantic check that a particular
// variable _access_ is guarded by an upper-bound check. We probably don't want
// to do this right away since it could expose a lot of FPs that were
// previously suppressed by this predicate by coincidence.
private predicate hasUpperBoundsCheck(Variable var) {
exists(RelationalOperation oper, VariableAccess access |
oper.getAnOperand() = access and
access.getTarget() = var and
// Comparing to 0 is not an upper bound check
not oper.getAnOperand().getValue() = "0"
)
}
private predicate nodeIsBarrierEqualityCandidate(
DataFlow::Node node, Operand access, Variable checkedVar
) {
readsVariable(node.asInstruction(), checkedVar) and
any(IRGuardCondition guard).ensuresEq(access, _, _, node.asInstruction().getBlock(), true)
}
cached
private module Cached {
cached
predicate nodeIsBarrier(DataFlow::Node node) {
exists(Variable checkedVar |
readsVariable(node.asInstruction(), checkedVar) and
hasUpperBoundsCheck(checkedVar)
)
or
exists(Variable checkedVar, Operand access |
/*
* This node is guarded by a condition that forces the accessed variable
* to equal something else. For example:
* ```
* x = taintsource()
* if (x == 10) {
* taintsink(x); // not considered tainted
* }
* ```
*/
nodeIsBarrierEqualityCandidate(node, access, checkedVar) and
readsVariable(access.getDef(), checkedVar)
)
}
cached
predicate nodeIsBarrierIn(DataFlow::Node node) {
// don't use dataflow into taint sources, as this leads to duplicate results.
exists(Expr source | isUserInput(source, _) |
node = DataFlow::exprNode(source)
or
// This case goes together with the similar (but not identical) rule in
// `getNodeForSource`.
node = DataFlow::definitionByReferenceNodeFromArgument(source)
)
or
// don't use dataflow into binary instructions if both operands are unpredictable
exists(BinaryInstruction iTo |
iTo = node.asInstruction() and
not predictableInstruction(iTo.getLeft()) and
not predictableInstruction(iTo.getRight()) and
// propagate taint from either the pointer or the offset, regardless of predictability
not iTo instanceof PointerArithmeticInstruction
)
or
// don't use dataflow through calls to pure functions if two or more operands
// are unpredictable
exists(Instruction iFrom1, Instruction iFrom2, CallInstruction iTo |
iTo = node.asInstruction() and
isPureFunction(iTo.getStaticCallTarget().getName()) and
iFrom1 = iTo.getAnArgument() and
iFrom2 = iTo.getAnArgument() and
not predictableInstruction(iFrom1) and
not predictableInstruction(iFrom2) and
iFrom1 != iFrom2
)
}
cached
Element adjustedSink(DataFlow::Node sink) {
// TODO: is it more appropriate to use asConvertedExpr here and avoid
// `getConversion*`? Or will that cause us to miss some cases where there's
// flow to a conversion (like a `ReferenceDereferenceExpr`) and we want to
// pretend there was flow to the converted `Expr` for the sake of
// compatibility.
sink.asExpr().getConversion*() = result
or
// For compatibility, send flow from arguments to parameters, even for
// functions with no body.
exists(FunctionCall call, int i |
sink.asExpr() = call.getArgument(pragma[only_bind_into](i)) and
result = resolveCall(call).getParameter(pragma[only_bind_into](i))
)
or
// For compatibility, send flow into a `Variable` if there is flow to any
// Load or Store of that variable.
exists(CopyInstruction copy |
copy.getSourceValue() = sink.asInstruction() and
(
readsVariable(copy, result) or
writesVariable(copy, result)
) and
not hasUpperBoundsCheck(result)
)
or
// For compatibility, send flow into a `NotExpr` even if it's part of a
// short-circuiting condition and thus might get skipped.
result.(NotExpr).getOperand() = sink.asExpr()
or
// Taint postfix and prefix crement operations when their operand is tainted.
result.(CrementOperation).getAnOperand() = sink.asExpr()
or
// Taint `e1 += e2`, `e &= e2` and friends when `e1` or `e2` is tainted.
result.(AssignOperation).getAnOperand() = sink.asExpr()
or
result =
sink.asOperand()
.(SideEffectOperand)
.getUse()
.(ReadSideEffectInstruction)
.getArgumentDef()
.getUnconvertedResultExpression()
}
/**
* Step to return value of a modeled function when an input taints the
* dereference of the return value.
*/
cached
predicate additionalTaintStep(DataFlow::Node n1, DataFlow::Node n2) {
exists(CallInstruction call, Function func, FunctionInput modelIn, FunctionOutput modelOut |
n1.asOperand() = callInput(call, modelIn) and
(
func.(TaintFunction).hasTaintFlow(modelIn, modelOut)
or
func.(DataFlowFunction).hasDataFlow(modelIn, modelOut)
) and
call.getStaticCallTarget() = func and
modelOut.isReturnValueDeref() and
call = n2.asInstruction()
)
}
}
private import Cached
/**
* Holds if `tainted` may contain taint from `source`.
*
* A tainted expression is either directly user input, or is
* computed from user input in a way that users can probably
* control the exact output of the computation.
*
* This doesn't include data flow through global variables.
* If you need that you must call `taintedIncludingGlobalVars`.
*/
cached
predicate tainted(Expr source, Element tainted) {
exists(DefaultTaintTrackingCfg cfg, DataFlow::Node sink |
cfg.hasFlow(getNodeForSource(source), sink) and
tainted = adjustedSink(sink)
)
}
/**
* Holds if `tainted` may contain taint from `source`, where the taint passed
* through a global variable named `globalVar`.
*
* A tainted expression is either directly user input, or is
* computed from user input in a way that users can probably
* control the exact output of the computation.
*
* This version gives the same results as tainted but also includes
* data flow through global variables.
*
* The parameter `globalVar` is the qualified name of the last global variable
* used to move the value from source to tainted. If the taint did not pass
* through a global variable, then `globalVar = ""`.
*/
cached
predicate taintedIncludingGlobalVars(Expr source, Element tainted, string globalVar) {
tainted(source, tainted) and
globalVar = ""
or
exists(
ToGlobalVarTaintTrackingCfg toCfg, FromGlobalVarTaintTrackingCfg fromCfg,
DataFlow::VariableNode variableNode, GlobalOrNamespaceVariable global, DataFlow::Node sink
|
global = variableNode.getVariable() and
toCfg.hasFlow(getNodeForSource(source), variableNode) and
fromCfg.hasFlow(variableNode, sink) and
tainted = adjustedSink(sink) and
global = globalVarFromId(globalVar)
)
}
/**
* Gets the global variable whose qualified name is `id`. Use this predicate
* together with `taintedIncludingGlobalVars`. Example:
*
* ```
* exists(string varName |
* taintedIncludingGlobalVars(source, tainted, varName) and
* var = globalVarFromId(varName)
* )
* ```
*/
GlobalOrNamespaceVariable globalVarFromId(string id) { id = result.getQualifiedName() }
/**
* Provides definitions for augmenting source/sink pairs with data-flow paths
* between them. From a `@kind path-problem` query, import this module in the
* global scope, extend `TaintTrackingConfiguration`, and use `taintedWithPath`
* in place of `tainted`.
*
* Importing this module will also import the query predicates that contain the
* taint paths.
*/
module TaintedWithPath {
private newtype TSingleton = MkSingleton()
/**
* A taint-tracking configuration that matches sources and sinks in the same
* way as the `tainted` predicate.
*
* Override `isSink` and `taintThroughGlobals` as needed, but do not provide
* a characteristic predicate.
*/
class TaintTrackingConfiguration extends TSingleton {
/** Override this to specify which elements are sources in this configuration. */
predicate isSource(Expr source) { exists(getNodeForSource(source)) }
/** Override this to specify which elements are sinks in this configuration. */
abstract predicate isSink(Element e);
/** Override this to specify which expressions are barriers in this configuration. */
predicate isBarrier(Expr e) { nodeIsBarrier(getNodeForExpr(e)) }
/**
* Override this predicate to `any()` to allow taint to flow through global
* variables.
*/
predicate taintThroughGlobals() { none() }
/** Gets a textual representation of this element. */
string toString() { result = "TaintTrackingConfiguration" }
}
private class AdjustedConfiguration extends TaintTracking3::Configuration {
AdjustedConfiguration() { this = "AdjustedConfiguration" }
override predicate isSource(DataFlow::Node source) {
exists(TaintTrackingConfiguration cfg, Expr e |
cfg.isSource(e) and source = getNodeForExpr(e)
)
}
override predicate isSink(DataFlow::Node sink) {
exists(TaintTrackingConfiguration cfg | cfg.isSink(adjustedSink(sink)))
}
override predicate isAdditionalTaintStep(DataFlow::Node n1, DataFlow::Node n2) {
// Steps into and out of global variables
exists(TaintTrackingConfiguration cfg | cfg.taintThroughGlobals() |
writesVariable(n1.asInstruction(), n2.asVariable().(GlobalOrNamespaceVariable))
or
readsVariable(n2.asInstruction(), n1.asVariable().(GlobalOrNamespaceVariable))
)
or
additionalTaintStep(n1, n2)
}
override predicate isSanitizer(DataFlow::Node node) {
exists(TaintTrackingConfiguration cfg, Expr e | cfg.isBarrier(e) and node = getNodeForExpr(e))
}
override predicate isSanitizerIn(DataFlow::Node node) { nodeIsBarrierIn(node) }
}
/*
* A sink `Element` may map to multiple `DataFlowX::PathNode`s via (the
* inverse of) `adjustedSink`. For example, an `Expr` maps to all its
* conversions, and a `Variable` maps to all loads and stores from it. Because
* the path node is part of the tuple that constitutes the alert, this leads
* to duplicate alerts.
*
* To avoid showing duplicates, we edit the graph to replace the final node
* coming from the data-flow library with a node that matches exactly the
* `Element` sink that's requested.
*
* The same is done for sources.
*/
private newtype TPathNode =
TWrapPathNode(DataFlow3::PathNode n) or
// There's a single newtype constructor for both sources and sinks since
// that makes it easiest to deal with the case where source = sink.
TEndpointPathNode(Element e) {
exists(AdjustedConfiguration cfg, DataFlow3::Node sourceNode, DataFlow3::Node sinkNode |
cfg.hasFlow(sourceNode, sinkNode)
|
sourceNode = getNodeForExpr(e) and
exists(TaintTrackingConfiguration ttCfg | ttCfg.isSource(e))
or
e = adjustedSink(sinkNode) and
exists(TaintTrackingConfiguration ttCfg | ttCfg.isSink(e))
)
}
/** An opaque type used for the nodes of a data-flow path. */
class PathNode extends TPathNode {
/** Gets a textual representation of this element. */
string toString() { none() }
/**
* Holds if this element is at the specified location.
* The location spans column `startcolumn` of line `startline` to
* column `endcolumn` of line `endline` in file `filepath`.
* For more information, see
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
*/
predicate hasLocationInfo(
string filepath, int startline, int startcolumn, int endline, int endcolumn
) {
none()
}
}
/**
* INTERNAL: Do not use.
*/
module Private {
/** Gets a predecessor `PathNode` of `pathNode`, if any. */
PathNode getAPredecessor(PathNode pathNode) { edges(result, pathNode) }
/** Gets the element that `pathNode` wraps, if any. */
Element getElementFromPathNode(PathNode pathNode) {
exists(DataFlow::Node node | node = pathNode.(WrapPathNode).inner().getNode() |
result = node.asInstruction().getAst()
or
result = node.asOperand().getDef().getAst()
)
or
result = pathNode.(EndpointPathNode).inner()
}
}
private class WrapPathNode extends PathNode, TWrapPathNode {
DataFlow3::PathNode inner() { this = TWrapPathNode(result) }
override string toString() { result = this.inner().toString() }
override predicate hasLocationInfo(
string filepath, int startline, int startcolumn, int endline, int endcolumn
) {
this.inner().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
}
}
private class EndpointPathNode extends PathNode, TEndpointPathNode {
Expr inner() { this = TEndpointPathNode(result) }
override string toString() { result = this.inner().toString() }
override predicate hasLocationInfo(
string filepath, int startline, int startcolumn, int endline, int endcolumn
) {
this.inner()
.getLocation()
.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
}
}
/** A PathNode whose `Element` is a source. It may also be a sink. */
private class InitialPathNode extends EndpointPathNode {
InitialPathNode() { exists(TaintTrackingConfiguration cfg | cfg.isSource(this.inner())) }
}
/** A PathNode whose `Element` is a sink. It may also be a source. */
private class FinalPathNode extends EndpointPathNode {
FinalPathNode() { exists(TaintTrackingConfiguration cfg | cfg.isSink(this.inner())) }
}
/** Holds if `(a,b)` is an edge in the graph of data flow path explanations. */
query predicate edges(PathNode a, PathNode b) {
DataFlow3::PathGraph::edges(a.(WrapPathNode).inner(), b.(WrapPathNode).inner())
or
// To avoid showing trivial-looking steps, we _replace_ the last node instead
// of adding an edge out of it.
exists(WrapPathNode sinkNode |
DataFlow3::PathGraph::edges(a.(WrapPathNode).inner(), sinkNode.inner()) and
b.(FinalPathNode).inner() = adjustedSink(sinkNode.inner().getNode())
)
or
// Same for the first node
exists(WrapPathNode sourceNode |
DataFlow3::PathGraph::edges(sourceNode.inner(), b.(WrapPathNode).inner()) and
sourceNode.inner().getNode() = getNodeForExpr(a.(InitialPathNode).inner())
)
or
// Finally, handle the case where the path goes directly from a source to a
// sink, meaning that they both need to be translated.
exists(WrapPathNode sinkNode, WrapPathNode sourceNode |
DataFlow3::PathGraph::edges(sourceNode.inner(), sinkNode.inner()) and
sourceNode.inner().getNode() = getNodeForExpr(a.(InitialPathNode).inner()) and
b.(FinalPathNode).inner() = adjustedSink(sinkNode.inner().getNode())
)
}
/**
* Holds if there is flow from `arg` to `out` across a call that can by summarized by the flow
* from `par` to `ret` within it, in the graph of data flow path explanations.
*/
query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) {
DataFlow3::PathGraph::subpaths(arg.(WrapPathNode).inner(), par.(WrapPathNode).inner(),
ret.(WrapPathNode).inner(), out.(WrapPathNode).inner())
or
// To avoid showing trivial-looking steps, we _replace_ the last node instead
// of adding an edge out of it.
exists(WrapPathNode sinkNode |
DataFlow3::PathGraph::subpaths(arg.(WrapPathNode).inner(), par.(WrapPathNode).inner(),
ret.(WrapPathNode).inner(), sinkNode.inner()) and
out.(FinalPathNode).inner() = adjustedSink(sinkNode.inner().getNode())
)
or
// Same for the first node
exists(WrapPathNode sourceNode |
DataFlow3::PathGraph::subpaths(sourceNode.inner(), par.(WrapPathNode).inner(),
ret.(WrapPathNode).inner(), out.(WrapPathNode).inner()) and
sourceNode.inner().getNode() = getNodeForExpr(arg.(InitialPathNode).inner())
)
or
// Finally, handle the case where the path goes directly from a source to a
// sink, meaning that they both need to be translated.
exists(WrapPathNode sinkNode, WrapPathNode sourceNode |
DataFlow3::PathGraph::subpaths(sourceNode.inner(), par.(WrapPathNode).inner(),
ret.(WrapPathNode).inner(), sinkNode.inner()) and
sourceNode.inner().getNode() = getNodeForExpr(arg.(InitialPathNode).inner()) and
out.(FinalPathNode).inner() = adjustedSink(sinkNode.inner().getNode())
)
}
/** Holds if `n` is a node in the graph of data flow path explanations. */
query predicate nodes(PathNode n, string key, string val) {
key = "semmle.label" and val = n.toString()
}
/**
* Holds if `tainted` may contain taint from `source`, where `sourceNode` and
* `sinkNode` are the corresponding `PathNode`s that can be used in a query
* to provide path explanations. Extend `TaintTrackingConfiguration` to use
* this predicate.
*
* A tainted expression is either directly user input, or is computed from
* user input in a way that users can probably control the exact output of
* the computation.
*/
predicate taintedWithPath(Expr source, Element tainted, PathNode sourceNode, PathNode sinkNode) {
exists(AdjustedConfiguration cfg, DataFlow3::Node flowSource, DataFlow3::Node flowSink |
source = sourceNode.(InitialPathNode).inner() and
flowSource = getNodeForExpr(source) and
cfg.hasFlow(flowSource, flowSink) and
tainted = adjustedSink(flowSink) and
tainted = sinkNode.(FinalPathNode).inner()
)
}
private predicate isGlobalVariablePathNode(WrapPathNode n) {
n.inner().getNode().asVariable() instanceof GlobalOrNamespaceVariable
}
private predicate edgesWithoutGlobals(PathNode a, PathNode b) {
edges(a, b) and
not isGlobalVariablePathNode(a) and
not isGlobalVariablePathNode(b)
}
/**
* Holds if `tainted` can be reached from a taint source without passing
* through a global variable.
*/
predicate taintedWithoutGlobals(Element tainted) {
exists(AdjustedConfiguration cfg, PathNode sourceNode, FinalPathNode sinkNode |
cfg.isSource(sourceNode.(WrapPathNode).inner().getNode()) and
edgesWithoutGlobals+(sourceNode, sinkNode) and
tainted = sinkNode.inner()
)
}
}
deprecated module TaintedWithPath = DefaultTaintTrackingImpl::TaintedWithPath;

View File

@@ -5,7 +5,6 @@
*/
private import cpp
import semmle.code.cpp.ir.dataflow.DataFlow
private import semmle.code.cpp.ir.IR
/**
@@ -25,18 +24,18 @@ abstract class MustFlowConfiguration extends string {
/**
* Holds if `source` is a relevant data flow source.
*/
abstract predicate isSource(DataFlow::Node source);
abstract predicate isSource(Instruction source);
/**
* Holds if `sink` is a relevant data flow sink.
*/
abstract predicate isSink(DataFlow::Node sink);
abstract predicate isSink(Operand sink);
/**
* Holds if the additional flow step from `node1` to `node2` must be taken
* into account in the analysis.
*/
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) { none() }
predicate isAdditionalFlowStep(Operand node1, Instruction node2) { none() }
/** Holds if this configuration allows flow from arguments to parameters. */
predicate allowInterproceduralFlow() { any() }
@@ -48,17 +47,17 @@ abstract class MustFlowConfiguration extends string {
* included in the module `PathGraph`.
*/
final predicate hasFlowPath(MustFlowPathNode source, MustFlowPathSink sink) {
this.isSource(source.getNode()) and
this.isSource(source.getInstruction()) and
source.getASuccessor+() = sink
}
}
/** Holds if `node` flows from a source. */
pragma[nomagic]
private predicate flowsFromSource(DataFlow::Node node, MustFlowConfiguration config) {
private predicate flowsFromSource(Instruction node, MustFlowConfiguration config) {
config.isSource(node)
or
exists(DataFlow::Node mid |
exists(Instruction mid |
step(mid, node, config) and
flowsFromSource(mid, pragma[only_bind_into](config))
)
@@ -66,12 +65,12 @@ private predicate flowsFromSource(DataFlow::Node node, MustFlowConfiguration con
/** Holds if `node` flows to a sink. */
pragma[nomagic]
private predicate flowsToSink(DataFlow::Node node, MustFlowConfiguration config) {
private predicate flowsToSink(Instruction node, MustFlowConfiguration config) {
flowsFromSource(node, pragma[only_bind_into](config)) and
(
config.isSink(node)
config.isSink(node.getAUse())
or
exists(DataFlow::Node mid |
exists(Instruction mid |
step(node, mid, config) and
flowsToSink(mid, pragma[only_bind_into](config))
)
@@ -198,12 +197,13 @@ private module Cached {
}
cached
predicate step(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
instructionToOperandStep(nodeFrom.asInstruction(), nodeTo.asOperand())
predicate step(Instruction nodeFrom, Instruction nodeTo) {
exists(Operand mid |
instructionToOperandStep(nodeFrom, mid) and
operandToInstructionStep(mid, nodeTo)
)
or
flowThroughCallable(nodeFrom.asInstruction(), nodeTo.asInstruction())
or
operandToInstructionStep(nodeFrom.asOperand(), nodeTo.asInstruction())
flowThroughCallable(nodeFrom, nodeTo)
}
}
@@ -213,12 +213,12 @@ private module Cached {
* way around.
*/
pragma[inline]
private Declaration getEnclosingCallable(DataFlow::Node n) {
pragma[only_bind_into](result) = pragma[only_bind_out](n).getEnclosingCallable()
private IRFunction getEnclosingCallable(Instruction n) {
pragma[only_bind_into](result) = pragma[only_bind_out](n).getEnclosingIRFunction()
}
/** Holds if `nodeFrom` flows to `nodeTo`. */
private predicate step(DataFlow::Node nodeFrom, DataFlow::Node nodeTo, MustFlowConfiguration config) {
private predicate step(Instruction nodeFrom, Instruction nodeTo, MustFlowConfiguration config) {
exists(config) and
Cached::step(pragma[only_bind_into](nodeFrom), pragma[only_bind_into](nodeTo)) and
(
@@ -227,37 +227,37 @@ private predicate step(DataFlow::Node nodeFrom, DataFlow::Node nodeTo, MustFlowC
getEnclosingCallable(nodeFrom) = getEnclosingCallable(nodeTo)
)
or
config.isAdditionalFlowStep(nodeFrom, nodeTo)
config.isAdditionalFlowStep(nodeFrom.getAUse(), nodeTo)
}
private newtype TLocalPathNode =
MkLocalPathNode(DataFlow::Node n, MustFlowConfiguration config) {
MkLocalPathNode(Instruction n, MustFlowConfiguration config) {
flowsToSink(n, config) and
(
config.isSource(n)
or
exists(MustFlowPathNode mid | step(mid.getNode(), n, config))
exists(MustFlowPathNode mid | step(mid.getInstruction(), n, config))
)
}
/** A `Node` that is in a path from a source to a sink. */
class MustFlowPathNode extends TLocalPathNode {
DataFlow::Node n;
Instruction n;
MustFlowPathNode() { this = MkLocalPathNode(n, _) }
/** Gets the underlying node. */
DataFlow::Node getNode() { result = n }
Instruction getInstruction() { result = n }
/** Gets a textual representation of this node. */
string toString() { result = n.toString() }
string toString() { result = n.getAst().toString() }
/** Gets the location of this element. */
Location getLocation() { result = n.getLocation() }
/** Gets a successor node, if any. */
MustFlowPathNode getASuccessor() {
step(this.getNode(), result.getNode(), this.getConfiguration())
step(this.getInstruction(), result.getInstruction(), this.getConfiguration())
}
/** Gets the associated configuration. */
@@ -265,7 +265,7 @@ class MustFlowPathNode extends TLocalPathNode {
}
private class MustFlowPathSink extends MustFlowPathNode {
MustFlowPathSink() { this.getConfiguration().isSink(this.getNode()) }
MustFlowPathSink() { this.getConfiguration().isSink(this.getInstruction().getAUse()) }
}
/**

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