Compare commits

...

599 Commits

Author SHA1 Message Date
Philip Ginsbach
8724f90206 set compileForOverlayEval true for java 2025-04-25 13:20:18 +01:00
Philip Ginsbach
7808763681 update python and csharp via config/sync-files.py 2025-04-22 17:24:53 +01:00
Philip Ginsbach
e3379dbe92 annotate .qll files in java and shared via script 2025-04-22 17:24:51 +01:00
Jeroen Ketema
0bcee84117 C++: Minor textual fixes 2025-04-17 12:33:27 +02:00
idrissrio
15fe2fbba6 C++: update stats file 2025-04-16 20:45:33 +02:00
idrissrio
36a425715c C++: add upgrade and downgrade scripts 2025-04-16 17:07:25 +02:00
idrissrio
d8afd2a786 C++: add change note for designator-based initializations 2025-04-16 16:23:32 +02:00
idrissrio
49183bb82a C++: add predicate to distinguish between array/field designators 2025-04-16 16:19:26 +02:00
Ian Lynagh
e05c030bb7 Merge pull request #19317 from github/post-release-prep/codeql-cli-2.21.1
Post-release preparation for codeql-cli-2.21.1
2025-04-16 14:45:49 +01:00
Ian Lynagh
bdd3207752 Merge branch 'main' into post-release-prep/codeql-cli-2.21.1 2025-04-16 11:54:23 +01:00
Idriss Riouak
67bfe108c2 Merge pull request #19298 from github/idrissrio/vla
C++: add `isVla` predicated to `ArrayType`
2025-04-16 11:25:31 +02:00
Michael Nebel
29be2171af Merge pull request #19309 from michaelnebel/csharp/fix-comments
C#: Adjust comments and remove compilation warnings.
2025-04-16 09:26:09 +02:00
Aditya Sharad
c4e8b1a79e Merge pull request #19307 from adityasharad/actions/public-preview-cleanup
Actions: Remove preview notice, minor help and metadata fixes
2025-04-16 05:40:20 +05:30
Aditya Sharad
4952768569 Actions: Fix change note newline 2025-04-15 10:21:54 -07:00
github-actions[bot]
d78736b1bf Post-release preparation for codeql-cli-2.21.1 2025-04-15 16:33:15 +00:00
Ian Lynagh
2409bcc0d6 Merge pull request #19301 from github/release-prep/2.21.1
Release preparation for version 2.21.1
2025-04-15 16:52:54 +01:00
Ian Lynagh
8ee353c12c Merge pull request #19312 from igfoo/igfoo/fix-typo-unmasked-secret-exposure
actions: Fix spelling error in UnmaskedSecretExposure.md
2025-04-15 15:41:07 +01:00
Paolo Tranquilli
ff8cd98527 Merge pull request #19233 from github/redsun82/cargo-upgrade
Rust: upgrade rust-analyzer to `0.0.273`
2025-04-15 16:30:12 +02:00
Ian Lynagh
b75e0ed02e actions: Fix spelling error in UnmaskedSecretExposure.md
Corrects "know" to "known" in the description of the UnmaskedSecretExposure document.
2025-04-15 14:25:39 +01:00
Paolo Tranquilli
3d3de78076 Merge pull request #19299 from github/redsun82/swift-6-extraction
Swift: extract still unextracted entities from the 6.0.2 upgrade
2025-04-15 14:08:38 +02:00
idrissrio
202040fad4 C++: update stats file 2025-04-15 13:36:24 +02:00
Michael Nebel
9170993cf0 C#: Adjust comments and remove compilation warnings. 2025-04-15 12:46:31 +02:00
idrissrio
ae07272c44 C++: add upgrade and downgrade scripts 2025-04-15 11:09:31 +02:00
idrissrio
15ba9e0c66 C++: add change note for VLAs 2025-04-15 11:06:19 +02:00
idrissrio
033bade0ab C++: add isVLA() to ArrayType to identify variable-length arrays 2025-04-15 11:03:26 +02:00
Tamás Vajk
de9c1fbc9c Merge pull request #19251 from tamasvajk/fix/macos15
C#: Fix autobuild on macos without mono
2025-04-15 10:07:26 +02:00
Arthur Baars
1c79c5e9ab Merge pull request #19292 from github/aibaars/rust-shadow-prelude
Rust: allow shadowing of prelude items
2025-04-15 09:54:31 +02:00
Paolo Tranquilli
eda1bc9f6b Merge pull request #19282 from github/redsun82/rust-codeowners
Rust: add to `CODEOWNERS`
2025-04-15 08:58:27 +02:00
Aditya Sharad
f9103f8ddc Actions: Add change note for missing severity 2025-04-14 14:48:43 -07:00
Aditya Sharad
6eb060f16a Actions: Add security-severity to excessive secrets exposure query
Same value as missing actions permissions,
both providing warnings to follow the
principle of least privilege within a
workflow.
2025-04-14 14:41:08 -07:00
Aditya Sharad
93fbb9fe61 Actions: Update description of missing permissions query 2025-04-14 14:39:31 -07:00
Aditya Sharad
eeb938a76d Docs: Minor fixes for Actions query help 2025-04-14 13:25:54 -07:00
Aditya Sharad
32f191cd9d Docs: Remove public preview notice for Actions support
Ready for GA.
2025-04-14 13:21:59 -07:00
Paolo Tranquilli
2dd3dea33a Merge branch 'main' into redsun82/cargo-upgrade 2025-04-14 16:35:57 +02:00
Paolo Tranquilli
6176202d50 Merge pull request #19291 from github/redsun82/rust-pick-edition
Rust: pick correct edition for the files
2025-04-14 16:26:00 +02:00
Paolo Tranquilli
c9cff09f5d Merge branch 'main' into redsun82/rust-pick-edition 2025-04-14 15:19:33 +02:00
Tamas Vajk
a70536f002 Improve code quality 2025-04-14 14:54:56 +02:00
Paolo Tranquilli
1c11c5562a Swift: add change note 2025-04-14 14:50:46 +02:00
Tamas Vajk
91daca1a6b Improve code quality based on PR review 2025-04-14 13:51:30 +02:00
Michael Nebel
53c4b29b50 Merge pull request #19289 from michaelnebel/csharp/improveautobuilder
C#: Improve auto-builder to better detect SDK references.
2025-04-14 12:43:23 +02:00
Paolo Tranquilli
c245459e97 Merge pull request #19293 from github/redsun82/rust-fix-member-aggregation
Rust: fix workspace member aggregation when absolute path is a glob pattern
2025-04-14 12:08:43 +02:00
github-actions[bot]
b961c5961d Release preparation for version 2.21.1 2025-04-14 09:53:06 +00:00
Geoffrey White
884c4a6e7b Merge pull request #19171 from geoffw0/badalloc
Rust: Query for uncontrolled allocation size
2025-04-14 10:10:53 +01:00
Paolo Tranquilli
1316e08365 Swift: add upgrade/downgrade scripts 2025-04-14 11:06:47 +02:00
Geoffrey White
c821f27309 Merge branch 'main' into badalloc 2025-04-14 09:36:59 +01:00
Paolo Tranquilli
fa6deaf87a Swift: extract UnreachableExpr 2025-04-14 10:35:24 +02:00
Paolo Tranquilli
9473543933 Swift: extract ActorIsolationErasureExpr 2025-04-14 10:35:24 +02:00
Paolo Tranquilli
ad0f9f1e73 Swift: mark ErrorUnionType as type-check only 2025-04-14 10:35:23 +02:00
Paolo Tranquilli
b575c89463 Swift: add CurrentContextIsolationTree to control flow 2025-04-14 10:35:23 +02:00
Paolo Tranquilli
712142cde9 Swift: extract CurrentContextIsolationExpr 2025-04-14 10:35:22 +02:00
Paolo Tranquilli
42ec6b018d Swift: add ExtractFunctionIsolationTree to control flow 2025-04-14 10:35:22 +02:00
Paolo Tranquilli
2910cb68ce Swift: extract ExtracFunctionIsolationExpr 2025-04-14 10:35:21 +02:00
Napalys Klicius
86313715a4 Merge pull request #19184 from Napalys/js/request_handlers
JS: Support for `Request` and `NextRequest`
2025-04-14 08:07:24 +02:00
yoff
85527101bd Merge pull request #19205 from yoff/ruby/refine-uninitialised-local
ruby: refine `rb/uninitialized-local-variable`
2025-04-11 23:08:01 +02:00
yoff
7517272d34 ruby: remove repetitive change note 2025-04-11 23:01:15 +02:00
yoff
b988be8ff6 ruby: improve help file
This has improved autofixes
I hope it also helps humans
2025-04-11 21:29:01 +02:00
yoff
85e27cae60 Merge branch 'main' into ruby/refine-uninitialised-local 2025-04-11 18:09:59 +02:00
Paolo Tranquilli
9dd1062a9c Rust: remove fixed inconsistency 2025-04-11 17:25:56 +02:00
Aditya Sharad
2dc88d87ae Merge pull request #19278 from adityasharad/actions/integration-test-filters
Actions: Fix handling of paths-ignore in autobuild scripts, add integration tests for configured path filters
2025-04-11 20:53:33 +05:30
Paolo Tranquilli
c844db09d2 Merge branch 'redsun82/rust-pick-edition' into redsun82/cargo-upgrade 2025-04-11 17:03:29 +02:00
Paolo Tranquilli
63e5f5a555 Rust: parametrize some integration tests on three editions 2025-04-11 16:50:23 +02:00
Paolo Tranquilli
868680f078 Merge branch 'redsun82/rust-fix-member-aggregation' into redsun82/rust-pick-edition 2025-04-11 16:46:16 +02:00
Paolo Tranquilli
60aa3a8d9d Rust: fix workspace member aggregation when absolute path is a glob pattern
We were interpreting the absolute path of a workspace as a glob pattern,
which doesn't work if the path has some special characters (e.g. `[` or
`]`).
2025-04-11 16:41:51 +02:00
yoff
eb0f8e9572 ruby: add rb/uninitialized-local-variable to quality suite 2025-04-11 16:27:21 +02:00
Mathias Vorreiter Pedersen
11aef7019e Merge pull request #19273 from MathiasVP/prepare-shared-mad-generation-for-cpp
Shared: Prepare model generation for C++ adoption
2025-04-11 07:22:56 -07:00
yoff
6a76a40cf4 ruby: adjust change notes 2025-04-11 16:18:03 +02:00
Arthur Baars
b27ae98b54 Rust: normalize paths in the rustup folder 2025-04-11 15:46:57 +02:00
Arthur Baars
662e963a7b Rust: allow shadowing of prelude items 2025-04-11 15:46:55 +02:00
Paolo Tranquilli
dbbd80f4dc Rust: pick correct edition for the files
Previously we would unconditionally set the edition to the latest stable
according to rust-analyzer (2021 at the moment). Now we ask
rust-analyzer itself to pick the correct edition for the file.
2025-04-11 15:36:45 +02:00
yoff
2477233508 ruby: only report on method calls
Interviewing a Ruby developer, I learned that
dealing with nil is common practice.
So alerts are mostly useful, if we can point to a place where this has gone wrong.
2025-04-11 15:01:57 +02:00
Tamas Vajk
51388f2401 Do not try running mono when it's not available on the runner 2025-04-11 14:58:08 +02:00
Mathias Vorreiter Pedersen
877118fb3b Merge pull request #19274 from MathiasVP/prepare-cpp-for-mad-generation
C++: Prepare for model generation adoption
2025-04-11 05:11:36 -07:00
Michael Nebel
f349048e42 C#: Add change note. 2025-04-11 13:53:54 +02:00
Michael Nebel
31143b405e C#: Improve auto builder logic to detect Sdk reference. 2025-04-11 13:53:52 +02:00
Mathias Vorreiter Pedersen
deef95d384 Update cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll
Co-authored-by: Taus <tausbn@github.com>
2025-04-11 12:43:59 +01:00
Mathias Vorreiter Pedersen
bfc494c0e1 Update cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll
Co-authored-by: Taus <tausbn@github.com>
2025-04-11 12:43:51 +01:00
yoff
b641d5f177 ruby: fix FP 2025-04-11 13:22:42 +02:00
yoff
6e2cfab7b2 ruby: add test for for
found during triage
2025-04-11 12:46:25 +02:00
Michael Nebel
a5aef8c6f9 C#: Add some more DotNet autobuilder unit tests. 2025-04-11 12:03:06 +02:00
Paolo Tranquilli
4ae49cfe35 Merge pull request #19281 from github/redsun82/rust-setup
Rust: refine `ql/test/setup.sh`
2025-04-11 11:55:12 +02:00
Owen Mansel-Chan
472bfa2668 Merge pull request #19115 from owen-mc/java/port/java/string-replace-all-with-non-regex
Java: Add new quality query to detect `String#replaceAll` with non-regex first argument
2025-04-11 10:31:38 +01:00
Napalys Klicius
3d7c0201d9 Merge pull request #19231 from Napalys/js/typed_array
JS: Taint propagation from low-level `ArrayBuffer` to `Strings`
2025-04-11 11:29:01 +02:00
Napalys
11abbf8c4a Now nextUrl is of type parameter and loosen the restriction for NextAppRouteHandler 2025-04-11 11:19:12 +02:00
Napalys Klicius
92e4f112c0 Update javascript/ql/lib/semmle/javascript/frameworks/Next.qll
Co-authored-by: Asger F <asgerf@github.com>
2025-04-11 11:08:40 +02:00
Napalys Klicius
d0dcf897cb Update javascript/ql/lib/semmle/javascript/internal/flow_summaries/Strings.qll
Co-authored-by: Asger F <asgerf@github.com>
2025-04-11 11:04:08 +02:00
yoff
4167e96058 ruby: more complete impleemntation of isInBooleanContext
Co-authored-by: Tom Hvitved <hvitved@github.com>
2025-04-11 11:00:22 +02:00
yoff
f675a143d6 ruby: remove redundant cases
The CFG handles the negation
2025-04-11 10:48:41 +02:00
Napalys Klicius
d17d29a387 Merge pull request #19218 from Napalys/js/upgrade_websocket
JS: Refactor `WebSocket` to use `API` graphs
2025-04-11 10:05:54 +02:00
Napalys
e3f1720f9c RenamedDecodeLike to Decode and updated propagatesFlow 2025-04-11 10:04:09 +02:00
Arthur Baars
85940484ab Update rust/ql/test/setup.sh 2025-04-11 09:57:50 +02:00
Napalys
2c4b3527b4 Added change note 2025-04-11 09:42:12 +02:00
Napalys
678eccb417 Added searchParams.get as potential source for SSRF 2025-04-11 09:42:07 +02:00
Napalys
8674b61e5a Added SSRF test case with searchParams for NextRequest 2025-04-11 09:26:16 +02:00
Paolo Tranquilli
db1203acb3 Rust: reinstate adding rust-src for test toolchains 2025-04-11 08:57:14 +02:00
Napalys
6e09a65da0 Added support for NextRequest middleware SSRF. 2025-04-11 08:43:36 +02:00
Napalys
734ad2d767 Removed legacy Consistency check as it is redundant now with inline test expectations. 2025-04-11 08:43:08 +02:00
Napalys
208487f236 Added middleware test 2025-04-11 08:39:47 +02:00
Paolo Tranquilli
547833afb5 Rust: add to CODEOWNERS 2025-04-11 08:32:33 +02:00
Paolo Tranquilli
becea89a47 Rust: refine ql/test/setup.sh 2025-04-11 08:26:48 +02:00
Tamas Vajk
159d31d494 Reenable problematic test 2025-04-11 08:24:08 +02:00
yoff
8555e8c8c8 ruby: add change notes 2025-04-11 03:07:19 +02:00
yoff
53c88da91b ruby: refine query for uninitialised local variables
- there are places where uninitialised reads are intentional
- there are also some places where they are impossible
2025-04-11 03:07:19 +02:00
yoff
1ca25b2ccb ruby: add test of rb/uninitialized-local-variable 2025-04-11 03:00:05 +02:00
Aditya Sharad
283503b06d Actions: Fix handling of paths-ignore in autobuild scripts
Always concatenate the default filters with the user-provided filters.
This ensures that when `paths-ignore` is provided,
we begin with the default path inclusions,
not all YAML files.
This makes the `paths-ignore-only` integration test variant
under `filters` pass.

The handling of `paths` is unchanged:
if provided, this overrides the default filters.
2025-04-10 11:18:45 -07:00
Aditya Sharad
30ce0c5cbf Actions: Add integration tests for configured path filters
Use the common structure from the existing test
for default filters.

Check both query output finding workflows and actions,
and source archive output showing all extracted YAML files.

The test for only `paths-ignore` fails in this commit,
demonstrating a bug: we start with all YAML files
rather than starting with the default includes.

The tests for `paths` reflect current behaviour
which is consistent with other languages:
`paths` overrides the default inclusions,
and only files under `paths` are included.

This may not be the best user experience for Actions,
since we want to scan all workflow and action files
even in the presence of `paths`, but that is not
currently addressed.
2025-04-10 11:17:51 -07:00
Tom Hvitved
7ed8a85e08 Merge pull request #19246 from hvitved/rust/cache-tweaks 2025-04-10 19:02:25 +02:00
Felicity Chapman
c2baf9a052 Merge pull request #19270 from github/felicitymay-patch-1
CodeQL docs: Fix ordering in side navigation bar for Query help
2025-04-10 15:10:14 +01:00
Owen Mansel-Chan
4f5bdbb517 Add new query to java-code-quality.qls.expected 2025-04-10 14:37:11 +01:00
Mathias Vorreiter Pedersen
3bb249f580 C++: Ensure we always have 'Position's even if there are no calls in the DB. 2025-04-10 14:28:40 +01:00
Mathias Vorreiter Pedersen
b678112f4d C++: Add a few predicates to 'ReturnKind'. 2025-04-10 14:28:38 +01:00
Mathias Vorreiter Pedersen
960e9900af C++: Move the 'getArgumentIndex' into the abstract 'Position' class. It is implemented in all subclasses anyway. 2025-04-10 14:28:36 +01:00
Mathias Vorreiter Pedersen
94e08e318d C++: Expose a few predicates from 'ExternalFlow'. 2025-04-10 14:18:47 +01:00
Napalys Klicius
43bf0beae9 Merge pull request #19263 from Napalys/js/make-dir-lib
JS: Add support for `make-dir` package
2025-04-10 15:09:43 +02:00
Napalys
86b64afa13 Added NextResponse to the ResponseCall class it models similar near idential behaviour. 2025-04-10 15:06:44 +02:00
Mathias Vorreiter Pedersen
ea3bb8cf0c Shared: Provide a hook to MaD generation to modify the 'ReturnValue' string. 2025-04-10 14:02:31 +01:00
Mathias Vorreiter Pedersen
6c348b5855 Rust: Fixup MaD input. 2025-04-10 14:01:20 +01:00
Mathias Vorreiter Pedersen
b6c658767e Java: Fixup MaD input. 2025-04-10 14:01:11 +01:00
Mathias Vorreiter Pedersen
04bf908a4b C#: Fixup MaD input. 2025-04-10 14:01:00 +01:00
Mathias Vorreiter Pedersen
c484945f39 Shared: Move 'getEnclosingCallable' and 'getAsExprEnclosingCallable' out of the class signature. 2025-04-10 14:00:11 +01:00
Mathias Vorreiter Pedersen
732fcbf1c9 Shared: Move 'asParameter' out of the class signature. 2025-04-10 13:58:59 +01:00
Napalys
8acb0243ad Added test cases for NextResponse and Response 2025-04-10 14:57:40 +02:00
Mathias Vorreiter Pedersen
a1dc87496a Shared: Replace a 'count' with a 'strictcount' to prevent a CP when testing on C++. 2025-04-10 13:56:38 +01:00
Napalys
63a3953b0c Enhance Next.js API endpoint handling for compatibility with both Pages and App Router structures. 2025-04-10 14:48:17 +02:00
Napalys
81cba7fa2f Added test cases with missing alerts for Request and NextRequest. 2025-04-10 14:43:48 +02:00
Asger F
eac14b9837 Merge pull request #19200 from asgerf/js/web-response
JS: Add sinks for calls to 'new Response()'
2025-04-10 14:41:32 +02:00
Napalys
171a84609e Applied copilot suggestion. 2025-04-10 14:13:48 +02:00
Felicity Chapman
78a26cfdb2 Update index.rst 2025-04-10 13:09:51 +01:00
Joe Farebrother
7f7fca9e27 Merge pull request #19165 from joefarebrother/python-qual-loop-var-capture
Python: Modernize the Loop Variable Capture query
2025-04-10 13:07:05 +01:00
Owen Mansel-Chan
acfcc6d490 Sort ids in java-code-quality.qls 2025-04-10 12:35:42 +01:00
Owen Mansel-Chan
576f4cf19f Update tags 2025-04-10 12:21:09 +01:00
Owen Mansel-Chan
ad89e7980e Tweak documentation 2025-04-10 12:21:08 +01:00
Owen Mansel-Chan
3ea5cc1b66 Add query to code-quality query suite 2025-04-10 12:21:06 +01:00
Owen Mansel-Chan
e1c5517de7 Keep COMPLIANT and NON_COMPLIANT comments in test 2025-04-10 12:21:05 +01:00
Owen Mansel-Chan
04ec1d7830 Update test expectations 2025-04-10 12:21:03 +01:00
Owen Mansel-Chan
626a7d5007 Fix punctuation 2025-04-10 12:21:02 +01:00
Owen Mansel-Chan
c4e56b1ec8 Add quality and cwe tag to query
CWE-1176: Inefficient CPU Computation
2025-04-10 12:21:00 +01:00
Owen Mansel-Chan
042fe07494 Adjust alert message 2025-04-10 11:47:19 +01:00
Owen Mansel-Chan
fea3d10b97 Update qhelp 2025-04-10 11:47:18 +01:00
Owen Mansel-Chan
441c79ebdf Use existing class StringReplaceAllCall 2025-04-10 11:47:17 +01:00
Owen Mansel-Chan
b5b252b10f Convert test to inline expectations 2025-04-10 11:47:15 +01:00
Owen Mansel-Chan
ff2947a0e5 Adjust query name 2025-04-10 11:47:14 +01:00
Owen Mansel-Chan
041adcd63a Java: Add initial version of string replaceAll with no regex query 2025-04-10 11:46:59 +01:00
Asger F
d2a4f1e17a Merge pull request #19267 from asgerf/js/json-array-trailing-comma
JS: Tolerate trailing commas in JSON arrays
2025-04-10 12:38:16 +02:00
Joe Farebrother
6802037c89 Update qhelp formatting 2025-04-10 09:52:18 +01:00
Joe Farebrother
00999baf9a Apply docs review suggestion - Reword query description.
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
2025-04-10 09:06:01 +01:00
Asger F
3da1f261f7 JS: Change note 2025-04-10 07:21:48 +02:00
Asger F
cfa1a9b603 JS: Update extractor version string 2025-04-10 07:20:53 +02:00
Asger F
1434f7acd2 JS: Tolerate trailing comma in JSON array
Previously we'd fail to extract some tsconfig.json files because of this.
2025-04-10 07:20:51 +02:00
Asger F
800dd168c2 JS: Add failing TRAP test for trailing comma 2025-04-10 07:20:49 +02:00
Aditya Sharad
bd3342af8a Actions: Update integration test for default filters
Create a common file structure to be shared among multiple tests
for path filters, and rename accordingly.
Update test expectations with additional files.
Use pytest markers to indicate the expected outputs.

Add source archive checking in addition to checking query output.
This allows us to test which YAML files were extracted
separately from whether they are semantically meaningful
to the Actions analysis.
2025-04-09 20:59:42 -07:00
Tom Hvitved
0e31bf1e7b Merge pull request #19265 from hvitved/rust/crate-graph-self-crate-ref 2025-04-09 22:54:53 +02:00
Tom Hvitved
a6b20d7731 Merge pull request #19259 from hvitved/ruby/fix-bad-join
Ruby: Fix bad join in `DeadStoreOfLocal.ql`
2025-04-09 19:03:33 +02:00
Tom Hvitved
1ba06ab3bf Merge pull request #19216 from hvitved/rust/path-resolution-path-attr
Rust: Handle path attributes in path resolution
2025-04-09 18:57:56 +02:00
Aditya Sharad
ef0065546a Merge pull request #19264 from github/coadaflorin-actions-docs-patch
Update codeql-library-for-actions.rst
2025-04-09 21:46:28 +05:30
Aditya Sharad
29af6f7f0d Merge pull request #19257 from adityasharad/actions/fix/autobuild-powershell-spaces
Actions: Fix invocation of autobuild PowerShell script
2025-04-09 21:26:32 +05:30
Tom Hvitved
52401aaa73 Address review comments 2025-04-09 17:19:25 +02:00
Chris Smowton
cc379b543c Merge pull request #19260 from smowton/smowton/feature/sanitize-enum-types
Java: Add EnumType to SimpleTypeSanitizer
2025-04-09 16:05:13 +01:00
Chris Smowton
7a8dfdb971 Grammar 2025-04-09 15:52:48 +01:00
Chris Smowton
f31b49b022 Change note 2025-04-09 15:41:48 +01:00
Tom Hvitved
fbab715cb6 Rust: Allow for crate self-references in crate graph paths 2025-04-09 15:21:34 +02:00
Joe Farebrother
84aa2e8627 Apply review suggestion - Tweak wording of example comment
Co-authored-by: Taus <tausbn@github.com>
2025-04-09 14:07:38 +01:00
Chris Smowton
949812243b Merge pull request #19261 from smowton/smowton/admin/improve-gradle-wrapper-message
Java: Update test expectation
2025-04-09 14:03:52 +01:00
Napalys
5243f90c90 Brought back old methods and marked them as deprecated 2025-04-09 14:56:24 +02:00
Florin Coada
0acccf240a Update codeql-library-for-actions.rst 2025-04-09 13:45:21 +01:00
Napalys
5ec71ab9af Added change note 2025-04-09 14:42:34 +02:00
Napalys
ce2fc25cdb Added make-dir model as data 2025-04-09 14:42:29 +02:00
Napalys
674f40b35f Added test cases for make-dir package. 2025-04-09 14:41:12 +02:00
Napalys Klicius
2dca95af92 Update javascript/ql/lib/change-notes/2025-04-07-websocket.md
Co-authored-by: Asger F <asgerf@github.com>
2025-04-09 14:26:00 +02:00
Napalys
0c52b5ad95 Added summary flow for StringFromCharCode 2025-04-09 14:24:43 +02:00
Chris Smowton
5c7a4eb511 Reorder test expectations 2025-04-09 12:51:18 +01:00
Napalys Klicius
f02783a9c6 Merge pull request #19210 from Napalys/js/mkdirp
JS: Modeling of `mkdirp` functions
2025-04-09 13:43:37 +02:00
Tom Hvitved
9323f1aaf0 Merge pull request #19250 from hvitved/rust/fix-bad-joins
Rust: Fix bad joins
2025-04-09 13:36:01 +02:00
Chris Smowton
3373c2457c Update test expectation 2025-04-09 12:27:48 +01:00
Napalys
a3e4e62eac Removed taint from ArrayBuffer constructor as it accepts length 2025-04-09 13:27:13 +02:00
Chris Smowton
0a293cf357 Add EnumType to SimpleTypeSanitizer 2025-04-09 12:12:35 +01:00
Owen Mansel-Chan
b6053e3f91 Merge pull request #19076 from owen-mc/go/update-depstubber-files
Go: update files generated by depstubber
2025-04-09 11:44:20 +01:00
Napalys
4bc3e9e736 Addressed comments
Co-authored-by: Asgerf <asgerf@github.com>
2025-04-09 12:31:45 +02:00
Napalys Klicius
0751d73eab Merge pull request #19256 from Napalys/js/open_package
JS: Model as Data `open` package
2025-04-09 11:54:44 +02:00
Asger F
da7d6d3346 JS: Change note 2025-04-09 11:28:21 +02:00
Tom Hvitved
35f9157e42 Ruby: Fix bad join in DeadStoreOfLocal.ql 2025-04-09 09:28:55 +02:00
Paolo Tranquilli
8d467c7d02 Merge pull request #19255 from github/redsun82/rust-setup
Rust: add test setup script
2025-04-09 08:51:58 +02:00
Aditya Sharad
2e75dbd519 Actions: Fix invocation of autobuild PowerShell script
Pass the quoted script path to PowerShell using `-File`.
This ensures the path is treated as a string rather
than a command, and correctly handles file paths
that contain spaces, unblocking integration tests.

Add logging to autobuild.cmd for easier debugging.
2025-04-08 20:00:25 -07:00
Aditya Sharad
c4c351c9dd Merge pull request #19239 from adityasharad/actions/integration-test-default-filters
Actions: Create initial integration test for default filters
2025-04-08 23:07:58 +05:30
Aditya Sharad
21af1c6113 Merge pull request #19241 from adityasharad/actions/fix/docs-table-block-formatting
Docs: Fix formatting of GitHub Actions content
2025-04-08 22:07:30 +05:30
Tamás Vajk
c0f2ce77d4 Merge pull request #19254 from tamasvajk/tamasvajk/test-queries-not-in-qls
Java: Add test to check queries not included in well-known query suites
2025-04-08 18:20:19 +02:00
Óscar San José
6d95950081 Merge pull request #19252 from github/oscarsj/nice-servers-for-java-tests
Run test servers with `sudo` when running on `macos-15`
2025-04-08 18:04:25 +02:00
Paolo Tranquilli
25bd0c3b21 Rust: add test setup script 2025-04-08 17:28:57 +02:00
Tamás Vajk
d39045e3e1 Merge pull request #19245 from tamasvajk/tamasvajk/improvement-security-and-quality-suite-selector
Java: Add explicit filtering for quality queries that should be included in security-and-quality
2025-04-08 17:08:28 +02:00
Tamas Vajk
e163344907 Java: Add test to check queries not included in well-known query suites 2025-04-08 17:06:46 +02:00
Tamas Vajk
6abff483da Java: Add explicit filtering for quality queries that should be included in security-and-quality 2025-04-08 16:47:41 +02:00
Tamas Vajk
259a09386e Move query suite selector logic to security-and-quality-suite 2025-04-08 16:47:41 +02:00
Tamás Vajk
f325f53273 Merge pull request #19229 from tamasvajk/test/java-query-suite
Java: add integration test for query suite contents
2025-04-08 16:47:07 +02:00
Óscar San José
afe3e5332f Update java/ql/integration-tests/java/buildless-inherit-trust-store/test.py
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
2025-04-08 16:29:23 +02:00
Óscar San José
1eb4a1aa81 Update java/ql/integration-tests/java/buildless-snapshot-repository/test.py
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
2025-04-08 16:29:16 +02:00
Óscar San José
3b56f95480 use only sudo for running maven test server (remove nice) 2025-04-08 16:19:33 +02:00
Paolo Tranquilli
84c728f847 Merge pull request #19244 from github/redsun82/bazel-update
Bazel: update to 8.1.1
2025-04-08 15:58:29 +02:00
Óscar San José
e49fb839b8 Update java/ql/integration-tests/java/buildless-inherit-trust-store/test.py
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
2025-04-08 15:28:18 +02:00
Michael B. Gale
87f2ccb5a2 Merge pull request #19249 from github/mbg/go/fix-getpkginfo-decerr
Go: Fix `err` instead of `decErr` in `GetPkgsInfo`
2025-04-08 14:21:14 +01:00
Óscar San José
b5e1b25553 use sudo nice for running maven test server 2025-04-08 13:51:09 +02:00
Simon Friis Vindum
9dc008b9f4 Merge pull request #19214 from paldepind/rust-ti-associated
Rust: Associated types
2025-04-08 13:46:36 +02:00
Tom Hvitved
95add2f60b Rust: Fix bad join in getAPrivateVisibleModule
Before
```
Pipeline standard for PathResolution::getAPrivateVisibleModule/1#3829a5ee@822d5hwq was evaluated in 24 iterations totaling 16ms (delta sizes total: 4843).
         105047   ~63652%    {2} r1 = SCAN `PathResolution::resolvePathPrivate/3#56db2cdf#reorder_1_2_0_3#prev_delta` OUTPUT In.0, In.0

             69       ~0%    {2} r2 = JOIN `#PathResolution::ItemNode.getImmediateParentModule/0#dispred#57c4c6d5Plus#bf#reorder_1_0#prev_delta` WITH `PathResolution::resolvePathPrivate/3#56db2cdf#reorder_1_2_0_3#prev` ON FIRST 1 OUTPUT Lhs.0, Lhs.1

        5766690  ~148309%    {2} r3 = JOIN `PathResolution::resolvePathPrivate/3#56db2cdf#reorder_1_2_0_3#prev_delta` WITH `#PathResolution::ItemNode.getImmediateParentModule/0#dispred#57c4c6d5Plus#bf#reorder_1_0#prev` ON FIRST 1 OUTPUT Lhs.0, Rhs.1

        5871806  ~143984%    {2} r4 = r1 UNION r2 UNION r3
           6859     ~148%    {2}    | AND NOT `PathResolution::getAPrivateVisibleModule/1#3829a5ee#prev`(FIRST 2)
                             return r4
```

After
```
Pipeline standard for PathResolution::getAPrivateVisibleModule/1#3829a5ee@5edefhwp was evaluated in 12 iterations totaling 0ms (delta sizes total: 3515).
         339   ~1%    {2} r1 = SCAN `PathResolution::isItemParent/1#d5e587d6#prev_delta` OUTPUT In.0, In.0

        3130   ~0%    {2} r2 = JOIN `PathResolution::isItemParent/1#d5e587d6#prev_delta` WITH `#PathResolution::ItemNode.getImmediateParentModule/0#dispred#57c4c6d5Plus#bf#reorder_1_0#prev` ON FIRST 1 OUTPUT Lhs.0, Rhs.1

          46   ~0%    {2} r3 = JOIN `#PathResolution::ItemNode.getImmediateParentModule/0#dispred#57c4c6d5Plus#bf#reorder_1_0#prev_delta` WITH `PathResolution::isItemParent/1#d5e587d6#prev` ON FIRST 1 OUTPUT Lhs.0, Lhs.1

        3515   ~2%    {2} r4 = r1 UNION r2 UNION r3
        3515   ~2%    {2}    | AND NOT `PathResolution::getAPrivateVisibleModule/1#3829a5ee#prev`(FIRST 2)
                      return r4
```
2025-04-08 13:11:32 +02:00
Tom Hvitved
2e1b8b8b0e Rust: Fix bad join in unqualifiedPathLookup
Before
```
Pipeline standard for PathResolution::unqualifiedPathLookup/2#6b171b76#reorder_2_0_1@822d53wq was evaluated in 61 iterations totaling 118ms (delta sizes total: 131072).
          606491   ~0%    {4} r1 = SCAN `PathResolution::getASuccessor/3#febac7bd#prev_delta` OUTPUT In.1, In.2, In.0, In.3
          106457   ~1%    {3}    | JOIN WITH `PathResolution::unqualifiedPathLookup/4#e32cdfce_1230#join_rhs` ON FIRST 3 OUTPUT Lhs.3, Rhs.3, Lhs.1

          606491   ~2%    {4} r2 = SCAN `PathResolution::getASuccessor/3#febac7bd#prev_delta` OUTPUT In.0, In.2, In.3, In.1

           19261   ~0%    {4} r3 = JOIN r2 WITH `PathResolution::ModuleLikeNode.isRoot/0#dispred#21662e64` ON FIRST 1 OUTPUT Lhs.3, Lhs.0, Lhs.1, Lhs.2

        42776643   ~1%    {4} r4 = JOIN r2 WITH `doublyBoundedFastTC@PathResolution::hasChild/2#6b318d51#2@PathResolution::isRoot/1#a01ce5c3#1@PathResolution::hasCratePath/1#73ea688d#1` ON FIRST 1 OUTPUT Lhs.3, Rhs.1, Lhs.1, Lhs.2

        42795904   ~1%    {4} r5 = r3 UNION r4
           24921   ~6%    {3}    | JOIN WITH `PathResolution::RelevantPath.isCratePath/2#e595e892_120#join_rhs` ON FIRST 2 OUTPUT Lhs.3, Rhs.2, Lhs.2

          131378   ~2%    {3} r6 = r1 UNION r5
          131072   ~2%    {3}    | AND NOT `PathResolution::unqualifiedPathLookup/2#6b171b76#reorder_2_0_1#prev`(FIRST 3)
                          return r6
```

After
```
Pipeline standard for PathResolution::unqualifiedPathLookup/2#6b171b76#reorder_2_0_1@0553a4wi was evaluated in 66 iterations totaling 10ms (delta sizes total: 131072).
        610251  ~0%    {4} r1 = SCAN `PathResolution::getASuccessor/3#febac7bd#prev_delta` OUTPUT In.1, In.2, In.0, In.3
        131378  ~0%    {3}    | JOIN WITH `PathResolution::unqualifiedPathLookup1/4#781de0cd_1230#join_rhs` ON FIRST 3 OUTPUT Lhs.3, Rhs.3, Lhs.1
        131072  ~0%    {3}    | AND NOT `PathResolution::unqualifiedPathLookup/2#6b171b76#reorder_2_0_1#prev`(FIRST 3)
                       return r1
```
2025-04-08 13:10:52 +02:00
Michael B. Gale
7798b716ff Go: Fix err instead of decErr in GetPkgsInfo 2025-04-08 12:04:48 +01:00
Óscar San José
a7943d88b1 Merge pull request #19234 from github/oscarsj/csharp-disable-nuget-tests
Disable csharp tests that use nuget on macos-15
2025-04-08 12:38:28 +02:00
Geoffrey White
866fc6b320 Merge pull request #19235 from geoffw0/ssaconsistency
Rust: SSA inconsistency counts
2025-04-08 10:49:19 +01:00
Tom Hvitved
7459548118 Rust: Cache tweaks 2025-04-08 11:49:16 +02:00
Owen Mansel-Chan
8c878cd8f5 Merge pull request #19243 from github/dependabot/go_modules/go/extractor/extractor-dependencies-891a2402ea
Bump golang.org/x/tools from 0.31.0 to 0.32.0 in /go/extractor in the extractor-dependencies group
2025-04-08 10:30:29 +01:00
Owen Mansel-Chan
5f6c59580c Merge pull request #19240 from github/workflow/coverage/update
Update CSV framework coverage reports
2025-04-08 10:28:22 +01:00
Geoffrey White
10ad5780b5 Rust: Try a different toolchain version to fix the test in CI? 2025-04-08 10:21:40 +01:00
Geoffrey White
e2f63db96d Merge branch 'main' into badalloc 2025-04-08 10:15:38 +01:00
Geoffrey White
fd3dcb2d00 Rust: More precise imports. 2025-04-08 09:30:14 +01:00
Paolo Tranquilli
15606dd894 Bazel: update to 8.1.1 2025-04-08 08:20:54 +02:00
Napalys
4a4d78bbde Added change note 2025-04-08 08:12:42 +02:00
Napalys
b8802a29f4 Added open package model as data. 2025-04-08 08:12:30 +02:00
Napalys
df89739085 Added test cases for open package. 2025-04-08 08:10:10 +02:00
dependabot[bot]
2f9be926fb Bump golang.org/x/tools
Bumps the extractor-dependencies group in /go/extractor with 1 update: [golang.org/x/tools](https://github.com/golang/tools).


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

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-08 03:42:17 +00:00
Aditya Sharad
cf4989e1f8 Docs: Place GitHub Actions link lower in sidebar
Order by the human-readable language name
that is rendered,
i.e. 'GitHub Actions', not 'actions'.
2025-04-07 17:37:24 -07:00
Aditya Sharad
98b6e5ce2f Docs: Fix formatting of GitHub Actions content
Discovered in internal review of docs preview.
Use double backticks to render inline code blocks.
Use __ after inline hyperlinks.
Use an extra blank line to format the Actions library predicates table correctly.
Fix some rogue references to Ruby and case inconsistency.
2025-04-07 17:33:43 -07:00
github-actions[bot]
5adf135134 Add changed framework coverage reports 2025-04-08 00:22:09 +00:00
Aditya Sharad
0bb4ab950f Actions: Add integration test for default filter behaviour
Include a reachable workflow, and several unreachable workflow files.
Include action metadata files at various depths, all reachable.
This test exercises the default filters when the user doesn't
specify paths/paths-ignore.
2025-04-07 17:14:53 -07:00
Aditya Sharad
37db35431b Actions: Ensure autobuild invocations work when the CLI path contains spaces
Quote the paths to the CodeQL CLI dist or autobuild scripts when invoked.

This unblocks integration testing, since our integration tests always use
a CLI with a space in its directory name.
2025-04-07 17:06:28 -07:00
Geoffrey White
88439b42e6 Merge pull request #19095 from geoffw0/blockon
Rust: Model futures::executor::block_on.
2025-04-07 17:41:49 +01:00
Óscar San José
5e74bdc8dd Disable csharp test failing on macos-15 2025-04-07 18:16:33 +02:00
Napalys
873db7c121 Added change note 2025-04-07 18:15:24 +02:00
Napalys
b97c61864e Add flow summaries and entry points for TextDecoder 2025-04-07 18:15:19 +02:00
Napalys
f28478e876 Add test cases from TypedArrays to strings. 2025-04-07 18:13:52 +02:00
Napalys
f4277204b7 Add flow summaries and entry points for ArrayBuffer and SharedArrayBuffer 2025-04-07 18:12:35 +02:00
Napalys
0e099474c5 Added test cases for ArrayBuffer and SharedArrayBuffer 2025-04-07 18:07:54 +02:00
Napalys
ff07ec8d8c Add flow summaries for TypedArray methods set and subarray 2025-04-07 18:06:40 +02:00
Geoffrey White
ee54ba4c48 Rust: Autoformat. 2025-04-07 17:06:15 +01:00
Chuan-kai Lin
7c63264951 Merge pull request #19208 from github/cklin/exclude-from-incremental
Java: add exclude-from-incremental tag to telemetry queries
2025-04-07 08:29:30 -07:00
Paolo Tranquilli
de0d374cce Rust: add upgrades property in qlpack.yml 2025-04-07 17:22:17 +02:00
Geoffrey White
9c1567375d Shared: Implement getInconsistencyCounts for SSA. 2025-04-07 16:20:42 +01:00
Simon Friis Vindum
48e5b0a731 Merge branch 'main' into rust-ti-associated 2025-04-07 17:07:05 +02:00
Simon Friis Vindum
602e617bc6 Rust: Add type inference test for trait with multiple associated types 2025-04-07 17:02:51 +02:00
Simon Friis Vindum
8e76bb1a43 Rust: Minor changes based on PR review 2025-04-07 16:46:54 +02:00
Óscar San José
3744ef7379 Disable csharp tests that use nuget on macos-15 2025-04-07 16:24:48 +02:00
Paolo Tranquilli
1f9455c434 Rust: add upgrade/downgrade scripts for struct_field_is_unsafe 2025-04-07 15:39:14 +02:00
Geoffrey White
41f54d836e Rust: Tweak query description. 2025-04-07 14:33:31 +01:00
Geoffrey White
dad85854cd Apply suggestions from code review
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
2025-04-07 14:27:12 +01:00
Paolo Tranquilli
260322b669 Rust: fix compilation errors 2025-04-07 15:25:19 +02:00
Tom Hvitved
13f4a6afa6 Rust: Handle path attributes in path resolution 2025-04-07 15:24:17 +02:00
Tom Hvitved
edb7aaabab Rust: Add path attribute test 2025-04-07 15:23:27 +02:00
Napalys
d689a55229 Added test cases for TypedArray methods 2025-04-07 15:15:29 +02:00
Napalys
e23ff9cf3e Add TypedArrays flow summaries for Uint8Array and buffer property 2025-04-07 15:15:24 +02:00
Owen Mansel-Chan
d8ca8dd954 Merge pull request #19203 from owen-mc/review/egregius313/17905
Go: Add database source models for `uptrace/bun` and `gogf/gf/database/gdb`
2025-04-07 13:56:00 +01:00
Tamás Vajk
ffcf6d6e58 Apply suggestions from code review
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-04-07 14:52:57 +02:00
Paolo Tranquilli
132632b2a1 Cargo: update rustc_apfloat patched revision 2025-04-07 14:45:55 +02:00
Paolo Tranquilli
afb97d2797 Rust: regenerate schema 2025-04-07 14:34:33 +02:00
Paolo Tranquilli
db9c908d1d Cargo: upgrade dependencies 2025-04-07 14:30:00 +02:00
yoff
bf7d3d12a9 Merge pull request #19230 from yoff/ruby/add-DeadStoreOfLocal-to-code-quality-suite
ruby: add `rb/useless-assignment-to-local` to the code-quality suite
2025-04-07 14:25:20 +02:00
Simon Friis Vindum
74583e4fbf Merge pull request #19227 from paldepind/rust-pr-self
Rust: Resolve `Self` path in trait type of implementation
2025-04-07 14:21:02 +02:00
yoff
ba225013e7 ruby: add rb/useless-assignment-to-local to the code-quality suite 2025-04-07 14:08:53 +02:00
yoff
76c0b1698f Merge pull request #19164 from yoff/ruby/refine-deadstore
ruby: remove some FPs from `rb/useless-assignment-to-local`
2025-04-07 14:08:12 +02:00
yoff
6a8484f843 ruby: adjust precision of rb/useless-assignment-to-local to medium 2025-04-07 13:28:05 +02:00
yoff
eb8cbfa287 ruby: add change note 2025-04-07 13:28:05 +02:00
yoff
385598d46d ruby: remove some FPs from rb/useless-assignment-to-local 2025-04-07 13:28:05 +02:00
yoff
b205fedef4 ruby: add tests 2025-04-07 13:27:27 +02:00
yoff
e5fc1b0b00 ruby: add qhelp to rb/useless-assignment-to-local 2025-04-07 13:27:27 +02:00
Tom Hvitved
ca5cc8e405 Merge pull request #19220 from hvitved/rust/path-resolution-crate-fix
Rust: Minor path resolution fix for `($)crate` paths
2025-04-07 13:24:12 +02:00
Geoffrey White
2c2506c4f8 Rust: Add Rust SSA inconsistency infrastructure. 2025-04-07 12:16:45 +01:00
Simon Friis Vindum
3441af136c Merge pull request #19146 from paldepind/rust-ti-alias
Rust: Implement support for inference of type aliases
2025-04-07 13:03:30 +02:00
Simon Friis Vindum
5dba2412b5 Rust: Fix annotation in comment 2025-04-07 12:53:13 +02:00
Florin Coada
5cde4ddccf Merge pull request #19219 from github/changedocs/2.21.0
Add changelog entries for CodeQL CLI versions 2.20.7 and 2.21.0
2025-04-07 11:53:05 +01:00
Simon Friis Vindum
acc565f84e Rust: Refactor PathMention as suggested in review 2025-04-07 12:50:31 +02:00
Tamas Vajk
d17d44125c Java: add integration test for query suite contents 2025-04-07 12:49:16 +02:00
Napalys
93882263f9 Added test case for Uint8Array and TypedArray.prototype.buffer 2025-04-07 12:46:19 +02:00
Napalys
c4fa417680 Added change note 2025-04-07 12:11:33 +02:00
yoff
a885e61875 Merge pull request #19206 from hvitved/ruby/super-implicit-args-synth
Ruby: Synthesize implicit super arguments
2025-04-07 11:57:12 +02:00
Simon Friis Vindum
6cecf7e618 Rust: Resolve Self path in trait type of implementation 2025-04-07 11:55:03 +02:00
Simon Friis Vindum
5c2d6e3d0f Rust: Add path resolution test for Self in trait implementation 2025-04-07 11:45:43 +02:00
Napalys
6fb5376c5f Refactor ReceivedItemAsRemoteFlow to handle data from both client and server WebSocket sources 2025-04-07 11:44:40 +02:00
Geoffrey White
893e42315e Merge branch 'main' into badalloc 2025-04-07 09:33:23 +01:00
Geoffrey White
f292d04d7a Merge branch 'main' into blockon 2025-04-07 09:03:55 +01:00
Geoffrey White
810228273b Merge pull request #19222 from geoffw0/sinkstats
Rust: Define queries more consistently and include all sinks in stats
2025-04-07 08:57:40 +01:00
Tom Hvitved
f992c714fd Ruby: Add change note 2025-04-07 09:24:26 +02:00
Geoffrey White
471f02cf3b Merge branch 'main' into sinkstats 2025-04-04 22:28:30 +01:00
Geoffrey White
6ad7a950da Merge branch 'main' into badalloc 2025-04-04 21:57:04 +01:00
Geoffrey White
c9939387f8 Rust: Turn on PrettyPrintModels for RegexInjection so we hopefully don't have to deal with test result changes there as often. 2025-04-04 21:47:22 +01:00
Geoffrey White
a5883b1627 Rust: Accept test changes (due to added models?). 2025-04-04 21:45:37 +01:00
Geoffrey White
bc92a99fae Merge pull request #19080 from geoffw0/deallocation
Rust: Query for dereferencing an invalid pointer
2025-04-04 21:25:40 +01:00
Geoffrey White
d7c14ec065 Rust: Revert change to Cargo.lock. 2025-04-04 20:47:16 +01:00
Geoffrey White
ff78c45e50 Rust: Abstractions then implementations. 2025-04-04 18:33:27 +01:00
Geoffrey White
47ee6c6b81 Rust: Give regex injection extendable sources as well. 2025-04-04 18:27:16 +01:00
Geoffrey White
0db551032c Rust: Make imports consistent and correct. 2025-04-04 18:23:53 +01:00
Geoffrey White
784ccb740b Rust: Define Rust queries and extensions more consistently. 2025-04-04 18:17:16 +01:00
Geoffrey White
1acbdbaaa2 Rust: Make all query sinks extend QuerySink::Range and import them into Stats.qll (this ensures that sink statistics are complete). 2025-04-04 18:02:59 +01:00
Geoffrey White
c783549b5c Merge branch 'main' into blockon 2025-04-04 17:35:00 +01:00
Geoffrey White
8e7e162ebc Merge branch 'main' into badalloc 2025-04-04 17:09:50 +01:00
Geoffrey White
49c2f97cc8 Merge pull request #19180 from geoffw0/lessnoise
Rust: Reduce CI noise from the SummaryStats query
2025-04-04 16:51:30 +01:00
Tom Hvitved
006cb024de Merge pull request #19217 from hvitved/rust/macro-expansion-inherit-location
Rust: Use macro call location as fall back in macro expansions
2025-04-04 16:25:45 +02:00
Geoffrey White
d47e925e85 Rust: Delete empty .expected files. 2025-04-04 14:43:24 +01:00
Geoffrey White
65974544a3 Merge remote-tracking branch 'upstream/main' into lessnoise 2025-04-04 13:58:29 +01:00
Geoffrey White
64ee6c5c02 Merge branch 'main' into lessnoise 2025-04-04 13:51:31 +01:00
Geoffrey White
e9971ffb94 Rust: Change the ID of the new query. 2025-04-04 13:50:28 +01:00
Tom Hvitved
8b6c8d7174 Rust: Minor path resolution fix for ($)crate paths 2025-04-04 14:44:39 +02:00
Geoffrey White
dc31da82d0 Rust: Fix file name typo. 2025-04-04 13:42:29 +01:00
Joe Farebrother
e08072d77b Fix qhelp formatting 2025-04-04 12:51:46 +01:00
Florin Coada
5c1581d080 Add changelog entries for CodeQL CLI versions 2.20.7 and 2.21.0 2025-04-04 12:37:37 +01:00
Joe Farebrother
de7e611962 Rewrite documentation 2025-04-04 12:36:13 +01:00
Geoffrey White
24a4aad120 Rust: Accept consistency check fixes following merge with main. 2025-04-04 12:11:25 +01:00
Geoffrey White
8b23945417 Merge branch 'main' into deallocation 2025-04-04 12:06:50 +01:00
Tom Hvitved
6f704f088e Merge pull request #19157 from hvitved/rust/path-resolution-prelude
Rust: Take prelude into account when resolving paths
2025-04-04 13:06:31 +02:00
Michael Nebel
8f0b9853f8 Merge pull request #19061 from michaelnebel/csharp/useless-assignment-to-local
C#: Add `cs/useless-assignment-to-local` to the code quality suite.
2025-04-04 13:00:36 +02:00
Joe Farebrother
b5805503fe Cleanups 2025-04-04 11:56:07 +01:00
Tom Hvitved
ffca52e5c0 Merge pull request #19195 from hvitved/rust/post-with-flow-in-exclude
Rust: Add another disjunct to `postWithInFlowExclude`
2025-04-04 12:41:30 +02:00
Tom Hvitved
8e9e772ac8 Merge pull request #19121 from hvitved/ruby/pre-update-unique
Ruby: Make `getPreUpdateNode` Unique Again
2025-04-04 12:40:44 +02:00
Napalys
6bcfd8c91d Updated getAServer with API graphs. 2025-04-04 12:31:29 +02:00
Napalys
c5860e92ec Updated WebSocketReceiveNode to match bind functions. 2025-04-04 12:28:53 +02:00
Napalys
4b7a9cd399 Added test case with bind. 2025-04-04 12:26:58 +02:00
Napalys
49194b0340 Updated WebSocketReceiveNode with API graphs. 2025-04-04 12:26:52 +02:00
Michael Nebel
70a174ad5a C#: Address review comments. 2025-04-04 11:47:46 +02:00
Tom Hvitved
b115f3f5e9 Update rust/ql/lib/codeql/rust/internal/PathResolution.qll
Co-authored-by: Simon Friis Vindum <paldepind@github.com>
2025-04-04 11:39:06 +02:00
Tom Hvitved
5731fa91f3 Rust: Use macro call location as fall back in macro expansions 2025-04-04 11:38:10 +02:00
Joe Farebrother
9fb1c31206 Update tests to inline expectations 2025-04-04 10:13:39 +01:00
Geoffrey White
44b26e5ae6 Rust: Change the test copy of the example as well. 2025-04-04 09:54:41 +01:00
Geoffrey White
f96b00a62a Update rust/ql/src/queries/security/CWE-770/UncontrolledAllocationSizeGood.rs
Co-authored-by: Simon Friis Vindum <paldepind@github.com>
2025-04-04 09:53:13 +01:00
Joe Farebrother
adfe89fadc Update test output 2025-04-04 09:47:21 +01:00
Simon Friis Vindum
77e1b231a6 Rust: Handle associated types in trait methods 2025-04-04 10:24:55 +02:00
Simon Friis Vindum
f9ff92a705 Rust: Expand on type inference tests for associated types 2025-04-04 10:16:09 +02:00
Michael Nebel
dd1fbd28be C#: Add string interpolation examples to cs/useless-assignment-to-local. 2025-04-04 10:08:41 +02:00
Michael Nebel
2b88600f0f C#: Re-factor cs/useless-assignment-to-local tests to use inline test framework. 2025-04-04 10:08:39 +02:00
Michael Nebel
49ecff3292 C#: Add cs/useless-assignment-to-local to the CCR suite. 2025-04-04 10:08:38 +02:00
Michael Nebel
5a4e0cea55 Merge pull request #19199 from michaelnebel/csharp/synctestfiles
C#: Accept file sync mismatch for C# testfiles.
2025-04-04 10:07:05 +02:00
Tom Hvitved
15bfeab652 Ruby: Make getPreUpdateNode Unique Again 2025-04-04 09:43:55 +02:00
Anders Schack-Mulligen
ea8cd6f758 Merge pull request #19160 from aschackmull/ssa/deprecate-definitionext
Ssa: Deprecate the public DefinitionExt and PhiReadNode
2025-04-04 09:23:08 +02:00
Napalys
0dbf951291 Updated ClientSocket and SendNode with API graphs. 2025-04-04 09:14:54 +02:00
Napalys
455ce59583 Added test cases with export of an instance. 2025-04-04 08:59:19 +02:00
Napalys
e16a20e69f Updated SocketClass to use API Graphs. 2025-04-04 08:47:27 +02:00
Napalys
c7fad09664 Added test cases with custom exports/imports. 2025-04-04 08:33:26 +02:00
Napalys
a572ac60d2 Added inline test expectations for WebSocket 2025-04-04 08:22:48 +02:00
Anders Schack-Mulligen
ce19972aef SSA: Reinstate consistency check. 2025-04-03 16:16:20 +02:00
Tom Hvitved
f4e9382622 Rust: Take prelude into account when resolving paths 2025-04-03 16:07:26 +02:00
Tom Hvitved
4b3816e14e Rust: Variants inherit visibility from their parent enum 2025-04-03 16:05:12 +02:00
Tom Hvitved
f09c3c5813 Rust: Handle self enum/struct uses 2025-04-03 16:05:11 +02:00
Tom Hvitved
3bfb4fbd8d Rust: More path resolution tests 2025-04-03 16:05:09 +02:00
Asger F
68f6f9f2e8 Merge pull request #19211 from asgerf/js/pp-unit-tests
Support post-procesed inline expectations for query predicates in unit tests
2025-04-03 16:00:18 +02:00
Simon Friis Vindum
a1d36c0501 Rust: Implement support for inference of type aliases 2025-04-03 15:18:15 +02:00
Simon Friis Vindum
e7027f0979 Rust: Add type inference tests for type aliases 2025-04-03 15:13:19 +02:00
Simon Friis Vindum
04d37c3f46 Merge pull request #19198 from paldepind/rust-ti-inline-expectations
Rust: Add inline expectations test for type inference
2025-04-03 14:55:12 +02:00
Simon Friis Vindum
e6c7ad8ee0 Rust: Add comment as suggested in review 2025-04-03 14:34:23 +02:00
Simon Friis Vindum
a53f664e85 Rust: Fix bad join 2025-04-03 14:33:02 +02:00
Anders Schack-Mulligen
5f290ebfca Merge pull request #19156 from aschackmull/misc/stageoverlap
Misc: Add stage overlap script
2025-04-03 13:40:24 +02:00
Asger F
14c5495b4c JS: Use in SensitiveActions test as an example 2025-04-03 13:24:18 +02:00
Asger F
c49ffa01ee JS: Enable post-processed inline expectations for query predicates 2025-04-03 13:24:17 +02:00
Simon Friis Vindum
d5d61dd8b3 Rust: Add inline expectations test for type inference 2025-04-03 12:49:34 +02:00
Simon Friis Vindum
b0c40111e7 Rust: Tweaks to stringification 2025-04-03 12:45:08 +02:00
Owen Mansel-Chan
1ed8fbd811 Delete commented out code 2025-04-03 11:19:14 +01:00
Asger F
6c33013788 JS: Enable association with headers without needing a route handler
Previously it was not possible to associate a ResponseSendArgument with its header definitions if they did not have the same route handler.

But for calls like `new Response(body, { headers })` the headers are fairly obvious whereas the route handler is unnecessarily hard to find. So we use the direct and obvious association between 'body' and 'headers' in the call.
2025-04-03 11:08:10 +02:00
Asger F
db2720ea5b JS: Initial model of Response 2025-04-03 11:08:05 +02:00
Napalys
0e7bff0f81 Added change note. 2025-04-03 10:45:17 +02:00
Napalys
04a39eb735 Removed old mkdirp modeling and replaced it with MaD. 2025-04-03 10:45:16 +02:00
Napalys
3fa24d6026 Add sink model for mkdirp and update tests for path injection alerts. 2025-04-03 10:45:14 +02:00
Napalys
533f1a93e2 JS: Added test cases for mkdirp. 2025-04-03 10:45:12 +02:00
Michael Nebel
79688efacb Merge pull request #19194 from michaelnebel/csharp/enumsimpletype
C#: Extend simple type sanitizers with enums and `System.DateTimeOffset`.
2025-04-03 10:24:26 +02:00
Tamás Vajk
befc2fd7c1 Merge pull request #19145 from tamasvajk/tamasvajk/blazor/parameter-passing-jumpnode-2
C#: Blazor: Support string literals as property names in jump nodes
2025-04-03 10:07:59 +02:00
Anders Schack-Mulligen
6ac4cb71cb SSA: Add change note. 2025-04-03 09:57:48 +02:00
Napalys Klicius
5c42c0ba4c Merge pull request #19196 from Napalys/js/rimraf
JS: Modeling of `rimraf` functions
2025-04-03 09:51:52 +02:00
Anders Schack-Mulligen
34554fd000 SSA: Deprecate the public DefinitionExt. 2025-04-03 09:47:50 +02:00
Anders Schack-Mulligen
e04075b0ec Merge pull request #19177 from aschackmull/swift/ssa-useuse
Swift: Update SSA to reference the new use-use predicates.
2025-04-03 09:46:47 +02:00
Asger F
bb15f30ef6 Merge pull request #19192 from asgerf/js/name-resolution-independent-fixes
JS: Some preliminary fixes from name resolution branch
2025-04-03 09:36:02 +02:00
Tom Hvitved
65a11984bd Ruby: Synthesize implicit super arguments 2025-04-03 09:13:06 +02:00
Tom Hvitved
c10b5801b1 Ruby: Add argument-less super call tests 2025-04-03 09:12:23 +02:00
Simon Friis Vindum
52660fa57d Merge pull request #19149 from paldepind/rust-ti-self-param
Rust: Make trait a base type mention of the self type parameter
2025-04-03 08:44:09 +02:00
Aditya Sharad
927b26b869 Merge pull request #19190 from adityasharad/actions/initial-docs
Docs: Add GitHub Actions as a supported language
2025-04-03 04:39:23 +05:30
Aditya Sharad
4d6afe7d29 Docs: Address comments on Actions docs 2025-04-02 16:00:55 -07:00
Aditya Sharad
8f6dc1cdfc Docs: Fix more short underlines 2025-04-02 15:56:42 -07:00
Aditya Sharad
67dd301a37 Docs: Add language guide structure for Actions 2025-04-02 15:25:27 -07:00
Jonas Jensen
118abd40c9 Java: add exclude-from-incremental tag to telemetry queries
In the future, this tag should signal to the action that the queries
should be excluded from incremental scans because they are too slow
and/or produce too many results.

The three queries tagged here rely on global data-flow analysis to find
all XSS sinks. All other metric and diagnostic queries are fast enough
for incrementality.
2025-04-02 14:19:45 -07:00
Nicolas Will
62fa136506 Merge pull request #19201 from nicolaswill/patch-1
Add @ps-codeql to CODEOWNERS for experimental cryptography
2025-04-02 22:15:03 +02:00
Aditya Sharad
d31896bf52 Merge pull request #19166 from yoff/actions/add-actions-permissions-MaD-model
actions: add MaD model for permissions needed by actions
2025-04-03 01:24:04 +05:30
Aditya Sharad
4207322719 Docs: Make Actions underlines the right length
Fixes warnings in Sphinx build.
2025-04-02 11:39:01 -07:00
Jon Janego
d5130127b1 Merge pull request #19189 from github/jonjanego/useless-expression-tags
Update tags for js/useless-expression
2025-04-02 13:24:56 -05:00
Tom Hvitved
a01b211f79 Merge pull request #19185 from hvitved/rust/ssa-capture-psudeo-read-dominate
Rust: Fix `capturedCallRead`
2025-04-02 19:16:55 +02:00
Jon Janego
e0d9dad9c2 Merge branch 'main' into jonjanego/useless-expression-tags 2025-04-02 10:51:52 -05:00
Jon Janego
d8ef4fc25d Update javascript/ql/src/Expressions/ExprHasNoEffect.ql
Co-authored-by: Napalys Klicius <napalys@github.com>
2025-04-02 10:22:27 -05:00
Idriss Riouak
145c141e63 Merge pull request #19202 from github/idrissrio/trailing-return
C++: update expected test results after extractor changes
2025-04-02 17:01:14 +02:00
Óscar San José
f4515515fe Merge pull request #19204 from github/oscarsj/migrate-builders-macos-15
Run pytest server with `sudo` and higher `nice` value
2025-04-02 16:59:11 +02:00
Chris Smowton
e865d07a70 Merge pull request #19187 from smowton/smowton/feature/jakarta-persistence
Java: generalise `javax.persistence` models to also recognise `jakarta.persistence`.
2025-04-02 15:56:29 +01:00
Óscar San José
18c901bee4 Merge branch 'main' into oscarsj/migrate-builders-macos-15 2025-04-02 16:11:58 +02:00
Michael Nebel
16142a287a C#: Add NoDisposeCallOnLocalIDisposableBad file and update test expected output. 2025-04-02 15:43:52 +02:00
Simon Friis Vindum
001735bfb8 Rust: Take internal IDs of a smaller class 2025-04-02 15:39:58 +02:00
Michael Nebel
2193bece90 C#: Update test expected output. 2025-04-02 15:30:48 +02:00
idrissrio
14a84c3209 C++: update expected test results after extractor changes 2025-04-02 15:20:06 +02:00
Owen Mansel-Chan
ecd09edf64 Add stubs for gogf/gf and uptrace/bun 2025-04-02 14:17:40 +01:00
Owen Mansel-Chan
1687042c3b Add Bun models and tests 2025-04-02 14:17:39 +01:00
Owen Mansel-Chan
ddb7da4c13 Add gogf models and tests 2025-04-02 14:17:37 +01:00
Ed Minnix
9cf4117120 Add tests for gogf/gf/database/gdb 2025-04-02 14:17:35 +01:00
Ed Minnix
db65a6ff85 [gogf] Model github.com/gogf/gf/database/gdb
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2025-04-02 14:17:34 +01:00
Ed Minnix
c54f0d82e2 [bun] Model github.com/uptrace/bun 2025-04-02 14:17:32 +01:00
Owen Mansel-Chan
89e853b4be Don't use non-existent dependency
This makes some go tooling, like `go mod tidy`, not work.
2025-04-02 14:17:31 +01:00
Owen Mansel-Chan
88b061e27e Add change note 2025-04-02 14:17:30 +01:00
Michael Nebel
93d0f364d6 C#: Add ConstantConditionBad file. 2025-04-02 15:00:05 +02:00
Nicolas Will
10564fac4d Add @ps-codeql to CODEOWNERS for experimental cryptography
This pull request adds @github/ps-codeql as a code owner of `**/experimental/quantum/` to support the development of post-quantum cryptography-related libraries and queries.

We’ll be committing stable but experimental work to these directories as it becomes ready for public use, with a near-term goal of moving it out of experimental.

To get started, we’d also need write access to `github/codeql`.

cc @adityasharad @lcartey
2025-04-02 14:20:24 +02:00
Asger F
6c3bc941c5 Merge branch 'main' into js/name-resolution-independent-fixes 2025-04-02 14:15:44 +02:00
Asger F
2c40359143 JS: Change note 2025-04-02 14:12:07 +02:00
Asger F
30a9cd7c8a JS: Include document as a DOM value 2025-04-02 14:09:52 +02:00
Michael Nebel
6820cbabc8 C#: Accept file sync mismatch for C# testfiles if they are identical modulo comments. 2025-04-02 14:01:00 +02:00
Asger F
9ebaac82cf JS: Add tests for Response object sink 2025-04-02 13:47:18 +02:00
Geoffrey White
fbde235253 Rust: Rename the test as well. 2025-04-02 12:16:10 +01:00
Geoffrey White
02245af3ca Rust: Rename the query file. 2025-04-02 12:11:55 +01:00
Geoffrey White
9fc0ee185b Rust: Change the query ID to rust/summary/summary-statistics-reduced. 2025-04-02 12:03:20 +01:00
Taus
f461763938 Merge pull request #19186 from github/tausbn/actions-fix-gettargetpath-performance
Actions: Fix bad performance in `getTargetPath`
2025-04-02 12:53:56 +02:00
Napalys
390d9ffe66 Added change note 2025-04-02 12:50:53 +02:00
Napalys
b16b407f89 Add rimraf model and update tests for path injection vulnerabilities 2025-04-02 12:49:48 +02:00
Napalys
14999c19da Added test cases for rimraf library. 2025-04-02 12:46:48 +02:00
Tom Hvitved
8663f3b8b2 Rust: Add another disjunct to postWithInFlowExclude 2025-04-02 12:32:28 +02:00
Geoffrey White
c737ee9b52 Rust: Accept another consistency check failure. 2025-04-02 10:58:56 +01:00
Michael Nebel
22c943657a C#: Update change note. 2025-04-02 11:21:11 +02:00
Michael Nebel
d7f5ce2492 C#: Update log forging expected test output. 2025-04-02 11:21:07 +02:00
Michael Nebel
cf75493fe9 C#: Consider Enums and System.DateTimeOffset as having a sanitizing effect. 2025-04-02 11:21:05 +02:00
Michael Nebel
08159896f3 C#: Convert cs/log-forging tests to inline expectations. 2025-04-02 11:21:03 +02:00
Michael Nebel
60e3b4351a C#: Fix simple types testcases. 2025-04-02 11:21:01 +02:00
Michael Nebel
024712c073 C#: Temporarily comment out considering Enums as having a sanitizing effect. 2025-04-02 11:20:59 +02:00
Chris Smowton
77e4d9e692 Fix stray references to the javax package name
Co-authored-by: Jami <57204504+jcogs33@users.noreply.github.com>
2025-04-02 10:03:49 +01:00
Joe Farebrother
c37809a187 Reduce scope of allowImplicitRead to avoid cartesian product. 2025-04-02 09:35:50 +01:00
Joe Farebrother
2d6476ad21 Update names and alert message 2025-04-02 09:35:43 +01:00
Joe Farebrother
11830bf661 Move to separate folder 2025-04-02 09:35:39 +01:00
Joe Farebrother
5b7200a041 Use flow path in alerts 2025-04-02 09:35:32 +01:00
Joe Farebrother
08b4281187 Update query message and remove field case 2025-04-02 09:35:25 +01:00
Joe Farebrother
efdb4a6d82 Use global dataflow for loop variable capture 2025-04-02 09:35:17 +01:00
Anders Schack-Mulligen
e6cf737f99 Merge pull request #19178 from aschackmull/csharp/pressa-useuse
C#: Update PreSSA to reference the new use-use predicates.
2025-04-02 10:30:36 +02:00
Anders Schack-Mulligen
47b1c3d3ce Merge pull request #19154 from aschackmull/ssa/variablecapture
Ssa: Replace phi-read references in VariableCapture with default use-use flow
2025-04-02 10:16:17 +02:00
Asger F
78b25388ca JS: Protect against bad join in BadRandomness
This code resulted in bad join orders in response to certain library
changes. The actual library changes have to be split into smaller pieces
but I'd like to ensure I don't run into the bad join again.
2025-04-02 10:14:07 +02:00
Asger F
46f88e7ce7 JS: Updates to DOM model 2025-04-02 10:14:03 +02:00
Asger F
48db2b9315 JS: Add test 2025-04-02 10:12:36 +02:00
Ian Roof
1d81c77fcd C#: Enhanced LogForgingQuery to treat C# Enums as simple types. 2025-04-02 09:40:10 +02:00
yoff
c18529086a actions: add change note 2025-04-02 08:50:05 +02:00
yoff
7bf4a47549 Apply suggestions from code review
Co-authored-by: Aditya Sharad <6874315+adityasharad@users.noreply.github.com>
2025-04-02 08:43:29 +02:00
Michael Nebel
45b55c05ae Merge pull request #19191 from github/workflow/coverage/update
Update CSV framework coverage reports
2025-04-02 08:02:39 +02:00
Aditya Sharad
3b8c4d970f Docs: Remove spurious predicate reference 2025-04-01 19:07:34 -07:00
Aditya Sharad
9db5cdf957 Docs: Add query help page placeholders for Actions 2025-04-01 19:03:59 -07:00
Aditya Sharad
a1ceaa0aa3 Docs: Add initial library docs for Actions
Create the basic structure, state the key importable libraries.
Describe a workflow.
State the extensible predicates available.
Other elements are to be filled in later.
2025-04-01 19:02:49 -07:00
github-actions[bot]
f379f23216 Add changed framework coverage reports 2025-04-02 00:22:37 +00:00
Aditya Sharad
f6442d20db Docs: Add Actions pages for CWE coverage 2025-04-01 17:09:03 -07:00
Aditya Sharad
09de7cfe4d Docs: Add GitHub Actions as a supported language
Include GitHub Actions (identifier `actions`) everywhere we list
supported languages, query packs, and library packs.

Query and library documentation link targets do not exist yet.
2025-04-01 17:01:47 -07:00
Jon Janego
74587f0d64 Update ExprHasNoEffect.ql
adding quality tags per metadata styleguide
2025-04-01 18:47:52 -05:00
Jon Janego
fa02f82ef6 Updating the metadata style guide
Update query-metadata-style-guide.md
2025-04-01 15:50:23 -05:00
Jon Janego
dcdc3b8939 Merge branch 'main' into jonjanego-patch-1 2025-04-01 15:42:51 -05:00
Jon Janego
00bb9056c2 Update query-metadata-style-guide.md 2025-04-01 15:42:36 -05:00
Geoffrey White
1d7dac485e Rust: switch the query to taint flow so that we get taint through conversions (without needing a special case). 2025-04-01 17:57:04 +01:00
Chris Smowton
3c555fce11 Add basic test for SQL injection vs Jakarta Persistence 2025-04-01 17:13:23 +01:00
Chris Smowton
5d37ccfa90 Change note 2025-04-01 16:51:29 +01:00
Chris Smowton
20839745bd Remove redundant import 2025-04-01 16:49:56 +01:00
Asger F
887942e3e9 Merge pull request #19108 from asgerf/js/api-graph-spread-rest
JS: Handle spread/rest in API graphs
2025-04-01 17:48:36 +02:00
Taus
aacdc70a73 Merge pull request #19136 from github/tausbn/python-modernise-mixed-tuple-returns-query
Python: Modernize `py/mixed-tuple-returns`
2025-04-01 17:31:56 +02:00
Chris Smowton
50119ae481 Update docs 2025-04-01 16:20:06 +01:00
Chris Smowton
a5a6fd37df Enable recognising jakarta.persistence in dead-code queries 2025-04-01 16:19:42 +01:00
yoff
80ae8794f5 actions: update test expectations 2025-04-01 17:07:57 +02:00
yoff
d83f35ff64 actions: remove unneded API 2025-04-01 17:07:43 +02:00
Chris Smowton
fb6296a564 Persistence models: recognise jakarta.persistence 2025-04-01 16:07:40 +01:00
yoff
6fd8aba560 actions: simplify using existing UsesStep 2025-04-01 17:07:21 +02:00
yoff
ee1eb199b5 actions: add description of actionsPermissionsDataModel 2025-04-01 17:07:02 +02:00
yoff
bd7c684c6c actions: add test with empty permissions 2025-04-01 17:06:32 +02:00
Taus
8afdf25e9a Actions: Mark helper predicate as noinline. 2025-04-01 14:50:00 +00:00
Asger F
4746cfddf2 JS: Add clarifying comment 2025-04-01 16:26:07 +02:00
Asger F
e1784bb10c JS: Fix handling of spread args on a bound function 2025-04-01 16:20:57 +02:00
Taus
c9fc7882e6 Actions: Fix bad performance in getTargetPath
Seen on `github/codeql`, some queries had very poor performance:
```
 [2/24 eval 36m4s] Evaluation done; writing results to
codeql/actions-queries/Security/CWE-312/ExcessiveSecretsExposure.bqrs
```

Investigating further lead to the following worrying sequence of joins
(after I ran out of patience and cancelled the query):
```
[2025-04-01 12:31:03] Tuple counts for
Yaml::YamlInclude.getTargetPath/0#dispred#32565107#fb#reorder_1_0/2@i6#9f4b2jw1
after 8m40s:
...
    559418    ~33%        {1} r5 = SCAN
`Yaml::YamlNode.getLocation/0#dispred#24555c57#prev_delta` OUTPUT In.1
...
    909345525 ~821%       {3} r7 = JOIN r5 WITH
`Yaml::YamlNode.getLocation/0#dispred#24555c57#prev` CARTESIAN PRODUCT
OUTPUT Rhs.1, Lhs.0 'result', Rhs.0
    909342139 ~779%       {3}    | JOIN WITH
`Locations::Location.getFile/0#dispred#dcf38c8d#prev` ON FIRST 1 OUTPUT
Rhs.1, Lhs.1 'result', Lhs.2
    909338753 ~794%       {3}    | JOIN WITH containerparent_10#join_rhs
ON FIRST 1 OUTPUT Rhs.1, Lhs.1 'result', Lhs.2
    909335367 ~824%       {3}    | JOIN WITH
`FileSystem::Container.getAbsolutePath/0#dispred#d234e6fa` ON FIRST 1
OUTPUT Lhs.2, Lhs.1 'result', Rhs.1
    883246724 ~812%       {3}    | JOIN WITH
`Yaml::YamlNode.getDocument/0#dispred#ee1eb3bf#bf_10#join_rhs` ON FIRST
1 OUTPUT Rhs.1 'this', Lhs.1 'result', Lhs.2
    760047185 ~838%       {5}    | JOIN WITH yaml_scalars ON FIRST 1
OUTPUT Lhs.1 'result', Lhs.0 'this', Rhs.2, _, Lhs.2
    0         ~0%         {4}    | REWRITE WITH Tmp.3 := "/", Out.3 :=
(In.4 ++ Tmp.3 ++ InOut.2), TEST Out.3 = InOut.0 KEEPING 4
                        {4}    | REWRITE WITH NOT [TEST InOut.2
startsWith "/"]
...
```

The culprit turned out to be the following method on class `YamlInclude`
```ql
private string getTargetPath() {
    exists(string path | path = this.getValue() |
    if path.matches("/%")
    then result = path
    else
        result =

this.getDocument().getLocation().getFile().getParentContainer().getAbsolutePath()
+ "/" +
            path
    )
}
```

Basically, in the `else` branch, the evaluator was producing all
possible values of `result` before filtering out the ones where the
`path` component started with a forward slash.

To fix this, I opted to factor out the logic into two helper predicates,
each accounting for whether `this.getValue()` does or does not start
with a `/`. With this, evaluating the original query from a clean cache
takes roughly 3.3s.
2025-04-01 13:59:19 +00:00
Tom Hvitved
ffb25b7aac Merge pull request #19162 from hvitved/rust/to-string-non-rec
Rust: Make `Element.toString` non-recursive
2025-04-01 15:31:18 +02:00
Anders Schack-Mulligen
e1ef56b8bb Swift: Fix accidental cartesian product. 2025-04-01 15:23:16 +02:00
Óscar San José
9b2eff88a6 restore original port 2025-04-01 15:17:52 +02:00
Arthur Baars
0e23b86bf5 Merge pull request #19182 from github/post-release-prep/codeql-cli-2.21.0
Post-release preparation for codeql-cli-2.21.0
2025-04-01 15:12:29 +02:00
Tom Hvitved
dcaeeabad8 Rust: Fix capturedCallRead 2025-04-01 15:11:20 +02:00
Tom Hvitved
9dea9f5046 SSA: Make phiWithoutTwoPriorRefs consistency check more informative 2025-04-01 15:07:46 +02:00
Tom Hvitved
01810cbac9 Rust: Update PhiDefinition.toString 2025-04-01 14:59:05 +02:00
Marco Gario
2419ccf511 Merge pull request #19183 from github/marcogario-patch-1
Update UntrustedCheckoutCritical.ql
2025-04-01 14:43:37 +02:00
Simon Friis Vindum
8acf9ceef4 Rust: Make trait a base type mention of the self type parameter 2025-04-01 14:04:46 +02:00
Marco Gario
d33ce423d8 Update UntrustedCheckoutCritical.ql 2025-04-01 13:58:37 +02:00
Arthur Baars
68690b4615 Merge pull request #19181 from github/aibaars/rust-delete-cargo-lock
Rust: QLTest: delete Cargo.lock files
2025-04-01 13:57:19 +02:00
yoff
3cdd641b81 actions: fix typo 2025-04-01 13:43:00 +02:00
Michael Nebel
f4105ee4af Merge pull request #19089 from michaelnebel/csharp/improvestringinterpolation
C#: Extract string interpolation alignment and format.
2025-04-01 13:40:15 +02:00
github-actions[bot]
10205cb990 Post-release preparation for codeql-cli-2.21.0 2025-04-01 11:30:43 +00:00
Joe Farebrother
0339601ada Merge pull request #19179 from joefarebrother/python-ccr
Python: Add file-not-closed and special-method-wrong-signature to python code-quality suite
2025-04-01 12:26:35 +01:00
yoff
1ec3e8712b Apply suggestions from code review
Co-authored-by: Aditya Sharad <6874315+adityasharad@users.noreply.github.com>
2025-04-01 13:18:30 +02:00
Óscar San José
81a39f380a Change niceness of test server 2025-04-01 12:48:00 +02:00
Arthur Baars
1d49252c03 Rust: QLTest: delete Cargo.lock files 2025-04-01 12:38:57 +02:00
Paolo Tranquilli
01d4c0ff56 Merge pull request #19167 from github/redsun82/rust-upgrades-downgrades
Rust: introduce upgrades/downgrades infrastructure
2025-04-01 12:01:30 +02:00
Paolo Tranquilli
7821fbf576 Merge branch 'main' into redsun82/rust-upgrades-downgrades 2025-04-01 11:38:34 +02:00
Marco Gario
c8299253f1 Merge pull request #19126 from github/marcogario-patch-1
Update UseOfKnownVulnerableAction.ql
2025-04-01 11:36:25 +02:00
Tom Hvitved
f54d8325ae Merge pull request #19133 from hvitved/rust/more-path-resolution
Rust: More path resolution improvements
2025-04-01 11:25:16 +02:00
Anders Schack-Mulligen
7afcd1bbec Swift: Update test output. 2025-04-01 11:07:17 +02:00
Joe Farebrother
73eebcbca6 Python: Add file-not-closed and special-method-wrong-signature to python code-quality suite 2025-04-01 10:05:17 +01:00
Marco Gario
c0d7288696 Merge branch 'main' into marcogario-patch-1 2025-04-01 10:59:03 +02:00
Geoffrey White
86840a78c2 Rust: Update .expected files. 2025-04-01 09:56:56 +01:00
Geoffrey White
cc90ba5836 Rust: Create a less noisy version of the summary stats query, for use in tests. 2025-04-01 09:56:47 +01:00
Geoffrey White
32e2c1912c Rust: Move all summary stats logic into Stats.qll. 2025-04-01 09:56:39 +01:00
Marco Gario
3652d6f258 Merge pull request #19127 from github/marcogario/untrusted_checkout_name
UntrustedCheckout: Try and differentiate between two versions of the query
2025-04-01 10:56:36 +02:00
Idriss Riouak
1ebce01c95 Merge pull request #19159 from github/idrissrio/calling-conventions
C++: Add class representing calling conventions
2025-04-01 10:31:16 +02:00
Tamas Vajk
a570a728bd Fix code quality 2025-04-01 10:29:55 +02:00
Tamás Vajk
398f041464 Update csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/aspnetcore/Components.qll
Co-authored-by: Michael Nebel <michaelnebel@github.com>
2025-04-01 10:18:09 +02:00
Michael Nebel
8bf2ceb942 Merge pull request #19125 from michaelnebel/csharp/updatedotnet9models
C#: Update generated .NET 9 Runtime models.
2025-04-01 10:09:58 +02:00
Anders Schack-Mulligen
887452d202 Swift: Update SSA to reference the new use-use predicates. 2025-04-01 10:05:02 +02:00
Anders Schack-Mulligen
dbd99df85b C#: Update PreSSA to reference the new use-use predicates. 2025-04-01 10:03:20 +02:00
idrissrio
d61d9730c8 C++: add change note for calling conventions 2025-04-01 09:53:36 +02:00
Tom Hvitved
56f4694b38 Swift: Avoid calling Element.toString recursively 2025-04-01 08:48:16 +02:00
Tom Hvitved
c14a2375c3 Swift: Run codegen 2025-04-01 08:48:15 +02:00
Tom Hvitved
4fb138a1a3 Rust: Make Element.toString non-recursive 2025-04-01 08:48:13 +02:00
Anders Schack-Mulligen
efb5ed1030 Merge pull request #19155 from aschackmull/cpp/iterator-ssa
C++: Refactor Iterator SSA flow to use the data flow integration module.
2025-04-01 08:44:10 +02:00
Michael Nebel
3017d42c95 Merge pull request #19173 from github/workflow/coverage/update
Update CSV framework coverage reports
2025-04-01 08:33:35 +02:00
Michael Nebel
de6e3eafb9 C#: Add change note. 2025-04-01 08:32:52 +02:00
Michael Nebel
2f16e3a0c0 C#: Update flowsummaries test expected output. 2025-04-01 08:32:43 +02:00
Michael Nebel
2487f7734b C#: Update the generated .NET 9 models. 2025-04-01 08:24:09 +02:00
Michael Nebel
ba26953f0b C#: Update generated .NET 9 models. 2025-04-01 08:24:07 +02:00
github-actions[bot]
1186699269 Add changed framework coverage reports 2025-04-01 00:25:24 +00:00
Andrew Eisenberg
70150eea9a Merge branch 'main' into marcogario/untrusted_checkout_name 2025-03-31 13:54:17 -07:00
Marco Gario
820dacd151 Merge branch 'main' into marcogario-patch-1 2025-03-31 20:42:12 +02:00
Marco Gario
8737acb6a9 Update actions/ql/src/Security/CWE-829/UntrustedCheckoutCritical.ql
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2025-03-31 20:42:03 +02:00
Geoffrey White
ff2a1ca961 Rust: Group the data in rust/summary/summary-statistics. 2025-03-31 19:28:00 +01:00
Geoffrey White
fb22d55878 Rust: Remove duplicate models. 2025-03-31 18:26:26 +01:00
Geoffrey White
6a5a1001bb Rust: Refine the barrier guard. 2025-03-31 18:26:21 +01:00
Geoffrey White
f7d3a51f27 Rust: Implement barrier guard. 2025-03-31 17:53:17 +01:00
Geoffrey White
cdd5cb0523 Rust: More test cases for bounds / guards. 2025-03-31 17:53:14 +01:00
Geoffrey White
addc1d34d8 Rust: Add qhelp, examples, and tests of examples. 2025-03-31 17:53:10 +01:00
Geoffrey White
64aa4e8bae Rust: Ensure that the sinks for this query appear in metrics. 2025-03-31 17:39:24 +01:00
Geoffrey White
e49c1afe72 Rust: Add a few missing models. 2025-03-31 17:39:19 +01:00
Geoffrey White
03f94de3cb Rust: Add models. 2025-03-31 17:39:15 +01:00
Geoffrey White
9409cd6ed7 Rust: Prototype query. 2025-03-31 17:39:11 +01:00
Geoffrey White
ae555f2f2e Rust: Add a test for uncontrolled allocation size. 2025-03-31 17:37:21 +01:00
idrissrio
9ec7f3c9a5 C++: add test for calling conventions 2025-03-31 17:45:44 +02:00
idrissrio
f83f14bab2 C++: add calling convention specifier class 2025-03-31 17:44:56 +02:00
Paolo Tranquilli
f5d6fd081d Rust: introduce upgrades/downgrades infrastructure 2025-03-31 16:49:45 +02:00
yoff
e7bb47f335 ruby: add MaD model for permissions needed by actions
Use this to suggest minimal set of nedded permissions
2025-03-31 16:48:37 +02:00
Asger F
149ec20758 JS: Add comment about internal edge 2025-03-31 15:39:09 +02:00
Asger F
f64bdccd6d Update javascript/ql/lib/semmle/javascript/ApiGraphs.qll
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2025-03-31 15:30:59 +02:00
Michael Nebel
8e1282bfde C#: Improve downgrade script. 2025-03-31 13:53:51 +02:00
Michael Nebel
e30fed6eec C#: Improve upgrade script. 2025-03-31 13:17:10 +02:00
Anders Schack-Mulligen
56c46d74f9 Java/Rust/Swift: Accept qltest changes. 2025-03-31 11:44:37 +02:00
Anders Schack-Mulligen
9a8ab2d45b Update misc/scripts/stageoverlap.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-03-31 11:28:29 +02:00
Anders Schack-Mulligen
8a67e4fddc Misc: Add stage overlap script 2025-03-31 11:20:40 +02:00
Anders Schack-Mulligen
a6a694dec6 C++: Use DataFlowIntegration in IteratorFlow. 2025-03-31 10:49:43 +02:00
Anders Schack-Mulligen
aaa7e4cf95 C++: Def is only used in defToNode, which doesn't include phi reads nodes. 2025-03-31 10:49:43 +02:00
Anders Schack-Mulligen
133f08784f C++: Eliminate dead code, uncertain is always false. 2025-03-31 10:49:42 +02:00
Anders Schack-Mulligen
b4daba30a5 SSA: Remove dead code. 2025-03-31 10:49:10 +02:00
Anders Schack-Mulligen
70e53c2f8b SSA: Push includeWriteDefsInFlowStep constraint into newtype. 2025-03-31 10:49:10 +02:00
Anders Schack-Mulligen
ca6444ce98 VariableCapture: Replace phi-read reference with SSA data flow integration module. 2025-03-31 10:49:09 +02:00
Geoffrey White
4a76b5b3db Rust: Accept consistency check failures. 2025-03-28 15:40:18 +00:00
Taus
6674288fd2 Python: Update test cases
Adds a comment explaining why we no longer flag the indirect tuple
example.
Also adds a test case which _would_ be flagged if not for the type
annotation.
2025-03-28 15:12:39 +00:00
Tamas Vajk
32448c14bd Adjust expected test file 2025-03-28 16:04:39 +01:00
Tamas Vajk
72fb6ed078 Restrict name based property lookup to opened component types 2025-03-28 16:04:39 +01:00
Edward Minnix III
d601c26355 [change-note] Blazor parameter passing string literal 2025-03-28 16:04:38 +01:00
Edward Minnix III
3d0a85b3cd Add test case using string literal in property name 2025-03-28 16:04:37 +01:00
Edward Minnix III
52b889f008 Support when a property is specified by a string literal instead of a nameof expression
In earlier versions of the Razor generator, a string literal was used
instead of a `nameof` expression in order to indicate the name of the
property being modified. This means we need to look up the property by
name instead of using a more explicit access.
2025-03-28 16:04:36 +01:00
Tom Hvitved
605cf35970 Rust: More path resolution improvements 2025-03-28 15:32:20 +01:00
Michael Nebel
00753a1fe4 C#: Address review comments. 2025-03-28 14:41:59 +01:00
Geoffrey White
ed14b37964 Merge branch 'main' into deallocation 2025-03-28 12:44:46 +00:00
Geoffrey White
ce7a0fd094 Rust: Test for sinks inside sources. 2025-03-28 11:12:10 +00:00
Asger F
b834ffe246 JS: Fix a bad join order 2025-03-28 09:14:40 +01:00
Asger F
1ad471cb32 JS: Track through spread/rest params in API graphs 2025-03-28 09:14:36 +01:00
Asger F
ff99d5c688 JS: Add test for API graph through spread args 2025-03-28 09:13:06 +01:00
Taus
68668b8e22 Python: Fix grammar in change note 2025-03-27 23:23:29 +01:00
Taus
980c7d83da Python: Add change note 2025-03-27 15:33:00 +00:00
Taus
f601f4ad9b Python: Update test expectations
As we're no longer tracking tuples across function boundaries, we lose
the result that related to this setup (which, as the preceding commit
explains, lead to a lot of false positives).
2025-03-27 15:31:28 +00:00
Taus
2dcd7895ec Python: Modernise py/mixed-tuple-returns
Removes the dependence on points-to in favour of an approach based on
(local) data-flow.

I first tried a version that used type tracking, as this more accurately
mimics the behaviour of the old query. However, I soon discovered that
there were _many_ false positives in this setup. The main bad pattern I
saw was a helper function somewhere deep inside the code that both
receives and returns an argument that can be tuples with different sizes
and origins. In this case, global flow produces something akin to a
cartesian product of "n-tuples that flow into the function" and
"m-tuples that flow into the function" where m < n.

To combat this, I decided to instead focus on only flow _within_ a given
function (and so local data-flow was sufficient).

Additionally, another class of false positives I saw was cases where the
return type actually witnessed that the function in question could
return tuples of varying sizes. In this case it seems reasonable to not
flag these instances, since they are already (presumably) being checked
by a type checker.

More generally, if you've annotated the return type of the function with
anything (not just `Tuple[...]`), then there's probably little need to
flag it.
2025-03-27 15:27:42 +00:00
Tom Hvitved
f6ac82aff0 Rust: Add more path resolution tests 2025-03-27 15:54:57 +01:00
Geoffrey White
9ae271a7d1 Rust: Fix incidentally affected test merge conflict. 2025-03-27 12:55:36 +00:00
Geoffrey White
4e496fe7b2 Rust: Lets just not model 'drop' incorrectly, for now. 2025-03-27 12:25:08 +00:00
Geoffrey White
8598d619f2 Rust: Add a test case involving a Drop method. 2025-03-27 09:39:25 +00:00
Geoffrey White
d1a0237e87 Rust: Correct a few details in the test. 2025-03-27 09:20:25 +00:00
Geoffrey White
c84e2cd7cb Rust: Reduce the workaround (fixes duplicate results). 2025-03-26 15:40:45 +00:00
Geoffrey White
0a04191a61 Rust: Effect of merging main (duplicate results). 2025-03-26 15:06:03 +00:00
Geoffrey White
56f330d545 Merge branch 'main' into deallocation 2025-03-26 14:58:32 +00:00
Marco Gario
288fcb6092 Update CWE-829 description for clarity 2025-03-26 15:53:20 +01:00
Marco Gario
b1737858fa UntrustedCheckout: Try and differentiate between two versions of the rule 2025-03-26 12:49:48 +00:00
Marco Gario
29a23a3d20 Update UseOfKnownVulnerableAction.ql
Name should not end in a `.`
2025-03-26 13:28:34 +01:00
Geoffrey White
82068a262d Rust: Further rephrasing. 2025-03-24 12:23:48 +00:00
Geoffrey White
363128f4ec Apply suggestions from code review
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
2025-03-24 12:21:51 +00:00
Geoffrey White
e4cadf09ce Rust: Don't report excessive results for the same source. 2025-03-24 12:12:42 +00:00
Geoffrey White
b7044bdcde Rust: Add a test of repeat sinks. 2025-03-24 12:04:43 +00:00
Geoffrey White
f582054ca4 Rust: Refactor the tests that have multiple control flow paths. 2025-03-24 11:56:32 +00:00
Michael Nebel
d9fb137909 C#: Add upgrade- and downgrade scripts. 2025-03-24 12:00:15 +01:00
Geoffrey White
d1ef2b50fb Rust: Model futures::executor::block_on. 2025-03-21 16:51:10 +00:00
Michael Nebel
acec97db94 C#: Add change-note. 2025-03-21 13:32:44 +01:00
Michael Nebel
5ae7e5ddb3 C#: Update other test expected output files. 2025-03-21 13:23:11 +01:00
Michael Nebel
a73a61b8fa C#: Add PrintAst test for string interpolation expressions. 2025-03-21 13:04:43 +01:00
Michael Nebel
2ca5ec0032 C#: Add some string interpolation tests with alignment and formatting. 2025-03-21 13:04:40 +01:00
Michael Nebel
af6e1bda4c C#: Extract alignment and format clauses of string interpolation expressions. 2025-03-21 13:04:39 +01:00
Owen Mansel-Chan
e44f7f946f Sort package paths in vendor/modules.txt 2025-03-21 09:45:50 +00:00
Geoffrey White
91d273ad76 Rust: I think these generated models are correct. Accept them. 2025-03-20 15:52:08 +00:00
Geoffrey White
98690f924a Rust: Incidental changes to other .expected files. 2025-03-20 15:39:03 +00:00
Geoffrey White
c6c4e3cf16 Rust: Add another reference. 2025-03-20 15:16:17 +00:00
Geoffrey White
5e18e1be11 Rust: Autofix and US spelling. 2025-03-20 15:03:55 +00:00
Geoffrey White
5831c446d3 Rust: Add test cases for another situation I came across. 2025-03-20 14:26:15 +00:00
Geoffrey White
7ecba71166 Rust: Add .qhelp. 2025-03-20 14:26:14 +00:00
Geoffrey White
019fcbfbf9 Rust: Add qhelp examples, and add them as tests. 2025-03-20 14:26:13 +00:00
Geoffrey White
671f7dff94 Rust: Query metadata. 2025-03-20 14:26:11 +00:00
Geoffrey White
7ceb76441a Rust: Improve the source to account for conversions. 2025-03-20 14:26:10 +00:00
Geoffrey White
be6d0d1f86 Rust: Work around data flow source issue. 2025-03-20 14:26:09 +00:00
Geoffrey White
c2ee4211e5 Rust: Add more models. 2025-03-20 14:26:08 +00:00
Geoffrey White
dcd016f5be Rust: Initial version of the query. 2025-03-20 14:26:06 +00:00
Geoffrey White
a139b3734c Rust: Split lang-core.model.yml into lang-core and lang-alloc. 2025-03-20 14:26:05 +00:00
Geoffrey White
19f009ae08 Rust: Add tests for various kinds of dangling pointers. 2025-03-20 14:26:04 +00:00
Owen Mansel-Chan
7e04a9f6c0 Improve stubs (made by old version of depstubber?) 2025-03-20 12:33:39 +00:00
Owen Mansel-Chan
6147f0a873 Fix outdated depstubber command 2025-03-20 12:32:56 +00:00
Owen Mansel-Chan
40768332d8 Remove empty imports from stubs 2025-03-20 12:32:12 +00:00
Owen Mansel-Chan
81e85010f9 List subpackages in vendor/modules.txt
These were all generated by running depstubber.
2025-03-20 12:30:57 +00:00
Jon Janego
f698d0a060 Update query-metadata-style-guide.md 2025-03-19 16:58:30 -05:00
Jon Janego
14d178f817 Update query-metadata-style-guide.md
minor tag changes to align with existing tags
2025-03-19 16:56:37 -05:00
Jon Janego
de5d3b6263 Update query-metadata-style-guide.md 2025-03-13 12:42:51 -05:00
Jon Janego
6c28be9827 Update query-metadata-style-guide.md
initial commit of changes starting to add quality tagging standards
2025-03-13 11:49:48 -05:00
1327 changed files with 82230 additions and 7636 deletions

View File

@@ -1 +1 @@
8.0.0
8.1.1

View File

@@ -8,12 +8,16 @@
/javascript/ @github/codeql-javascript
/python/ @github/codeql-python
/ruby/ @github/codeql-ruby
/rust/ @github/codeql-rust
/swift/ @github/codeql-swift
/misc/codegen/ @github/codeql-swift
/java/kotlin-extractor/ @github/codeql-kotlin
/java/ql/test-kotlin1/ @github/codeql-kotlin
/java/ql/test-kotlin2/ @github/codeql-kotlin
# Experimental CodeQL cryptography
**/experimental/quantum/ @github/ps-codeql
# CodeQL tools and associated docs
/docs/codeql/codeql-cli/ @github/codeql-cli-reviewers
/docs/codeql/codeql-for-visual-studio-code/ @github/codeql-vscode-reviewers
@@ -38,6 +42,7 @@ MODULE.bazel @github/codeql-ci-reviewers
/.github/workflows/go-* @github/codeql-go
/.github/workflows/ql-for-ql-* @github/codeql-ql-for-ql-reviewers
/.github/workflows/ruby-* @github/codeql-ruby
/.github/workflows/rust.yml @github/codeql-rust
/.github/workflows/swift.yml @github/codeql-swift
# Misc

277
Cargo.lock generated
View File

@@ -154,15 +154,15 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.8.0"
version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
[[package]]
name = "borsh"
version = "1.5.3"
version = "1.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2506947f73ad44e344215ccd6403ac2ae18cd8e046e581a441bf8d199f257f03"
checksum = "5430e3be710b68d984d1391c854eb431a9d548640711faa54eecb1df93db91cc"
dependencies = [
"cfg_aliases",
]
@@ -224,9 +224,9 @@ dependencies = [
[[package]]
name = "cargo_metadata"
version = "0.18.1"
version = "0.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037"
checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba"
dependencies = [
"camino",
"cargo-platform",
@@ -275,7 +275,7 @@ version = "0.100.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f114996bda14c0213f014a4ef31a7867dcf5f539a3900477fc6b20138e7a17b"
dependencies = [
"bitflags 2.8.0",
"bitflags 2.9.0",
"chalk-derive",
]
@@ -301,7 +301,7 @@ dependencies = [
"chalk-derive",
"chalk-ir",
"ena",
"indexmap 2.7.0",
"indexmap 2.9.0",
"itertools 0.12.1",
"petgraph",
"rustc-hash 1.1.0",
@@ -325,9 +325,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.32"
version = "4.5.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6088f3ae8c3608d19260cd7445411865a485688711b78b5be70d78cd96136f83"
checksum = "d8aa86934b44c19c50f87cc2790e19f54f7a67aedb64101c2e1a2e5ecfb73944"
dependencies = [
"clap_builder",
"clap_derive",
@@ -335,9 +335,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.32"
version = "4.5.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22a7ef7f676155edfb82daa97f99441f3ebf4a58d5e32f295a56259f1b6facc8"
checksum = "2414dbb2dd0695280da6ea9261e327479e9d37b0630f6b53ba2a11c60c679fd9"
dependencies = [
"anstream",
"anstyle",
@@ -622,7 +622,7 @@ version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5"
dependencies = [
"log 0.4.25",
"log 0.4.27",
]
[[package]]
@@ -691,9 +691,9 @@ checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569"
[[package]]
name = "equivalent"
version = "1.0.1"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
[[package]]
name = "figment"
@@ -781,7 +781,7 @@ checksum = "cc6bd114ceda131d3b1d665eba35788690ad37f5916457286b32ab6fd3c438dd"
dependencies = [
"cfg-if",
"libc",
"log 0.4.25",
"log 0.4.27",
"rustversion",
"windows",
]
@@ -812,7 +812,7 @@ checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19"
dependencies = [
"aho-corasick",
"bstr",
"log 0.4.25",
"log 0.4.27",
"regex-automata 0.4.9",
"regex-syntax 0.8.5",
]
@@ -918,9 +918,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.7.0"
version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f"
checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e"
dependencies = [
"equivalent",
"hashbrown 0.15.2",
@@ -939,7 +939,7 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3"
dependencies = [
"bitflags 2.8.0",
"bitflags 2.9.0",
"inotify-sys",
"libc",
]
@@ -979,9 +979,9 @@ dependencies = [
[[package]]
name = "itoa"
version = "1.0.14"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
[[package]]
name = "jod-thread"
@@ -1033,9 +1033,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "libc"
version = "0.2.169"
version = "0.2.171"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6"
[[package]]
name = "libredox"
@@ -1043,7 +1043,7 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
"bitflags 2.8.0",
"bitflags 2.9.0",
"libc",
"redox_syscall",
]
@@ -1074,14 +1074,14 @@ version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
dependencies = [
"log 0.4.25",
"log 0.4.27",
]
[[package]]
name = "log"
version = "0.4.25"
version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f"
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
[[package]]
name = "loom"
@@ -1096,12 +1096,6 @@ dependencies = [
"tracing-subscriber",
]
[[package]]
name = "lz4_flex"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75761162ae2b0e580d7e7c390558127e5f01b4194debd6221fd8c207fc80e3f5"
[[package]]
name = "matchers"
version = "0.1.0"
@@ -1142,7 +1136,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd"
dependencies = [
"libc",
"log 0.4.25",
"log 0.4.27",
"wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys 0.52.0",
]
@@ -1178,13 +1172,13 @@ version = "8.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fee8403b3d66ac7b26aee6e40a897d85dc5ce26f44da36b8b73e987cc52e943"
dependencies = [
"bitflags 2.8.0",
"bitflags 2.9.0",
"filetime",
"fsevent-sys",
"inotify",
"kqueue",
"libc",
"log 0.4.25",
"log 0.4.27",
"mio",
"notify-types",
"walkdir",
@@ -1240,9 +1234,9 @@ checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e"
[[package]]
name = "oorandom"
version = "11.1.4"
version = "11.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9"
checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e"
[[package]]
name = "os_str_bytes"
@@ -1331,7 +1325,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db"
dependencies = [
"fixedbitset",
"indexmap 2.7.0",
"indexmap 2.9.0",
]
[[package]]
@@ -1398,7 +1392,7 @@ version = "0.100.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1651b0f7e8c3eb7c27a88f39d277e69c32bfe58e3be174d286c1a24d6a7a4d8"
dependencies = [
"bitflags 2.8.0",
"bitflags 2.9.0",
"ra-ap-rustc_hashes",
"ra-ap-rustc_index",
"tracing",
@@ -1470,18 +1464,16 @@ dependencies = [
[[package]]
name = "ra_ap_base_db"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4baa9734d254af14fd603528ad594650dea601b1764492bd39988da38598ae67"
checksum = "8fd761118bbafe29e2b187e694c6b8e800f2c7822bbc1d9d2db4ac21fb8b0365"
dependencies = [
"dashmap 5.5.3",
"la-arena",
"lz4_flex",
"ra_ap_cfg",
"ra_ap_intern",
"ra_ap_query-group-macro",
"ra_ap_span",
"ra_ap_stdx",
"ra_ap_syntax",
"ra_ap_vfs",
"rustc-hash 2.1.1",
@@ -1493,9 +1485,9 @@ dependencies = [
[[package]]
name = "ra_ap_cfg"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ef2ba45636c5e585040c0c4bee640737a6001b08309f1a25ca78cf04abfbf90"
checksum = "5ce74ce1af24afd86d3529dbbf5a849d026948b2d8ba51d199b6ea6db6e345b6"
dependencies = [
"ra_ap_intern",
"ra_ap_tt",
@@ -1505,20 +1497,20 @@ dependencies = [
[[package]]
name = "ra_ap_edition"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8955c1484d5e7274f755187788ba0d51eb149f870c69cdf0d87c3b7edea20ea0"
checksum = "f423b9fb19e3920e4c7039120d09d9c79070a26efe8ff9f787c7234b07f518c5"
[[package]]
name = "ra_ap_hir"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a51d7955beff2212701b149bea36d4cf2dc0f5cd129652c9bcf0cb5c0b021078"
checksum = "dd4aa8a568b80d288b90c4fa5dc8a3cc405914d261bfd33a3761c1ba41be358d"
dependencies = [
"arrayvec",
"either",
"indexmap 2.7.0",
"itertools 0.12.1",
"indexmap 2.9.0",
"itertools 0.14.0",
"ra_ap_base_db",
"ra_ap_cfg",
"ra_ap_hir_def",
@@ -1537,23 +1529,20 @@ dependencies = [
[[package]]
name = "ra_ap_hir_def"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5c97e617e4c585d24b3d4f668861452aedddfbe0262f4c53235dcea77e62f9b"
checksum = "acb18d9378a828a23ccf87b89199db005adb67ba2a05a37d7a3fcad4d1036e66"
dependencies = [
"arrayvec",
"bitflags 2.8.0",
"bitflags 2.9.0",
"cov-mark",
"dashmap 5.5.3",
"drop_bomb",
"either",
"fst",
"hashbrown 0.14.5",
"indexmap 2.7.0",
"itertools 0.12.1",
"indexmap 2.9.0",
"itertools 0.14.0",
"la-arena",
"ra-ap-rustc_abi",
"ra-ap-rustc_hashes",
"ra-ap-rustc_parse_format",
"ra_ap_base_db",
"ra_ap_cfg",
@@ -1570,21 +1559,20 @@ dependencies = [
"salsa",
"smallvec",
"text-size",
"thin-vec",
"tracing",
"triomphe",
]
[[package]]
name = "ra_ap_hir_expand"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be57c0d7e3f2180dd8ea584b11447f34060eadc06f0f6d559e2a790f6e91b6c5"
checksum = "094fa79d8f661f52cf3b7fb8b3d91c4be2ad9e71a3967d3dacd25429fa44b37d"
dependencies = [
"cov-mark",
"either",
"hashbrown 0.14.5",
"itertools 0.12.1",
"la-arena",
"itertools 0.14.0",
"ra_ap_base_db",
"ra_ap_cfg",
"ra_ap_intern",
@@ -1605,24 +1593,22 @@ dependencies = [
[[package]]
name = "ra_ap_hir_ty"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f260f35748f3035b46a8afcdebda7cb75d95c24750105fad86101d09a9d387c8"
checksum = "093482d200d5db421db5692e7819bbb14fb717cc8cb0f91f93cce9fde85b3df2"
dependencies = [
"arrayvec",
"bitflags 2.8.0",
"bitflags 2.9.0",
"chalk-derive",
"chalk-ir",
"chalk-recursive",
"chalk-solve",
"cov-mark",
"dashmap 5.5.3",
"either",
"ena",
"indexmap 2.7.0",
"itertools 0.12.1",
"indexmap 2.9.0",
"itertools 0.14.0",
"la-arena",
"nohash-hasher",
"oorandom",
"ra-ap-rustc_abi",
"ra-ap-rustc_index",
@@ -1647,19 +1633,18 @@ dependencies = [
[[package]]
name = "ra_ap_ide_db"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0426263be26e27cb55a3b9ef88b120511b66fe7d9b418a2473d6d5f3ac2fe0a6"
checksum = "b655b92dfa9444db8129321b9217d9e4a83a58ee707aa1004a93052acfb43d57"
dependencies = [
"arrayvec",
"bitflags 2.8.0",
"bitflags 2.9.0",
"cov-mark",
"crossbeam-channel",
"dashmap 5.5.3",
"either",
"fst",
"indexmap 2.7.0",
"itertools 0.12.1",
"indexmap 2.9.0",
"itertools 0.14.0",
"line-index",
"memchr",
"nohash-hasher",
@@ -1681,9 +1666,9 @@ dependencies = [
[[package]]
name = "ra_ap_intern"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6ea8c9615b3b0688cf557e7310dbd9432f43860c8ea766d54f4416cbecf3571"
checksum = "b4e528496b4d4c351806bb073d3d7f6526535741b9e8801776603c924bbec624"
dependencies = [
"dashmap 5.5.3",
"hashbrown 0.14.5",
@@ -1693,17 +1678,16 @@ dependencies = [
[[package]]
name = "ra_ap_load-cargo"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "570907e16725c13a678bfd8050ce8839af2831da042a0878b75ee8c41b0f7b0c"
checksum = "1a97a5070b2f4b99f56683d91b2687aa0c530d8969cc5252ec2ae5644e428ffe"
dependencies = [
"anyhow",
"crossbeam-channel",
"itertools 0.12.1",
"itertools 0.14.0",
"ra_ap_hir_expand",
"ra_ap_ide_db",
"ra_ap_intern",
"ra_ap_paths",
"ra_ap_proc_macro_api",
"ra_ap_project_model",
"ra_ap_span",
@@ -1715,9 +1699,9 @@ dependencies = [
[[package]]
name = "ra_ap_mbe"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e893fe03b04b30c9b5a339ac2bf39ce32ac9c05a8b50121b7d89ce658346e164"
checksum = "b187ee5ee3fa726eeea5142242a0397e2200d77084026986a68324b9599f9046"
dependencies = [
"arrayvec",
"cov-mark",
@@ -1726,19 +1710,17 @@ dependencies = [
"ra_ap_parser",
"ra_ap_span",
"ra_ap_stdx",
"ra_ap_syntax",
"ra_ap_syntax-bridge",
"ra_ap_tt",
"rustc-hash 2.1.1",
"smallvec",
"tracing",
]
[[package]]
name = "ra_ap_parser"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fd9a264120968b14a66b6ba756cd7f99435385b5dbc2f0a611cf3a12221c385"
checksum = "2306e6c051e60483f3b317fac9dec6c883b7792eeb8db24ec6f39dbfa5430159"
dependencies = [
"drop_bomb",
"ra-ap-rustc_lexer",
@@ -1748,20 +1730,20 @@ dependencies = [
[[package]]
name = "ra_ap_paths"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f47817351651e36b56ff3afc483b41600053c9cb7e67d945467c0abe93416032"
checksum = "dcedd00499621bdd0f1fe01955c04e4b388197aa826744003afaf6cc2944bc80"
dependencies = [
"camino",
]
[[package]]
name = "ra_ap_proc_macro_api"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d96da3b8b9f6b813a98f5357eef303905450741f47ba90adaab8a5371b748416"
checksum = "7a2e49b550015cd4ad152bd78d92d73594497f2e44f61273f9fed3534ad4bbbe"
dependencies = [
"indexmap 2.7.0",
"indexmap 2.9.0",
"ra_ap_intern",
"ra_ap_paths",
"ra_ap_span",
@@ -1776,9 +1758,9 @@ dependencies = [
[[package]]
name = "ra_ap_profile"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13637377287c84f88a628e40229d271ef0081c0d683956bd99a6c8278a4f8b14"
checksum = "87cdbd27ebe02ec21fdae3df303f194bda036a019ecef80d47e0082646f06c54"
dependencies = [
"cfg-if",
"libc",
@@ -1788,13 +1770,13 @@ dependencies = [
[[package]]
name = "ra_ap_project_model"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "053c5207a638fc7a752c7a454bc952b28b0d02f0bf9f6d7ec785ec809579d8fa"
checksum = "5eaa3406c891a7840d20ce615f8decca32cbc9d3654b82dcbcc3a31257ce90b9"
dependencies = [
"anyhow",
"cargo_metadata",
"itertools 0.12.1",
"itertools 0.14.0",
"la-arena",
"ra_ap_base_db",
"ra_ap_cfg",
@@ -1814,22 +1796,20 @@ dependencies = [
[[package]]
name = "ra_ap_query-group-macro"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f1a38f07b442e47a234cbe2e8fd1b8a41ff0cc5123cb1cf994c5ce20edb5bd6"
checksum = "1fbc1748e4876a9b0ccfacfc7e2fe254f30e92ef58d98925282b3803e8b004ed"
dependencies = [
"heck",
"proc-macro2",
"quote",
"salsa",
"syn",
]
[[package]]
name = "ra_ap_span"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8818680c6f7da3b32cb2bb0992940b24264b1aa90203aa94812e09ab34d362d1"
checksum = "ed1d036e738bf32a057d90698df85bcb83ed6263b5fe9fba132c99e8ec3aecaf"
dependencies = [
"hashbrown 0.14.5",
"la-arena",
@@ -1843,12 +1823,12 @@ dependencies = [
[[package]]
name = "ra_ap_stdx"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1c10bee1b03fc48083862c13cf06bd3ed17760463ecce2734103a2f511e5ed4"
checksum = "6e3775954ab24408f71e97079a97558078a166a4082052e83256ae4c22dae18d"
dependencies = [
"crossbeam-channel",
"itertools 0.12.1",
"itertools 0.14.0",
"jod-thread",
"libc",
"miow",
@@ -1858,14 +1838,12 @@ dependencies = [
[[package]]
name = "ra_ap_syntax"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92bc32f3946fc5fcbdc79e61b7e26a8c2a3a56f3ef6ab27c7d298a9e21a462f2"
checksum = "b49b081f209a764700f688db91820a66c2ecfe5f138895d831361cf84f716691"
dependencies = [
"cov-mark",
"either",
"indexmap 2.7.0",
"itertools 0.12.1",
"itertools 0.14.0",
"ra-ap-rustc_lexer",
"ra_ap_parser",
"ra_ap_stdx",
@@ -1878,9 +1856,9 @@ dependencies = [
[[package]]
name = "ra_ap_syntax-bridge"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a42052c44c98c122c37aac476260c8f19d8fec495edc9c05835307c9ae86194d"
checksum = "f2740bbe603d527f2cf0aaf51629de7d072694fbbaaeda8264f7591be1493d1b"
dependencies = [
"ra_ap_intern",
"ra_ap_parser",
@@ -1889,14 +1867,13 @@ dependencies = [
"ra_ap_syntax",
"ra_ap_tt",
"rustc-hash 2.1.1",
"tracing",
]
[[package]]
name = "ra_ap_toolchain"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75996e70b3a0c68cd5157ba01f018964c7c6a5d7b209047d449b393139d0b57f"
checksum = "efbff9f26f307ef958586357d1653d000861dcd3acbaf33a009651e024720c7e"
dependencies = [
"camino",
"home",
@@ -1904,9 +1881,9 @@ dependencies = [
[[package]]
name = "ra_ap_tt"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e4ee31e93bfabe83e6720b7469db88d7ad7ec5c59a1f011efec4aa1327ffc5c"
checksum = "0b1ce3ac14765e414fa6031fda7dc35d3492c74de225aac689ba8b8bf037e1f8"
dependencies = [
"arrayvec",
"ra-ap-rustc_lexer",
@@ -1917,13 +1894,13 @@ dependencies = [
[[package]]
name = "ra_ap_vfs"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6aac1e277ac70bb073f40f8a3fc44e4b1bb9e4d4b1d0e0bd2f8269543560f80"
checksum = "29427a7c27ce8ddfefb52d77c952a4588c74d0a7ab064dc627129088a90423ca"
dependencies = [
"crossbeam-channel",
"fst",
"indexmap 2.7.0",
"indexmap 2.9.0",
"nohash-hasher",
"ra_ap_paths",
"ra_ap_stdx",
@@ -1933,9 +1910,9 @@ dependencies = [
[[package]]
name = "ra_ap_vfs-notify"
version = "0.0.270"
version = "0.0.273"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd95285146049621ee8f7a512c982a008bf036321fcc9b01a95c1ad7e6aeae57"
checksum = "d5a0e3095b8216ecc131f38b4b0025cac324a646469a95d2670354aee7278078"
dependencies = [
"crossbeam-channel",
"notify",
@@ -2005,7 +1982,7 @@ version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834"
dependencies = [
"bitflags 2.8.0",
"bitflags 2.9.0",
]
[[package]]
@@ -2093,10 +2070,10 @@ checksum = "2febf9acc5ee5e99d1ad0afcdbccc02d87aa3f857a1f01f825b80eacf8edfcd1"
[[package]]
name = "rustc_apfloat"
version = "0.2.1+llvm-462a31f5a5ab"
source = "git+https://github.com/redsun82/rustc_apfloat.git?rev=096d585100636bc2e9f09d7eefec38c5b334d47b#096d585100636bc2e9f09d7eefec38c5b334d47b"
version = "0.2.2+llvm-462a31f5a5ab"
source = "git+https://github.com/redsun82/rustc_apfloat.git?rev=32968f16ef1b082243f9bf43a3fbd65c381b3e27#32968f16ef1b082243f9bf43a3fbd65c381b3e27"
dependencies = [
"bitflags 1.3.2",
"bitflags 2.9.0",
"smallvec",
]
@@ -2123,7 +2100,7 @@ dependencies = [
"dashmap 6.1.0",
"hashbrown 0.15.2",
"hashlink",
"indexmap 2.7.0",
"indexmap 2.9.0",
"parking_lot",
"portable-atomic",
"rayon",
@@ -2176,9 +2153,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "semver"
version = "1.0.24"
version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba"
checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0"
dependencies = [
"serde",
]
@@ -2234,7 +2211,7 @@ dependencies = [
"chrono",
"hex",
"indexmap 1.9.3",
"indexmap 2.7.0",
"indexmap 2.9.0",
"serde",
"serde_derive",
"serde_json",
@@ -2260,7 +2237,7 @@ version = "0.9.34+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
dependencies = [
"indexmap 2.7.0",
"indexmap 2.9.0",
"itoa",
"ryu",
"serde",
@@ -2345,19 +2322,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233"
[[package]]
name = "thiserror"
version = "1.0.69"
name = "thin-vec"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
checksum = "144f754d318415ac792f9d69fc87abbbfc043ce2ef041c60f16ad828f638717d"
[[package]]
name = "thiserror"
version = "2.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.69"
version = "2.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
dependencies = [
"proc-macro2",
"quote",
@@ -2432,7 +2415,7 @@ version = "0.22.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474"
dependencies = [
"indexmap 2.7.0",
"indexmap 2.9.0",
"serde",
"serde_spanned",
"toml_datetime",
@@ -2488,7 +2471,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
dependencies = [
"log 0.4.25",
"log 0.4.27",
"once_cell",
"tracing-core",
]
@@ -2603,9 +2586,9 @@ checksum = "a3e5df347f0bf3ec1d670aad6ca5c6a1859cd9ea61d2113125794654ccced68f"
[[package]]
name = "unicode-ident"
version = "1.0.16"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034"
checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe"
[[package]]
name = "unicode-properties"
@@ -2686,7 +2669,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79"
dependencies = [
"bumpalo",
"log 0.4.25",
"log 0.4.27",
"proc-macro2",
"quote",
"syn",
@@ -2995,7 +2978,7 @@ version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
dependencies = [
"bitflags 2.8.0",
"bitflags 2.9.0",
]
[[package]]

View File

@@ -14,4 +14,4 @@ members = [
[patch.crates-io]
# patch for build script bug preventing bazel build
# see https://github.com/rust-lang/rustc_apfloat/pull/17
rustc_apfloat = { git = "https://github.com/redsun82/rustc_apfloat.git", rev = "096d585100636bc2e9f09d7eefec38c5b334d47b" }
rustc_apfloat = { git = "https://github.com/redsun82/rustc_apfloat.git", rev = "32968f16ef1b082243f9bf43a3fbd65c381b3e27" }

View File

@@ -75,7 +75,7 @@ use_repo(
"vendor_ts__argfile-0.2.1",
"vendor_ts__chalk-ir-0.100.0",
"vendor_ts__chrono-0.4.40",
"vendor_ts__clap-4.5.32",
"vendor_ts__clap-4.5.35",
"vendor_ts__dunce-1.0.5",
"vendor_ts__either-1.15.0",
"vendor_ts__encoding-0.2.33",
@@ -90,22 +90,22 @@ use_repo(
"vendor_ts__num_cpus-1.16.0",
"vendor_ts__proc-macro2-1.0.94",
"vendor_ts__quote-1.0.40",
"vendor_ts__ra_ap_base_db-0.0.270",
"vendor_ts__ra_ap_cfg-0.0.270",
"vendor_ts__ra_ap_hir-0.0.270",
"vendor_ts__ra_ap_hir_def-0.0.270",
"vendor_ts__ra_ap_hir_expand-0.0.270",
"vendor_ts__ra_ap_hir_ty-0.0.270",
"vendor_ts__ra_ap_ide_db-0.0.270",
"vendor_ts__ra_ap_intern-0.0.270",
"vendor_ts__ra_ap_load-cargo-0.0.270",
"vendor_ts__ra_ap_parser-0.0.270",
"vendor_ts__ra_ap_paths-0.0.270",
"vendor_ts__ra_ap_project_model-0.0.270",
"vendor_ts__ra_ap_span-0.0.270",
"vendor_ts__ra_ap_stdx-0.0.270",
"vendor_ts__ra_ap_syntax-0.0.270",
"vendor_ts__ra_ap_vfs-0.0.270",
"vendor_ts__ra_ap_base_db-0.0.273",
"vendor_ts__ra_ap_cfg-0.0.273",
"vendor_ts__ra_ap_hir-0.0.273",
"vendor_ts__ra_ap_hir_def-0.0.273",
"vendor_ts__ra_ap_hir_expand-0.0.273",
"vendor_ts__ra_ap_hir_ty-0.0.273",
"vendor_ts__ra_ap_ide_db-0.0.273",
"vendor_ts__ra_ap_intern-0.0.273",
"vendor_ts__ra_ap_load-cargo-0.0.273",
"vendor_ts__ra_ap_parser-0.0.273",
"vendor_ts__ra_ap_paths-0.0.273",
"vendor_ts__ra_ap_project_model-0.0.273",
"vendor_ts__ra_ap_span-0.0.273",
"vendor_ts__ra_ap_stdx-0.0.273",
"vendor_ts__ra_ap_syntax-0.0.273",
"vendor_ts__ra_ap_vfs-0.0.273",
"vendor_ts__rand-0.9.0",
"vendor_ts__rayon-1.10.0",
"vendor_ts__regex-1.11.1",

View File

@@ -1,27 +1,34 @@
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.'
# Note: We're adding the `reusable_workflows` subdirectories to proactively
# record workflows that were called cross-repo, check them out locally,
# and enable an interprocedural analysis across the workflow files.
# These workflows follow the convention `.github/reusable_workflows/<nwo>/*.ya?ml`
$DefaultPathFilters = @(
'exclude:**/*',
'include:.github/workflows/*.yml',
'include:.github/workflows/*.yaml',
'include:.github/reusable_workflows/**/*.yml',
'include:.github/reusable_workflows/**/*.yaml',
'include:**/action.yml',
'include:**/action.yaml'
)
# Note: We're adding the `reusable_workflows` subdirectories to proactively
# record workflows that were called cross-repo, check them out locally,
# and enable an interprocedural analysis across the workflow files.
# These workflows follow the convention `.github/reusable_workflows/<nwo>/*.ya?ml`
$DefaultPathFilters = @(
'exclude:**/*',
'include:.github/workflows/*.yml',
'include:.github/workflows/*.yaml',
'include:.github/reusable_workflows/**/*.yml',
'include:.github/reusable_workflows/**/*.yaml',
'include:**/action.yml',
'include:**/action.yaml'
)
if ($null -ne $env:LGTM_INDEX_FILTERS) {
Write-Output 'LGTM_INDEX_FILTERS set. Using the default filters together with the user-provided filters, and passing through to the JavaScript extractor.'
# Begin with the default path inclusions only,
# followed by the user-provided filters.
# If the user provided `paths`, those patterns override the default inclusions
# (because `LGTM_INDEX_FILTERS` will begin with `exclude:**/*`).
# If the user provided `paths-ignore`, those patterns are excluded.
$PathFilters = ($DefaultPathFilters -join "`n") + "`n" + $env:LGTM_INDEX_FILTERS
$env:LGTM_INDEX_FILTERS = $PathFilters
} else {
Write-Output 'LGTM_INDEX_FILTERS not set. Using the default filters, and passing through to the JavaScript extractor.'
$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
$env:CODEQL_EXTRACTOR_JAVASCRIPT_ROOT = &"$CodeQL" resolve extractor --language javascript
if ($LASTEXITCODE -ne 0) {
throw 'Failed to resolve JavaScript extractor.'
}
@@ -40,7 +47,7 @@ $env:CODEQL_EXTRACTOR_JAVASCRIPT_SOURCE_ARCHIVE_DIR = $env:CODEQL_EXTRACTOR_ACTI
$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
&"$JavaScriptAutoBuild"
if ($LASTEXITCODE -ne 0) {
throw "JavaScript autobuilder failed."
}

View File

@@ -1,3 +1,4 @@
@echo off
rem All of the work is done in the PowerShell script
powershell.exe %~dp0autobuild-impl.ps1
echo "Running PowerShell script at '%~dp0autobuild-impl.ps1'"
powershell.exe -File "%~dp0autobuild-impl.ps1"

View File

@@ -17,16 +17,28 @@ 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."
if [ -n "${LGTM_INDEX_FILTERS:-}" ]; then
echo "LGTM_INDEX_FILTERS set. Using the default filters together with the user-provided filters, and passing through to the JavaScript extractor."
# Begin with the default path inclusions only,
# followed by the user-provided filters.
# If the user provided `paths`, those patterns override the default inclusions
# (because `LGTM_INDEX_FILTERS` will begin with `exclude:**/*`).
# If the user provided `paths-ignore`, those patterns are excluded.
PATH_FILTERS="$(cat << END
${DEFAULT_PATH_FILTERS}
${LGTM_INDEX_FILTERS}
END
)"
LGTM_INDEX_FILTERS="${PATH_FILTERS}"
export LGTM_INDEX_FILTERS
else
echo "No path filters set. Using the default filters."
echo "LGTM_INDEX_FILTERS not set. Using the default filters, and passing through to the JavaScript extractor."
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)"
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}'."
@@ -42,4 +54,4 @@ env CODEQL_EXTRACTOR_JAVASCRIPT_DIAGNOSTIC_DIR="${CODEQL_EXTRACTOR_ACTIONS_DIAGN
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}
"${JAVASCRIPT_AUTO_BUILD}"

View File

@@ -0,0 +1,5 @@
import actions
from AstNode n
where n instanceof Workflow or n instanceof CompositeAction
select n

View File

@@ -0,0 +1,6 @@
| src/.github/action.yaml:1:1:11:32 | name: ' ... action' |
| src/.github/actions/action-name/action.yml:1:1:11:32 | name: ' ... action' |
| src/.github/workflows/workflow.yml:1:1:12:33 | name: A workflow |
| src/action.yml:1:1:11:32 | name: ' ... action' |
| src/excluded/action.yml:1:1:11:32 | name: ' ... action' |
| src/included/action.yml:1:1:11:32 | name: ' ... action' |

View File

@@ -0,0 +1,2 @@
| src/included/action.yml:1:1:11:32 | name: ' ... action' |
| src/included/unreachable-workflow.yml:1:1:12:33 | name: A ... orkflow |

View File

@@ -0,0 +1,5 @@
| src/.github/action.yaml:1:1:11:32 | name: ' ... action' |
| src/.github/actions/action-name/action.yml:1:1:11:32 | name: ' ... action' |
| src/.github/workflows/workflow.yml:1:1:12:33 | name: A workflow |
| src/action.yml:1:1:11:32 | name: ' ... action' |
| src/included/action.yml:1:1:11:32 | name: ' ... action' |

View File

@@ -0,0 +1,2 @@
| src/included/action.yml:1:1:11:32 | name: ' ... action' |
| src/included/unreachable-workflow.yml:1:1:12:33 | name: A ... orkflow |

View File

@@ -0,0 +1,5 @@
import actions
from AstNode n
where n instanceof Workflow or n instanceof CompositeAction
select n

View File

@@ -0,0 +1,4 @@
paths:
- 'included'
paths-ignore:
- 'excluded'

View File

@@ -0,0 +1,2 @@
paths-ignore:
- 'excluded'

View File

@@ -0,0 +1,2 @@
paths:
- 'included'

View File

@@ -0,0 +1,6 @@
src/.github/action.yaml
src/.github/actions/action-name/action.yml
src/.github/workflows/workflow.yml
src/action.yml
src/excluded/action.yml
src/included/action.yml

View File

@@ -0,0 +1,3 @@
src/included/action.yml
src/included/not-an-action.yml
src/included/unreachable-workflow.yml

View File

@@ -0,0 +1,5 @@
src/.github/action.yaml
src/.github/actions/action-name/action.yml
src/.github/workflows/workflow.yml
src/action.yml
src/included/action.yml

View File

@@ -0,0 +1,3 @@
src/included/action.yml
src/included/not-an-action.yml
src/included/unreachable-workflow.yml

View File

@@ -0,0 +1,11 @@
name: 'A composite action'
description: 'Do something'
runs:
using: "composite"
steps:
- name: Print
run: echo "Hello world"
shell: bash
- name: Checkout
uses: actions/checkout@v4

View File

@@ -0,0 +1,11 @@
name: 'A composite action'
description: 'Do something'
runs:
using: "composite"
steps:
- name: Print
run: echo "Hello world"
shell: bash
- name: Checkout
uses: actions/checkout@v4

View File

@@ -0,0 +1,12 @@
name: An unreachable workflow
on:
push:
branches:
- main
jobs:
job:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

View File

@@ -0,0 +1,12 @@
name: A workflow
on:
push:
branches:
- main
jobs:
job:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

View File

@@ -0,0 +1,11 @@
name: 'A composite action'
description: 'Do something'
runs:
using: "composite"
steps:
- name: Print
run: echo "Hello world"
shell: bash
- name: Checkout
uses: actions/checkout@v4

View File

@@ -0,0 +1,11 @@
name: 'A composite action'
description: 'Do something'
runs:
using: "composite"
steps:
- name: Print
run: echo "Hello world"
shell: bash
- name: Checkout
uses: actions/checkout@v4

View File

@@ -0,0 +1,12 @@
name: An unreachable workflow
on:
push:
branches:
- main
jobs:
job:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

View File

@@ -0,0 +1,11 @@
name: 'A composite action'
description: 'Do something'
runs:
using: "composite"
steps:
- name: Print
run: echo "Hello world"
shell: bash
- name: Checkout
uses: actions/checkout@v4

View File

@@ -0,0 +1 @@
name: 'Not an action, just a YAML file'

View File

@@ -0,0 +1,12 @@
name: An unreachable workflow
on:
push:
branches:
- main
jobs:
job:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

View File

@@ -0,0 +1,12 @@
name: An unreachable workflow
on:
push:
branches:
- main
jobs:
job:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

View File

@@ -0,0 +1,18 @@
import pytest
@pytest.mark.ql_test(expected=".default-filters.expected")
def test_default_filters(codeql, actions, check_source_archive):
check_source_archive.expected_suffix = ".default-filters.expected"
codeql.database.create(source_root="src")
@pytest.mark.ql_test(expected=".paths-only.expected")
def test_config_paths_only(codeql, actions):
codeql.database.create(source_root="src", codescanning_config="codeql-config.paths-only.yml")
@pytest.mark.ql_test(expected=".paths-ignore-only.expected")
def test_config_paths_ignore_only(codeql, actions):
codeql.database.create(source_root="src", codescanning_config="codeql-config.paths-ignore-only.yml")
@pytest.mark.ql_test(expected=".paths-and-paths-ignore.expected")
def test_config_paths_and_paths_ignore(codeql, actions):
codeql.database.create(source_root="src", codescanning_config="codeql-config.paths-and-paths-ignore.yml")

View File

@@ -1,3 +1,7 @@
## 0.4.7
No user-facing changes.
## 0.4.6
### Bug Fixes

View File

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

View File

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

View File

@@ -154,3 +154,13 @@ predicate untrustedGitCommandDataModel(string cmd_regex, string flag) {
predicate untrustedGhCommandDataModel(string cmd_regex, string flag) {
Extensions::untrustedGhCommandDataModel(cmd_regex, flag)
}
/**
* MaD models for permissions needed by actions
* Fields:
* - action: action name, e.g. `actions/checkout`
* - permission: permission name, e.g. `contents: read`
*/
predicate actionsPermissionsDataModel(string action, string permission) {
Extensions::actionsPermissionsDataModel(action, permission)
}

View File

@@ -77,3 +77,14 @@ extensible predicate untrustedGitCommandDataModel(string cmd_regex, string flag)
* Holds for gh commands that may introduce untrusted data
*/
extensible predicate untrustedGhCommandDataModel(string cmd_regex, string flag);
/**
* Holds if `action` needs `permission` to run.
* - 'action' is the name of the action without any version information.
* E.g. for the action selector `actions/checkout@v2`, `action` is `actions/checkout`.
* - `permission` is of the form `scope-name: read|write`, for example `contents: read`.
* - see https://github.com/actions/checkout?tab=readme-ov-file#recommended-permissions
* for an example of recommended permissions.
* - see https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token for documentation of token permissions.
*/
extensible predicate actionsPermissionsDataModel(string action, string permission);

View File

@@ -0,0 +1,37 @@
extensions:
- addsTo:
pack: codeql/actions-all
extensible: actionsPermissionsDataModel
data:
- ["actions/checkout", "contents: read"]
- ["actions/setup-node", "contents: read"]
- ["actions/setup-python", "contents: read"]
- ["actions/setup-java", "contents: read"]
- ["actions/setup-go", "contents: read"]
- ["actions/setup-dotnet", "contents: read"]
- ["actions/labeler", "contents: read"]
- ["actions/labeler", "pull-requests: write"]
- ["actions/attest", "id-token: write"]
- ["actions/attest", "attestations: write"]
# No permissions needed for actions/add-to-project
- ["actions/dependency-review-action", "contents: read"]
- ["actions/attest-sbom", "id-token: write"]
- ["actions/attest-sbom", "attestations: write"]
- ["actions/stale", "contents: write"]
- ["actions/stale", "issues: write"]
- ["actions/stale", "pull-requests: write"]
- ["actions/attest-build-provenance", "id-token: write"]
- ["actions/attest-build-provenance", "attestations: write"]
- ["actions/jekyll-build-pages", "contents: read"]
- ["actions/jekyll-build-pages", "pages: write"]
- ["actions/jekyll-build-pages", "id-token: write"]
- ["actions/publish-action", "contents: write"]
- ["actions/versions-package-tools", "contents: read"]
- ["actions/versions-package-tools", "actions: read"]
- ["actions/reusable-workflows", "contents: read"]
- ["actions/reusable-workflows", "actions: read"]
# TODO: Add permissions for actions/download-artifact
# TODO: Add permissions for actions/upload-artifact
# TODO: Add permissions for actions/cache

View File

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

View File

@@ -1,3 +1,9 @@
## 0.5.4
### Bug Fixes
* Alerts produced by the query `actions/missing-workflow-permissions` now include a minimal set of recommended permissions in the alert message, based on well-known actions seen within the workflow file.
## 0.5.3
### Bug Fixes

View File

@@ -109,7 +109,7 @@ An attacker could craft a malicious artifact that writes dangerous environment v
### Exploitation
An attacker is be able to run arbitrary code by injecting environment variables such as `LD_PRELOAD`, `BASH_ENV`, etc.
An attacker would be able to run arbitrary code by injecting environment variables such as `LD_PRELOAD`, `BASH_ENV`, etc.
## References

View File

@@ -1,5 +1,5 @@
/**
* @name Use of a known vulnerable action.
* @name Use of a known vulnerable action
* @description The workflow is using an action with known vulnerabilities.
* @kind problem
* @problem.severity error

View File

@@ -1,6 +1,6 @@
/**
* @name Workflow does not contain permissions
* @description Workflows should contain permissions to provide a clear understanding has permissions to run the workflow.
* @description Workflows should contain explicit permissions to restrict the scope of the default GITHUB_TOKEN.
* @kind problem
* @security-severity 5.0
* @problem.severity warning
@@ -14,7 +14,19 @@
import actions
from Job job
Step stepInJob(Job job) { result = job.(LocalJob).getAStep() }
string jobNeedsPermission(Job job) {
actionsPermissionsDataModel(stepInJob(job).(UsesStep).getCallee(), result)
}
/** Gets a suggestion for the minimal token permissions for `job`, as a JSON string. */
string permissionsForJob(Job job) {
result =
"{" + concat(string permission | permission = jobNeedsPermission(job) | permission, ", ") + "}"
}
from Job job, string permissions
where
not exists(job.getPermissions()) and
not exists(job.getEnclosingWorkflow().getPermissions()) and
@@ -22,5 +34,8 @@ where
exists(Event e |
e = job.getATriggerEvent() and
not e.getName() = "workflow_call"
)
select job, "Actions Job or Workflow does not set permissions"
) and
permissions = permissionsForJob(job)
select job,
"Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: "
+ permissions

View File

@@ -3,6 +3,7 @@
* @description All organization and repository secrets are passed to the workflow runner.
* @kind problem
* @precision high
* @security-severity 5.0
* @problem.severity warning
* @id actions/excessive-secrets-exposure
* @tags actions

View File

@@ -2,11 +2,11 @@
## Description
Secrets derived from other secrets are not know to the workflow runner and therefore not masked unless explicitly registered.
Secrets derived from other secrets are not known to the workflow runner, and therefore are not masked unless explicitly registered.
## Recommendations
Avoid defining non-plain secrets. For example, do not define a new secret containing a JSON object and then read properties out of it from the workflow since these read values will not be masked by the workflow runner.
Avoid defining non-plain secrets. For example, do not define a new secret containing a JSON object and then read properties out of it from the workflow, since these read values will not be masked by the workflow runner.
## Examples

View File

@@ -1,5 +1,5 @@
/**
* @name Checkout of untrusted code in trusted context
* @name Checkout of untrusted code in a privileged context
* @description Privileged workflows have read/write access to the base repository and access to secrets.
* By explicitly checking out and running the build script from a fork the untrusted code is running in an environment
* that is able to push to the base repository and to access secrets.

View File

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

View File

@@ -0,0 +1,5 @@
## 0.5.4
### Bug Fixes
* Alerts produced by the query `actions/missing-workflow-permissions` now include a minimal set of recommended permissions in the alert message, based on well-known actions seen within the workflow file.

View File

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

View File

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

View File

@@ -0,0 +1,13 @@
on:
workflow_call:
workflow_dispatch:
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/jekyll-build-pages

View File

@@ -0,0 +1,10 @@
on:
workflow_call:
workflow_dispatch:
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v2

View File

@@ -1,3 +1,5 @@
| .github/workflows/perms1.yml:6:5:9:32 | Job: build | Actions Job or Workflow does not set permissions |
| .github/workflows/perms2.yml:6:5:10:2 | Job: build | Actions Job or Workflow does not set permissions |
| .github/workflows/perms5.yml:7:5:10:32 | Job: build | Actions Job or Workflow does not set permissions |
| .github/workflows/perms1.yml:6:5:9:32 | Job: build | Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read} |
| .github/workflows/perms2.yml:6:5:10:2 | Job: build | Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read} |
| .github/workflows/perms5.yml:7:5:10:32 | Job: build | Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read} |
| .github/workflows/perms6.yml:7:5:11:39 | Job: build | Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read, id-token: write, pages: write} |
| .github/workflows/perms7.yml:7:5:10:38 | Job: build | Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {} |

View File

@@ -0,0 +1,175 @@
# This script is used to annotate .qll files with overlay[local?] annotations.
# It will walk the directory tree and annotate most .qll files, skipping only
# some specific cases (e.g., empty files, files that configure dataflow for queries).
# It will also add overlay[caller] annotations to predicates that are pragma[inline]
# and either not private or in a hardcoded list of predicates.
# The script takes a list of languages and processes the corresponding directories.
# Usage: python3 annotate-overlay-local.py <language1> <language2> ...
# The script will modify the files in place and print the changes made.
# The script is designed to be run from the root of the repository.
#!/usr/bin/python3
import sys
import os
from difflib import *
# These are the only two predicates that are pragma[inline], private, and must be
# overlay[caller] in order to successfully compile our internal java queries.
hardcoded_overlay_caller_preds = [
"fwdFlowInCand", "fwdFlowInCandTypeFlowDisabled"]
def filter_out_annotations(filename):
'''
Read the file and strip all existing overlay[...] annotations from the contents.
Return the file modified file content as a list of lines.
'''
overlays = ["local", "local?", "global", "caller"]
annotations = [f"overlay[{t}]" for t in overlays]
with open(filename, 'r') as file_in:
lines = [l for l in file_in if not l.strip() in annotations]
for ann in annotations:
if any(line for line in lines if ann in line):
raise Exception(f"Failed to filter out {ann} from {filename}.")
return lines
def insert_toplevel_maybe_local_anntotation(filename, lines):
'''
Find a suitable place to insert an overlay[local?] annotation at the top of the file.
Return a pair: (string describing action taken, modified content as list of lines).
'''
out_lines = []
status = 0
for line in lines:
if status == 0 and line.rstrip().endswith("module;"):
out_lines.append("overlay[local?]\n")
status = 1
out_lines.append(line)
if status == 1:
return (f"Annotating \"{filename}\" via existing file-level module statement", out_lines)
out_lines = []
empty_line_buffer = []
status = 0
for line in lines:
trimmed = line.strip()
if not trimmed:
empty_line_buffer.append(line)
continue
if status <= 1 and trimmed.endswith("*/"):
status = 2
elif status == 0 and trimmed.startswith("/**"):
status = 1
elif status == 0 and not trimmed.startswith("/*"):
out_lines.append("overlay[local?]\n")
out_lines.append("module;\n")
out_lines.append("\n")
status = 3
elif status == 2 and (trimmed.startswith("import ") or trimmed.startswith("private import ")):
out_lines.append("overlay[local?]\n")
out_lines.append("module;\n")
status = 3
elif status == 2 and (trimmed.startswith("class ") or trimmed.startswith("predicate ")
or trimmed.startswith("module ") or trimmed.startswith("signature ")):
out_lines = ["overlay[local?]\n", "module;\n", "\n"] + out_lines
status = 3
elif status == 2 and trimmed.startswith("/*"):
out_lines.append("overlay[local?]\n")
out_lines.append("module;\n")
status = 3
elif status == 2:
status = 4
if empty_line_buffer:
out_lines += empty_line_buffer
empty_line_buffer = []
out_lines.append(line)
if status == 3:
out_lines += empty_line_buffer
if status == 3:
return (f"Annotating \"{filename}\" after file-level module qldoc", out_lines)
raise Exception(f"Failed to annotate \"{filename}\" as overlay[local?].")
def insert_overlay_caller_annotations(lines):
'''
Mark pragma[inline] predicates as overlay[caller] if they are not declared private
or if they are private but are in the list of hardcoded_overlay_caller_preds.
'''
out_lines = []
for i, line in enumerate(lines):
trimmed = line.strip()
if trimmed == "pragma[inline]":
if (not "private" in lines[i+1] or
any(pred in lines[i+1] for pred in hardcoded_overlay_caller_preds)):
whitespace = line[0: line.find(trimmed)]
out_lines.append(f"{whitespace}overlay[caller]\n")
out_lines.append(line)
return out_lines
def annotate_as_appropriate(filename):
'''
Read file and strip all existing overlay[...] annotations from the contents;
then insert new overlay[...] annotations according to heuristics.
Return a pair: (string describing action taken, modified content as list of lines).
'''
lines = filter_out_annotations(filename)
lines = insert_overlay_caller_annotations(lines)
# These simple heuristics filter out those .qll files that we no _not_ want to annotate
# as overlay[local?]. It is not clear that these heuristics are exactly what we want,
# but they seem to work well enough for now (as determined by speed and accuracy numbers).
if (filename.endswith("Test.qll") or
((filename.endswith("Query.qll") or filename.endswith("Config.qll")) and
any("implements DataFlow::ConfigSig" in line for line in lines))):
return (f"Keeping \"{filename}\" global because it configures dataflow for a query", lines)
elif not any(line for line in lines if line.strip()):
return (f"Keeping \"{filename}\" global because it is empty", lines)
return insert_toplevel_maybe_local_anntotation(filename, lines)
def process_single_file(filename):
'''
Process a single file, annotating it as appropriate and writing the changes back to the file.
'''
annotate_result = annotate_as_appropriate(filename)
old = [line for line in open(filename)]
new = annotate_result[1]
if old != new:
diff = context_diff(old, new, fromfile=filename, tofile=filename)
diff = [line for line in diff]
if diff:
print(annotate_result[0])
for line in diff:
print(line.rstrip())
with open(filename, "w") as out_file:
for line in new:
out_file.write(line)
dirs = []
for lang in sys.argv[1:]:
if lang in ["cpp", "go", "csharp", "java", "javascript", "python", "ruby", "rust", "swift"]:
dirs.append(f"{lang}/ql/lib")
else:
raise Exception(f"Unknown language \"{lang}\".")
if dirs:
dirs.append("shared")
for roots in dirs:
for dirpath, dirnames, filenames in os.walk(roots):
for filename in filenames:
if filename.endswith(".qll") and not dirpath.endswith("tutorial"):
process_single_file(os.path.join(dirpath, filename))

View File

@@ -58,7 +58,19 @@ def file_checksum(filename):
with open(filename, 'rb') as file_handle:
return hashlib.sha1(file_handle.read()).hexdigest()
def check_group(group_name, files, master_file_picker, emit_error):
def accept_prefix(line1, line2):
suffix = line2.removeprefix(line1)
return not suffix or suffix.lstrip().startswith("//")
def equivalent_lines(lines1, lines2):
if len(lines1) != len(lines2):
return False
for line1, line2 in zip(lines1, lines2):
if not accept_prefix(line1, line2) and not accept_prefix(line2, line1):
return False
return True
def check_group(group_name, files, master_file_picker, emit_error, accept_prefix):
extant_files = [f for f in files if path.isfile(f)]
if len(extant_files) == 0:
emit_error(__file__, 0, "No files found from group '" + group_name + "'.")
@@ -70,11 +82,23 @@ def check_group(group_name, files, master_file_picker, emit_error):
return
checksums = {file_checksum(f) for f in extant_files}
if len(checksums) == 1 and len(extant_files) == len(files):
same_lengths = len(extant_files) == len(files)
if len(checksums) == 1 and same_lengths:
# All files are present and identical.
return
# In this case we also consider files indentical, if
# (1) The group only containts two files.
# (2) The lines of one file are the same as the lines of another file
# modulo comments.
if accept_prefix and same_lengths and len(extant_files) == 2:
with open(extant_files[0], 'r') as f1:
file1_lines = [l.strip('\n\r') for l in f1.readlines()]
with open(extant_files[1], 'r') as f2:
file2_lines = [l.strip('\n\r') for l in f2.readlines()]
if equivalent_lines(file1_lines, file2_lines):
return
master_file = master_file_picker(extant_files)
if master_file is None:
emit_error(__file__, 0,
@@ -139,9 +163,10 @@ def sync_identical_files(emit_error):
raise Exception("Bad command line or file not found")
chdir_repo_root()
load_if_exists('.', 'config/identical-files.json')
file_groups.update(csharp_test_files())
for group_name, files in csharp_test_files().items():
check_group(group_name, files, master_file_picker, emit_error, True)
for group_name, files in file_groups.items():
check_group(group_name, files, master_file_picker, emit_error)
check_group(group_name, files, master_file_picker, emit_error, False)
def main():
sync_identical_files(emit_local_error)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
description: Add a new predicate `isVla()` to the `ArrayType` class
compatibility: full
type_is_vla.rel: delete

View File

@@ -0,0 +1,11 @@
class Expr extends @expr {
string toString() { none() }
}
class AggregateLiteral extends Expr, @aggregateliteral {
override string toString() { none() }
}
from AggregateLiteral aggregate, Expr initializer, int element_index, int position
where aggregate_array_init(aggregate, initializer, element_index, position, _)
select aggregate, initializer, element_index, position

View File

@@ -0,0 +1,15 @@
class Expr extends @expr {
string toString() { none() }
}
class AggregateLiteral extends Expr, @aggregateliteral {
override string toString() { none() }
}
class MemberVariable extends @membervariable {
string toString() { none() }
}
from AggregateLiteral aggregate, Expr initializer, MemberVariable field, int position
where aggregate_field_init(aggregate, initializer, field, position, _)
select aggregate, initializer, field, position

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
description: add `hasDesignator` predicate to `ArrayOrVectorAggregateLiteral` and `ClassAggregateLiteral`
compatibility: backwards
aggregate_array_init.rel: run aggregate_array_init.qlo
aggregate_field_init.rel: run aggregate_field_init.qlo

View File

@@ -1,3 +1,10 @@
## 4.2.0
### New Features
* Calling conventions explicitly specified on function declarations (`__cdecl`, `__stdcall`, `__fastcall`, etc.) are now represented as specifiers of those declarations.
* A new class `CallingConventionSpecifier` extending the `Specifier` class was introduced, which represents explicitly specified calling conventions.
## 4.1.0
### New Features

View File

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

View File

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

View File

@@ -0,0 +1,6 @@
## 4.2.0
### New Features
* Calling conventions explicitly specified on function declarations (`__cdecl`, `__stdcall`, `__fastcall`, etc.) are now represented as specifiers of those declarations.
* A new class `CallingConventionSpecifier` extending the `Specifier` class was introduced, which represents explicitly specified calling conventions.

View File

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

View File

@@ -1,5 +1,5 @@
name: codeql/cpp-all
version: 4.1.0
version: 4.2.1-dev
groups: cpp
dbscheme: semmlecode.cpp.dbscheme
extractor: cpp

View File

@@ -97,6 +97,18 @@ class AccessSpecifier extends Specifier {
override string getAPrimaryQlClass() { result = "AccessSpecifier" }
}
/**
* A C/C++ calling convention specifier: `cdecl`, `fastcall`, `stdcall`, `thiscall`,
* `vectorcall`, or `clrcall`.
*/
class CallingConventionSpecifier extends Specifier {
CallingConventionSpecifier() {
this.hasName(["cdecl", "fastcall", "stdcall", "thiscall", "vectorcall", "clrcall"])
}
override string getAPrimaryQlClass() { result = "CallingConventionSpecifier" }
}
/**
* An attribute introduced by GNU's `__attribute__((name))` syntax,
* Microsoft's `__declspec(name)` syntax, Microsoft's `[name]` syntax, the

View File

@@ -1369,6 +1369,11 @@ class ArrayType extends DerivedType {
override predicate isDeeplyConst() { this.getBaseType().isDeeplyConst() } // No such thing as a const array type
override predicate isDeeplyConstBelow() { this.getBaseType().isDeeplyConst() }
/**
* Holds if this array is a variable-length array (VLA).
*/
predicate isVla() { type_is_vla(underlyingElement(this)) }
}
/**

View File

@@ -465,7 +465,7 @@ private predicate isFunctionConstructedFrom(Function f, Function templateFunc) {
}
/** Gets the fully templated version of `f`. */
private Function getFullyTemplatedFunction(Function f) {
Function getFullyTemplatedFunction(Function f) {
not f.isFromUninstantiatedTemplate(_) and
(
exists(Class c, Class templateClass, int i |
@@ -559,12 +559,15 @@ private string getTypeName(Type t, boolean needsSpace) {
/**
* Gets a type name for the `n`'th parameter of `f` without any template
* arguments. The result may be a string representing a type for which the
* typedefs have been resolved.
* arguments.
*
* If `canonical = false` then the result may be a string representing a type
* for which the typedefs have been resolved. If `canonical = true` then the
* result will be a string representing a type without resolving `typedefs`.
*/
bindingset[f]
pragma[inline_late]
string getParameterTypeWithoutTemplateArguments(Function f, int n) {
string getParameterTypeWithoutTemplateArguments(Function f, int n, boolean canonical) {
exists(string s, string base, string specifiers, Type t |
t = f.getParameter(n).getType() and
// The name of the string can either be the possibly typedefed name
@@ -572,14 +575,19 @@ string getParameterTypeWithoutTemplateArguments(Function f, int n) {
// `getTypeName(t, _)` is almost equal to `t.resolveTypedefs().getName()`,
// except that `t.resolveTypedefs()` doesn't have a result when the
// resulting type doesn't appear in the database.
s = [t.getName(), getTypeName(t, _)] and
(
s = t.getName() and canonical = true
or
s = getTypeName(t, _) and canonical = false
) and
parseAngles(s, base, _, specifiers) and
result = base + specifiers
)
or
f.isVarargs() and
n = f.getNumberOfParameters() and
result = "..."
result = "..." and
canonical = true
}
/**
@@ -590,7 +598,7 @@ private string getTypeNameWithoutFunctionTemplates(Function f, int n, int remain
exists(Function templateFunction |
templateFunction = getFullyTemplatedFunction(f) and
remaining = templateFunction.getNumberOfTemplateArguments() and
result = getParameterTypeWithoutTemplateArguments(templateFunction, n)
result = getParameterTypeWithoutTemplateArguments(templateFunction, n, _)
)
or
exists(string mid, TypeTemplateParameter tp, Function templateFunction |
@@ -627,7 +635,7 @@ private string getTypeNameWithoutClassTemplates(Function f, int n, int remaining
}
/** Gets the string representation of the `i`'th parameter of `c`. */
private string getParameterTypeName(Function c, int i) {
string getParameterTypeName(Function c, int i) {
result = getTypeNameWithoutClassTemplates(c, i, 0)
}

View File

@@ -213,7 +213,24 @@ class ClassAggregateLiteral extends AggregateLiteral {
Expr getFieldExpr(Field field, int position) {
field = classType.getAField() and
aggregate_field_init(underlyingElement(this), unresolveElement(result), unresolveElement(field),
position)
position, _)
}
/**
* Holds if the `position`-th initialization of `field` in this aggregate initializer
* uses a designated (e.g., `.x = ...`) rather than a positional initializer.
*
* For example, in:
* ```c
* struct S { int x, y; };
* struct S s = { .x = 1, 2 };
* ```
* - `.x = 1` is a designated initializer, therefore `hasDesignator(x, 0)` holds.
* - `2` is a positional initializer for `s.y`, therefore `hasDesignator(y, 1)` does not hold.
*/
predicate hasDesignator(Field field, int position) {
field = classType.getAField() and
aggregate_field_init(underlyingElement(this), _, unresolveElement(field), position, true)
}
/**
@@ -304,7 +321,24 @@ class ArrayOrVectorAggregateLiteral extends AggregateLiteral {
* - `a.getElementExpr(0, 2)` gives `789`.
*/
Expr getElementExpr(int elementIndex, int position) {
aggregate_array_init(underlyingElement(this), unresolveElement(result), elementIndex, position)
aggregate_array_init(underlyingElement(this), unresolveElement(result), elementIndex, position,
_)
}
/**
* Holds if the `position`-th initialization of the array element at `elementIndex`
* in this aggregate initializer uses a designated (e.g., `[0] = ...`) rather than
* a positional initializer.
*
* For example, in:
* ```c
* int x[] = { [0] = 1, 2 };
* ```
* - `[0] = 1` is a designated initializer, therefore `hasDesignator(0, 0)` holds.
* - `2` is a positional initializer for `x[1]`, therefore `hasDesignator(1, 1)` does not hold.
*/
predicate hasDesignator(int elementIndex, int position) {
aggregate_array_init(underlyingElement(this), _, elementIndex, position, true)
}
/**

View File

@@ -371,7 +371,7 @@ private class PrimaryArgumentNode extends ArgumentNode, OperandNode {
PrimaryArgumentNode() { exists(CallInstruction call | op = call.getAnArgumentOperand()) }
override predicate argumentOf(DataFlowCall call, ArgumentPosition pos) {
op = call.getArgumentOperand(pos.(DirectPosition).getIndex())
op = call.getArgumentOperand(pos.(DirectPosition).getArgumentIndex())
}
}
@@ -410,8 +410,16 @@ class ParameterPosition = Position;
class ArgumentPosition = Position;
abstract class Position extends TPosition {
/** Gets a textual representation of this position. */
abstract string toString();
/**
* Gets the argument index of this position. The qualifier of a call has
* argument index `-1`.
*/
abstract int getArgumentIndex();
/** Gets the indirection index of this position. */
abstract int getIndirectionIndex();
}
@@ -428,7 +436,7 @@ class DirectPosition extends Position, TDirectPosition {
result = index.toString()
}
int getIndex() { result = index }
override int getArgumentIndex() { result = index }
final override int getIndirectionIndex() { result = 0 }
}
@@ -445,16 +453,29 @@ class IndirectionPosition extends Position, TIndirectionPosition {
else result = repeatStars(indirectionIndex) + argumentIndex.toString()
}
int getArgumentIndex() { result = argumentIndex }
override int getArgumentIndex() { result = argumentIndex }
final override int getIndirectionIndex() { result = indirectionIndex }
}
newtype TPosition =
TDirectPosition(int argumentIndex) { exists(any(CallInstruction c).getArgument(argumentIndex)) } or
TDirectPosition(int argumentIndex) {
exists(any(CallInstruction c).getArgument(argumentIndex))
or
// Handle the rare case where there is a function definition but no call to
// the function.
exists(any(Cpp::Function f).getParameter(argumentIndex))
} or
TIndirectionPosition(int argumentIndex, int indirectionIndex) {
Ssa::hasIndirectOperand(any(CallInstruction call).getArgumentOperand(argumentIndex),
indirectionIndex)
or
// Handle the rare case where there is a function definition but no call to
// the function.
exists(Cpp::Function f, Cpp::Parameter p |
p = f.getParameter(argumentIndex) and
indirectionIndex = [1 .. Ssa::getMaxIndirectionsForType(p.getUnspecifiedType()) - 1]
)
}
private newtype TReturnKind =
@@ -501,6 +522,15 @@ class ReturnKind extends TReturnKind {
/** Gets a textual representation of this return kind. */
abstract string toString();
/** Holds if this `ReturnKind` is generated from a `return` statement. */
abstract predicate isNormalReturn();
/**
* Holds if this `ReturnKind` is generated from a write to the parameter with
* index `argumentIndex`
*/
abstract predicate isIndirectReturn(int argumentIndex);
}
/**
@@ -514,6 +544,10 @@ class NormalReturnKind extends ReturnKind, TNormalReturnKind {
override int getIndirectionIndex() { result = indirectionIndex }
override string toString() { result = "indirect return" }
override predicate isNormalReturn() { any() }
override predicate isIndirectReturn(int argumentIndex) { none() }
}
/**
@@ -528,6 +562,10 @@ private class IndirectReturnKind extends ReturnKind, TIndirectReturnKind {
override int getIndirectionIndex() { result = indirectionIndex }
override string toString() { result = "indirect outparam[" + argumentIndex.toString() + "]" }
override predicate isNormalReturn() { none() }
override predicate isIndirectReturn(int argumentIndex_) { argumentIndex_ = argumentIndex }
}
/** A data flow node that occurs as the result of a `ReturnStmt`. */
@@ -1834,7 +1872,47 @@ module IteratorFlow {
private module IteratorSsa = SsaImpl::Make<Location, SsaInput>;
private class Def extends IteratorSsa::DefinitionExt {
private module DataFlowIntegrationInput implements IteratorSsa::DataFlowIntegrationInputSig {
private import codeql.util.Void
class Expr extends Instruction {
Expr() {
exists(IRBlock bb, int i |
SsaInput::variableRead(bb, i, _, true) and
this = bb.getInstruction(i)
)
}
predicate hasCfgNode(SsaInput::BasicBlock bb, int i) { bb.getInstruction(i) = this }
}
predicate ssaDefHasSource(IteratorSsa::WriteDefinition def) { none() }
predicate allowFlowIntoUncertainDef(IteratorSsa::UncertainWriteDefinition def) { any() }
class Guard extends Void {
predicate controlsBranchEdge(
SsaInput::BasicBlock bb1, SsaInput::BasicBlock bb2, boolean branch
) {
none()
}
}
predicate guardDirectlyControlsBlock(Guard guard, SsaInput::BasicBlock bb, boolean branch) {
none()
}
predicate supportBarrierGuardsOnPhiEdges() { none() }
}
private module DataFlowIntegrationImpl =
IteratorSsa::DataFlowIntegration<DataFlowIntegrationInput>;
private class IteratorSynthNode extends DataFlowIntegrationImpl::SsaNode {
IteratorSynthNode() { not this.asDefinition() instanceof IteratorSsa::WriteDefinition }
}
private class Def extends IteratorSsa::Definition {
final override Location getLocation() { result = this.getImpl().getLocation() }
/**
@@ -1842,7 +1920,7 @@ module IteratorFlow {
* and is a definition (or use) of the variable `sv`.
*/
predicate hasIndexInBlock(IRBlock block, int index, SourceVariable sv) {
super.definesAt(sv, block, index, _)
super.definesAt(sv, block, index)
}
private Ssa::DefImpl getImpl() {
@@ -1859,46 +1937,15 @@ module IteratorFlow {
int getIndirectionIndex() { result = this.getImpl().getIndirectionIndex() }
}
private class PhiNode extends IteratorSsa::DefinitionExt {
PhiNode() {
this instanceof IteratorSsa::PhiNode or
this instanceof IteratorSsa::PhiReadNode
}
SsaIteratorNode getNode() { result.getIteratorFlowNode() = this }
}
cached
private module IteratorSsaCached {
cached
predicate adjacentDefRead(IRBlock bb1, int i1, SourceVariable sv, IRBlock bb2, int i2) {
IteratorSsa::adjacentDefReadExt(_, sv, bb1, i1, bb2, i2)
or
exists(PhiNode phi |
IteratorSsa::lastRefRedefExt(_, sv, bb1, i1, phi) and
phi.definesAt(sv, bb2, i2, _)
)
}
cached
Node getAPriorDefinition(IteratorSsa::DefinitionExt next) {
exists(IRBlock bb, int i, SourceVariable sv, IteratorSsa::DefinitionExt def |
IteratorSsa::lastRefRedefExt(pragma[only_bind_into](def), pragma[only_bind_into](sv),
pragma[only_bind_into](bb), pragma[only_bind_into](i), next) and
nodeToDefOrUse(result, sv, bb, i, _)
)
}
}
/** The set of nodes necessary for iterator flow. */
class IteratorFlowNode instanceof PhiNode {
class IteratorFlowNode instanceof IteratorSynthNode {
/** Gets a textual representation of this node. */
string toString() { result = super.toString() }
/** Gets the type of this node. */
DataFlowType getType() {
exists(Ssa::SourceVariable sv |
super.definesAt(sv, _, _, _) and
super.getSourceVariable() = sv and
result = sv.getType()
)
}
@@ -1910,60 +1957,33 @@ module IteratorFlow {
Location getLocation() { result = super.getBasicBlock().getLocation() }
}
private import IteratorSsaCached
private predicate defToNode(Node node, Def def, boolean uncertain) {
(
nodeHasOperand(node, def.getValue().asOperand(), def.getIndirectionIndex())
or
nodeHasInstruction(node, def.getValue().asInstruction(), def.getIndirectionIndex())
) and
uncertain = false
private predicate defToNode(Node node, Def def) {
nodeHasOperand(node, def.getValue().asOperand(), def.getIndirectionIndex())
or
nodeHasInstruction(node, def.getValue().asInstruction(), def.getIndirectionIndex())
}
private predicate nodeToDefOrUse(
Node node, SourceVariable sv, IRBlock bb, int i, boolean uncertain
) {
exists(Def def |
def.hasIndexInBlock(bb, i, sv) and
defToNode(node, def, uncertain)
bindingset[result, v]
pragma[inline_late]
private DataFlowIntegrationImpl::Node fromDfNode(Node n, SourceVariable v) {
result = n.(SsaIteratorNode).getIteratorFlowNode()
or
exists(Ssa::UseImpl use, IRBlock bb, int i |
result.(DataFlowIntegrationImpl::ExprNode).getExpr().hasCfgNode(bb, i) and
use.hasIndexInBlock(bb, i, v) and
use.getNode() = n
)
or
useToNode(bb, i, sv, node) and
uncertain = false
}
private predicate useToNode(IRBlock bb, int i, SourceVariable sv, Node nodeTo) {
exists(PhiNode phi |
phi.definesAt(sv, bb, i, _) and
nodeTo = phi.getNode()
)
or
exists(Ssa::UseImpl use |
use.hasIndexInBlock(bb, i, sv) and
nodeTo = use.getNode()
)
defToNode(n, result.(DataFlowIntegrationImpl::SsaDefinitionNode).getDefinition())
}
/**
* Holds if `nodeFrom` flows to `nodeTo` in a single step.
*/
predicate localFlowStep(Node nodeFrom, Node nodeTo) {
exists(
Node nFrom, SourceVariable sv, IRBlock bb1, int i1, IRBlock bb2, int i2, boolean uncertain
|
adjacentDefRead(bb1, i1, sv, bb2, i2) and
nodeToDefOrUse(nFrom, sv, bb1, i1, uncertain) and
useToNode(bb2, i2, sv, nodeTo)
|
if uncertain = true
then
nodeFrom =
[
nFrom,
getAPriorDefinition(any(IteratorSsa::DefinitionExt next | next.definesAt(sv, bb1, i1, _)))
]
else nFrom = nodeFrom
exists(SourceVariable v |
nodeFrom != nodeTo and
DataFlowIntegrationImpl::localFlowStep(v, fromDfNode(nodeFrom, v), fromDfNode(nodeTo, v), _)
)
}
}

View File

@@ -1445,7 +1445,7 @@ private class ExplicitParameterInstructionNode extends AbstractExplicitParameter
ExplicitParameterInstructionNode() { exists(instr.getParameter()) }
override predicate isSourceParameterOf(Function f, ParameterPosition pos) {
f.getParameter(pos.(DirectPosition).getIndex()) = instr.getParameter()
f.getParameter(pos.(DirectPosition).getArgumentIndex()) = instr.getParameter()
}
override string toStringImpl() { result = instr.getParameter().toString() }
@@ -1460,7 +1460,7 @@ class ThisParameterInstructionNode extends AbstractExplicitParameterNode,
ThisParameterInstructionNode() { instr.getIRVariable() instanceof IRThisVariable }
override predicate isSourceParameterOf(Function f, ParameterPosition pos) {
pos.(DirectPosition).getIndex() = -1 and
pos.(DirectPosition).getArgumentIndex() = -1 and
instr.getEnclosingFunction() = f
}
@@ -1494,7 +1494,7 @@ private class DirectBodyLessParameterNode extends AbstractExplicitParameterNode,
override predicate isSourceParameterOf(Function f, ParameterPosition pos) {
this.getFunction() = f and
f.getParameter(pos.(DirectPosition).getIndex()) = p
f.getParameter(pos.(DirectPosition).getArgumentIndex()) = p
}
override Parameter getParameter() { result = p }

View File

@@ -1069,7 +1069,7 @@ module BarrierGuard<guardChecksNodeSig/3 guardChecksNode> {
bindingset[result, v]
pragma[inline_late]
DataFlowIntegrationImpl::Node fromDfNode(Node n, SourceVariable v) {
private DataFlowIntegrationImpl::Node fromDfNode(Node n, SourceVariable v) {
result = n.(SsaSynthNode).getSynthNode()
or
exists(UseImpl use, IRBlock bb, int i |

View File

@@ -229,11 +229,11 @@ private module SpeculativeTaintFlow {
not exists(DataFlowDispatch::viableCallable(call)) and
src.(DataFlowPrivate::ArgumentNode).argumentOf(call, argpos)
|
not argpos.(DirectPosition).getIndex() = -1 and
not argpos.(DirectPosition).getArgumentIndex() = -1 and
sink.(PostUpdateNode)
.getPreUpdateNode()
.(DataFlowPrivate::ArgumentNode)
.argumentOf(call, any(DirectPosition qualpos | qualpos.getIndex() = -1))
.argumentOf(call, any(DirectPosition qualpos | qualpos.getArgumentIndex() = -1))
or
sink.(DataFlowPrivate::OutNode).getCall() = call
)

View File

@@ -2039,7 +2039,8 @@ aggregate_field_init(
int aggregate: @aggregateliteral ref,
int initializer: @expr ref,
int field: @membervariable ref,
int position: int ref
int position: int ref,
boolean is_designated: boolean ref
);
/**
@@ -2051,7 +2052,8 @@ aggregate_array_init(
int aggregate: @aggregateliteral ref,
int initializer: @expr ref,
int element_index: int ref,
int position: int ref
int position: int ref,
boolean is_designated: boolean ref
);
@ctorinit = @ctordirectinit
@@ -2178,6 +2180,8 @@ variable_vla(
int decl: @stmt_vla_decl ref
);
type_is_vla(unique int type_id: @derivedtype ref)
if_initialization(
unique int if_stmt: @stmt_if ref,
int init_id: @stmt ref

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
class Expr extends @expr {
string toString() { none() }
}
class AggregateLiteral extends Expr, @aggregateliteral {
override string toString() { none() }
}
from AggregateLiteral aggregate, Expr initializer, int element_index, int position
where aggregate_array_init(aggregate, initializer, element_index, position)
select aggregate, initializer, element_index, position, false

View File

@@ -0,0 +1,15 @@
class Expr extends @expr {
string toString() { none() }
}
class AggregateLiteral extends Expr, @aggregateliteral {
override string toString() { none() }
}
class MemberVariable extends @membervariable {
string toString() { none() }
}
from AggregateLiteral aggregate, Expr initializer, MemberVariable field, int position
where aggregate_field_init(aggregate, initializer, field, position)
select aggregate, initializer, field, position, false

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
description: add `hasDesignator` predicate to `ArrayOrVectorAggregateLiteral` and `ClassAggregateLiteral`
compatibility: backwards
aggregate_array_init.rel: run aggregate_array_init.qlo
aggregate_field_init.rel: run aggregate_field_init.qlo

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: Add a new predicate `isVla()` to the `ArrayType` class
compatibility: backwards

View File

@@ -1,3 +1,7 @@
## 1.3.8
No user-facing changes.
## 1.3.7
### Minor Analysis Improvements

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,7 @@
| test.cpp:4:21:4:35 | definition of thiscall_method | thiscall |
| test.cpp:7:14:7:23 | definition of func_cdecl | cdecl |
| test.cpp:9:16:9:27 | definition of func_stdcall | stdcall |
| test.cpp:11:17:11:29 | definition of func_fastcall | fastcall |
| test.cpp:13:20:13:34 | definition of func_vectorcall | vectorcall |
| test.cpp:15:13:15:25 | definition of func_overload | cdecl |
| test.cpp:16:15:16:27 | definition of func_overload | stdcall |

View File

@@ -0,0 +1,5 @@
import cpp
from FunctionDeclarationEntry func, CallingConventionSpecifier ccs
where ccs.hasName(func.getASpecifier())
select func, func.getASpecifier()

View File

@@ -0,0 +1,16 @@
// semmle-extractor-options: --microsoft
struct call_conventions {
void __thiscall thiscall_method() {}
};
void __cdecl func_cdecl() {}
void __stdcall func_stdcall() {}
void __fastcall func_fastcall() {}
void __vectorcall func_vectorcall() {}
int __cdecl func_overload() {}
int __stdcall func_overload(int x) {}

View File

@@ -27,7 +27,7 @@
| Function | cpp20.cpp:62:8:62:8 | operator= | operator= | extern, inline, is_constexpr, public |
| Function | cpp20.cpp:62:8:62:8 | operator= | operator= | extern, inline, is_constexpr, public |
| Function | cpp20.cpp:64:5:64:21 | TestExplicitBool4 | TestExplicitBool4 | explicit, extern, public |
| Function | file://:0:0:0:0 | TestExplicitBool | TestExplicitBool | explicit, has_trailing_return_type |
| Function | file://:0:0:0:0 | TestExplicitBool | TestExplicitBool | explicit |
| Function | file://:0:0:0:0 | operator delete | operator delete | extern |
| Function | file://:0:0:0:0 | operator new | operator new | extern |
| Function | specifiers2.c:11:6:11:6 | f | f | c_linkage, extern |
@@ -67,6 +67,8 @@
| Function | specifiers2pp.cpp:63:19:63:34 | member_constexpr | member_constexpr | const, declared_constexpr, inline, is_constexpr, private |
| Function | specifiers2pp.cpp:64:19:64:40 | member_const_constexpr | member_const_constexpr | const, declared_constexpr, inline, is_constexpr, private |
| FunctionDeclarationEntry | cpp20.cpp:11:14:11:24 | declaration of TestExplict | TestExplict | explicit |
| FunctionDeclarationEntry | cpp20.cpp:23:1:23:1 | declaration of TestExplicitBool | TestExplicitBool | has_trailing_return_type |
| FunctionDeclarationEntry | cpp20.cpp:24:1:24:16 | definition of TestExplicitBool | TestExplicitBool | has_trailing_return_type |
| FunctionDeclarationEntry | cpp20.cpp:40:23:40:23 | definition of TestExplicitBool2 | TestExplicitBool2 | explicit |
| FunctionDeclarationEntry | cpp20.cpp:51:5:51:5 | definition of TestExplicitBool3 | TestExplicitBool3 | explicit |
| FunctionDeclarationEntry | cpp20.cpp:51:5:51:21 | declaration of TestExplicitBool3 | TestExplicitBool3 | explicit |

View File

@@ -162,6 +162,10 @@ namespace Semmle.Autobuild.CSharp.Tests
bool IBuildActions.IsRunningOnAppleSilicon() => IsRunningOnAppleSilicon;
public bool IsMonoInstalled { get; set; }
bool IBuildActions.IsMonoInstalled() => IsMonoInstalled;
public string PathCombine(params string[] parts)
{
return string.Join(IsWindows ? '\\' : '/', parts.Where(p => !string.IsNullOrWhiteSpace(p)));
@@ -424,8 +428,7 @@ namespace Semmle.Autobuild.CSharp.Tests
return new CSharpAutobuilder(actions, options);
}
[Fact]
public void TestDefaultCSharpAutoBuilder()
private void SetupActionForDotnet()
{
actions.RunProcess["cmd.exe /C dotnet --info"] = 0;
actions.RunProcess[@"cmd.exe /C dotnet clean C:\Project\test.csproj"] = 0;
@@ -438,20 +441,80 @@ namespace Semmle.Autobuild.CSharp.Tests
actions.GetEnvironmentVariable["CODEQL_EXTRACTOR_CSHARP_SCRATCH_DIR"] = "scratch";
actions.EnumerateFiles[@"C:\Project"] = "foo.cs\nbar.cs\ntest.csproj";
actions.EnumerateDirectories[@"C:\Project"] = "";
var xml = new XmlDocument();
xml.LoadXml(@"<Project Sdk=""Microsoft.NET.Sdk"">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
}
</Project>");
private void CreateAndVerifyDotnetScript(XmlDocument xml)
{
actions.LoadXml[@"C:\Project\test.csproj"] = xml;
var autobuilder = CreateAutoBuilder(true);
TestAutobuilderScript(autobuilder, 0, 4);
}
[Fact]
public void TestDefaultCSharpAutoBuilder1()
{
SetupActionForDotnet();
var xml = new XmlDocument();
xml.LoadXml(
"""
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
</Project>
""");
CreateAndVerifyDotnetScript(xml);
}
[Fact]
public void TestDefaultCSharpAutoBuilder2()
{
SetupActionForDotnet();
var xml = new XmlDocument();
xml.LoadXml(
"""
<Project>
<Sdk Name="Microsoft.NET.Sdk" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
"""
);
CreateAndVerifyDotnetScript(xml);
}
[Fact]
public void TestDefaultCSharpAutoBuilder3()
{
SetupActionForDotnet();
var xml = new XmlDocument();
xml.LoadXml(
"""
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>
"""
);
CreateAndVerifyDotnetScript(xml);
}
[Fact]
public void TestLinuxCSharpAutoBuilder()
{
@@ -797,11 +860,32 @@ namespace Semmle.Autobuild.CSharp.Tests
}
[Fact]
public void TestDirsProjLinux()
public void TestDirsProjLinux_WithMono()
{
actions.IsMonoInstalled = true;
actions.RunProcess[@"nuget restore C:\Project/dirs.proj -DisableParallelProcessing"] = 1;
actions.RunProcess[@"mono scratch/.nuget/nuget.exe restore C:\Project/dirs.proj -DisableParallelProcessing"] = 0;
actions.RunProcess[@"msbuild C:\Project/dirs.proj /t:rebuild"] = 0;
var autobuilder = TestDirsProjLinux();
TestAutobuilderScript(autobuilder, 0, 3);
}
[Fact]
public void TestDirsProjLinux_WithoutMono()
{
actions.IsMonoInstalled = false;
actions.RunProcess[@"dotnet msbuild /t:restore C:\Project/dirs.proj"] = 0;
actions.RunProcess[@"dotnet msbuild C:\Project/dirs.proj /t:rebuild"] = 0;
var autobuilder = TestDirsProjLinux();
TestAutobuilderScript(autobuilder, 0, 2);
}
private CSharpAutobuilder TestDirsProjLinux()
{
actions.FileExists["csharp.log"] = true;
actions.FileExists[@"C:\Project/a/test.csproj"] = true;
actions.FileExists[@"C:\Project/dirs.proj"] = true;
@@ -830,8 +914,7 @@ namespace Semmle.Autobuild.CSharp.Tests
</Project>");
actions.LoadXml[@"C:\Project/dirs.proj"] = dirsproj;
var autobuilder = CreateAutoBuilder(false);
TestAutobuilderScript(autobuilder, 0, 3);
return CreateAutoBuilder(false);
}
[Fact]

View File

@@ -150,6 +150,10 @@ namespace Semmle.Autobuild.Cpp.Tests
bool IBuildActions.IsRunningOnAppleSilicon() => IsRunningOnAppleSilicon;
public bool IsMonoInstalled { get; set; }
bool IBuildActions.IsMonoInstalled() => IsMonoInstalled;
string IBuildActions.PathCombine(params string[] parts)
{
return string.Join(IsWindows ? '\\' : '/', parts.Where(p => !string.IsNullOrWhiteSpace(p)));

View File

@@ -10,15 +10,15 @@ namespace Semmle.Autobuild.Shared
/// <summary>
/// Appends a call to msbuild.
/// </summary>
/// <param name="cmdBuilder"></param>
/// <param name="builder"></param>
/// <returns></returns>
public static CommandBuilder MsBuildCommand(this CommandBuilder cmdBuilder, IAutobuilder<AutobuildOptionsShared> builder)
public static CommandBuilder MsBuildCommand(this CommandBuilder cmdBuilder, IAutobuilder<AutobuildOptionsShared> builder, bool preferDotnet)
{
// mono doesn't ship with `msbuild` on Arm-based Macs, but we can fall back to
// msbuild that ships with `dotnet` which can be invoked with `dotnet msbuild`
// perhaps we should do this on all platforms?
return builder.Actions.IsRunningOnAppleSilicon()
// Similarly, there's no point in trying to rely on mono if it's not installed.
// In which case we can still fall back to `dotnet msbuild`.
return preferDotnet
? cmdBuilder.RunCommand("dotnet").Argument("msbuild")
: cmdBuilder.RunCommand("msbuild");
}
@@ -75,13 +75,16 @@ namespace Semmle.Autobuild.Shared
QuoteArgument(projectOrSolution.FullPath).
Argument("-DisableParallelProcessing").
Script;
var preferDotnet = builder.Actions.IsRunningOnAppleSilicon() || !builder.Actions.IsWindows() && !builder.Actions.IsMonoInstalled();
var nugetRestore = GetNugetRestoreScript();
var msbuildRestoreCommand = new CommandBuilder(builder.Actions).
MsBuildCommand(builder).
MsBuildCommand(builder, preferDotnet).
Argument("/t:restore").
QuoteArgument(projectOrSolution.FullPath);
if (builder.Actions.IsRunningOnAppleSilicon())
if (preferDotnet)
{
// On Apple Silicon, only try package restore with `dotnet msbuild /t:restore`
ret &= BuildScript.Try(msbuildRestoreCommand.Script);
@@ -119,7 +122,7 @@ namespace Semmle.Autobuild.Shared
command.RunCommand("set Platform=&& type NUL", quoteExe: false);
}
command.MsBuildCommand(builder);
command.MsBuildCommand(builder, preferDotnet);
command.QuoteArgument(projectOrSolution.FullPath);
var target = "rebuild";

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
using Semmle.Util.Logging;
namespace Semmle.Autobuild.Shared
{
@@ -26,6 +25,26 @@ namespace Semmle.Autobuild.Shared
private readonly Lazy<List<Project<TAutobuildOptions>>> includedProjectsLazy;
public override IEnumerable<IProjectOrSolution> IncludedProjects => includedProjectsLazy.Value;
private static bool HasSdkAttribute(XmlElement xml) =>
xml.HasAttribute("Sdk");
private static bool AnyElement(XmlNodeList l, Func<XmlElement, bool> f) =>
l.OfType<XmlElement>().Any(f);
/// <summary>
/// According to https://learn.microsoft.com/en-us/visualstudio/msbuild/how-to-use-project-sdk?view=vs-2022#reference-a-project-sdk
/// there are three ways to reference a project SDK:
/// 1. As an attribute on the &lt;Project/&gt;.
/// 2. As a top level element of &lt;Project&gt;.
/// 3. As an attribute on an &lt;Import&gt; element.
///
/// Returns true, if the Sdk attribute is used, otherwise false.
/// </summary>
private static bool ReferencesSdk(XmlElement xml) =>
HasSdkAttribute(xml) || // Case 1
AnyElement(xml.ChildNodes, e => e.Name == "Sdk") || // Case 2
AnyElement(xml.GetElementsByTagName("Import"), HasSdkAttribute); // Case 3
public Project(Autobuilder<TAutobuildOptions> builder, string path) : base(builder, path)
{
ToolsVersion = new Version();
@@ -49,7 +68,7 @@ namespace Semmle.Autobuild.Shared
if (root?.Name == "Project")
{
if (root.HasAttribute("Sdk"))
if (ReferencesSdk(root))
{
DotNetProject = true;
return;

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