Compare commits

..

491 Commits

Author SHA1 Message Date
Chuan-kai Lin
39a67b6e2e Merge pull request #17903 from github/release-prep/2.19.3
Release preparation for version 2.19.3
2024-11-04 08:42:12 -08:00
github-actions[bot]
cc7b724123 Release preparation for version 2.19.3 2024-11-04 16:37:28 +00:00
Florin Coada
7418d8ed24 Merge pull request #17832 from github/changedocs/2.19.2
CodeQL 2.19.2 changedocs
2024-11-04 13:56:28 +00:00
Tom Hvitved
0aee809697 Merge pull request #17899 from hvitved/accept-changes-multi-jobs
Handle matrix jobs in accept changes script
2024-11-04 14:54:21 +01:00
Rasmus Wriedt Larsen
5f20f1984c expected-changes: Use set constructor 2024-11-04 14:14:15 +01:00
Rasmus Wriedt Larsen
8f80c24270 Merge pull request #17256 from RasmusWL/js-threat-models
JS: Add support for threat models
2024-11-04 14:04:12 +01:00
Simon Friis Vindum
34e8ea17d8 Merge pull request #17898 from paldepind/rust-cfg-refactor
Rust: CFG classes are in expression module iff they correspond to exp…
2024-11-04 13:01:15 +01:00
Tom Hvitved
a89c82bf74 Handle matrix jobs in accept changes script 2024-11-04 11:49:35 +01:00
Simon Friis Vindum
fb26f7861f Merge pull request #17895 from paldepind/rust-data-flow-consistency-query
Rust: Add data flow consistency queries
2024-11-04 11:07:46 +01:00
Simon Friis Vindum
714e2fc2c1 Merge branch 'main' into rust-data-flow-consistency-query 2024-11-04 10:42:53 +01:00
Simon Friis Vindum
2ae721bd54 Merge pull request #17897 from github/redsun82/rust-fix-compilation
Rust: fix semantic merge conflict about semantics
2024-11-04 10:35:47 +01:00
Simon Friis Vindum
633bac633c Rust: CFG classes are in expression module iff they correspond to expressions 2024-11-04 10:34:08 +01:00
Simon Friis Vindum
7f344fab78 Rust: Add data flow consistency queries 2024-11-04 10:17:50 +01:00
Paolo Tranquilli
6848a22c65 Rust: fix semantic merge conflict about semantics 2024-11-04 10:04:40 +01:00
Paolo Tranquilli
bde517fcb1 Merge pull request #17849 from github/aibaars/single-semantics
Rust: try to speed things up a bit
2024-11-04 09:24:26 +01:00
Tom Hvitved
662a824312 Merge pull request #17865 from hvitved/rust/unused-macro-expansion 2024-11-03 09:17:14 +01:00
Tom Hvitved
c4adec3010 Address review comment 2024-11-01 15:28:17 +01:00
yoff
cec0544ca5 Merge pull request #17789 from aschackmull/python/resolvecall-refactor
Python: Refactor references to NormalCall.
2024-11-01 14:20:34 +01:00
Taus
0bb5b4b9dc Merge pull request #17875 from github/tausbn/python-improve-parser-logging-and-timing
Python: Improve parser logging/timing/customisability
2024-11-01 12:47:46 +01:00
Taus
2892f0ff48 Merge pull request #17873 from github/tausbn/python-fix-generator-expression-locations
Python: Even more parser fixes
2024-11-01 12:47:19 +01:00
Rasmus Wriedt Larsen
c0ad9ba529 Merge branch 'main' into js-threat-models 2024-11-01 10:48:32 +01:00
Rasmus Wriedt Larsen
dc8e645594 JS: Convert remaining queries to use ActiveThreatModelSourceAsSource 2024-11-01 10:47:10 +01:00
Tom Hvitved
03ffaac87a Merge pull request #17880 from hvitved/ruby/symbol-string-key-indifference
Ruby: Do not distinguish between symbols and strings in hash keys
2024-11-01 10:43:56 +01:00
Rasmus Wriedt Larsen
19fae76a94 JS: Remove dummy comment
Co-authored-by: Asger F <asgerf@github.com>
2024-11-01 10:24:22 +01:00
Paolo Tranquilli
03aef50836 Merge pull request #17883 from github/redsun82/rust-analysis
Rust: use common config for analysis
2024-10-31 17:46:15 +01:00
Paolo Tranquilli
c6585b726a Rust: use common config for analysis
Now that the nightly bundle has the default query set, we don't need a special
inline config.
2024-10-31 16:44:07 +01:00
Jeroen Ketema
03ced1795a Merge pull request #17694 from jketema/multiple-entry-point
C++: Do not generate IR for functions with multiple entry points
2024-10-31 16:16:03 +01:00
Rasmus Wriedt Larsen
61e60de969 JS: Model readline as a stdin threat-model source
Technically not always true, but my assumption is that +90% of the time
that's what it will be used for, so while we could be more precise by
adding a taint-step from the `input` part of the construction, I'm not
sure it's worth it in this case.

Furthermore, doing so would break with the current way we model
threat-model sources, and how sources are generally modeled in JS... so
for a very pretty setup it would require changing all the other `file`
threat-model sources to start at the constructors such as
`fs.createReadStream()` and have taint-propagation steps towards the
actual use (like we do in Python)...

I couldn't see an easy path forwards for doing this while keeping the
Concepts integration, so I opted for the simpler solution here.
2024-10-31 14:29:30 +01:00
Rasmus Wriedt Larsen
eca8bf5a35 JS: Do simple modeling of process.stdin as threat-model source 2024-10-31 14:26:45 +01:00
Rasmus Wriedt Larsen
34b86c39c1 JS: Model fs.promises.readFile as file source
You could argue that proper modeling be done in the same way as
`NodeJSFileSystemAccessRead` is done for the callback based `fs` API (in
NodeJSLib.qll). However, that work is straying from the core goals I'm
working towards right now, so I'll argue that "perfect is the enemy of
good", and leave this as is for now.
2024-10-31 14:09:38 +01:00
Rasmus Wriedt Larsen
971f53870e JS: Include fs externs
Makes a difference due to the modeling of NodeJSFileSystemAccessRead depending on these, see
412e841d69/javascript/ql/lib/semmle/javascript/frameworks/NodeJSLib.qll (L479-L488)

File copied from 7cef4322e7/javascript/externs/nodejs/fs.js
2024-10-31 13:51:22 +01:00
Rasmus Wriedt Larsen
b47fa77dc6 JS: Add tests for stdin threat-model sources 2024-10-31 12:59:21 +01:00
Tom Hvitved
d0f9a0b9ce Rust: Add another unused-value test 2024-10-31 11:43:33 +01:00
Tom Hvitved
55a6ed7e8a Rust: Include link to variable in unused value query 2024-10-31 11:42:44 +01:00
Tom Hvitved
2b340b18dd Rust: Exclude results inside macro expansions from unused entity queries 2024-10-31 11:42:43 +01:00
Tom Hvitved
fec31a6da4 Rust: Include variable name in Unused{Variable,Value}.ql 2024-10-31 11:42:41 +01:00
Tom Hvitved
6b60865d7e Ruby: Do not distinguish between symbols and strings in hash keys 2024-10-31 11:42:09 +01:00
Tom Hvitved
2b37c6cd32 Merge pull request #17548 from hvitved/shared/inline-test-post-process
Shared: Post-processing query for inline test expectations
2024-10-31 11:40:11 +01:00
Tom Hvitved
f04a55ecb5 Ruby: Update hash extension tests 2024-10-31 11:00:33 +01:00
Jeroen Ketema
5e3748ac12 C++: Update expected test results 2024-10-31 10:57:12 +01:00
Jeroen Ketema
1a830cdf14 C++: Do not generate IR for functions with multiple entry points in different locations 2024-10-31 10:55:52 +01:00
Jeroen Ketema
8cfd19cf2f C++: Add multiple entry point test 2024-10-31 10:55:48 +01:00
Tom Hvitved
977eb05f31 Merge pull request #17879 from paldepind/rust-speculative-taint
Rust: Add predicate for speculative taint step
2024-10-31 10:17:48 +01:00
Simon Friis Vindum
00b8a29da7 Rust: Add predicate for speculative taint step 2024-10-31 09:09:39 +01:00
Simon Friis Vindum
b96698aee3 Merge pull request #17871 from paldepind/rust-data-flow-skeleton
Rust: Add basic skeleton setup for data flow
2024-10-31 08:26:11 +01:00
Tom Hvitved
c936468b17 Merge pull request #17739 from hvitved/dataflow/big-step-quadratic 2024-10-31 08:16:16 +01:00
Anders Schack-Mulligen
b556590ef8 Merge pull request #17663 from aschackmull/dataflow/speculative-flow
Dataflow: Add support for speculative taint flow.
2024-10-31 08:12:43 +01:00
Paolo Tranquilli
7e8a09aea1 Merge pull request #17825 from github/redsun82/rust-canonical-path
Rust: add `extended_canonical_path` and `crate_origin` to `Item`
2024-10-30 18:13:05 +01:00
Simon Friis Vindum
efa59fd2b6 Rust: Make changes based on PR feedback 2024-10-30 16:01:26 +01:00
Anders Schack-Mulligen
570b042645 Dataflow: Rename SpeculativeFlow to SpeculativeGlobal. 2024-10-30 15:23:15 +01:00
Taus
2ef3ae9860 Python: Improve parser logging/timing/customisability
Does a bunch of things, unfortunately all in the same place, so my
apologies in advance for a slightly complicated commit.

As for the changes themselves, this commit

- Adds timers for the old and new parsers. This means we get the overall
time spent on these parts of the extractor if the extractor is run with
`DEBUG` output shown.
- Adds logging information (at the `DEBUG` level) to show which
invocations of the parsers happen when, and whether they succeed or not.
- Adds support for using an environment variable named
`CODEQL_PYTHON_DISABLE_OLD_PARSER` to disable using the old parser
entirely. This makes it easier to test the new parser in isolation.
- Fixes a bug where we did not check whether a parse with the new parser
had already succeeded, and so would do a superfluous second parse.
2024-10-30 13:58:46 +00:00
Taus
f75615b913 Merge pull request #17822 from github/tausbn/python-more-parser-fixes
Python: A few more parser fixes
2024-10-30 13:47:10 +01:00
Arthur Baars
0e511d640b Rust: avoid panics
If:
* the text for a file_id is not found (likely non-utf data in file)
* path does not appear in Vfs, in which case we fall back on loading the file from disk with no "semantics" available
2024-10-30 13:18:36 +01:00
Simon Friis Vindum
44bebedae6 Rust: Add basic skeleton setup for data flow 2024-10-30 13:16:26 +01:00
Tom Hvitved
495c92df38 Shared: Also take query ID into account in PathProblemSourceTestInput 2024-10-30 10:54:40 +01:00
Chris Smowton
2b678c97ab Merge pull request #17870 from charmander/patch-1
Fix typo and grammar in InsecureCookie.qhelp
2024-10-30 09:48:20 +00:00
Chris Smowton
5f31adc1f4 Update InsecureCookie.qhelp
Gratuitous commit to nudge CI
2024-10-30 09:34:49 +00:00
Tom Hvitved
ff9811b488 C#: Add tests for the inline test post-processor 2024-10-30 10:09:40 +01:00
Charmander
a97998811a Fix typo and grammar in InsecureCookie.qhelp 2024-10-30 07:29:20 +00:00
Paolo Tranquilli
4c73c6284e Merge pull request #17867 from github/dbartol/actions-build
Add the Actions extractor to the build
2024-10-30 05:48:41 +01:00
Dave Bartolomeo
b07642b585 Fix linting 2024-10-29 17:09:47 -04:00
Dave Bartolomeo
902a8bd847 Add Actions extractor to build 2024-10-29 16:54:37 -04:00
Dave Bartolomeo
3c9e19346c Update test expectations 2024-10-29 16:53:36 -04:00
Tom Hvitved
cc94c42f87 Address review comments 2024-10-29 20:36:16 +01:00
Ian Lynagh
b00bbc9ca2 Merge pull request #17731 from igfoo/igfoo/removeErasure
Java/Kotlin: Remove the erasure dbscheme relation
2024-10-29 14:21:57 +00:00
Rasmus Wriedt Larsen
2b6c27eb60 JS: Add initial file threat-model support
However, as indicated by the `MISSING` annotations, we could do better.
2024-10-29 15:14:39 +01:00
Rasmus Wriedt Larsen
3656864695 JS: Add database threat-model source modeling 2024-10-29 15:11:09 +01:00
Tom Hvitved
baeffa2345 Update rust/ql/test/query-tests/unusedentities/unreachable.rs
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2024-10-29 15:00:09 +01:00
Anders Schack-Mulligen
8b5756526c Update python/ql/test/experimental/library-tests/CallGraph/InlineCallGraphTest.ql
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
2024-10-29 13:57:27 +01:00
Tom Hvitved
dd520fea47 Rust: Post-processing query for inline test expectations 2024-10-29 13:37:04 +01:00
Tom Hvitved
1259b7e8e7 JS: Post-processing query for inline test expectations 2024-10-29 13:35:38 +01:00
Tom Hvitved
e5f2bbb6ec Python: Post-processing query for inline test expectations 2024-10-29 13:35:37 +01:00
Tom Hvitved
4750b0de94 C++: Post-processing query for inline test expectations 2024-10-29 13:35:36 +01:00
Tom Hvitved
540b433f5a Go: Post-processing query for inline test expectations 2024-10-29 13:35:35 +01:00
Tom Hvitved
4561770db4 Swift: Post-processing query for inline test expectations 2024-10-29 13:35:34 +01:00
Tom Hvitved
5b5ca05e87 Ruby: Post-processing query for inline test expectations 2024-10-29 13:35:33 +01:00
Tom Hvitved
e2b614d18a Java: Post-processing query for inline test expectations 2024-10-29 13:35:32 +01:00
Tom Hvitved
8ba80fd022 C#: Post-processing query for inline test expectations 2024-10-29 13:35:31 +01:00
Tom Hvitved
e7a3e6bfed Shared: Post-processing query for inline test expectations 2024-10-29 13:35:29 +01:00
Tom Hvitved
b111194fbc Shared: Simplify PrettyPrintModels.ql 2024-10-29 13:35:28 +01:00
Tom Hvitved
c5d699cb6b Merge pull request #17857 from geoffw0/unreachable3
Rust: Fix rust/dead-code
2024-10-29 13:35:10 +01:00
Asger F
879cb7c365 Merge pull request #17864 from asgerf/js/vue-attribute-syntax
JS: Fix parsing of special Vue attributes
2024-10-29 13:23:47 +01:00
Ian Lynagh
251a8a34ed Java: Add up/downgrade scripts 2024-10-29 11:32:22 +00:00
Geoffrey White
6a110368a5 Rust: Rename predicates. 2024-10-29 11:32:22 +00:00
Ian Lynagh
6be2e98796 Java/Kotlin: Remove the erasure relation
It's no longer used
2024-10-29 11:32:20 +00:00
Ian Lynagh
8ab52dba83 Kotlin: Don't write the erasure relation
It's no longer used
2024-10-29 11:32:18 +00:00
Ian Lynagh
6c9739023d Java: Remove redundant getErasure overrides
The root definition covers these cases already
2024-10-29 11:32:16 +00:00
Rasmus Wriedt Larsen
7c7420a9a4 JS: Add change-note 2024-10-29 11:35:56 +01:00
Rasmus Wriedt Larsen
07bc1feb11 Docs: Threat-models supported in JS
Capturing
- 7d3793e718
- e35c2b243a
- e11bfc27bd
2024-10-29 11:33:02 +01:00
Rasmus Wriedt Larsen
84f6b89ced JS: Minor improvements to threat-model Concepts
Mirroring what was done for Python
2024-10-29 11:29:48 +01:00
Asger F
6aef571c17 JS: Bump extractor version string 2024-10-29 11:28:06 +01:00
Asger F
3cc6b11e6b JS: Expand attribute regex to include some Vue attributes 2024-10-29 11:19:01 +01:00
Asger F
560b3da851 JS: Add test with some special Vue attributes 2024-10-29 11:18:17 +01:00
Tom Hvitved
7ddc8f087d Merge pull request #17786 from paldepind/rust-saa-additions
Rust: SSA additions
2024-10-29 09:51:38 +01:00
Tom Hvitved
813ccb9c06 Merge pull request #17855 from hvitved/csharp/comments-mapped-locations
C#: Take mapped locations into account in `Comments.qll`
2024-10-29 08:58:38 +01:00
Erik Krogh Kristensen
733158f8f2 Merge pull request #17860 from erik-krogh/fix-windows
fix the RAM setting on Windows
2024-10-29 08:34:09 +01:00
erik-krogh
2ee88f6774 fix the RAM setting on Windows 2024-10-28 20:39:34 +01:00
Arthur Baars
c87f2c4eb1 Rust: remove unnecessary field 2024-10-28 18:56:20 +01:00
Paolo Tranquilli
2b386c422c Merge pull request #17839 from github/redsun82/rust-analysis
Rust: add codeql analysis workflow
2024-10-28 18:14:32 +01:00
Dave Bartolomeo
d4db759057 Merge pull request #17858 from github/dbartol/actions-placeholder 2024-10-28 11:57:20 -04:00
Dave Bartolomeo
609a6c38e4 Revert "Fix bash nit"
This reverts commit 3228447544.
2024-10-28 11:39:22 -04:00
Dave Bartolomeo
a70ce25144 Merge pull request #17850 from github/dbartol/actions-placeholder
Implement Actions extractor and placeholder Actions QL packs
2024-10-28 11:34:00 -04:00
Taus
5d6600e61f Python: Fix generator expression locations
Our logic for detecting the first and last item in a generator
expression was faulty, sometimes matching comments as well. Because
attributes (like `_location_start`) can only be written once, this
caused `tree-sitter-graph` to get unhappy.

To fix this, we now require the first item to be an `expression`, and
the last one to be either a `for_in_clause` or an `if_clause`.
Crucially, `comment` is neither of these, and this prevents the
unfortunate overlap.
2024-10-28 14:53:09 +00:00
Taus
ef60b730ea Python: Fix parenthesized tuple parser bug
We were writing the `parenthesised` attribute twice on tuples, once
because of the explicit parenthetisation, and once because all non-empty
tuples are parenthesised. This made `tree-sitter-graph` unhappy.

To fix this, we now explicitly check whether a tuple is already
parenthesised, and do nothing if that is the case.
2024-10-28 14:49:45 +00:00
Taus
b4ecc7937d Python: Fix some more async parsing problems
Turns out we were not setting the `is_async` field on anything except
`async for` statements. This commit makes it so that we also do this for
`async def` and `async with`, and adds a test that this produces the
same behaviour as the old parser.
2024-10-28 14:44:02 +00:00
Taus
e710c0a6bf Python: Regenerate parser files 2024-10-28 14:44:01 +00:00
Taus
ac87868097 Python: Fix parsing of await inside expressions
Found when parsing `Lib/test/test_coroutines.py` using the new parser.

For whatever reason, having `await` be an `expression` (with an argument
of the same kind) resulted in a bad parse. Consulting the official
grammar, we see that `await` should actually be a `primary_expression`
instead. This is also more in line with the other unary operators, whose
precedence is shared by the `await` syntax.
2024-10-28 14:44:01 +00:00
Taus
1e51703ce9 Python: Allow escaped quotes/backslashes in raw strings
Quoting the Python documentation (last paragraph of
https://docs.python.org/3/reference/lexical_analysis.html#escape-sequences):

"Even in a raw literal, quotes can be escaped with a backslash, but the
backslash remains in the result; for example, r"\"" is a valid string
literal consisting of two characters: a backslash and a double quote;
r"\" is not a valid string literal (even a raw string cannot end in an
odd number of backslashes)."

We did not handle this correctly in the scanner, as we only consumed the
backslash but not the following single or double quote, resulting in
that character getting interpreted as the end of the string.

To fix this, we do a second lookahead after consuming the backslash, and
if the next character is the end character for the string, we advance
the lexer across it as well.

Similarly, backslashes in raw strings can escape other backslashes.
Thus, for a string like '\\' we must consume the second backslash,
otherwise we'll interpret it as escaping the end quote.
2024-10-28 14:40:24 +00:00
Geoffrey White
eb79bcbc34 Rust: Remove unnecessary line. 2024-10-28 14:36:45 +00:00
Geoffrey White
bf5a0b7bd0 Rust: Rewrite UnreachableCode.ql to be more robust. 2024-10-28 14:36:42 +00:00
Geoffrey White
41df9ae4fc Merge pull request #17854 from geoffw0/cleanuptest
Rust: Clean up unreachable test
2024-10-28 14:29:42 +00:00
Paolo Tranquilli
f5d14dbe07 Merge pull request #17856 from github/redsun82/rust-defaultSuiteFile
Rust: add `defaultSuiteFile`
2024-10-28 15:27:51 +01:00
Simon Friis Vindum
8f8564ddfd Rust: Address PR comments 2024-10-28 15:15:38 +01:00
Dave Bartolomeo
3228447544 Fix bash nit
Co-authored-by: Rasmus Wriedt Larsen <rasmuswl@github.com>
2024-10-28 09:58:11 -04:00
Paolo Tranquilli
5420e52afa Rust: add defaultSuiteFile 2024-10-28 14:56:09 +01:00
Tom Hvitved
cfa1ed38b4 Merge pull request #17844 from hvitved/rust/location-impl
Rust: Cache `Locatable.getLocation` and `Location`
2024-10-28 14:41:36 +01:00
Paolo Tranquilli
5a84d290e6 Rust: ignore test directory 2024-10-28 14:32:53 +01:00
Tom Hvitved
7910af159c C#: Take mapped locations into account in Comments.qll 2024-10-28 14:21:10 +01:00
Paolo Tranquilli
dd4fe2a32b Rust: change analysis config 2024-10-28 14:21:07 +01:00
Tom Hvitved
c93e4385f2 C#: Add a test for a comment with a mapped location 2024-10-28 14:20:24 +01:00
Arthur Baars
2326861b23 Merge pull request #17805 from github/aibaars/local-defs
Rust: Rust: add jump to definition for format arguments
2024-10-28 14:17:40 +01:00
Cornelius Riemenschneider
1972532f1c Merge pull request #17732 from github/criemen/bazel-8
Bazel: Upgrade to 8.0.0rc1
2024-10-28 14:03:20 +01:00
Michael Nebel
058fcc1a51 Merge pull request #17853 from michaelnebel/csharp/madtests
C#: Re-factor test for CWE-611/UntrustedDataInsecureXml.ql to pretty print models.
2024-10-28 13:38:26 +01:00
Tom Hvitved
711dfc3592 Rust: Cache Locatable.getLocation and Location 2024-10-28 13:33:49 +01:00
Arthur Baars
b6c26debef Rust: create single Semantics object for each workspace 2024-10-28 13:29:04 +01:00
Arthur Baars
57cdda3405 Rust: no longer reload files into the RootDatabase
Files were reloaded to handle cases were there was no content
for a file_id, causing a panic. Missing contents was caused by
files that did not contain valid UTF-8 data. These are skipped
by rust-analyzer when it is loading data into the RootDatabase.
2024-10-28 13:29:03 +01:00
Paolo Tranquilli
9c95a17882 Rust: add block ids to canonical paths, making them "extended" 2024-10-28 12:41:05 +01:00
Simon Friis Vindum
cab916453d Rust: Update unused value expected test result 2024-10-28 12:18:00 +01:00
Simon Friis Vindum
b86a5810b3 Rust: Small refactor based on PR feedback 2024-10-28 11:45:46 +01:00
Simon Friis Vindum
c5b01eb629 Merge branch 'main' into rust-saa-additions 2024-10-28 11:42:32 +01:00
Geoffrey White
e5818f6f2e Rust: Fix unused value cases in the unreachable test (they're not interesting, just distract from the point of these tests. 2024-10-28 10:29:31 +00:00
Arthur Baars
fdf99e2f50 Rust: filter out definitions that are inside expanded macros 2024-10-28 11:27:59 +01:00
Geoffrey White
72606d5a59 Rust: Add missing annotations to unreachable test. 2024-10-28 10:22:46 +00:00
Arthur Baars
c4126e4410 Rust: add tests for Definitions.qll 2024-10-28 11:17:48 +01:00
Rasmus Wriedt Larsen
e3c400b0c8 Add auto labeler support for 'Actions' 2024-10-28 10:46:05 +01:00
Rasmus Wriedt Larsen
01fa95f98a Actions: autoformat 2024-10-28 10:43:46 +01:00
Michael Nebel
b112a9b31e Merge pull request #17851 from github/workflow/coverage/update
Update CSV framework coverage reports
2024-10-28 10:38:27 +01:00
Michael Nebel
82ff545424 C#: Re-factor test for CWE-611/UntrustedDataInsecureXml.ql to pretty print models in test case. 2024-10-28 10:36:32 +01:00
Óscar San José
3e77629477 Merge pull request #17838 from github/oscarsj/deprecate-macos-12
Remove macos-12 and its variants, deprecated
2024-10-28 10:32:49 +01:00
Paolo Tranquilli
2fa1c5ebcd Merge branch 'main' into redsun82/rust-analysis 2024-10-28 10:30:08 +01:00
Arthur Baars
40ef9ad805 Rust: make TDef cached 2024-10-28 10:21:43 +01:00
github-actions[bot]
0e5ba2b23e Add changed framework coverage reports 2024-10-28 00:21:56 +00:00
Dave Bartolomeo
8840f91503 Fix formatting 2024-10-25 20:32:01 -04:00
Dave Bartolomeo
4a567344f5 Fix style alerts 2024-10-25 17:59:49 -04:00
Dave Bartolomeo
dffc9e2e31 Create placeholder Actions QL packs 2024-10-25 17:45:05 -04:00
Dave Bartolomeo
47a7d24a1a Implement Actions extractor 2024-10-25 17:44:46 -04:00
Jeroen Ketema
655fa53cdd Merge pull request #17848 from jketema/wrong-format
C++: Add wrong format type builtin function test
2024-10-25 19:11:22 +02:00
Chris Smowton
fa4cc83753 Merge pull request #17837 from smowton/smowton/admin/trim-java-web-jsp-test
Java: Trim JSP test
2024-10-25 17:23:51 +01:00
Paolo Tranquilli
652e47177f Rust: format 2024-10-25 17:44:16 +02:00
Simon Friis Vindum
7db90fe073 Merge pull request #17847 from paldepind/rust-unused-variable-trait
Rust: Don't consider parameters in trait method definitions without bodies as variables
2024-10-25 17:41:04 +02:00
Paolo Tranquilli
719b5e175f Rust: add missing expected files 2024-10-25 17:06:54 +02:00
Paolo Tranquilli
8f6196d5f1 Rust: accept test changes 2024-10-25 16:58:05 +02:00
Paolo Tranquilli
9789059e9f Rust: add more thourough canonical path testing 2024-10-25 16:58:05 +02:00
Paolo Tranquilli
34b1055c13 Rust: accept test changes 2024-10-25 16:58:04 +02:00
Paolo Tranquilli
194e0daa8c Rust: add canonical_path and crate_origin to Item 2024-10-25 16:58:04 +02:00
yoff
7338eafbd4 Merge pull request #16812 from porcupineyhairs/pyloadSsl
Python: Pycurl SSL Disabled
2024-10-25 16:23:25 +02:00
Simon Friis Vindum
bfa6113366 Rust: Fix grammar in comment
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
2024-10-25 16:23:04 +02:00
Jeroen Ketema
ccc2a39abc C++: Add wrong format type builtin function test 2024-10-25 16:16:13 +02:00
Simon Friis Vindum
f7a45e6650 Rust: Don't consider parameters in trait method definitions without bodies as variables 2024-10-25 15:56:58 +02:00
Paolo Tranquilli
ab1b48d687 Merge pull request #17843 from github/redsun82/reduce-log-noise
Rust: reduce log spam and skip debug diagnostics in the DB
2024-10-25 15:33:29 +02:00
Simon Friis Vindum
a5ce3c1570 Rust: Move trait tests for unused entities into main.rs 2024-10-25 15:15:49 +02:00
Rasmus Wriedt Larsen
1726287bf4 JS: Add e2e threat-model test 2024-10-25 15:03:44 +02:00
Rasmus Wriedt Larsen
d3ae4c930e JS: Model newer yargs command-line parsing pattern 2024-10-25 15:03:43 +02:00
Rasmus Wriedt Larsen
3448751b4c JS: Consolidate command-line argument modeling
Such that we can reuse the existing modeling, but have it globally
applied as a threat-model as well.

I Basically just moved the modeling. One important aspect is that this
changes is that the previously query-specific `argsParseStep` is now a
globally applied taint-step. This seems reasonable, if someone applied
the argument parsing to any user-controlled string, it seems correct to
propagate that taint for _any_ query.
2024-10-25 15:03:43 +02:00
Rasmus Wriedt Larsen
412e841d69 JS: Add environment threat-model source 2024-10-25 15:03:43 +02:00
Rasmus Wriedt Larsen
f733ac19a9 JS: Make (most) queries use ActiveThreatModelSource
7 cases looks something like this:

```
class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource {
  RemoteFlowSourceAsSource() { not this instanceof ClientSideRemoteFlowSource }
}
```

(some have variations like `not this.(ClientSideRemoteFlowSource).getKind().isPathOrUrl()`)

javascript/ql/lib/semmle/javascript/security/dataflow/ClientSideUrlRedirectCustomizations.qll
javascript/ql/lib/semmle/javascript/security/dataflow/CommandInjectionCustomizations.qll
javascript/ql/lib/semmle/javascript/security/dataflow/CorsMisconfigurationForCredentialsCustomizations.qll
javascript/ql/lib/semmle/javascript/security/dataflow/RegExpInjectionCustomizations.qll
javascript/ql/lib/semmle/javascript/security/dataflow/RequestForgeryCustomizations.qll
javascript/ql/lib/semmle/javascript/security/dataflow/ResourceExhaustionCustomizations.qll
javascript/ql/lib/semmle/javascript/security/dataflow/TaintedPathCustomizations.qll
2024-10-25 15:03:42 +02:00
Rasmus Wriedt Larsen
4b1c027359 JS: Integrate RemoteFlowSource with ThreatModelSource 2024-10-25 14:52:49 +02:00
Rasmus Wriedt Larsen
dbfbd2c00a JS: Remove 'response' from default threat-models
I didn't want to put the configuration file in
`semmle/javascript/frameworks/**/*.model.yml`, so created `ext/` as in other
languages
2024-10-25 14:52:49 +02:00
Rasmus Wriedt Larsen
05dce8a0be JS: Add test showing default active threat-models 2024-10-25 14:50:59 +02:00
Rasmus Wriedt Larsen
17a6d54e4d JS: Setup basic support for threat-models
Integration with RemoteFlowSource is not straightforward, so postponing
that for later

Naming in other languages:
- `SourceNode` (for QL only modeling)
- `ThreatModelFlowSource` (for active sources from QL or data-extensions)

However, since we use `LocalSourceNode` in Python, and `SourceNode` in
JS (for local source nodes), it seems a bit confusing to follow the same
naming convention as other languages, and instead I came up with new names.
2024-10-25 14:50:59 +02:00
Tom Hvitved
c5da712d10 Merge pull request #17840 from hvitved/shared/inline-test-space
Shared: Add missing spaces in inline test expectation output
2024-10-25 14:23:55 +02:00
Paolo Tranquilli
a760b89895 Rust: small tweaks 2024-10-25 14:13:27 +02:00
Paolo Tranquilli
5230b7b041 Rust: reduce log spam and skip debug diagnostics in the DB 2024-10-25 13:47:13 +02:00
Tom Hvitved
7c4d5981dd Shared: Add missing spaces in inline test expectation output 2024-10-25 13:23:03 +02:00
Arthur Baars
f092594a52 Rust: add location definitions for format arguments 2024-10-25 12:57:08 +02:00
Arthur Baars
997a622496 Rust: also implement localReferences.ql 2024-10-25 12:57:06 +02:00
Paolo Tranquilli
45e9c2ff4d Merge pull request #17841 from github/redsun82/rust-fix-qltest-macos
Rust: fix qltest on macOS, and add CI cross-platform testing of it
2024-10-25 12:56:23 +02:00
Tom Hvitved
ba600b0791 Merge pull request #17829 from hvitved/rust/cfg-stage
Rust: Collapse cached CFG logic into one stage
2024-10-25 12:45:38 +02:00
Arthur Baars
9dc5e2fa36 Merge pull request #17791 from github/aibaars/rust-format-templates
Rust: parse formatting templates
2024-10-25 12:42:35 +02:00
Paolo Tranquilli
4485193f57 Rust: skip output redirection QL test on windows for now 2024-10-25 12:33:47 +02:00
Óscar San José
8f7ed21f5d Update macOS version in workflow file 2024-10-25 12:21:27 +02:00
Arthur Baars
8d4bb97b1a Rust: make VariableAccess non-abstract 2024-10-25 12:21:23 +02:00
Óscar San José
c2a644b740 Update macOS version in build workflow 2024-10-25 12:20:25 +02:00
Paolo Tranquilli
4e8b6dc038 Rust: fix qltest on macOS, and add CI cross-platform testing of it 2024-10-25 12:19:46 +02:00
Michael Nebel
0b538313fb Merge pull request #17666 from michaelnebel/csharp/net8models
C#: Update .NET 8 models.
2024-10-25 11:24:27 +02:00
Arthur Baars
a08b4b7372 Rust: allow VariableAccess elements to have another primary QL class 2024-10-25 11:02:55 +02:00
Arthur Baars
a6e69eb147 Revert "Rust: avoid classes with multiple getAPrimaryQLClass result"
This reverts commit 110d2ea775.
2024-10-25 10:59:31 +02:00
Simon Friis Vindum
334602a50a Rust: Handle calls that might read/write variables through closures
This implementation is copied and adapted from the Ruby SSA
implementation.
2024-10-25 10:50:32 +02:00
Simon Friis Vindum
75103f4b26 Merge branch 'main' into rust-saa-additions 2024-10-25 10:43:59 +02:00
Paolo Tranquilli
af3be84005 Rust: add codeql analysis workflow 2024-10-25 10:05:28 +02:00
Óscar San José
a467923e9b Remove macos-12 and its variants, deprecated 2024-10-24 18:57:58 +02:00
Paolo Tranquilli
55d092fd3e Merge pull request #17835 from github/redsun82/rust-qltest
Rust: move `qltest` to rust code, add `options` with cargo check
2024-10-24 18:29:17 +02:00
Paolo Tranquilli
41d0085918 Rust: address review 2024-10-24 17:54:18 +02:00
Paolo Tranquilli
c79f8180f3 Rust: move down options in query-tests 2024-10-24 17:14:48 +02:00
Arthur Baars
bd19661b60 Address comments 2024-10-24 16:40:19 +02:00
Chris Smowton
4e879e64fc Trim JSP test
This was only ever testing that Java files relating to the JSPs in question appear in the database, so there's no need for a particularly wide selection.
2024-10-24 14:19:16 +01:00
Arthur Baars
a7628e7f4e Rust: revert unnecessary changes to VariableImpl.qll 2024-10-24 15:19:01 +02:00
Arthur Baars
2d07270c1e Rust: stop sharing Diagnostics.qll with Ruby :-( 2024-10-24 15:14:13 +02:00
Arthur Baars
bad9262f12 Rust: create locations for Format and FormatArgument 2024-10-24 15:14:11 +02:00
Arthur Baars
017d492348 Rust: implement synthesized Locations 2024-10-24 15:14:10 +02:00
Arthur Baars
110d2ea775 Rust: avoid classes with multiple getAPrimaryQLClass result 2024-10-24 15:14:09 +02:00
Arthur Baars
ca469f6d5c Rust: introduce PathExprBase class 2024-10-24 15:14:07 +02:00
Arthur Baars
2b65e78674 Rust: fix bad join order 2024-10-24 15:13:27 +02:00
Arthur Baars
a3b903f13a Rust: simplify synth constructors 2024-10-24 15:13:25 +02:00
Arthur Baars
8843a7c389 Rust: rename {Implicit,FormatTemplate}VariableAccess 2024-10-24 15:13:24 +02:00
Arthur Baars
fc4ac9bcf8 Rust: implement Format and FormatArgument classes 2024-10-24 15:13:23 +02:00
Arthur Baars
58dfe6c667 Rust: run codegen 2024-10-24 15:13:22 +02:00
Arthur Baars
8d2236b6d6 Rust: define Format and FormatArgument in schema 2024-10-24 15:13:21 +02:00
Arthur Baars
d4b2dc3711 Apply suggestion 2024-10-24 15:13:20 +02:00
Arthur Baars
be41ca5d4e Rust: update expected output 2024-10-24 15:13:19 +02:00
Arthur Baars
11396ef7cb Rust: avoid multiple PrimaryQLClass warnings
Fixes things like:
```
multiplePrimaryQlClasses
| x | PathExpr,VariableAccess |
```
2024-10-24 15:13:17 +02:00
Arthur Baars
e1c315b288 Rust: make ImplicitVariableAccess instance of VariableAccess 2024-10-24 15:13:14 +02:00
Arthur Baars
1b7b24ecb8 Rust: add Locatable::hasLocationInfo 2024-10-24 15:11:02 +02:00
Arthur Baars
f213a2d640 Rust: CFG for ImplicitVariableAccess 2024-10-24 15:11:01 +02:00
Arthur Baars
8a5fa9b72f Rust: add ImplicitVariableAccess class 2024-10-24 15:11:00 +02:00
Arthur Baars
8f2c7c1239 Rust: parse formatting templates 2024-10-24 15:10:59 +02:00
Tom Hvitved
09c3ac6f81 Rust: Collapse cached CFG logic into one stage 2024-10-24 14:58:19 +02:00
Tom Hvitved
e920a4c56c Merge pull request #17828 from hvitved/rust/enclosing-callable
Rust: Introduce `AstNode.getEnclosingCallable`
2024-10-24 14:57:12 +02:00
Cornelius Riemenschneider
f900060e7f Bazel: Upgrade to bazel 8. 2024-10-24 13:30:57 +02:00
Paolo Tranquilli
3f8d438851 Rust: move qltest to rust code, add options with cargo check 2024-10-24 12:55:23 +02:00
Erik Krogh Kristensen
7bbd4a10b9 Merge pull request #17831 from erik-krogh/skip-more-types
JS: have getId always return null if skipExtractingTypes is set
2024-10-24 12:34:22 +02:00
Owen Mansel-Chan
e16f35478b Merge pull request #17833 from github/workflow/coverage/update
Update CSV framework coverage reports
2024-10-24 11:19:01 +01:00
yoff
c78aeec2ec Update python/ql/lib/semmle/python/frameworks/Pycurl.qll 2024-10-24 11:44:16 +02:00
Calum Grant
a8f1d57573 Merge pull request #17775 from github/calumgrant/bmn/wrong-type-format-arguments-test
C++: Reduce FPs in cpp/wrong-type-format-argument due to extraction errors
2024-10-24 08:40:46 +01:00
github-actions[bot]
1e26db64fb Add changed framework coverage reports 2024-10-24 00:20:48 +00:00
Florin Coada
6838d9414b CodeQL 2.19.2 changedocs 2024-10-23 16:02:22 +01:00
erik-krogh
073d6d8c14 have getId always return null if skipExtractingTypes is set 2024-10-23 16:50:23 +02:00
Taus
5db601af3c Python: Allow comments in comprehensions
A somewhat complicated solution that necessitated adding a new custom
function to `tsg-python`. See the comments in `python.tsg` for why this
was necessary.
2024-10-23 14:24:47 +00:00
Jeroen Ketema
226756e1d4 Merge pull request #17826 from MathiasVP/missing-flow-with-aliasing-fields
C++: Add test with missing flow
2024-10-23 15:49:42 +02:00
Calum Grant
421413a654 C++: Update change notes 2024-10-23 14:46:00 +01:00
Michael Nebel
779ee25a19 Merge pull request #17824 from michaelnebel/java/maptoobj
Java: Add manual models for `mapToObj`.
2024-10-23 15:40:28 +02:00
Calum Grant
f37be68067 C++: Handle builtin FormattingFunctions better 2024-10-23 14:35:32 +01:00
Tom Hvitved
a3d8b8eb14 Rust: Run codegen 2024-10-23 15:31:08 +02:00
Tom Hvitved
df19281b9f Rust: Introduce AstNode.getEnclosingCallable 2024-10-23 15:31:07 +02:00
Michael Nebel
c1b1c62616 C#: Address review comments. 2024-10-23 15:25:52 +02:00
Tom Hvitved
086e0c61fc Merge pull request #17817 from hvitved/rust/cfg-scope-callable
Rust: Use `Callable` to define `CfgScope`
2024-10-23 15:24:13 +02:00
Taus
24ae54886f Merge pull request #17809 from github/tausbn/python-fix-kwargs-in-class-bases
Python: Fix bug in handling of `**kwargs` in class bases
2024-10-23 15:04:54 +02:00
Mathias Vorreiter Pedersen
7c5f561724 C++: Accept test changes. 2024-10-23 13:37:06 +01:00
Taus
e1e35689ca Merge pull request #17807 from github/tausbn/python-fix-string-encoding-dataset-check-failure
Python: Fix string encoding dataset check failure
2024-10-23 14:26:45 +02:00
Mathias Vorreiter Pedersen
2fd07f28f0 C++: Add test with missing flow. 2024-10-23 13:00:33 +01:00
Michael Nebel
146c88fabb C#: Update test expected output where the results are not affected. 2024-10-23 13:08:21 +02:00
Michael Nebel
5495a211f2 C#: Update exception information exposure expected output. 2024-10-23 13:08:19 +02:00
Michael Nebel
cad9aa21d8 C#: Update flow summaries test expected output. 2024-10-23 13:08:18 +02:00
Michael Nebel
b7b6feed04 C#: Re-generate .NET 8 Runtime models. 2024-10-23 13:08:17 +02:00
Michael Nebel
9cd9ebfda9 C#: Add manual models for StringWriter. 2024-10-23 13:08:15 +02:00
Michael Nebel
87caf3d826 C#: Add change note. 2024-10-23 13:08:14 +02:00
Michael Nebel
d3a359b498 C#: Update .NET 8 models. 2024-10-23 13:08:13 +02:00
Michael Nebel
00ccd20452 C#: Delete all .NET 8 Runtime models. 2024-10-23 13:08:11 +02:00
Michael Nebel
20b5a7b6f0 C#: Update expected test output. 2024-10-23 13:08:10 +02:00
Michael Nebel
062a2ad97d C#: Include exception property accesses in the exception information exposure query. 2024-10-23 13:08:08 +02:00
Tom Hvitved
7a2105b1d5 Go: Update expected test output 2024-10-23 10:41:13 +02:00
Tom Hvitved
2e7b71c28d Data flow: Prevent quadratic blowup in Stage6Param::localStep 2024-10-23 10:41:12 +02:00
Michael Nebel
caa08046b6 Java: Update expected test output. 2024-10-23 09:29:29 +02:00
Michael Nebel
3d70f91b9f Java: Add manual models for various mapToObj methods. 2024-10-23 09:29:15 +02:00
Michael Nebel
197642c914 Merge pull request #17547 from michaelnebel/java/jdk17update
Java: Update Java JDK 17 models.
2024-10-23 09:07:02 +02:00
Henning Makholm
665354ebd2 Merge pull request #17823 from github/hmakholm/pr/graph-equivalence-test
Supplement 'query-type: graph' with actual query metadata
2024-10-22 21:08:15 +02:00
Henning Makholm
3d8d340f2a Supplement 'query-type: graph' with actual query metadata
A number of CPP library tests contain `// query-type: graph`
annotations that make the test driver compare the output
from the test query in a special mode. (This feature is
not used by other languages).

It's somewhat awkward in the implementation of `codeql test run`
that this annotation is not an ordinary item of query metadata --
essentially it means that _every_ test query has to be opened
and read an extra time to look for this annotation. I'd like
to move towards using ordinary query metadata for this, since
the QL compiler already parses it anyway.

For the time being, give the annotation in both old and new
syntaxes, until a CLI that recognizes both has been released.
2024-10-22 20:38:00 +02:00
Taus
4f60494019 Python: Support assignments of the form [x,y,z] = w
Surprisingly, the new parser did not support these constructs (and the
relevant test was missing this case), so on files that required the new
parser we were unable to parse this construct.

To fix it, we add `list_pattern` (not to be confused with
`pattern_list`) as a `tree-sitter-python` node that results in a `List`
node in the AST.
2024-10-22 16:06:35 +00:00
Taus
89ea4b8200 Python: Regenerate parser files 2024-10-22 15:39:41 +00:00
Taus
9c913902c5 Python: Allow except* to be written as except *
Turns out, `except*` is actually not a token on its own according to the
Python grammar. This means it's legal to write `except *foo: ...`, which
we previously would consider a syntax error.

To fix it, we simply break up the `except*` into two separate tokens.
2024-10-22 15:39:29 +00:00
Taus
7ceefb509b Python: Regenerate parser files 2024-10-22 15:17:34 +00:00
Taus
8053e0ed44 Python: Allow list_splats as type annotations
That is, the `*T` in `def foo(*args : *T): ...`.

This is apparently a piece of syntax we did not support correctly until
now.

In terms of the grammar, we simply add `list_splat` as a possible
alternative for `type` (which could previously only be an `expression`).
We also update `python.tsg` to not specify `expression` those places (as
the relevant stanzas will then not work for `list_splat`s).

This syntax is not supported by the old parser, hence we only add a new
parser test for it.
2024-10-22 15:17:12 +00:00
Taus
fcec8e0256 Python: Fail tests when errors/warnings are logged
This is primarily useful for ensuring that errors where a node does not
have an appropriate context set in `python.tsg` actually have an effect
on the pass/fail status of the parser tests. Previously, these would
just be logged to stdout, but test could still succeed when there were
errors present.

Also fixes one of the logging lines in `tsg_parser.py` to be more
consistent with the others.
2024-10-22 15:11:51 +00:00
Michael Nebel
16fe7a2fbe Merge pull request #17815 from michaelnebel/csharp/logforgingreplacelineending
C#: Add sanitizer to `cs/log-forging`.
2024-10-22 15:41:17 +02:00
Chris Smowton
2312f9d8df Merge pull request #17811 from github/smowton/admin/package-maven-plugin-change-note
Add change-note for Java buildless packaging its required Maven plugin
2024-10-22 14:23:01 +01:00
Cornelius Riemenschneider
cdffa09a7b Merge pull request #17821 from github/criemen/win-make-bazel
Go: Fix makefile to use bash to look up bazel path.
2024-10-22 12:50:10 +02:00
Cornelius Riemenschneider
1ccadbc3f6 Add comment. 2024-10-22 11:26:02 +02:00
Cornelius Riemenschneider
ad1ef65539 Go: Fix makefile to use bash to look up bazel path.
On Windows, make's path resolution algorithm is incorrect.
It picks up a bazel.exe in PATH that's _after_ a bazel binary.
In particular, on actions, the non-exe binary is a bazelisk
instance, whereas bazel.exe is a bazel (at the current time 7.3.2)
installation.
This means we pick up the wrong bazel version, and
if the differences between the bazel we want and that we actually
get are too big, the build fails.
2024-10-22 10:51:10 +02:00
Tom Hvitved
60c205ff37 Merge pull request #17818 from hvitved/rust/summary-stats-perf
Rust: Speedup `SummaryStats.ql`
2024-10-22 10:15:56 +02:00
Owen Mansel-Chan
23a1ea7191 Merge pull request #17717 from owen-mc/go/update-incorrect-integer-conversion-qhelp
Go: Update `go/incorrect-integer-conversion` qhelp to explain possible source of FPs
2024-10-21 21:53:32 +01:00
Jeroen Ketema
9ef1a9c3f9 Merge pull request #17225 from geoffw0/aliasperf2
C++: Improve AliasedSSA performance
2024-10-21 20:20:24 +02:00
Taus
9803bbdc4b Python: Update class parser test 2024-10-21 15:35:48 +00:00
Taus
1cd04c96c7 Python: Fix bug in handling of **kwargs in class bases
This caused a dataset check error on the `python/cpython` database, as
we had a `DictUnpacking` node whose parent was not a `dict_item_list`,
but rather an `expr_list`.

Investigating a bit further revealed that this was because in a
construction like

```python
class C[T](base, foo=bar, **kwargs): ...
```
we were mistakenly adding `**kwargs` to the same list as `base` (which
is just a list of expressions), rather than the same list as `foo=bar`
(which is a list of dictionary items)

The ultimate cause of this was the use of `! name` in `python.tsg` to
distinguish between bases and keyword arguments (only the latter of
which have the `name` field). Because `dictionary_splat` doesn't have a
`name` field either, these were mistakenly put in the wrong list,
leading to the error.

Also, because our previous test of `class` statements did not include a
`**kwargs` construction, we were not checking that the new parser
behaved correctly in this case. For the most part this was not a
problem, but on files that use syntax not supported by the old parser
(like type parameters on classes), this became an issue. This is also
why we did not see this error previously.

To fix this, we added `! value` (which is a field present on
`dictionary_splat` nodes) as a secondary filter, and added a third
stanza to handle `dictionary_splat` nodes.
2024-10-21 15:35:47 +00:00
Taus
ae4a4bb881 Python: Flip test expectation
This test should now validate that we no longer have dataset check
errors even when there are unencodable characters.
2024-10-21 15:32:23 +00:00
Taus
cc39ae57dc Python: Fix dataset check error for string encoding
Here's an example of one of these errors:
```
INVALID_KEY predicate py_cobjectnames(@py_cobject obj, string name)

The key set {obj} does not functionally determine all fields. Here is a
pair of tuples that agree on the key set but differ at index 1: Tuple 1
in row 63874: (72088,"u'<X>'") Tuple 2 in row 63875: (72088,"u'<?>'")
```
(Here, the substring `X` should really be the Unicode character U+FFFD,
but for some reason I'm not allowed to put that in this commit message.)

Inside the extractor, we assign IDs based on the string type (bytestring
or Unicode) and a hash of the UTF-8 encoded content of the string. In
this case, however, certain _different_ strings were receiving the same
hash, due to replacement characters in the encoding process.

In particular, we were converting unencodable characters to question
marks in one place, and to U+FFFD in another place. This caused a
discrepancy that lead to the dataset check error.

To fix this, we put in a custom error handler that always puts the
U+FFFD character in place of unencodable characters. With this, the
strings now agree, and hence there is no clash.
2024-10-21 15:31:16 +00:00
Porcupiney Hairs
c7610b3539 Include change-note 2024-10-21 20:14:58 +05:30
Porcupiney Hairs
c93f0ed851 Include change-note 2024-10-21 20:12:46 +05:30
Jeroen Ketema
e36a1c717d Merge branch 'main' into aliasperf2 2024-10-21 16:40:01 +02:00
Porcupiney Hairs
c74f6f587f Merge branch 'main' into pyloadSsl 2024-10-21 20:09:05 +05:30
Porcupiney Hairs
f6369a6ed7 Include changes from review 2024-10-21 20:01:44 +05:30
Arthur Baars
490f81437b Merge pull request #17804 from github/aibaars/local-defs-1
Rust: add ide-contextual-queries/localDefinitions.ql
2024-10-21 15:30:44 +02:00
Tom Hvitved
f72af4f1f3 Rust: Use Callable to define CfgScope 2024-10-21 15:22:04 +02:00
Tom Hvitved
c4c936d6fa Rust: Speedup SummaryStats.ql 2024-10-21 15:21:13 +02:00
Michael Nebel
dec2c61e5d Java: Update LdapInjection expected test output. 2024-10-21 15:19:46 +02:00
Michael Nebel
d59df1f938 Java: Re-generate JDK 17 models. 2024-10-21 15:19:45 +02:00
Michael Nebel
23d285c698 Java: Update model generator expected output. 2024-10-21 15:19:44 +02:00
Michael Nebel
786d04e939 Java: Add the clone method to the model generation exclusions. 2024-10-21 15:19:43 +02:00
Michael Nebel
7919dcfb12 Java: Add modelgenerator clone example. 2024-10-21 15:19:42 +02:00
Michael Nebel
e2ada2536b Java: Update java.net expected output. 2024-10-21 15:19:41 +02:00
Michael Nebel
97f0037a7b Java: Manually model InetSocketAddress as the model generator doesn't correctly taint the hostname. 2024-10-21 15:19:40 +02:00
Michael Nebel
0a931aa69f Java: Add change note. 2024-10-21 15:19:38 +02:00
Michael Nebel
9a44eec04c Java: Add manual models for FileReader (they would also have disappeared if models were re-generated without using mixed mode). 2024-10-21 15:19:37 +02:00
Michael Nebel
b356c3cd48 Java: Manually model ZipFile (due to CWE-522 compression bombs test failure). 2024-10-21 15:19:36 +02:00
Michael Nebel
f537e04532 Java: Update LdapInjection expected test output. 2024-10-21 15:19:35 +02:00
Michael Nebel
f7b38a8955 Java: Add some less precise models for BasicAttributes to get the models to work with search sink and re-generate SDK models. 2024-10-21 15:19:34 +02:00
Michael Nebel
e94cacd449 Java: Update test expected output where the query results are not affected. 2024-10-21 15:19:33 +02:00
Michael Nebel
24d1e9927b Java: Update expected test output for the model editor tests. 2024-10-21 15:19:32 +02:00
Michael Nebel
ea14547643 Java: Update TopJdkApisTest expected output. 2024-10-21 15:19:31 +02:00
Michael Nebel
cbd9cc6dae Java: Update request forgery expected output. 2024-10-21 15:19:30 +02:00
Michael Nebel
3b6f39931b Java: Re-add generated (mixed) summaries and neutrals for the Java SDK 17. 2024-10-21 15:19:28 +02:00
Michael Nebel
f50734f0ee Java: Delete all generated Java JDK models. 2024-10-21 15:19:27 +02:00
Tom Hvitved
e9adbf231f Merge pull request #17816 from hvitved/rust/expr-trees-module
Rust: Move all expression CFG trees inside an `ExprTrees` module
2024-10-21 15:12:51 +02:00
Tom Hvitved
d2623cf4c3 Merge pull request #17814 from hvitved/rust/fix-bad-join
Rust: Fix bad join
2024-10-21 15:01:31 +02:00
Tom Hvitved
a6a68ef8be Apply suggestions from code review
Co-authored-by: Simon Friis Vindum <paldepind@github.com>
2024-10-21 14:43:22 +02:00
Taus
d01593e571 Python: Add test for string encoding dataset check
Note that this test checks that the current setup creates dataset check
violations. A later commit will fix this (and flip the negation in the
test).
2024-10-21 12:08:46 +00:00
Tom Hvitved
1f5e02f539 Rust: Move all expression CFG trees inside an ExprTrees module 2024-10-21 13:41:11 +02:00
Simon Friis Vindum
85e59c9920 Merge branch 'main' into rust-saa-additions 2024-10-21 13:30:02 +02:00
Michael Nebel
1217c55c36 C#: Add change note. 2024-10-21 12:08:03 +02:00
Michael Nebel
191658f637 C#: Update expected test output. 2024-10-21 12:04:31 +02:00
Michael Nebel
b2b1a3ea65 C#: Consider string.ReplaceLineEndings(string) as a sanitizer for log forging. 2024-10-21 12:03:59 +02:00
Michael Nebel
0b8e83dc87 C#: Add log forging false positive example using ReplaceLineEndings. 2024-10-21 11:55:09 +02:00
Cornelius Riemenschneider
ce53964edf Merge pull request #17812 from github/redsun82/rust-move-integration-tests
Rust: move integration tests to where other languages have them
2024-10-21 11:41:16 +02:00
Tom Hvitved
7e82595cae Rust: Fix bad join
Before
```
Evaluated relational algebra for predicate MatchExprImpl::Impl::MatchExpr.getLastArm/0#dispred#24e5f4cf@9cf607tl with tuple counts:
            660677  ~0%    {4} r1 = SCAN `MatchExprImpl::Impl::MatchExpr.getArm/1#dispred#817de8a3` OUTPUT _, In.0, In.2, In.1
            660677  ~0%    {3}    | REWRITE WITH Tmp.0 := 1, Out.0 := (Tmp.0 + In.3) KEEPING 3
        5342095756  ~0%    {3}    | JOIN WITH `MatchArmList::Generated::MatchArmList.getNumberOfArms/0#dispred#9ad72f08_10#join_rhs` ON FIRST 1 OUTPUT Lhs.1, Rhs.1, Lhs.2
             96597  ~3%    {2}    | JOIN WITH `MatchExpr::Generated::MatchExpr.getMatchArmList/0#dispred#11f1a73e` ON FIRST 2 OUTPUT Lhs.0, Lhs.2
                           return r1
```

After
```
Evaluated relational algebra for predicate MatchExprImpl::Impl::MatchExpr.getLastArm/0#dispred#24e5f4cf@9d7a92pu with tuple counts:
        660677   ~0%    {5} r1 = JOIN `MatchExprImpl::Impl::MatchExpr.getArm/1#344daffc` WITH `MatchExprImpl::Impl::MatchExpr.getNumberOfArms/0#ab0d8732` ON FIRST 1 OUTPUT Lhs.0, Lhs.1, Lhs.2, _, Rhs.1
                        {4}    | REWRITE WITH Tmp.3 := 1, Out.3 := (In.4 - Tmp.3), TEST Out.3 = InOut.1 KEEPING 4
         96597   ~3%    {2}    | SCAN OUTPUT In.0, In.2
                        return r1
```
2024-10-21 11:40:13 +02:00
Simon Friis Vindum
5e4ce8f66d Merge pull request #17800 from paldepind/rust-cfg-fixes
Rust: Various fixes to the CFG construction
2024-10-21 10:39:27 +02:00
Chris Smowton
5ba37bd7a3 Rename change note 2024-10-21 09:36:07 +01:00
Simon Friis Vindum
a1ebf98552 Merge branch 'main' into rust-cfg-fixes 2024-10-21 10:12:07 +02:00
Simon Friis Vindum
3ae04752c4 Rust: Accept less CFG inconsistencies 2024-10-21 10:07:11 +02:00
Simon Friis Vindum
9c172f62a4 Rust: Fix dead end in CFG for match expressions with no arms 2024-10-21 09:59:23 +02:00
Paolo Tranquilli
7b870d30a4 Rust: move integration tests to where other languages have them 2024-10-21 09:29:37 +02:00
Simon Friis Vindum
381f061e7f Rust: Add CFG test for match with no arms 2024-10-21 09:29:28 +02:00
Simon Friis Vindum
e149071634 Merge pull request #17803 from paldepind/unreachable2
Rust: More test cases for rust/dead-code
2024-10-21 08:30:36 +02:00
Porcupiney Hairs
7ef2d79b3f Include changes from review 2024-10-21 03:28:19 +05:30
Calum Grant
c5a082fd8e C++: Fix CWE-022 2024-10-18 19:45:29 +01:00
Chris Smowton
241f951db1 Add change-note for Java buildless packaging its required Maven plugin 2024-10-18 17:43:18 +01:00
Chris Smowton
74ef91649b Merge pull request #17780 from smowton/smowton/admin/add-buildless-maven-packaging-test
Java buildless: add tests checking usage of a local copy of the Maven dependency graph plugin
2024-10-18 17:38:59 +01:00
Arthur Baars
08af7d0007 Merge pull request #17810 from github/post-release-prep/codeql-cli-2.19.2
Post-release preparation for codeql-cli-2.19.2
2024-10-18 18:28:07 +02:00
github-actions[bot]
272f6c2541 Post-release preparation for codeql-cli-2.19.2 2024-10-18 15:56:02 +00:00
Calum Grant
0fcabc4e61 C++: Move mayBeFromImplicitlyDeclaredFunction to Call 2024-10-18 15:56:08 +01:00
Jami
c8d420ec57 Merge pull request #17795 from jcogs33/jcogs33/update-spring-csrf-qhelp-link
Java: update qhelp link for `java/spring-disabled-csrf-protection`
2024-10-18 10:11:37 -04:00
Arthur Baars
4a5a48a5b6 Rust: move PrintCfg to ide-contextual-queries 2024-10-18 16:11:18 +02:00
Arthur Baars
c9372b91f8 Rust: move ide-contextual-queries to the library pack 2024-10-18 16:11:17 +02:00
Arthur Baars
53744407ad Rust: add localDefinitions.ql 2024-10-18 16:11:08 +02:00
Calum Grant
419780591a C++: Resolve firstFormatArgumentIndex in FormattingFunction CP 2024-10-18 14:52:54 +01:00
Simon Friis Vindum
4ddc7a4592 Rust: Update unused value expected results 2024-10-18 15:49:52 +02:00
Jami Cogswell
335c59792c Java: remove unnecessary anchor and update page name 2024-10-18 09:26:56 -04:00
Simon Friis Vindum
b665f45ffa Merge branch 'main' into unreachable2 2024-10-18 15:13:40 +02:00
Chuan-kai Lin
41e811773c Merge pull request #17648 from github/cklin/dataflow-diff-informed-filtering
Dataflow: apply diff-informed filtering consistently
2024-10-18 06:02:28 -07:00
Simon Friis Vindum
b1e85d1ad8 Rust: Refactor BreakExprTree to use StandardPostOrderTree 2024-10-18 13:30:36 +02:00
Simon Friis Vindum
28f111b7c0 Rust: Remove erroneous CFG edge from return to break 2024-10-18 13:26:11 +02:00
Simon Friis Vindum
4ca6b0eceb Rust: Add a CFG test for a return within a break 2024-10-18 13:22:39 +02:00
Simon Friis Vindum
6568eb80a2 Rust: Refactor CFG pattern tree implementation 2024-10-18 12:52:56 +02:00
Simon Friis Vindum
7aa28a0449 Rust: Fix multiple CFG successors in range pattern without lower bound 2024-10-18 11:19:21 +02:00
Simon Friis Vindum
b0625f83c6 Rust: Add CFG test of range patterns 2024-10-18 11:19:19 +02:00
Simon Friis Vindum
272d12fee1 Rust: Step correctly over method arguments
Previously the math was wrong and the first argument (with `i` being `0`) had two edges out of it.
2024-10-18 11:19:07 +02:00
Owen Mansel-Chan
f3abe549f3 Merge pull request #17794 from owen-mc/go/ast-viewer-typeparamdecl
Go: Fix type param declarations in AST viewer
2024-10-18 10:14:51 +01:00
Owen Mansel-Chan
b0376d500c Merge pull request #17792 from owen-mc/go/lookthrough-pointer-type
Go: Add helper predicate `lookThroughPointerType`
2024-10-18 09:30:46 +01:00
Owen Mansel-Chan
bacf448388 Add change note 2024-10-17 22:06:49 +01:00
Jami Cogswell
88b7a9fcb5 Java: update qhelp link 2024-10-17 16:38:53 -04:00
Chris Smowton
8b0bd8c8ad Adjust test expectations 2024-10-17 20:42:41 +01:00
Chris Smowton
13f19481db Add tests checking Maven retrieves the depgraph plugin from our shipped repo, and produces the expected settings.xml file in the process 2024-10-17 20:42:40 +01:00
Arthur Baars
6e197b5802 Merge pull request #17773 from geoffw0/unusedval2
Rust: Implement UnusedValue.ql (2)
2024-10-17 21:03:24 +02:00
Dave Bartolomeo
639864e94d Handle may vs. must for EntireAllocationMemoryLocation 2024-10-17 19:50:50 +01:00
Chuan-kai Lin
1aa3eb527f Dataflow: apply diff-informed filtering consistently 2024-10-17 10:23:38 -07:00
yoff
b07c788a08 Merge pull request #17793 from github/tausbn/python-update-docs-for-python-3.13
Python: Update supported-versions-compilers.rst
2024-10-17 16:59:08 +02:00
Owen Mansel-Chan
7ed82068ef Add type param decls to AST viewer hierarchy 2024-10-17 15:39:16 +01:00
Geoffrey White
e1aaa136b2 Rust: Add variants with pattern matching for unreachable_let_1 and 2. 2024-10-17 15:38:47 +01:00
Taus
bf920605b2 Python: Update supported-versions-compilers.rst
Adds Python 3.13 to the list.

We might want to consider shortening the list to something like "3.5 - 3.13" at some point.

Also, once we're finally rid of standard library extraction, we should update footnote 8 accordingly.
2024-10-17 16:38:10 +02:00
Owen Mansel-Chan
b8ea8400d1 Add type param decls to PrintAST tests 2024-10-17 15:37:31 +01:00
Geoffrey White
3d0c86e176 Rust: Test spacing. 2024-10-17 15:37:03 +01:00
Jeroen Ketema
064ec91fa2 Merge pull request #17778 from jketema/param-name
C++: Improve parameter naming
2024-10-17 16:29:10 +02:00
Simon Friis Vindum
b2032fc6fd Rust: Only normal completion of a let statement initializer steps to the pattern 2024-10-17 16:28:57 +02:00
Simon Friis Vindum
e6f1edcbb5 Rust: Conditional completion of match arm expression should now flow to next arm 2024-10-17 16:25:19 +02:00
Simon Friis Vindum
04f2062942 Rust: Label the non-return CFG edge out of question mark as match 2024-10-17 16:22:07 +02:00
Simon Friis Vindum
fd5d6255c1 Rust: Avoid creating CFG scopes for trait signatures without implementations 2024-10-17 16:20:30 +02:00
Simon Friis Vindum
b0cd44e47f Rust: Add CFG test cases 2024-10-17 16:09:17 +02:00
Owen Mansel-Chan
1318504aa5 Add QLDoc 2024-10-17 12:06:46 +01:00
Owen Mansel-Chan
87992fac88 Revert change to hasEmbeddedField 2024-10-17 11:50:17 +01:00
Mathias Vorreiter Pedersen
b9205b13d6 Merge pull request #17788 from MathiasVP/better-function-pointer-resolution
C++: Improve function pointer resolution
2024-10-17 11:27:43 +01:00
Owen Mansel-Chan
5007666d6e Add helper predicate lookThroughPointerType 2024-10-17 11:26:24 +01:00
Mathias Vorreiter Pedersen
5e04358ece Update cpp/ql/lib/change-notes/2024-10-16-new-api-for-call-target-resolution.md
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-10-17 10:57:30 +01:00
Calum Grant
4341fab794 C++: Reject invalid results from getFirstFormatArgumentIndex() 2024-10-17 10:50:44 +01:00
Simon Friis Vindum
2d1c62b6df Rust: Fix dead end in CFG for empty tuple and struct patterns 2024-10-17 10:40:34 +02:00
Simon Friis Vindum
b97ec405d0 Rust: Add CFG tests with empty tuple and struct patterns 2024-10-17 10:34:49 +02:00
Mathias Vorreiter Pedersen
baab74cb35 C++: Add change notes. 2024-10-16 17:45:44 +01:00
Geoffrey White
e21959d7bb Rust: Add more unreachable test cases. 2024-10-16 17:34:57 +01:00
Geoffrey White
a92de0df93 Rust: Test spacing. 2024-10-16 16:56:12 +01:00
Calum Grant
5315a5cfbf C++: Tweak test 2024-10-16 15:47:34 +01:00
Anders Schack-Mulligen
4153a83a4f Python: Add workaround. 2024-10-16 16:14:51 +02:00
Anders Schack-Mulligen
5950c336e2 Python: Refactor references to NormalCall. 2024-10-16 16:04:31 +02:00
Mathias Vorreiter Pedersen
a99d57640a C++: Add a new API for getting the target of a 'Call' expression. 2024-10-16 14:45:44 +01:00
Geoffrey White
7e2542bd74 Rust: Accept consistency check failures. 2024-10-16 14:32:16 +01:00
Geoffrey White
7d62cdad71 Merge pull request #17774 from geoffw0/astcount
Rust: Count number of AST inconsistencies
2024-10-16 14:17:39 +01:00
Mathias Vorreiter Pedersen
2dbf75fde9 C++: Accept test changes. 2024-10-16 14:15:05 +01:00
Mathias Vorreiter Pedersen
30e0781778 C++: Also check for source calls when using 'lambda call resolution'. 2024-10-16 14:14:52 +01:00
Mathias Vorreiter Pedersen
9ea4c40ca9 C++: Add failing test. 2024-10-16 14:13:55 +01:00
Simon Friis Vindum
76e1885355 Rust: Make mutable variables that are only borrowed immutably amenable for SSA 2024-10-16 15:07:46 +02:00
Simon Friis Vindum
577afc3fd5 Rust: Support capture of mutable variables in SSA 2024-10-16 14:57:46 +02:00
Calum Grant
9758e023f9 C++: Remove redundant test 2024-10-16 13:47:06 +01:00
Calum Grant
ceceee1947 C++: Add test for mixed implicit/explicit function declarations 2024-10-16 13:46:06 +01:00
Anders Schack-Mulligen
42d35f8b9d Ruby: Exclude some cases that are unlikely library calls. 2024-10-16 14:35:23 +02:00
Anders Schack-Mulligen
c20f12fa6c Add qldoc. 2024-10-16 14:35:23 +02:00
Anders Schack-Mulligen
9ca8a27bae C/C++: Accept test changes. 2024-10-16 14:35:22 +02:00
Anders Schack-Mulligen
4e8a4a5cdd C/C++: Add tentative support for speculative taint flow. 2024-10-16 14:35:22 +02:00
Anders Schack-Mulligen
fae71756eb Go: Add tentative support for speculative taint flow. 2024-10-16 14:35:21 +02:00
Anders Schack-Mulligen
635071fe8a Swift: Add tentative support for speculative taint flow. 2024-10-16 14:35:21 +02:00
Anders Schack-Mulligen
7497d9530d Python: Add tentative support for speculative taint flow. 2024-10-16 14:35:20 +02:00
Anders Schack-Mulligen
8eb0cb4c66 Ruby: Add tentative support for speculative taint flow. 2024-10-16 14:35:20 +02:00
Anders Schack-Mulligen
7b43100af5 C#: Add support for speculative taint flow. 2024-10-16 14:35:19 +02:00
Anders Schack-Mulligen
6c6b6061bc Dataflow: Add consistency check. 2024-10-16 14:35:19 +02:00
Anders Schack-Mulligen
8b99154a00 Java: Add support for speculative taint flow. 2024-10-16 14:35:19 +02:00
Anders Schack-Mulligen
7d123296f8 Dataflow: Add speculative flow modules. 2024-10-16 14:35:18 +02:00
Anders Schack-Mulligen
c80627a3d3 Dataflow: add plumbing for adding provenance to state-steps. 2024-10-16 14:35:18 +02:00
Jeroen Ketema
bee073dee5 Merge pull request #17776 from jketema/parent-scope
C++: Add missing parent scope cases
2024-10-16 13:12:24 +02:00
Simon Friis Vindum
a1db359ba1 Rust: Add variable tests involving borrowing and capture 2024-10-16 13:05:53 +02:00
yoff
6cb607e087 Merge pull request #17779 from github/tausbn/python-run-replace-test
Python: Add `copy.replace` test to list of runnable tests
2024-10-16 13:01:49 +02:00
Geoffrey White
4577d1ce06 Rust: Additional test cases. 2024-10-16 11:38:30 +01:00
Jeroen Ketema
1eb0b49634 C++: Improve parameter naming 2024-10-16 11:33:18 +02:00
Calum Grant
d88a674a15 C++: Change note for mayBeFromImplicitlyDeclaredFunction 2024-10-16 10:27:54 +01:00
Calum Grant
6a48ad0ee7 C++: Implement Expr::mayBeFromImplicitlyDeclaredFunction 2024-10-16 10:23:39 +01:00
Paolo Tranquilli
79c3728d1f Merge pull request #17719 from github/redsun82/bazel-lfs
Bazel: skip git lfs endpoints presenting malformed data, and print workaround
2024-10-16 10:57:30 +02:00
Calum Grant
853128c9c3 C++: Clean up false-positives
C++: Change note
2024-10-16 09:46:26 +01:00
Paolo Tranquilli
8f451515e0 Bazel: print workaround for git_lfs_probe.py failing 2024-10-16 10:16:38 +02:00
Paolo Tranquilli
fd31e6d813 Bazel: skip git lfs endpoints presenting malformed data 2024-10-16 10:01:19 +02:00
Taus
65dbc1de91 Python: Add copy.replace test to list of runnable tests 2024-10-15 18:17:00 +02:00
Taus
28f8874243 Merge pull request #17688 from github/tausbn/python-3.13-default-type-parser-support
Python: Add support for type parameter defaults
2024-10-15 18:01:51 +02:00
Taus
d4e0cb2ffa Merge pull request #17767 from github/tausbn/python-3.13-model-flow-in-replace
Python: Model `copy.replace`
2024-10-15 18:01:28 +02:00
Geoffrey White
5b667026cb Rust: More fixup after some line numbers changed. 2024-10-15 16:17:03 +01:00
Jeroen Ketema
22b8e2cbb4 C++: Add missing parent scope cases 2024-10-15 17:16:58 +02:00
Calum Grant
fe85e007b3 C++: Add test for cpp/wrong-type-format-argument 2024-10-15 16:09:35 +01:00
Paolo Tranquilli
886c7f1f7a Merge pull request #17771 from github/redsun82/rust-codegen
Rust: fix codegen to allow `--force` again
2024-10-15 17:08:39 +02:00
Owen Mansel-Chan
5efb88ed1f Merge pull request #17737 from owen-mc/go/extractor/objecttypes-consistency-generics-2
Go: extractor/objecttypes consistency generics (second try)
2024-10-15 15:50:45 +01:00
Paolo Tranquilli
2c970a080d Rust: remove useless blank line
Co-authored-by: Simon Friis Vindum <simonfv@gmail.com>
2024-10-15 16:50:15 +02:00
Geoffrey White
feed0ebeca Rust: Autoformat. 2024-10-15 15:49:56 +01:00
Geoffrey White
f9eca42ded Merge pull request #17763 from geoffw0/cfgcount3
Rust: Count number of CFG inconsistencies
2024-10-15 15:43:39 +01:00
Geoffrey White
2a68d3e46e Rust: Put Yes, No back in the logical order. 2024-10-15 15:31:34 +01:00
Geoffrey White
84a74d910d Rust: Fixup after merging main. 2024-10-15 15:24:43 +01:00
Tom Hvitved
88f6d3b5ea Rust: Implement UnusedValue.ql 2024-10-15 15:05:39 +01:00
Ian Lynagh
196baa99b2 Merge pull request #17769 from igfoo/igfoo/2.1.0-beta2
Kotlin: Fix for 2.1.0-Beta2
2024-10-15 14:56:55 +01:00
Arthur Baars
bdec751527 Merge pull request #17768 from github/post-release-prep/codeql-cli-2.19.2
Post-release preparation for codeql-cli-2.19.2
2024-10-15 15:33:42 +02:00
Geoffrey White
f07f6188ae Rust: Make rust/summary/summary-statistics a metric query so that we can access data in the DCA job. 2024-10-15 14:19:46 +01:00
Geoffrey White
f4d4925239 Rust: Address QL-for-QL complaint. 2024-10-15 14:19:45 +01:00
Geoffrey White
2be5ce4f7a Rust: Change rust/summary/summary-statistics to a diagnostic query, so that it gets run as a diagnmetric query for DCA. 2024-10-15 14:19:44 +01:00
Geoffrey White
e8953fb5e4 Rust: Add diagnostic query for AST inconsistency counts. 2024-10-15 14:19:43 +01:00
Geoffrey White
e01ecd1b79 Rust: Calculate a total of AST inconsistencies. 2024-10-15 14:19:42 +01:00
Geoffrey White
2d019eb00e Rust: Add QLDoc to the AST consistency rules and make their output more consistent. 2024-10-15 14:19:40 +01:00
Geoffrey White
b5c88c7bfe Rust: Give the extraction consistency query metadata as well. 2024-10-15 14:19:39 +01:00
Geoffrey White
414fcf836e Rust: Move the AST consistency logic to a .qll. 2024-10-15 14:19:38 +01:00
Geoffrey White
79c5adfc9a Rust: Use correct versions of the consistency predicates. 2024-10-15 14:10:51 +01:00
Paolo Tranquilli
1d9767a163 Merge pull request #17770 from github/redsun82/rust-callable-base
Rust: Add `Callable` as a base class of `Function` and `ClosureExpr`
2024-10-15 15:00:59 +02:00
Paolo Tranquilli
8e31abaefe Rust: fix codegen to allow --force
This passes command line arguments to codegen, allowing in particular
`--force` to be passed.

Also, a convenience `//rust/codegen:py` is added to only run the python
based code generation, which will be faster and enough when
`ast-generator` is unchanged.
2024-10-15 14:37:30 +02:00
Jeroen Ketema
50ec2549c0 Merge pull request #17740 from jketema/requires
C++: Add support for C++ requires expressions
2024-10-15 14:32:28 +02:00
Paolo Tranquilli
bd08bc7923 Rust: address review 2024-10-15 14:21:11 +02:00
Ian Lynagh
b5bfd06624 Kotlin: Fix for 2.1.0-Beta2
We need to catch a different exception now.
2024-10-15 13:17:26 +01:00
github-actions[bot]
079ab77a38 Post-release preparation for codeql-cli-2.19.2 2024-10-15 12:16:59 +00:00
Taus
3b60d8302b Python: Add change note 2024-10-15 12:14:20 +00:00
Taus
778b96aa39 Python: Update test expectations 2024-10-15 12:14:19 +00:00
Taus
eaef783f4b Python: Add partial model for copy.replace
Extends our modelling to partially cover the behaviour of
`copy.replace`. In particular, we model this in two ways:

Firstly, we extend the existing Models-as-Data row for `copy` and
`deepcopy` to also cover `replace`. This means that we treat the result
of `replace` as containing all of the fields of the original object.
This is somewhat _more_ than we want, as strictly speaking the fields
that are overwritten should _not_ propagate flow through the `replace`
call, but currently we don't have a good way of modelling this blocking
of flow.

Secondly, we add a flow summary that adds flow from named arguments of
the `replace` call to the corresponding fields on the base object. This
ensures that we at least have the new flow arising from the `replace`
call.

Note that the flow summary adds this flow for _all_ named arguments of
_all_ `replace` calls throughout the codebase. However, since any
particular `replace` call will only populate a subset of these (the
subset consisting of exactly those named arguments that are in that
particular call), this does not cause any unwanted crosstalk between
different `replace` calls.§
2024-10-15 12:14:19 +00:00
Taus
6f2cfa0ba8 Python: Update CopySummary to use getMaDRepresentation
Demonstrates the somewhat more ergonomic way to use
`getMaDRepresentation` when specifying summaries.

Note that this slightly extends the previous definition, in that
`DictionaryContentAny` is now _also_ propagated by a call to the
`.copy()` method, but I think this is correct.
2024-10-15 11:52:37 +00:00
Taus
ce914019c5 Python: Add getMaDRepresentation()
This adds a convenient way of getting the Models-as-Data representation
of a particular type of content. This avoids repeating the same
construction over and over in our various summaries. Currently this is
defined for all types of content except the captured variable content,
which to my knowledge doesn't have any representation in Models-as-Data.
2024-10-15 11:50:38 +00:00
Taus
e16405c675 Python: Add test for copy.replace
This test demonstrates the current state of affairs: that `copy.replace`
essentially blocks all flow of taint through it, because it has not been
modelled yet.
2024-10-15 11:48:43 +00:00
Jeroen Ketema
168f7f5d34 C++: Add support for C++ requires expressions 2024-10-15 13:44:17 +02:00
Taus
417e60a466 Python: Update extractor version 2024-10-15 11:22:54 +00:00
Taus
d905010aa8 Python: Add change note 2024-10-15 11:22:34 +00:00
Taus
8630f57710 Python: Add up-/downgrade scripts
Adds up- and downgrade scripts for the support for type parameter
defaults.

In the upgrade direction we do nothing, matching the behaviour of
`getDefault` not having a result for old databases.

In the downgrade direction, we explicitly remove the relevant child (via
the `py_exprs` database relation) for `TypeVar`, `TypeVarTuple`, and
`ParamSpec` parameters.
2024-10-15 11:22:33 +00:00
Taus
819b3d77ab Python: Update test expectations
Note that this still includes the somewhat puzzling parsing of
`Spam[**P2]` as an exponentiation with an empty left hand side. When we
fix that bug, we should also update this test to contain actually valid
syntax.
2024-10-15 11:22:33 +00:00
Taus
182a192cc0 Python: Regenerate dbscheme/AST 2024-10-15 11:22:33 +00:00
Taus
36d89745f9 Python: Fix dbscheme/AST autogeneration
There was an errant `ql` in the relevant paths, a leftover from the move
from the internal repo. Also, we can no longer rely on an intree version
of the CodeQL CLI, so from now on we'll just assume it's present in the
path. (On Codespaces, `gh codeql` is a decent replacement, especially if
using the `install-stub` functionality.
2024-10-15 11:22:32 +00:00
Taus
2af0d78435 Python: Add default field to the relevant AST nodes 2024-10-15 11:22:32 +00:00
Taus
55ee3eb36b Python: Add TSG support for type defaults 2024-10-15 11:22:31 +00:00
Taus
6545bfffa7 Python: Regenerate parser files
Two new files -- alloc.h and array.h -- suddenly appeared. Presumably
they are used by the somewhat newer version of tree-sitter. To be safe,
I included them in this commit.
2024-10-15 11:22:31 +00:00
Taus
882249ef82 Python: Add grammar support for type defaults
Also fixes an oversight in the grammar: starred expressions should be
allowed inside the subscript of an `Index` expression.
2024-10-15 11:22:30 +00:00
Taus
1ced5b44d7 Python: Add test for type parameter defaults 2024-10-15 11:22:30 +00:00
Ian Lynagh
24d98eef83 Merge pull request #17741 from github/igfoo/logverb
Kotlin: Log our verbosity level
2024-10-15 11:42:15 +01:00
Geoffrey White
abc4981300 Rust: Address QL-for-QL complaint. 2024-10-15 11:30:03 +01:00
Geoffrey White
983179b84e Rust: Autoformat. 2024-10-15 11:23:16 +01:00
Paolo Tranquilli
248eb7f00c Merge branch 'main' into rust/callable-base 2024-10-15 11:03:11 +02:00
Geoffrey White
ac9a8d602c Rust: Add metadata to the original CFG consistency query. 2024-10-11 17:01:47 +01:00
Geoffrey White
d4c3e3323f Rust: Add diagnostic query for CFG inconsistency counts. 2024-10-11 17:01:46 +01:00
Geoffrey White
7b712f3d65 Rust: Calculate a total of CFG inconsistencies. 2024-10-11 17:01:41 +01:00
Geoffrey White
4398c83a67 Rust: Add more QLDoc to the CFG consistency library. 2024-10-11 16:53:46 +01:00
Geoffrey White
85f2582afd Rust: Move CFG consistency logic into a library. 2024-10-11 16:53:45 +01:00
Ian Lynagh
9f340279cb Kotlin: Accept test changes 2024-10-11 15:10:19 +01:00
Ian Lynagh
156ddd3fae Kotlin: Log our verbosity level
This happens at `info` level, which is logged by default.
2024-10-11 14:24:25 +01:00
Tom Hvitved
0ec40afa4c Rust: Update expected test output 2024-10-11 12:44:35 +02:00
Owen Mansel-Chan
9381dda4a9 Use un-specialized field when extracting struct types 2024-10-11 11:30:02 +01:00
Owen Mansel-Chan
6bf6ed6f48 Add check for object for specialized named type 2024-10-11 11:30:00 +01:00
Owen Mansel-Chan
a810309160 Add check for specialized objects 2024-10-11 11:29:58 +01:00
Owen Mansel-Chan
45710e23c6 Always use generic method object 2024-10-11 11:29:57 +01:00
Tom Hvitved
8cc349e85f Rust: Run codegen 2024-10-11 12:01:16 +02:00
Tom Hvitved
b284a2a7c0 Rust: Add Callable as a base class of Function and ClosureExpr 2024-10-11 12:00:30 +02:00
Geoffrey White
b692b1b282 C++: Autoformat. 2024-10-10 17:26:38 +01:00
Geoffrey White
cedfeee6d7 Merge branch 'main' into aliasperf2 2024-10-10 17:25:45 +01:00
Owen Mansel-Chan
500992c499 Update qhelp to explain possible source of FPs 2024-10-09 15:08:48 +01:00
Geoffrey White
7ff376b346 Merge branch 'main' into aliasperf2 2024-10-08 15:08:43 +01:00
Geoffrey White
4a131dd8f1 C++: Implement dbartol's suggestion. 2024-10-08 14:44:45 +01:00
Geoffrey White
f9fa52fe77 C++: Disabled the change again. 2024-10-08 14:43:56 +01:00
Geoffrey White
1ff6c4c090 C++: Restore change and see effect on test. 2024-09-03 11:55:06 +01:00
Geoffrey White
5bd58f044e C++: Add a direct test of getOverlap and a test case for it. 2024-09-03 11:52:20 +01:00
Porcupiney Hairs
e2dd126962 Python: Pycurl SSL Disabled 2024-09-03 03:41:23 +05:30
Geoffrey White
0e766aa99b C++: Remove redundant lines. 2024-08-16 15:56:30 +01:00
Geoffrey White
7430fde8c6 C++: Avoid outputting a cartesian product in AliasedSSA's getOverlap. 2024-08-14 10:53:25 +01:00
1358 changed files with 115513 additions and 86482 deletions

View File

@@ -1,5 +1,4 @@
common --enable_platform_specific_config
common --enable_bzlmod
# because we use --override_module with `%workspace%`, the lock file is not stable
common --lockfile_mode=off
@@ -25,6 +24,5 @@ common --registry=https://bcr.bazel.build
common --@rules_dotnet//dotnet/settings:strict_deps=false
common --experimental_isolated_extension_usages
common --incompatible_use_plus_in_repo_names
try-import %workspace%/local.bazelrc

View File

@@ -1 +1 @@
5f5d70b6c4d2fb1a889479569107f1692239e8a7
8.0.0rc1

View File

@@ -9,3 +9,5 @@ paths-ignore:
- '/python/'
- '/javascript/ql/test'
- '/javascript/extractor/tests'
- '/rust/ql/test'
- '/rust/ql/integration-tests'

4
.github/labeler.yml vendored
View File

@@ -38,6 +38,10 @@ Swift:
- swift/**/*
- change-notes/**/*swift*
Actions:
- actions/**/*
- change-notes/**/*actions*
documentation:
- "**/*.qhelp"
- "**/*.md"

View File

@@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-12, windows-2019]
os: [ubuntu-20.04, macos-13, windows-2019]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

64
.github/workflows/rust-analysis.yml vendored Normal file
View File

@@ -0,0 +1,64 @@
name: "Code scanning - Rust"
on:
push:
branches:
- main
- 'rc/*'
pull_request:
branches:
- main
- 'rc/*'
paths:
- '**/*.rs'
- '**/Cargo.toml'
- '.github/codeql/codeql-config.yml'
- '.github/workflows/rust-analysis.yml'
schedule:
- cron: '0 9 * * 1'
env:
CODEQL_ENABLE_EXPERIMENTAL_FEATURES: "true"
jobs:
analyze:
strategy:
matrix:
language: [ 'rust' ]
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
pull-requests: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Query latest nightly CodeQL bundle
shell: bash
id: codeql
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
REPO=dsp-testing/codeql-cli-nightlies
TAG=$(
gh release list -R $REPO -L1 --exclude-drafts --json tagName -q ".[] | .tagName"
)
echo "nightly_bundle=https://github.com/$REPO/releases/download/$TAG/codeql-bundle-linux64.tar.zst" \
| tee -a "$GITHUB_OUTPUT"
- name: Initialize CodeQL
uses: github/codeql-action/init@main
with:
tools: ${{ steps.codeql.outputs.nightly_bundle }}
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
- name: Autobuild
uses: github/codeql-action/autobuild@main
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@main

View File

@@ -44,7 +44,7 @@ jobs:
# without waiting for the macOS build
build-and-test-macos:
if: github.repository_owner == 'github'
runs-on: macos-12-xl
runs-on: macos-13-xlarge
steps:
- uses: actions/checkout@v4
- uses: ./swift/actions/build-and-test
@@ -64,7 +64,7 @@ jobs:
qltests-macos:
if: ${{ github.repository_owner == 'github' && github.event_name == 'pull_request' }}
needs: build-and-test-macos
runs-on: macos-12-xl
runs-on: macos-13-xlarge
steps:
- uses: actions/checkout@v4
- uses: ./swift/actions/run-ql-tests

View File

@@ -23,7 +23,6 @@
/ql/ @github/codeql-ql-for-ql-reviewers
# Bazel (excluding BUILD.bazel files)
WORKSPACE.bazel @github/codeql-ci-reviewers
MODULE.bazel @github/codeql-ci-reviewers
.bazelversion @github/codeql-ci-reviewers
.bazelrc @github/codeql-ci-reviewers

27
Cargo.lock generated
View File

@@ -384,6 +384,7 @@ dependencies = [
"clap",
"codeql-extractor",
"figment",
"glob",
"itertools 0.13.0",
"log",
"num-traits",
@@ -631,6 +632,7 @@ dependencies = [
"atomic",
"pear",
"serde",
"serde_yaml",
"uncased",
"version_check",
]
@@ -704,6 +706,12 @@ dependencies = [
"wasi",
]
[[package]]
name = "glob"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "globset"
version = "0.4.15"
@@ -2058,6 +2066,19 @@ dependencies = [
"syn",
]
[[package]]
name = "serde_yaml"
version = "0.9.34+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
dependencies = [
"indexmap 2.5.0",
"itoa",
"ryu",
"serde",
"unsafe-libyaml",
]
[[package]]
name = "sharded-slab"
version = "0.1.7"
@@ -2381,6 +2402,12 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a"
[[package]]
name = "unsafe-libyaml"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
[[package]]
name = "utf8parse"
version = "0.2.2"

View File

@@ -18,14 +18,14 @@ bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_go", version = "0.50.0")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_nodejs", version = "6.2.0-codeql.1")
bazel_dep(name = "rules_python", version = "0.35.0")
bazel_dep(name = "bazel_skylib", version = "1.6.1")
bazel_dep(name = "rules_python", version = "0.36.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "abseil-cpp", version = "20240116.0", repo_name = "absl")
bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "json")
bazel_dep(name = "fmt", version = "10.0.0")
bazel_dep(name = "rules_kotlin", version = "2.0.0-codeql.1")
bazel_dep(name = "gazelle", version = "0.38.0")
bazel_dep(name = "rules_dotnet", version = "0.15.1")
bazel_dep(name = "rules_dotnet", version = "0.16.1")
bazel_dep(name = "googletest", version = "1.14.0.bcr.1")
bazel_dep(name = "rules_rust", version = "0.52.2")

View File

@@ -1,2 +0,0 @@
# please use MODULE.bazel to add dependencies
# this empty file is required by internal repositories, don't remove it

20
actions/BUILD.bazel Normal file
View File

@@ -0,0 +1,20 @@
load("//misc/bazel:pkg.bzl", "codeql_pack")
package(default_visibility = ["//visibility:public"])
[
codeql_pack(
name = "-".join(parts),
srcs = [
"//actions/extractor",
],
pack_prefix = "/".join(parts),
)
for parts in (
[
"experimental",
"actions",
],
["actions"],
)
]

View File

@@ -0,0 +1,10 @@
load("//misc/bazel:pkg.bzl", "codeql_pkg_files", "strip_prefix")
codeql_pkg_files(
name = "extractor",
srcs = [
"codeql-extractor.yml",
] + glob(["tools/**"]),
strip_prefix = strip_prefix.from_pkg(),
visibility = ["//actions:__pkg__"],
)

View File

@@ -0,0 +1,44 @@
name: "actions"
aliases: []
display_name: "GitHub Actions"
version: 0.0.1
column_kind: "utf16"
unicode_newlines: true
build_modes:
- none
file_coverage_languages: []
github_api_languages: []
scc_languages: []
file_types:
- name: workflow
display_name: GitHub Actions workflow files
extensions:
- .yml
- .yaml
forwarded_extractor_name: javascript
options:
trap:
title: TRAP options
description: Options about how the extractor handles TRAP files
type: object
visibility: 3
properties:
cache:
title: TRAP cache options
description: Options about how the extractor handles its TRAP cache
type: object
properties:
dir:
title: TRAP cache directory
description: The directory of the TRAP cache to use
type: string
bound:
title: TRAP cache bound
description: A soft limit (in MB) on the size of the TRAP cache
type: string
pattern: "[0-9]+"
write:
title: TRAP cache writeable
description: Whether to write to the TRAP cache as well as reading it
type: string
pattern: "(true|TRUE|false|FALSE)"

View File

@@ -0,0 +1,40 @@
if (($null -ne $env:LGTM_INDEX_INCLUDE) -or ($null -ne $env:LGTM_INDEX_EXCLUDE) -or ($null -ne $env:LGTM_INDEX_FILTERS)) {
Write-Output 'Path filters set. Passing them through to the JavaScript extractor.'
} else {
Write-Output 'No path filters set. Using the default filters.'
$DefaultPathFilters = @(
'exclude:**/*',
'include:.github/workflows/**/*.yml',
'include:.github/workflows/**/*.yaml',
'include:**/action.yml',
'include:**/action.yaml'
)
$env:LGTM_INDEX_FILTERS = $DefaultPathFilters -join "`n"
}
# Find the JavaScript extractor directory via `codeql resolve extractor`.
$CodeQL = Join-Path $env:CODEQL_DIST 'codeql.exe'
$env:CODEQL_EXTRACTOR_JAVASCRIPT_ROOT = &$CodeQL resolve extractor --language javascript
if ($LASTEXITCODE -ne 0) {
throw 'Failed to resolve JavaScript extractor.'
}
Write-Output "Found JavaScript extractor at '${env:CODEQL_EXTRACTOR_JAVASCRIPT_ROOT}'."
# Run the JavaScript autobuilder.
$JavaScriptAutoBuild = Join-Path $env:CODEQL_EXTRACTOR_JAVASCRIPT_ROOT 'tools\autobuild.cmd'
Write-Output "Running JavaScript autobuilder at '${JavaScriptAutoBuild}'."
# Copy the values of the Actions extractor environment variables to the JavaScript extractor environment variables.
$env:CODEQL_EXTRACTOR_JAVASCRIPT_DIAGNOSTIC_DIR = $env:CODEQL_EXTRACTOR_ACTIONS_DIAGNOSTIC_DIR
$env:CODEQL_EXTRACTOR_JAVASCRIPT_LOG_DIR = $env:CODEQL_EXTRACTOR_ACTIONS_LOG_DIR
$env:CODEQL_EXTRACTOR_JAVASCRIPT_SCRATCH_DIR = $env:CODEQL_EXTRACTOR_ACTIONS_SCRATCH_DIR
$env:CODEQL_EXTRACTOR_JAVASCRIPT_SOURCE_ARCHIVE_DIR = $env:CODEQL_EXTRACTOR_ACTIONS_SOURCE_ARCHIVE_DIR
$env:CODEQL_EXTRACTOR_JAVASCRIPT_TRAP_DIR = $env:CODEQL_EXTRACTOR_ACTIONS_TRAP_DIR
$env:CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE = $env:CODEQL_EXTRACTOR_ACTIONS_WIP_DATABASE
&$JavaScriptAutoBuild
if ($LASTEXITCODE -ne 0) {
throw "JavaScript autobuilder failed."
}

View File

@@ -0,0 +1,3 @@
@echo off
rem All of the work is done in the PowerShell script
powershell.exe %~dp0autobuild-impl.ps1

View File

@@ -0,0 +1,39 @@
#!/bin/sh
set -eu
DEFAULT_PATH_FILTERS=$(cat << END
exclude:**/*
include:.github/workflows/**/*.yml
include:.github/workflows/**/*.yaml
include:**/action.yml
include:**/action.yaml
END
)
if [ -n "${LGTM_INDEX_INCLUDE:-}" ] || [ -n "${LGTM_INDEX_EXCLUDE:-}" ] || [ -n "${LGTM_INDEX_FILTERS:-}" ] ; then
echo "Path filters set. Passing them through to the JavaScript extractor."
else
echo "No path filters set. Using the default filters."
LGTM_INDEX_FILTERS="${DEFAULT_PATH_FILTERS}"
export LGTM_INDEX_FILTERS
fi
# Find the JavaScript extractor directory via `codeql resolve extractor`.
CODEQL_EXTRACTOR_JAVASCRIPT_ROOT="$($CODEQL_DIST/codeql resolve extractor --language javascript)"
export CODEQL_EXTRACTOR_JAVASCRIPT_ROOT
echo "Found JavaScript extractor at '${CODEQL_EXTRACTOR_JAVASCRIPT_ROOT}'."
# Run the JavaScript autobuilder
JAVASCRIPT_AUTO_BUILD="${CODEQL_EXTRACTOR_JAVASCRIPT_ROOT}/tools/autobuild.sh"
echo "Running JavaScript autobuilder at '${JAVASCRIPT_AUTO_BUILD}'."
# Copy the values of the Actions extractor environment variables to the JavaScript extractor environment variables.
env CODEQL_EXTRACTOR_JAVASCRIPT_DIAGNOSTIC_DIR="${CODEQL_EXTRACTOR_ACTIONS_DIAGNOSTIC_DIR}" \
CODEQL_EXTRACTOR_JAVASCRIPT_LOG_DIR="${CODEQL_EXTRACTOR_ACTIONS_LOG_DIR}" \
CODEQL_EXTRACTOR_JAVASCRIPT_SCRATCH_DIR="${CODEQL_EXTRACTOR_ACTIONS_SCRATCH_DIR}" \
CODEQL_EXTRACTOR_JAVASCRIPT_SOURCE_ARCHIVE_DIR="${CODEQL_EXTRACTOR_ACTIONS_SOURCE_ARCHIVE_DIR}" \
CODEQL_EXTRACTOR_JAVASCRIPT_TRAP_DIR="${CODEQL_EXTRACTOR_ACTIONS_TRAP_DIR}" \
CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE="${CODEQL_EXTRACTOR_ACTIONS_WIP_DATABASE}" \
${JAVASCRIPT_AUTO_BUILD}

View File

@@ -0,0 +1 @@
predicate placeholder(int x) { x = 0 }

12
actions/ql/lib/qlpack.yml Normal file
View File

@@ -0,0 +1,12 @@
name: codeql/actions-all
version: 0.0.1-dev
library: true
warnOnImplicitThis: true
dependencies:
codeql/util: ${workspace}
codeql/yaml: ${workspace}
codeql/controlflow: ${workspace}
codeql/dataflow: ${workspace}
codeql/javascript-all: ${workspace}
extractor: actions
groups: actions

View File

@@ -0,0 +1,16 @@
/**
* @name Placeholder Query
* @description Placeholder
* @kind problem
* @problem.severity warning
* @security-severity 9.3
* @precision high
* @id actions/placeholder
* @tags actions security
*/
import actions
import javascript
from File f
select f, "Analyzed a file."

View File

@@ -0,0 +1,8 @@
name: codeql/actions-queries
version: 0.0.1-dev
library: false
groups: [actions, queries]
extractor: actions
dependencies:
codeql/actions-all: ${workspace}
warnOnImplicitThis: true

View File

@@ -0,0 +1,23 @@
on: push
jobs:
job1:
runs-on: ubuntu-latest
steps:
- shell: pwsh
run: Write-Output "foo"
job2:
runs-on: ubuntu-latest
steps:
- run: echo "foo"
job3:
runs-on: windows-latest
steps:
- shell: bash
run: echo "foo"
job4:
runs-on: windows-latest
steps:
- run: Write-Output "foo"

View File

@@ -0,0 +1 @@
| 1 |

View File

@@ -0,0 +1 @@
select 1

View File

@@ -0,0 +1,8 @@
name: codeql/actions-tests
groups: [codeql, test]
dependencies:
codeql/actions-all: ${workspace}
codeql/actions-queries: ${workspace}
extractor: actions
tests: .
warnOnImplicitThis: true

View File

@@ -0,0 +1,23 @@
on: push
jobs:
job1:
runs-on: ubuntu-latest
steps:
- shell: pwsh
run: Write-Output "foo"
job2:
runs-on: ubuntu-latest
steps:
- run: echo "foo"
job3:
runs-on: windows-latest
steps:
- shell: bash
run: echo "foo"
job4:
runs-on: windows-latest
steps:
- run: Write-Output "foo"

View File

@@ -0,0 +1 @@
| .github/workflows/shell.yml:0:0:0:0 | .github/workflows/shell.yml | Analyzed a file. |

View File

@@ -0,0 +1 @@
Placeholder.ql

View File

@@ -351,9 +351,5 @@
"Python model summaries test extension": [
"python/ql/test/library-tests/dataflow/model-summaries/InlineTaintTest.ext.yml",
"python/ql/test/library-tests/dataflow/model-summaries/NormalDataflowTest.ext.yml"
],
"Diagnostics.qll": [
"ruby/ql/lib/codeql/ruby/Diagnostics.qll",
"rust/ql/lib/codeql/rust/Diagnostics.qll"
]
}

View File

@@ -0,0 +1,17 @@
class Expr extends @expr {
string toString() { none() }
}
class Location extends @location_expr {
string toString() { none() }
}
predicate isExprRequirement(Expr expr) {
exists(int kind | exprs(expr, kind, _) | kind = [391, 392, 393])
}
from Expr expr, int kind, int kind_new, Location location
where
exprs(expr, kind, location) and
if isExprRequirement(expr) then kind_new = 1 else kind_new = kind
select expr, kind_new, location

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
class Parameter extends @parameter {
string toString() { none() }
}
class ParameterizedElement extends @parameterized_element {
string toString() { none() }
}
class Type extends @type {
string toString() { none() }
}
from Parameter param, ParameterizedElement pe, int index, Type type
where
params(param, pe, index, type) and
not pe instanceof @requires_expr
select param, pe, index, type

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
description: Support C++20 requires expressions
compatibility: partial
compound_requirement_is_noexcept.rel: delete
exprs.rel: run exprs.qlo
params.rel: run params.qlo

View File

@@ -1,3 +1,16 @@
## 2.1.0
### New Features
* Added a new predicate `DataFlow::getARuntimeTarget` for getting a function that may be invoked by a `Call` expression. Unlike `Call.getTarget` this new predicate may also resolve function pointers.
* Added the predicate `mayBeFromImplicitlyDeclaredFunction()` to the `Call` class to represent calls that may be the return value of an implicitly declared C function.
* Added the predicate `getAnExplicitDeclarationEntry()` to the `Function` class to get a `FunctionDeclarationEntry` that is not implicit.
* Added classes `RequiresExpr`, `SimpleRequirementExpr`, `TypeRequirementExpr`, `CompoundRequirementExpr`, and `NestedRequirementExpr` to represent C++20 requires expressions and the simple, type, compound, and nested requirements that can occur in `requires` expressions.
### Minor Analysis Improvements
* The function call target resolution algorithm has been improved to resolve more calls through function pointers. As a result, dataflow queries may have more results.
## 2.0.2
### Minor Analysis Improvements

View File

@@ -0,0 +1,12 @@
## 2.1.0
### New Features
* Added a new predicate `DataFlow::getARuntimeTarget` for getting a function that may be invoked by a `Call` expression. Unlike `Call.getTarget` this new predicate may also resolve function pointers.
* Added the predicate `mayBeFromImplicitlyDeclaredFunction()` to the `Call` class to represent calls that may be the return value of an implicitly declared C function.
* Added the predicate `getAnExplicitDeclarationEntry()` to the `Function` class to get a `FunctionDeclarationEntry` that is not implicit.
* Added classes `RequiresExpr`, `SimpleRequirementExpr`, `TypeRequirementExpr`, `CompoundRequirementExpr`, and `NestedRequirementExpr` to represent C++20 requires expressions and the simple, type, compound, and nested requirements that can occur in `requires` expressions.
### Minor Analysis Improvements
* The function call target resolution algorithm has been improved to resolve more calls through function pointers. As a result, dataflow queries may have more results.

View File

@@ -1,2 +1,2 @@
---
lastReleaseVersion: 2.0.2
lastReleaseVersion: 2.1.0

View File

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

View File

@@ -6,9 +6,156 @@ import semmle.code.cpp.exprs.Expr
/**
* A C++ requires expression.
*
* For example, with `T` and `U` template parameters:
* ```cpp
* requires (T x, U y) { x + y; };
* ```
*/
class RequiresExpr extends Expr, @requires_expr {
override string toString() { result = "requires ..." }
override string toString() {
if exists(this.getAParameter())
then result = "requires(...) { ... }"
else result = "requires { ... }"
}
override string getAPrimaryQlClass() { result = "RequiresExpr" }
/**
* Gets a requirement in this requires expression.
*/
RequirementExpr getARequirement() { result = this.getAChild() }
/**
* Gets the nth requirement in this requires expression.
*/
RequirementExpr getRequirement(int n) { result = this.getChild(n) }
/**
* Gets the number of requirements in this requires expression.
*/
int getNumberOfRequirements() { result = count(this.getARequirement()) }
/**
* Gets a parameter of this requires expression, if any.
*/
Parameter getAParameter() { result.getRequiresExpr() = underlyingElement(this) }
/**
* Gets the the nth parameter of this requires expression.
*/
Parameter getParameter(int n) {
result.getRequiresExpr() = underlyingElement(this) and result.getIndex() = n
}
/**
* Gets the number of parameters of this requires expression.
*/
int getNumberOfParameters() { result = count(this.getAParameter()) }
}
/**
* A C++ requirement in a requires expression.
*/
class RequirementExpr extends Expr { }
/**
* A C++ simple requirement in a requires expression.
*
* For example, if:
* ```cpp
* requires(T x, U y) { x + y; };
* ```
* with `T` and `U` template parameters, then `x + y;` is a simple requirement.
*/
class SimpleRequirementExpr extends RequirementExpr {
SimpleRequirementExpr() {
this.getParent() instanceof RequiresExpr and
not this instanceof TypeRequirementExpr and
not this instanceof CompoundRequirementExpr and
not this instanceof NestedRequirementExpr
}
override string getAPrimaryQlClass() { result = "SimpleRequirementExpr" }
}
/**
* A C++ type requirement in a requires expression.
*
* For example, if:
* ```cpp
* requires { typename T::a_field; };
* ```
* with `T` a template parameter, then `typename T::a_field;` is a type requirement.
*/
class TypeRequirementExpr extends RequirementExpr, TypeName {
TypeRequirementExpr() { this.getParent() instanceof RequiresExpr }
override string getAPrimaryQlClass() { result = "TypeRequirementExpr" }
}
/**
* A C++ compound requirement in a requires expression.
*
* For example, if:
* ```cpp
* requires(T x) { { x } noexcept -> std::same_as<int>; };
* ```
* with `T` a template parameter, then `{ x } noexcept -> std::same_as<int>;` is
* a compound requirement.
*/
class CompoundRequirementExpr extends RequirementExpr, @compound_requirement {
override string toString() {
if exists(this.getReturnTypeRequirement())
then result = "{ ... } -> ..."
else result = "{ ... }"
}
override string getAPrimaryQlClass() { result = "CompoundRequirementExpr" }
/**
* Gets the expression from the compound requirement.
*/
Expr getExpr() { result = this.getChild(0) }
/**
* Gets the return type requirement from the compound requirement, if any.
*/
Expr getReturnTypeRequirement() { result = this.getChild(1) }
/**
* Holds if the expression from the compound requirement must not be
* potentially throwing.
*/
predicate isNoExcept() { compound_requirement_is_noexcept(underlyingElement(this)) }
}
/**
* A C++ nested requirement in a requires expression.
*
* For example, if:
* ```cpp
* requires { requires std::is_same<T, int>::value; };
* ```
* with `T` a template parameter, then `requires std::is_same<T, int>::value;` is
* a nested requirement.
*/
class NestedRequirementExpr extends Expr, @nested_requirement {
override string toString() { result = "requires ..." }
override string getAPrimaryQlClass() { result = "NestedRequirementExpr" }
/**
* Gets the constraint from the nested requirement.
*/
Expr getConstraint() { result = this.getChild(0) }
}
/**
* A C++ concept id expression.
*/
class ConceptIdExpr extends RequirementExpr, @concept_id {
override string toString() { result = "concept<...>" }
override string getAPrimaryQlClass() { result = "ConceptIdExpr" }
}

View File

@@ -129,7 +129,7 @@ class Element extends ElementBase {
* or certain kinds of `Statement`.
*/
Element getParentScope() {
// result instanceof class
// result instanceof Class
exists(Declaration m |
m = this and
result = m.getDeclaringType() and
@@ -138,31 +138,40 @@ class Element extends ElementBase {
or
exists(TemplateClass tc | this = tc.getATemplateArgument() and result = tc)
or
// result instanceof namespace
// result instanceof Namespace
exists(Namespace n | result = n and n.getADeclaration() = this)
or
exists(FriendDecl d, Namespace n | this = d and n.getADeclaration() = d and result = n)
or
exists(Namespace n | this = n and result = n.getParentNamespace())
or
// result instanceof stmt
// result instanceof Stmt
exists(LocalVariable v |
this = v and
exists(DeclStmt ds | ds.getADeclaration() = v and result = ds.getParent())
)
or
exists(Parameter p | this = p and result = p.getFunction())
exists(Parameter p |
this = p and
(
result = p.getFunction() or
result = p.getCatchBlock().getParent().(Handler).getParent().(TryStmt).getParent() or
result = p.getRequiresExpr().getEnclosingStmt().getParent()
)
)
or
exists(GlobalVariable g, Namespace n | this = g and n.getADeclaration() = g and result = n)
or
exists(TemplateVariable tv | this = tv.getATemplateArgument() and result = tv)
or
exists(EnumConstant e | this = e and result = e.getDeclaringEnum())
or
// result instanceof block|function
// result instanceof Block|Function
exists(BlockStmt b | this = b and blockscope(unresolveElement(b), unresolveElement(result)))
or
exists(TemplateFunction tf | this = tf.getATemplateArgument() and result = tf)
or
// result instanceof stmt
// result instanceof Stmt
exists(ControlStructure s | this = s and result = s.getParent())
or
using_container(unresolveElement(result), underlyingElement(this))

View File

@@ -230,6 +230,14 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
)
}
/**
* Gets a non-implicit function declaration entry.
*/
FunctionDeclarationEntry getAnExplicitDeclarationEntry() {
result = this.getADeclarationEntry() and
not result.isImplicit()
}
private predicate declEntry(FunctionDeclarationEntry fde) {
fun_decls(unresolveElement(fde), underlyingElement(this), _, _, _) and
// If one .cpp file specializes a function, and another calls the

View File

@@ -7,8 +7,8 @@ import semmle.code.cpp.Declaration
private import semmle.code.cpp.internal.ResolveClass
/**
* A C/C++ function parameter or catch block parameter. For example the
* function parameter `p` and the catch block parameter `e` in the following
* A C/C++ function parameter, catch block parameter, or requires expression parameter.
* For example the function parameter `p` and the catch block parameter `e` in the following
* code:
* ```
* void myFunction(int p) {
@@ -20,8 +20,8 @@ private import semmle.code.cpp.internal.ResolveClass
* }
* ```
*
* For catch block parameters, there is a one-to-one correspondence between
* the `Parameter` and its `ParameterDeclarationEntry`.
* For catch block parameters and expression , there is a one-to-one
* correspondence between the `Parameter` and its `VariableDeclarationEntry`.
*
* For function parameters, there is a one-to-many relationship between
* `Parameter` and `ParameterDeclarationEntry`, because one function can
@@ -73,7 +73,8 @@ class Parameter extends LocalScopeVariable, @parameter {
}
private VariableDeclarationEntry getANamedDeclarationEntry() {
result = this.getAnEffectiveDeclarationEntry() and result.getName() != ""
result = this.getAnEffectiveDeclarationEntry() and
exists(string name | var_decls(unresolveElement(result), _, _, name, _) | name != "")
}
/**
@@ -118,6 +119,12 @@ class Parameter extends LocalScopeVariable, @parameter {
*/
BlockStmt getCatchBlock() { params(underlyingElement(this), unresolveElement(result), _, _) }
/**
* Gets the requires expression to which the parameter belongs, if it is a
* requires expression parameter.
*/
RequiresExpr getRequiresExpr() { params(underlyingElement(this), unresolveElement(result), _, _) }
/**
* Gets the zero-based index of this parameter.
*

View File

@@ -82,6 +82,8 @@ private Declaration getAnEnclosingDeclaration(Locatable ast) {
or
result = ast.(Parameter).getCatchBlock().getEnclosingFunction()
or
result = ast.(Parameter).getRequiresExpr().getEnclosingFunction()
or
result = ast.(Expr).getEnclosingDeclaration()
or
result = ast.(Initializer).getDeclaration()
@@ -101,7 +103,10 @@ private newtype TPrintAstNode =
stmt.getADeclarationEntry() = entry and
shouldPrintDeclaration(stmt.getEnclosingFunction())
} or
TParametersNode(Function func) { shouldPrintDeclaration(func) } or
TFunctionParametersNode(Function func) { shouldPrintDeclaration(func) } or
TRequiresExprParametersNode(RequiresExpr req) {
shouldPrintDeclaration(getAnEnclosingDeclaration(req))
} or
TConstructorInitializersNode(Constructor ctor) {
ctor.hasEntryPoint() and
shouldPrintDeclaration(ctor)
@@ -305,14 +310,14 @@ class ExprNode extends AstNode {
ExprNode() { expr = ast }
override AstNode getChildInternal(int childIndex) {
result.getAst() = expr.getChild(childIndex)
override PrintAstNode getChildInternal(int childIndex) {
result.(AstNode).getAst() = expr.getChild(childIndex)
or
childIndex = max(int index | exists(expr.getChild(index)) or index = 0) + 1 and
result.getAst() = expr.(ConditionDeclExpr).getInitializingExpr()
result.(AstNode).getAst() = expr.(ConditionDeclExpr).getInitializingExpr()
or
exists(int destructorIndex |
result.getAst() = expr.getImplicitDestructorCall(destructorIndex) and
result.(AstNode).getAst() = expr.getImplicitDestructorCall(destructorIndex) and
childIndex = destructorIndex + max(int index | exists(expr.getChild(index)) or index = 0) + 2
)
}
@@ -331,7 +336,8 @@ class ExprNode extends AstNode {
}
override string getChildAccessorPredicateInternal(int childIndex) {
result = getChildAccessorWithoutConversions(ast, this.getChildInternal(childIndex).getAst())
result =
getChildAccessorWithoutConversions(ast, this.getChildInternal(childIndex).(AstNode).getAst())
}
/**
@@ -411,6 +417,26 @@ class StmtExprNode extends ExprNode {
}
}
/**
* A node representing a `RequiresExpr`
*/
class RequiresExprNode extends ExprNode {
override RequiresExpr expr;
override PrintAstNode getChildInternal(int childIndex) {
result = super.getChildInternal(childIndex)
or
childIndex = -1 and
result.(RequiresExprParametersNode).getRequiresExpr() = expr
}
override string getChildAccessorPredicateInternal(int childIndex) {
result = super.getChildAccessorPredicateInternal(childIndex)
or
childIndex = -1 and result = "<params>"
}
}
/**
* A node representing a `DeclarationEntry`.
*/
@@ -570,10 +596,10 @@ class InitializerNode extends AstNode {
/**
* A node representing the parameters of a `Function`.
*/
class ParametersNode extends PrintAstNode, TParametersNode {
class FunctionParametersNode extends PrintAstNode, TFunctionParametersNode {
Function func;
ParametersNode() { this = TParametersNode(func) }
FunctionParametersNode() { this = TFunctionParametersNode(func) }
final override string toString() { result = "" }
@@ -594,6 +620,33 @@ class ParametersNode extends PrintAstNode, TParametersNode {
final Function getFunction() { result = func }
}
/**
* A node representing the parameters of a `RequiresExpr`.
*/
class RequiresExprParametersNode extends PrintAstNode, TRequiresExprParametersNode {
RequiresExpr req;
RequiresExprParametersNode() { this = TRequiresExprParametersNode(req) }
final override string toString() { result = "" }
final override Location getLocation() { result = getRepresentativeLocation(req) }
override AstNode getChildInternal(int childIndex) {
result.getAst() = req.getParameter(childIndex)
}
override string getChildAccessorPredicateInternal(int childIndex) {
exists(this.getChildInternal(childIndex)) and
result = "getParameter(" + childIndex.toString() + ")"
}
/**
* Gets the `RequiresExpr` for which this node represents the parameters.
*/
final RequiresExpr getRequiresExpr() { result = req }
}
/**
* A node representing the initializer list of a `Constructor`.
*/
@@ -697,7 +750,7 @@ class FunctionNode extends FunctionOrGlobalOrNamespaceVariableNode {
override PrintAstNode getChildInternal(int childIndex) {
childIndex = 0 and
result.(ParametersNode).getFunction() = func
result.(FunctionParametersNode).getFunction() = func
or
childIndex = 1 and
result.(ConstructorInitializersNode).getConstructor() = func
@@ -921,6 +974,11 @@ private predicate namedExprChildPredicates(Expr expr, Element ele, string pred)
or
expr.(CommaExpr).getRightOperand() = ele and pred = "getRightOperand()"
or
expr.(CompoundRequirementExpr).getExpr() = ele and pred = "getExpr()"
or
expr.(CompoundRequirementExpr).getReturnTypeRequirement() = ele and
pred = "getReturnTypeRequirement()"
or
expr.(ConditionDeclExpr).getVariableAccess() = ele and pred = "getVariableAccess()"
or
expr.(ConstructorFieldInit).getExpr() = ele and pred = "getExpr()"
@@ -941,6 +999,8 @@ private predicate namedExprChildPredicates(Expr expr, Element ele, string pred)
or
expr.(LambdaExpression).getInitializer() = ele and pred = "getInitializer()"
or
expr.(NestedRequirementExpr).getConstraint() = ele and pred = "getConstraint()"
or
expr.(NewOrNewArrayExpr).getAllocatorCall() = ele and pred = "getAllocatorCall()"
or
expr.(NewOrNewArrayExpr).getAlignmentArgument() = ele and pred = "getAlignmentArgument()"
@@ -980,6 +1040,11 @@ private predicate namedExprChildPredicates(Expr expr, Element ele, string pred)
or
expr.(UnaryOperation).getOperand() = ele and pred = "getOperand()"
or
exists(int n |
expr.(RequiresExpr).getRequirement(n) = ele and
pred = "getRequirement(" + n + ")"
)
or
expr.(SizeofExprOperator).getExprOperand() = ele and pred = "getExprOperand()"
or
expr.(StmtExpr).getStmt() = ele and pred = "getStmt()"

View File

@@ -241,6 +241,10 @@ class VariableDeclarationEntry extends DeclarationEntry, @var_decl {
name != "" and result = name
or
name = "" and result = this.getVariable().(LocalVariable).getName()
or
name = "" and
not this instanceof ParameterDeclarationEntry and
result = this.getVariable().(Parameter).getName()
)
)
}
@@ -295,19 +299,11 @@ class ParameterDeclarationEntry extends VariableDeclarationEntry {
private string getAnonymousParameterDescription() {
not exists(this.getName()) and
exists(string idx |
idx =
((this.getIndex() + 1).toString() + "th")
.replaceAll("1th", "1st")
.replaceAll("2th", "2nd")
.replaceAll("3th", "3rd")
.replaceAll("11st", "11th")
.replaceAll("12nd", "12th")
.replaceAll("13rd", "13th") and
exists(string anon |
anon = "(unnamed parameter " + this.getIndex().toString() + ")" and
if exists(this.getCanonicalName())
then
result = "declaration of " + this.getCanonicalName() + " as anonymous " + idx + " parameter"
else result = "declaration of " + idx + " parameter"
then result = "declaration of " + this.getCanonicalName() + " as " + anon
else result = "declaration of " + anon
)
}

View File

@@ -261,13 +261,17 @@ deprecated private module Config implements FullStateConfigSig {
model = ""
}
predicate isAdditionalFlowStep(Node node1, FlowState state1, Node node2, FlowState state2) {
predicate isAdditionalFlowStep(
Node node1, FlowState state1, Node node2, FlowState state2, string model
) {
getConfig(state1).isAdditionalFlowStep(node1, getState(state1), node2, getState(state2)) and
getConfig(state2) = getConfig(state1)
getConfig(state2) = getConfig(state1) and
model = ""
or
not singleConfiguration() and
getConfig(state1).isAdditionalFlowStep(node1, node2) and
state2 = state1
state2 = state1 and
model = ""
}
predicate allowImplicitRead(Node node, ContentSet c) {

View File

@@ -261,13 +261,17 @@ deprecated private module Config implements FullStateConfigSig {
model = ""
}
predicate isAdditionalFlowStep(Node node1, FlowState state1, Node node2, FlowState state2) {
predicate isAdditionalFlowStep(
Node node1, FlowState state1, Node node2, FlowState state2, string model
) {
getConfig(state1).isAdditionalFlowStep(node1, getState(state1), node2, getState(state2)) and
getConfig(state2) = getConfig(state1)
getConfig(state2) = getConfig(state1) and
model = ""
or
not singleConfiguration() and
getConfig(state1).isAdditionalFlowStep(node1, node2) and
state2 = state1
state2 = state1 and
model = ""
}
predicate allowImplicitRead(Node node, ContentSet c) {

View File

@@ -261,13 +261,17 @@ deprecated private module Config implements FullStateConfigSig {
model = ""
}
predicate isAdditionalFlowStep(Node node1, FlowState state1, Node node2, FlowState state2) {
predicate isAdditionalFlowStep(
Node node1, FlowState state1, Node node2, FlowState state2, string model
) {
getConfig(state1).isAdditionalFlowStep(node1, getState(state1), node2, getState(state2)) and
getConfig(state2) = getConfig(state1)
getConfig(state2) = getConfig(state1) and
model = ""
or
not singleConfiguration() and
getConfig(state1).isAdditionalFlowStep(node1, node2) and
state2 = state1
state2 = state1 and
model = ""
}
predicate allowImplicitRead(Node node, ContentSet c) {

View File

@@ -261,13 +261,17 @@ deprecated private module Config implements FullStateConfigSig {
model = ""
}
predicate isAdditionalFlowStep(Node node1, FlowState state1, Node node2, FlowState state2) {
predicate isAdditionalFlowStep(
Node node1, FlowState state1, Node node2, FlowState state2, string model
) {
getConfig(state1).isAdditionalFlowStep(node1, getState(state1), node2, getState(state2)) and
getConfig(state2) = getConfig(state1)
getConfig(state2) = getConfig(state1) and
model = ""
or
not singleConfiguration() and
getConfig(state1).isAdditionalFlowStep(node1, node2) and
state2 = state1
state2 = state1 and
model = ""
}
predicate allowImplicitRead(Node node, ContentSet c) {

View File

@@ -261,13 +261,17 @@ deprecated private module Config implements FullStateConfigSig {
model = ""
}
predicate isAdditionalFlowStep(Node node1, FlowState state1, Node node2, FlowState state2) {
predicate isAdditionalFlowStep(
Node node1, FlowState state1, Node node2, FlowState state2, string model
) {
getConfig(state1).isAdditionalFlowStep(node1, getState(state1), node2, getState(state2)) and
getConfig(state2) = getConfig(state1)
getConfig(state2) = getConfig(state1) and
model = ""
or
not singleConfiguration() and
getConfig(state1).isAdditionalFlowStep(node1, node2) and
state2 = state1
state2 = state1 and
model = ""
}
predicate allowImplicitRead(Node node, ContentSet c) {

View File

@@ -281,3 +281,9 @@ private predicate exprToPartialDefinitionStep(Expr exprIn, Expr exprOut) {
}
private predicate iteratorDereference(Call c) { c.getTarget() instanceof IteratorReferenceFunction }
/**
* Holds if the additional step from `src` to `sink` should be considered in
* speculative taint flow exploration.
*/
predicate speculativeTaintStep(DataFlow::Node src, DataFlow::Node sink) { none() }

View File

@@ -149,6 +149,11 @@ class Call extends Expr, NameQualifiableElement, TCall {
variableAddressEscapesTreeNonConst(va, this.getQualifier().getFullyConverted()) and
i = -1
}
/** Holds if this expression could be the return value of an implicitly declared function. */
predicate mayBeFromImplicitlyDeclaredFunction() {
this.getTarget().getADeclarationEntry().isImplicit()
}
}
/**

View File

@@ -181,12 +181,7 @@ class VariableDeclarationEntry extends @var_decl {
string getName() { var_decls(this, _, _, result, _) and result != "" }
}
class Parameter extends LocalScopeVariable, @parameter {
@functionorblock function;
int index;
Parameter() { params(this, function, index, _) }
}
class Parameter extends LocalScopeVariable, @parameter { }
class GlobalOrNamespaceVariable extends Variable, @globalvariable { }

View File

@@ -261,13 +261,17 @@ deprecated private module Config implements FullStateConfigSig {
model = ""
}
predicate isAdditionalFlowStep(Node node1, FlowState state1, Node node2, FlowState state2) {
predicate isAdditionalFlowStep(
Node node1, FlowState state1, Node node2, FlowState state2, string model
) {
getConfig(state1).isAdditionalFlowStep(node1, getState(state1), node2, getState(state2)) and
getConfig(state2) = getConfig(state1)
getConfig(state2) = getConfig(state1) and
model = ""
or
not singleConfiguration() and
getConfig(state1).isAdditionalFlowStep(node1, node2) and
state2 = state1
state2 = state1 and
model = ""
}
predicate allowImplicitRead(Node node, ContentSet c) {

View File

@@ -261,13 +261,17 @@ deprecated private module Config implements FullStateConfigSig {
model = ""
}
predicate isAdditionalFlowStep(Node node1, FlowState state1, Node node2, FlowState state2) {
predicate isAdditionalFlowStep(
Node node1, FlowState state1, Node node2, FlowState state2, string model
) {
getConfig(state1).isAdditionalFlowStep(node1, getState(state1), node2, getState(state2)) and
getConfig(state2) = getConfig(state1)
getConfig(state2) = getConfig(state1) and
model = ""
or
not singleConfiguration() and
getConfig(state1).isAdditionalFlowStep(node1, node2) and
state2 = state1
state2 = state1 and
model = ""
}
predicate allowImplicitRead(Node node, ContentSet c) {

View File

@@ -261,13 +261,17 @@ deprecated private module Config implements FullStateConfigSig {
model = ""
}
predicate isAdditionalFlowStep(Node node1, FlowState state1, Node node2, FlowState state2) {
predicate isAdditionalFlowStep(
Node node1, FlowState state1, Node node2, FlowState state2, string model
) {
getConfig(state1).isAdditionalFlowStep(node1, getState(state1), node2, getState(state2)) and
getConfig(state2) = getConfig(state1)
getConfig(state2) = getConfig(state1) and
model = ""
or
not singleConfiguration() and
getConfig(state1).isAdditionalFlowStep(node1, node2) and
state2 = state1
state2 = state1 and
model = ""
}
predicate allowImplicitRead(Node node, ContentSet c) {

View File

@@ -261,13 +261,17 @@ deprecated private module Config implements FullStateConfigSig {
model = ""
}
predicate isAdditionalFlowStep(Node node1, FlowState state1, Node node2, FlowState state2) {
predicate isAdditionalFlowStep(
Node node1, FlowState state1, Node node2, FlowState state2, string model
) {
getConfig(state1).isAdditionalFlowStep(node1, getState(state1), node2, getState(state2)) and
getConfig(state2) = getConfig(state1)
getConfig(state2) = getConfig(state1) and
model = ""
or
not singleConfiguration() and
getConfig(state1).isAdditionalFlowStep(node1, node2) and
state2 = state1
state2 = state1 and
model = ""
}
predicate allowImplicitRead(Node node, ContentSet c) {

View File

@@ -1328,7 +1328,10 @@ predicate lambdaCreation(Node creation, LambdaCallKind kind, DataFlowCallable c)
/** Holds if `call` is a lambda call of kind `kind` where `receiver` is the lambda expression. */
predicate lambdaCall(DataFlowCall call, LambdaCallKind kind, Node receiver) {
call.(SummaryCall).getReceiver() = receiver.(FlowSummaryNode).getSummaryNode() and
(
call.(SummaryCall).getReceiver() = receiver.(FlowSummaryNode).getSummaryNode() or
call.asCallInstruction().getCallTargetOperand() = receiver.asOperand()
) and
exists(kind)
}

View File

@@ -17,6 +17,7 @@ private import SsaInternals as Ssa
private import DataFlowImplCommon as DataFlowImplCommon
private import codeql.util.Unit
private import Node0ToString
private import DataFlowDispatch as DataFlowDispatch
import ExprNodes
/**
@@ -2497,3 +2498,16 @@ class AdditionalCallTarget extends Unit {
*/
abstract Declaration viableTarget(Call call);
}
/**
* Gets a function that may be called by `call`.
*
* Note that `call` may be a call to a function pointer expression.
*/
Function getARuntimeTarget(Call call) {
exists(DataFlowCall dfCall | dfCall.asCallInstruction().getUnconvertedResultExpression() = call |
result = DataFlowDispatch::viableCallable(dfCall).asSourceCallable()
or
result = DataFlowImplCommon::viableCallableLambda(dfCall, _).asSourceCallable()
)
}

View File

@@ -212,3 +212,30 @@ predicate modeledTaintStep(DataFlow::Node nodeIn, DataFlow::Node nodeOut, string
nodeOut = callOutput(call, modelOut)
)
}
import SpeculativeTaintFlow
private module SpeculativeTaintFlow {
private import semmle.code.cpp.ir.dataflow.internal.DataFlowDispatch as DataFlowDispatch
private import semmle.code.cpp.ir.dataflow.internal.DataFlowPrivate as DataFlowPrivate
/**
* Holds if the additional step from `src` to `sink` should be considered in
* speculative taint flow exploration.
*/
predicate speculativeTaintStep(DataFlow::Node src, DataFlow::Node sink) {
exists(DataFlowCall call, ArgumentPosition argpos |
// TODO: exclude neutrals and anything that has QL modeling.
not exists(DataFlowDispatch::viableCallable(call)) and
src.(DataFlowPrivate::ArgumentNode).argumentOf(call, argpos)
|
not argpos.(DirectPosition).getIndex() = -1 and
sink.(PostUpdateNode)
.getPreUpdateNode()
.(DataFlowPrivate::ArgumentNode)
.argumentOf(call, any(DirectPosition qualpos | qualpos.getIndex() = -1))
or
sink.(DataFlowPrivate::OutNode).getCall() = call
)
}
}

View File

@@ -683,8 +683,13 @@ private Overlap getExtentOverlap(MemoryLocation0 def, MemoryLocation0 use) {
def.getVirtualVariable() = use.getVirtualVariable() and
def instanceof EntireAllocationMemoryLocation and
(
// EntireAllocationMemoryLocation exactly overlaps itself.
use instanceof EntireAllocationMemoryLocation and
// EntireAllocationMemoryLocation exactly overlaps any EntireAllocationMemoryLocation for the
// same allocation. Checking the allocation, rather than the memory location itself, ensures
// that we get the right relationship between the "must" and "may" memory locations for that
// allocation.
// Note that if one of the locations is a "may" access, the overlap will be downgraded to
// `MustTotallyOverlap` or `MayPartialOverlap` in `getOverlap()`.
use.(EntireAllocationMemoryLocation).getAnAllocation() = def.getAnAllocation() and
result instanceof MustExactlyOverlap
or
not use instanceof EntireAllocationMemoryLocation and

View File

@@ -196,6 +196,8 @@ private predicate isInvalidFunction(Function func) {
expr.getEnclosingFunction() = func and
not exists(expr.getType())
)
or
count(func.getEntryPoint().getLocation()) > 1
}
/**

View File

@@ -91,7 +91,7 @@ private class Sprintf extends FormattingFunction, NonThrowingFunction {
override int getFirstFormatArgumentIndex() {
if this.hasName("__builtin___sprintf_chk")
then result = 4
else result = this.getNumberOfParameters()
else result = super.getFirstFormatArgumentIndex()
}
}

View File

@@ -42,6 +42,21 @@ private Type getAFormatterWideTypeOrDefault() {
* A standard library function that uses a `printf`-like formatting string.
*/
abstract class FormattingFunction extends ArrayFunction, TaintFunction {
int firstFormatArgumentIndex;
FormattingFunction() {
firstFormatArgumentIndex > 0 and
if this.hasDefinition()
then firstFormatArgumentIndex = this.getDefinition().getNumberOfParameters()
else
if this instanceof BuiltInFunction
then firstFormatArgumentIndex = this.getNumberOfParameters()
else
forex(FunctionDeclarationEntry fde | fde = this.getAnExplicitDeclarationEntry() |
firstFormatArgumentIndex = fde.getNumberOfParameters()
)
}
/** Gets the position at which the format parameter occurs. */
abstract int getFormatParameterIndex();
@@ -121,33 +136,7 @@ abstract class FormattingFunction extends ArrayFunction, TaintFunction {
* the first format specifier in the format string. We ignore all
* implicit function definitions.
*/
int getFirstFormatArgumentIndex() {
// The formatting function either has a definition in the snapshot, or all
// `DeclarationEntry`s agree on the number of parameters (otherwise we don't
// really know the correct number)
if this.hasDefinition()
then result = this.getDefinition().getNumberOfParameters()
else result = this.getNumberOfExplicitParameters()
}
/**
* Gets a non-implicit function declaration entry.
*/
private FunctionDeclarationEntry getAnExplicitDeclarationEntry() {
result = this.getADeclarationEntry() and
not result.isImplicit()
}
/**
* Gets the number of parameters, excluding any parameters that have been defined
* from implicit function declarations. If there is some inconsistency in the number
* of parameters, then don't return anything.
*/
private int getNumberOfExplicitParameters() {
forex(FunctionDeclarationEntry fde | fde = this.getAnExplicitDeclarationEntry() |
result = fde.getNumberOfParameters()
)
}
int getFirstFormatArgumentIndex() { result = firstFormatArgumentIndex }
/**
* Gets the position of the buffer size argument, if any.

View File

@@ -534,7 +534,7 @@ static_asserts(
#keyset[function, index, type_id]
params(
int id: @parameter,
int function: @functionorblock ref,
int function: @parameterized_element ref,
int index: int ref,
int type_id: @type ref
);
@@ -1791,6 +1791,9 @@ case @expr.kind of
| 388 = @datasizeof
| 389 = @c11_generic
| 390 = @requires_expr
| 391 = @nested_requirement
| 392 = @compound_requirement
| 393 = @concept_id
;
@var_args_expr = @vastartexpr
@@ -1909,6 +1912,10 @@ case @expr.kind of
| @istriviallyrelocatable
;
compound_requirement_is_noexcept(
int expr: @compound_requirement ref
);
new_allocated_type(
unique int expr: @new_expr ref,
int type_id: @type ref
@@ -2168,11 +2175,11 @@ stmt_decl_entry_bind(
int decl_entry: @element ref
);
@functionorblock = @function | @stmt_block;
@parameterized_element = @function | @stmt_block | @requires_expr;
blockscope(
unique int block: @stmt_block ref,
int enclosing: @functionorblock ref
int enclosing: @parameterized_element ref
);
@jump = @stmt_goto | @stmt_break | @stmt_continue;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: Support C++20 requires expressions
compatibility: backwards

View File

@@ -1,3 +1,9 @@
## 1.2.6
### Minor Analysis Improvements
* Remove results from the `cpp/wrong-type-format-argument` ("Wrong type of arguments to formatting function") query if the argument is the return value of an implicitly declared function.
## 1.2.5
### Minor Analysis Improvements

View File

@@ -170,7 +170,8 @@ where
) and
not arg.isAffectedByMacro() and
not arg.isFromUninstantiatedTemplate(_) and
not actual.getUnspecifiedType() instanceof ErroneousType
not actual.getUnspecifiedType() instanceof ErroneousType and
not arg.(Call).mayBeFromImplicitlyDeclaredFunction()
select arg,
"This format specifier for type '" + expected.getName() + "' does not match the argument type '" +
actual.getUnspecifiedType().getName() + "'."

View File

@@ -0,0 +1,5 @@
## 1.2.6
### Minor Analysis Improvements
* Remove results from the `cpp/wrong-type-format-argument` ("Wrong type of arguments to formatting function") query if the argument is the return value of an implicitly declared function.

View File

@@ -1,2 +1,2 @@
---
lastReleaseVersion: 1.2.5
lastReleaseVersion: 1.2.6

View File

@@ -1,5 +1,5 @@
name: codeql/cpp-queries
version: 1.2.5
version: 1.2.6
groups:
- cpp
- queries

View File

@@ -5,31 +5,5 @@
import cpp as C
private import codeql.util.test.InlineExpectationsTest
private module Impl implements InlineExpectationsTestSig {
private newtype TExpectationComment = MkExpectationComment(C::CppStyleComment c)
/**
* A class representing a line comment in the CPP style.
* Unlike the `CppStyleComment` class, however, the string returned by `getContents` does _not_
* include the preceding comment marker (`//`).
*/
class ExpectationComment extends TExpectationComment {
C::CppStyleComment comment;
ExpectationComment() { this = MkExpectationComment(comment) }
/** Returns the contents of the given comment, _without_ the preceding comment marker (`//`). */
string getContents() { result = comment.getContents().suffix(2) }
/** Gets a textual representation of this element. */
string toString() { result = comment.toString() }
/** Gets the location of this comment. */
Location getLocation() { result = comment.getLocation() }
}
class Location = C::Location;
}
private import internal.InlineExpectationsTestImpl
import Make<Impl>

View File

@@ -0,0 +1,21 @@
/**
* @kind test-postprocess
*/
private import cpp
private import codeql.util.test.InlineExpectationsTest as T
private import internal.InlineExpectationsTestImpl
import T::TestPostProcessing
import T::TestPostProcessing::Make<Impl, Input>
private module Input implements T::TestPostProcessing::InputSig<Impl> {
string getRelativeUrl(Location location) {
exists(File f, int startline, int startcolumn, int endline, int endcolumn |
location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
f = location.getFile()
|
result =
f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
)
}
}

View File

@@ -0,0 +1,28 @@
import cpp as C
private import codeql.util.test.InlineExpectationsTest
module Impl implements InlineExpectationsTestSig {
private newtype TExpectationComment = MkExpectationComment(C::CppStyleComment c)
/**
* A class representing a line comment in the CPP style.
* Unlike the `CppStyleComment` class, however, the string returned by `getContents` does _not_
* include the preceding comment marker (`//`).
*/
class ExpectationComment extends TExpectationComment {
C::CppStyleComment comment;
ExpectationComment() { this = MkExpectationComment(comment) }
/** Returns the contents of the given comment, _without_ the preceding comment marker (`//`). */
string getContents() { result = comment.getContents().suffix(2) }
/** Gets a textual representation of this element. */
string toString() { result = comment.toString() }
/** Gets the location of this comment. */
Location getLocation() { result = comment.getLocation() }
}
class Location = C::Location;
}

View File

@@ -1,4 +1,9 @@
// query-type: graph
/**
* query-type: graph
*
* @kind graph-equivalence-test
*/
import cpp
class DestructorCallEnhanced extends DestructorCall {

View File

@@ -1,4 +1,9 @@
// query-type: graph
/**
* query-type: graph
*
* @kind graph-equivalence-test
*/
import cpp
class DestructorCallEnhanced extends DestructorCall {

View File

@@ -1,4 +1,9 @@
// query-type: graph
/**
* query-type: graph
*
* @kind graph-equivalence-test
*/
import cpp
class DestructorCallEnhanced extends DestructorCall {

View File

@@ -1,4 +1,9 @@
// query-type: graph
/**
* query-type: graph
*
* @kind graph-equivalence-test
*/
import cpp
class DestructorCallEnhanced extends DestructorCall {

View File

@@ -3,6 +3,9 @@ uniqueEnclosingCallable
| test.cpp:864:47:864:54 | call to source | Node should have one enclosing callable but has 0. |
| test.cpp:872:46:872:51 | call to source | Node should have one enclosing callable but has 0. |
| test.cpp:872:53:872:56 | 1 | Node should have one enclosing callable but has 0. |
| test.cpp:1126:33:1129:1 | {...} | Node should have one enclosing callable but has 0. |
| test.cpp:1127:3:1127:13 | reads_input | Node should have one enclosing callable but has 0. |
| test.cpp:1128:3:1128:21 | not_does_read_input | Node should have one enclosing callable but has 0. |
uniqueCallEnclosingCallable
| test.cpp:864:47:864:54 | call to source | Call should have one enclosing callable but has 0. |
| test.cpp:872:46:872:51 | call to source | Call should have one enclosing callable but has 0. |
@@ -186,3 +189,4 @@ identityLocalStep
missingArgumentCall
multipleArgumentCall
lambdaCallEnclosingCallableMismatch
speculativeStepAlreadyHasModel

View File

@@ -38,3 +38,4 @@ identityLocalStep
missingArgumentCall
multipleArgumentCall
lambdaCallEnclosingCallableMismatch
speculativeStepAlreadyHasModel

View File

@@ -323,6 +323,7 @@ irFlow
| test.cpp:1069:9:1069:14 | call to source | test.cpp:1074:10:1074:10 | i |
| test.cpp:1069:9:1069:14 | call to source | test.cpp:1081:10:1081:10 | i |
| test.cpp:1117:27:1117:34 | call to source | test.cpp:1117:27:1117:34 | call to source |
| test.cpp:1132:11:1132:16 | call to source | test.cpp:1121:8:1121:8 | x |
| true_upon_entry.cpp:9:11:9:16 | call to source | true_upon_entry.cpp:13:8:13:8 | x |
| true_upon_entry.cpp:17:11:17:16 | call to source | true_upon_entry.cpp:21:8:21:8 | x |
| true_upon_entry.cpp:27:9:27:14 | call to source | true_upon_entry.cpp:29:8:29:8 | x |

View File

@@ -1115,4 +1115,20 @@ void indirect_sink_const_ref(const T&);
void test_temp_with_conversion_from_materialization() {
indirect_sink_const_ref(source()); // $ ir MISSING: ast
}
void reads_input(int x) {
sink(x); // $ ir MISSING: ast
}
void not_does_read_input(int x);
void (*dispatch_table[])(int) = {
reads_input,
not_does_read_input
};
void test_dispatch_table(int i) {
int x = source();
dispatch_table[i](x);
}

View File

@@ -185,6 +185,8 @@ postWithInFlow
| simple.cpp:83:12:83:13 | f1 [post update] | PostUpdateNode should not be the target of local flow. |
| simple.cpp:92:7:92:7 | i [post update] | PostUpdateNode should not be the target of local flow. |
| simple.cpp:118:7:118:7 | i [post update] | PostUpdateNode should not be the target of local flow. |
| simple.cpp:124:5:124:6 | * ... [post update] | PostUpdateNode should not be the target of local flow. |
| simple.cpp:124:6:124:6 | p [inner post update] | PostUpdateNode should not be the target of local flow. |
| struct_init.c:24:11:24:12 | ab [inner post update] | PostUpdateNode should not be the target of local flow. |
| struct_init.c:36:17:36:24 | nestedAB [inner post update] | PostUpdateNode should not be the target of local flow. |
viableImplInCallContextTooLarge
@@ -195,3 +197,4 @@ identityLocalStep
missingArgumentCall
multipleArgumentCall
lambdaCallEnclosingCallableMismatch
speculativeStepAlreadyHasModel

View File

@@ -28,3 +28,4 @@ identityLocalStep
missingArgumentCall
multipleArgumentCall
lambdaCallEnclosingCallableMismatch
speculativeStepAlreadyHasModel

View File

@@ -291,3 +291,6 @@ WARNING: module 'DataFlow' has been deprecated and may be removed in future (par
| simple.cpp:94:10:94:11 | a2 | IR only |
| simple.cpp:118:7:118:7 | i | AST only |
| simple.cpp:120:8:120:8 | a | IR only |
| simple.cpp:124:5:124:6 | * ... | AST only |
| simple.cpp:131:14:131:14 | a | IR only |
| simple.cpp:136:10:136:10 | a | IR only |

View File

@@ -651,6 +651,9 @@
| simple.cpp:94:10:94:11 | a2 |
| simple.cpp:118:5:118:5 | a |
| simple.cpp:120:8:120:8 | a |
| simple.cpp:131:14:131:14 | a |
| simple.cpp:135:20:135:20 | q |
| simple.cpp:136:10:136:10 | a |
| struct_init.c:15:8:15:9 | ab |
| struct_init.c:15:12:15:12 | a |
| struct_init.c:16:8:16:9 | ab |

View File

@@ -581,6 +581,8 @@ WARNING: module 'DataFlow' has been deprecated and may be removed in future (par
| simple.cpp:92:7:92:7 | i |
| simple.cpp:118:5:118:5 | a |
| simple.cpp:118:7:118:7 | i |
| simple.cpp:124:5:124:6 | * ... |
| simple.cpp:135:20:135:20 | q |
| struct_init.c:15:8:15:9 | ab |
| struct_init.c:15:12:15:12 | a |
| struct_init.c:16:8:16:9 | ab |

View File

@@ -120,4 +120,20 @@ void post_update_to_phi_input(bool b)
sink(a.i); // $ ast,ir
}
} // namespace Simple
void write_to_param(int* p) {
*p = user_input();
}
void alias_with_fields(bool b) {
A a;
int* q;
if(b) {
q = &a.i;
} else {
q = nullptr;
}
write_to_param(q);
sink(a.i); // $ MISSING: ast,ir
}
} // namespace Simple

View File

@@ -25,8 +25,8 @@
| declarationEntry.cpp:39:7:39:7 | declaration of operator= | declarationEntry.cpp:39:7:39:7 | operator= | yes |
| declarationEntry.cpp:39:7:39:13 | definition of myClass | declarationEntry.cpp:39:7:39:13 | myClass | yes |
| declarationEntry.cpp:42:6:42:21 | definition of myMemberVariable | declarationEntry.cpp:42:6:42:21 | myMemberVariable | yes |
| file://:0:0:0:0 | declaration of 1st parameter | file://:0:0:0:0 | (unnamed parameter 0) | yes |
| file://:0:0:0:0 | declaration of 1st parameter | file://:0:0:0:0 | (unnamed parameter 0) | yes |
| file://:0:0:0:0 | declaration of (unnamed parameter 0) | file://:0:0:0:0 | (unnamed parameter 0) | yes |
| file://:0:0:0:0 | declaration of (unnamed parameter 0) | file://:0:0:0:0 | (unnamed parameter 0) | yes |
| file://:0:0:0:0 | definition of fp_offset | file://:0:0:0:0 | fp_offset | yes |
| file://:0:0:0:0 | definition of gp_offset | file://:0:0:0:0 | gp_offset | yes |
| file://:0:0:0:0 | definition of overflow_arg_area | file://:0:0:0:0 | overflow_arg_area | yes |

View File

@@ -1,7 +1,7 @@
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of (unnamed parameter 0) |
| file://:0:0:0:0 | declaration of (unnamed parameter 0) |
| file://:0:0:0:0 | declaration of (unnamed parameter 0) |
| file://:0:0:0:0 | declaration of (unnamed parameter 0) |
| file://:0:0:0:0 | definition of fp_offset |
| file://:0:0:0:0 | definition of gp_offset |
| file://:0:0:0:0 | definition of overflow_arg_area |

View File

@@ -1,4 +1,9 @@
// query-type: graph
/**
* query-type: graph
*
* @kind graph-equivalence-test
*/
import cpp
class DestructorCallEnhanced extends DestructorCall {

View File

@@ -0,0 +1 @@
| file://:0:0:0:0 | <error expr> |

View File

@@ -0,0 +1,5 @@
import cpp
from Expr e
where e.getType() instanceof ErroneousType
select e

View File

@@ -0,0 +1,2 @@
| file://:0:0:0:0 | There was an error during this compilation |
| implicit.cpp:5:5:5:5 | identifier 'g' is undefined |

View File

@@ -0,0 +1,4 @@
import cpp
from Diagnostic d
select d

View File

@@ -0,0 +1,6 @@
| implicit2.c:1:7:1:7 | g | file://:0:0:0:0 | float |
| implicit2.c:1:7:1:7 | g | file://:0:0:0:0 | int |
| implicit.c:1:6:1:6 | f | file://:0:0:0:0 | void |
| implicit.c:3:5:3:5 | g | file://:0:0:0:0 | float |
| implicit.c:3:5:3:5 | g | file://:0:0:0:0 | int |
| implicit.cpp:3:6:3:6 | f | file://:0:0:0:0 | void |

View File

@@ -0,0 +1,5 @@
import cpp
from Function fn
where fn.fromSource()
select fn, fn.getType()

View File

@@ -0,0 +1,4 @@
void f() {
f();
g();
}

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