Compare commits

...

255 Commits

Author SHA1 Message Date
Cornelius Riemenschneider
0b4c37ac90 Upgrade to bazel 7.3.1.
Also flip the flag for the repo separator.
2024-08-20 10:41:35 +02:00
Cornelius Riemenschneider
675e920667 Fix formatting. 2024-08-19 09:00:08 +02:00
Cornelius Riemenschneider
1faad979ad Address review. 2024-08-19 08:54:56 +02:00
Cornelius Riemenschneider
f9bc97b2a1 crate_universe: Enable modext isolation.
This should allow us to build our python and ruby
code independently - in particular, we can now do shallow
checkouts of one without the other.
Previously, the modext introduced cross-dependency.
This also reduces the amount of work we do in the
crate universe processing for the other language, even
though it's unused.

This does need renaming the module, as otherwise
the generated paths from rules_rust get too long
for Windows :(
2024-08-18 21:00:30 +02:00
Geoffrey White
b001f47c17 Merge pull request #17211 from paldepind/uncontrolled-allocation-size-docs
C++: Update documentation for cpp/uncontrolled-allocation-size to clarify its scope
2024-08-16 16:36:22 +01:00
Geoffrey White
e3b9b0a9bd Merge pull request #17210 from geoffw0/mailto
Swift: Fix false positives in the swift/cleartext-transmission query
2024-08-16 16:23:09 +01:00
Simon Friis Vindum
5504799d44 Merge branch 'main' into uncontrolled-allocation-size-docs 2024-08-16 16:15:14 +02:00
Anders Schack-Mulligen
3a9610795b Merge pull request #16808 from JLLeitschuh/patch-8
Align Java CommandInjectionRuntimeExec.ql Severity
2024-08-16 15:14:48 +02:00
Simon Friis Vindum
07800ea7ef Merge branch 'main' into uncontrolled-allocation-size-docs 2024-08-16 13:10:08 +02:00
Simon Friis Vindum
5548304432 C++: Grammar improvements to query help text 2024-08-16 13:08:34 +02:00
Chris Smowton
f7d8c210e5 Merge pull request #17239 from smowton/smowton/admin/camel-test
Java: add test for Apache Camel dead-code analysis
2024-08-16 11:00:30 +01:00
Rasmus Wriedt Larsen
d6af999c2d Merge pull request #17234 from github/felicitymay-patch-1
Update CookieInjection.ql to remove period from @name
2024-08-16 11:26:16 +02:00
Rasmus Wriedt Larsen
25fc5f3803 Merge pull request #17209 from RasmusWL/threat-models-stdin
ThreatModels: Add `stdin` kind
2024-08-16 11:01:33 +02:00
Rasmus Wriedt Larsen
c3d8efc43d Merge branch 'main' into stdin3 2024-08-16 09:54:45 +02:00
Anders Schack-Mulligen
ae013ba01a Merge pull request #17235 from aschackmull/dataflow/fix-missing-subpaths
Dataflow: Fix missing subpaths due to type strengthening.
2024-08-16 08:41:35 +02:00
Anders Schack-Mulligen
51c43a7440 Java: Accept expected changes. 2024-08-16 07:01:35 +02:00
Anders Schack-Mulligen
86708c9ff8 Dataflow: Fix missing subpaths due to type strengthening. 2024-08-15 18:57:10 +02:00
Chris Smowton
0b56bf98f3 Java: add test for Apache Camel dead-code analysis
This exercises code that detects Camel entry-points and marks them as live.
2024-08-15 17:26:38 +01:00
Tom Hvitved
fb7b89f309 Merge pull request #17237 from aschackmull/java/fix-merge-conflict
Java: Fix expected files following semantic merge conflict.
2024-08-15 17:25:03 +02:00
Rasmus Wriedt Larsen
7a446231b6 C#: Accept benign test changes 2024-08-15 16:20:00 +02:00
Anders Schack-Mulligen
e77c3dfda1 Java: Fix expected files following https://github.com/github/codeql/pull/17233 and https://github.com/github/codeql/pull/17224. 2024-08-15 15:45:37 +02:00
Rasmus Wriedt Larsen
78770bcd1b Docs: Mention new stdin threat-model 2024-08-15 15:45:21 +02:00
Rasmus Wriedt Larsen
1e7eae58f4 Java: Add change-note 2024-08-15 15:45:20 +02:00
Rasmus Wriedt Larsen
ebafe65ac2 C#: Fixup test expectations from using stdin 2024-08-15 15:45:20 +02:00
Rasmus Wriedt Larsen
43b61dd2aa C#: Support stdin in LocalFlowSource 2024-08-15 15:45:20 +02:00
Rasmus Wriedt Larsen
fee38b3781 Java: Fixup test 2024-08-15 15:37:35 +02:00
Rasmus Wriedt Larsen
1e12c11adc Java: Model System.in as stdin threat-model 2024-08-15 15:37:35 +02:00
Rasmus Wriedt Larsen
7395223410 C#: Model System.Console reads as stdin threat-model 2024-08-15 15:36:28 +02:00
Rasmus Wriedt Larsen
157d0b7f37 ThreatModels: Add stdin kind
None of the current local subgroups precisely captures stdin, so
although it's much like both commandargs and file, a separate kind seems
better.
2024-08-15 15:36:28 +02:00
Anders Schack-Mulligen
7d61d9282c Merge pull request #17233 from aschackmull/dataflow/match-summarylabel
Dataflow: Fix missing join on summaryLabel.
2024-08-15 14:55:38 +02:00
Felicity Chapman
fcb2b5730f Update CookieInjection.ql to remove period 2024-08-15 13:17:13 +01:00
Anders Schack-Mulligen
6f23e8dcf3 Merge pull request #17224 from aschackmull/java/inlineflow-pathgraph
Java: Add PathGraph to test output for default inline flow tests.
2024-08-15 13:35:24 +02:00
Anders Schack-Mulligen
a85f8a2fbd Java/C#: Accept expected changes. 2024-08-15 13:24:31 +02:00
Paolo Tranquilli
f0de9f9276 Merge pull request #17232 from github/redsun82/kotlin
Kotlin: fix wrapper on windows and use `os.execv` on POSIX
2024-08-15 12:50:46 +02:00
Chris Smowton
3450e509fe Merge pull request #17228 from smowton/smowton/admin/missing-change-notes
Java: add change notes for three recent buildless fixes
2024-08-15 10:56:22 +01:00
Anders Schack-Mulligen
2c591f5420 Dataflow: Fix missing join on summaryLabel. 2024-08-15 11:05:08 +02:00
Michael Nebel
4b3cc5bd0e Merge pull request #17219 from michaelnebel/shared/neutralsourcesink
C#/Java: Fix source- and sink callable provenance overlap.
2024-08-15 11:02:18 +02:00
Anders Schack-Mulligen
fb1dfd4217 Java: Accept test changes. 2024-08-15 10:32:12 +02:00
Paolo Tranquilli
beba032ba5 Kotlin: fix wrapper on windows 2024-08-15 10:31:32 +02:00
Anders Schack-Mulligen
3cdc8d5eca Java: Add PathGraph to test output for default inline flow tests. 2024-08-15 10:17:31 +02:00
Michael Nebel
b16dc20bbd Merge pull request #17230 from github/workflow/coverage/update
Update CSV framework coverage reports
2024-08-15 09:31:16 +02:00
github-actions[bot]
4c0f31d77b Add changed framework coverage reports 2024-08-15 00:18:12 +00:00
Chris Smowton
b4a42de7f4 Java: add change notes for three recent buildless fixes 2024-08-14 18:34:25 +01:00
Anders Schack-Mulligen
c1d03acd45 Merge pull request #17221 from aschackmull/dataflow/qltest-missing-subpath
Dataflow: Add test highlighting missing subpath.
2024-08-14 15:46:32 +02:00
Michael Nebel
27e9cb5384 Merge pull request #16872 from michaelnebel/csharp/updatedotnetmodels
C#: Update .NET 8 Runtime models.
2024-08-14 15:42:02 +02:00
Anders Schack-Mulligen
79dec723b0 Dataflow: Add test highlighting missing subpath. 2024-08-14 13:30:13 +02:00
Michael Nebel
c8d301ed43 C#: Add change note. 2024-08-14 13:13:29 +02:00
Michael Nebel
d5f8adbfee C#: Update test expected output. 2024-08-14 13:13:27 +02:00
Owen Mansel-Chan
0c525972a2 Merge pull request #17193 from github/workflow/coverage/update
Update CSV framework coverage reports
2024-08-14 11:06:15 +01:00
Michael Nebel
4b0427c732 C#: Update .NET 8 runtime models. 2024-08-14 11:24:54 +02:00
Michael Nebel
35ec9db23a C#: Add some manual source neutrals. 2024-08-14 11:24:50 +02:00
Michael Nebel
094c98db5e C#: Update .NET 8 Runtime models. 2024-08-14 11:24:46 +02:00
Michael Nebel
3425efe421 Merge pull request #17208 from michaelnebel/csharp/prettyprintmodels
C#: Pretty print models in tests.
2024-08-14 11:23:01 +02:00
Owen Mansel-Chan
005ffd4f64 Merge branch 'main' into workflow/coverage/update 2024-08-14 09:45:17 +01:00
Tamás Vajk
4e02e34fd5 Merge pull request #17214 from tamasvajk/fix/message-limit
C#: Minor adjustment to limiting the number of extractor messages
2024-08-14 10:05:27 +02:00
Michael Nebel
eaf4f5eeab C#/Java: Update model generation expected output. 2024-08-14 09:57:49 +02:00
Michael Nebel
f0817dc07c C#/Java: Use a parameterized module for making the source and sink callable classes. 2024-08-14 09:50:38 +02:00
Michael Nebel
046018fa25 Java: Add example of missing sink generation. 2024-08-14 09:50:34 +02:00
Michael Nebel
6f79480b40 C#: Add example of missing sink generation. 2024-08-14 09:50:13 +02:00
github-actions[bot]
86ab941acd Add changed framework coverage reports 2024-08-14 00:18:29 +00:00
Tamas Vajk
5f74ead99b C#: Store extractor message in DB for limit reached 2024-08-13 17:24:43 +02:00
Simon Friis Vindum
5e8ac5ef0d C++: Update documentation for cpp/uncontrolled-allocation-size to clarify its scope 2024-08-13 16:27:04 +02:00
Tamas Vajk
05500568c9 C#: Minor adjustment to limiting the number of extractor messages 2024-08-13 16:22:19 +02:00
Michael Nebel
c5343fb829 C#: Make language specific ShowProvenance module and update tests. 2024-08-13 16:10:11 +02:00
Michael Nebel
97f9340a0a C#: Update security related tests and expected output to pretty print MaD. 2024-08-13 16:10:04 +02:00
Michael Nebel
ddbca5aee9 C#: Add PrettyPrintModel post process query and migrate existing test case. 2024-08-13 16:09:59 +02:00
Anders Schack-Mulligen
a782952969 Merge pull request #17202 from aschackmull/dataflow/stagepathgraph-strengthen
Dataflow: bugfix add missing typeStrengthen in StagePathGraph throughflow.
2024-08-13 14:59:47 +02:00
Tom Hvitved
3395dc9e71 Merge pull request #16576 from hvitved/csharp/static-field-side-effect
C#: Add support for flow through side-effects on static fields
2024-08-13 14:16:28 +02:00
Tom Hvitved
aeabee3e34 Merge pull request #17179 from hvitved/shared/pretty-print-models
Go/Java: Share more `PrettyPrintModels.ql` logic
2024-08-13 14:15:40 +02:00
Tom Hvitved
51077ce2e7 Merge pull request #17173 from hvitved/shared/inline-flow-provenance
Shared: Apply `ShowProvenance` in `InlineFlowTest.qll`
2024-08-13 14:15:08 +02:00
Tom Hvitved
69b581cc4d C#: Update expected test output 2024-08-13 13:34:47 +02:00
Tom Hvitved
c9aaba677d Ruby: Update expected test output 2024-08-13 13:34:46 +02:00
Tom Hvitved
0fcfb47423 Sync shared files 2024-08-13 13:34:45 +02:00
Tom Hvitved
f83df76928 Shared: Apply ShowProvenance in InlineFlowTest.qll 2024-08-13 13:34:43 +02:00
Tom Hvitved
d5a0df3f87 Go/Java: Share more PrettyPrintModels.ql logic 2024-08-13 12:48:22 +02:00
Geoffrey White
8646643f0e Swift: Change note. 2024-08-13 11:23:41 +01:00
Geoffrey White
446c992181 Swift: Exclude tel:, mailto: and similar URLs from the query. 2024-08-13 11:23:40 +01:00
Geoffrey White
897bfb5517 Swift: Convert URL sinks for swift/cleartext-transmission to be defined in QL. 2024-08-13 11:23:39 +01:00
Tom Hvitved
fbcb4498fe Merge pull request #16817 from hvitved/csharp/multi-body-dataflow-dispatch
C#: Restrict multi-body dataflow dispatch based on file-system distance
2024-08-13 12:15:22 +02:00
Rasmus Wriedt Larsen
6dd52e45e4 Merge pull request #17154 from RasmusWL/poetry-update
Python: Upgrade lockfile for extractor tests
2024-08-13 11:54:15 +02:00
Geoffrey White
345e1840f2 Swift: Add more test cases for swift/cleartext-transmission. 2024-08-13 09:28:23 +01:00
Owen Mansel-Chan
0dfdee775b Merge pull request #17177 from owen-mc/go/mad/convert-sink-3
Go: convert regex-use, url-redirection sinks to use models-as-data
2024-08-12 16:21:48 +01:00
Joe Farebrother
c98110306b Merge pull request #16807 from JLLeitschuh/patch-7
Align Ruby NonConstantKernelOpen.ql Severity
2024-08-12 16:07:29 +01:00
Owen Mansel-Chan
6b6e773ce1 Merge pull request #17196 from owen-mc/go/tidy-up-test-go-mod-2
Go: Remove unneeded dependency from test go.mod
2024-08-12 15:48:05 +01:00
Owen Mansel-Chan
e6873cfb2e Merge pull request #17195 from owen-mc/go/tidy-up-test-go-mod
Go: Remove unneeded dependencies from test go.mod
2024-08-12 15:45:32 +01:00
Tamás Vajk
8bc9e497eb Merge pull request #17200 from tamasvajk/fix/logging
C#: Fix logging in assets file parsing
2024-08-12 16:18:31 +02:00
Joe Farebrother
d08713f66c Merge branch 'main' into patch-7 2024-08-12 15:12:33 +01:00
Anders Schack-Mulligen
75aa439132 Merge pull request #17201 from aschackmull/dataflow/pathgraphsig1
Dataflow: Reduce duplication, define PathGraphSig only once.
2024-08-12 16:10:07 +02:00
Anders Schack-Mulligen
757fdf567d Dataflow: bugfix add missing typeStrengthen in StagePathGraph throughflow. 2024-08-12 15:53:58 +02:00
Tamas Vajk
bfaafcf88c Address review findings 2024-08-12 15:49:09 +02:00
Anders Schack-Mulligen
3d5d270dfb Dataflow: Reduce duplication, define PathGraphSig only once. 2024-08-12 15:22:17 +02:00
Tamas Vajk
089999dd3c C#: Fix logging in assets file parsing 2024-08-12 14:06:28 +02:00
Michael Nebel
4a5c9f0ec4 Merge pull request #17007 from michaelnebel/shared/neutralimplementation
C#/Java/Go: Neutrals are split into separate classes.
2024-08-12 13:58:12 +02:00
Anders Schack-Mulligen
3c6459e65a Merge pull request #17029 from aschackmull/dataflow/stagepathgraph-provenance
Dataflow: Add provenance to StagePathGraph.
2024-08-12 13:30:03 +02:00
Anders Schack-Mulligen
f28f42bcba Merge pull request #17049 from aschackmull/dataflow/bugfix-flowfeature-sinkctx
Dataflow: Fix bug causing spurious flow for FeatureHasSinkCallContext
2024-08-12 13:29:42 +02:00
Tamás Vajk
c514d36d90 Merge pull request #17197 from tamasvajk/fix/missing-xmldoc
C#: Exclude `System.Runtime.CompilerServices` attributes from XML doc…
2024-08-12 13:12:46 +02:00
Tamás Vajk
5248c8e3a2 Merge pull request #17198 from tamasvajk/remove-unstable-telemetry
C#: Remove timing values from extractor telemetry query
2024-08-12 13:10:45 +02:00
Tamas Vajk
fa3b65fc4e C#: Remove timing values from extractor telemetry query 2024-08-12 11:59:53 +02:00
Tamas Vajk
63d07a933a C#: Exclude System.Runtime.CompilerServices attributes from XML documentation needed check 2024-08-12 11:48:57 +02:00
Owen Mansel-Chan
600c84505f Remove unneeded dependency from test go.mod 2024-08-12 10:15:36 +01:00
Owen Mansel-Chan
30dc2289a3 Remove unneeded dependencies from test go.mod 2024-08-12 10:14:09 +01:00
Tom Hvitved
1bcac50db1 C#: Add support for flow through side-effects on static fields 2024-08-12 10:01:51 +02:00
Tom Hvitved
29c204bc61 C#: Add a data flow test for side effects on static fields 2024-08-12 10:01:48 +02:00
Owen Mansel-Chan
1df81dbfb6 Use regex-use[receiver] instead of regex-use[-1] 2024-08-11 00:37:25 +01:00
Owen Mansel-Chan
2fe74a8554 Update model validation 2024-08-11 00:29:58 +01:00
Owen Mansel-Chan
49f3959405 Convert url-redirection sinks to MaD 2024-08-11 00:29:53 +01:00
Owen Mansel-Chan
3a285f500e Convert regex-use sinks to use MaD 2024-08-11 00:21:31 +01:00
Owen Mansel-Chan
a5a999f7d6 Merge pull request #17162 from owen-mc/go/mad/convert-sink-2
Go: Convert log-injection, path-injection and command-injection sinks to use models-as-data
2024-08-11 00:20:42 +01:00
Owen Mansel-Chan
f851f2120f Merge pull request #17186 from github/workflow/coverage/update
Update CSV framework coverage reports
2024-08-10 12:55:44 +01:00
github-actions[bot]
8b51f9865d Add changed framework coverage reports 2024-08-10 00:18:17 +00:00
Cornelius Riemenschneider
974868cf9c Merge pull request #17178 from github/criemen/pytest-swift
Port Swift integration tests to pytest.
2024-08-09 20:06:20 +02:00
Cornelius Riemenschneider
0b60bfecd1 Merge branch 'main' into criemen/pytest-swift 2024-08-09 18:16:46 +02:00
Cornelius Riemenschneider
d82f66cc63 Merge pull request #17149 from github/criemen/pytest-go
Port the go integration tests to pytest framework
2024-08-09 18:13:46 +02:00
Chris Smowton
d97f6572c2 Merge pull request #17189 from smowton/smowton/admin/executable-war-fetch-test
Java: Add test for buildless fetching an executable war file
2024-08-09 16:10:12 +01:00
Owen Mansel-Chan
6f5a045437 Fix typo in package path
Co-authored-by: Edward Minnix III <egregius313@github.com>
2024-08-09 14:27:58 +01:00
Chris Smowton
00efebe8b0 Add test for buildless fetching an executable war file 2024-08-09 12:32:43 +01:00
Cornelius Riemenschneider
1689e60445 Merge remote-tracking branch 'origin/main' into criemen/pytest-swift 2024-08-09 11:22:41 +02:00
Cornelius Riemenschneider
cdf067703b Merge remote-tracking branch 'origin/main' into criemen/pytest-go 2024-08-09 09:59:29 +02:00
Cornelius Riemenschneider
ae96111848 Revert "Simplify test."
This reverts commit 2310bd94a4.
2024-08-09 09:48:38 +02:00
Chris Smowton
4de0d10dce Merge pull request #17111 from smowton/smowton/admin/gradle-classifier-test
Java: Add test for Gradle fetching a jar with a classifier
2024-08-08 17:50:50 +01:00
Michael B. Gale
267ee3dce9 Merge pull request #17168 from github/dependabot/go_modules/go/extractor/extractor-dependencies-d889f6e8ba 2024-08-08 17:16:23 +01:00
Owen Mansel-Chan
32958e9625 Pretty print models in stored command test 2024-08-08 17:06:06 +01:00
Owen Mansel-Chan
d066faf212 Update test expectatations 2024-08-08 17:06:01 +01:00
Owen Mansel-Chan
5ef37c4501 Converting command-injection sinks to use MaD 2024-08-08 17:03:57 +01:00
Owen Mansel-Chan
8536e7eb02 Convert path-injection sinks to use MaD 2024-08-08 17:03:53 +01:00
Owen Mansel-Chan
fa472f5e18 Convert logging sinks to use MaD 2024-08-08 17:01:49 +01:00
Owen Mansel-Chan
d240951da0 Merge pull request #17157 from owen-mc/go/mad/change-provenance-for-package-grouping
Go: Change provenance for MaD models that use package grouping
2024-08-08 16:57:31 +01:00
Alexander Eyers-Taylor
ffd811a55d Merge pull request #17182 from github/post-release-prep/codeql-cli-2.18.2
Post-release preparation for codeql-cli-2.18.2
2024-08-08 16:28:03 +01:00
Chris Smowton
84f3b7322e Add test for Gradle fetching a jar with a classifier 2024-08-08 15:49:11 +01:00
Michael B. Gale
2109bba928 Go: Bump Go version in ExternalValueFlow test 2024-08-08 15:34:47 +01:00
Cornelius Riemenschneider
9ce8018093 Autobuilder test/unsupported os: Promote to Windows and Linux test.
This way, we have at least one Windows test, which makes our internal testing easier.
2024-08-08 15:41:48 +02:00
Owen Mansel-Chan
c0a69f197d Merge pull request #17180 from owen-mc/go/update-framework-csv
Go: Fix mistake in frameworks.csv
2024-08-08 14:25:56 +01:00
github-actions[bot]
cc6d87c276 Post-release preparation for codeql-cli-2.18.2 2024-08-08 12:56:21 +00:00
Cornelius Riemenschneider
448da89519 Merge remote-tracking branch 'origin/main' into criemen/pytest-go 2024-08-08 13:52:22 +02:00
Cornelius Riemenschneider
2310bd94a4 Simplify test. 2024-08-08 13:51:38 +02:00
Owen Mansel-Chan
55de3511b0 Fix frameworks.csv 2024-08-08 10:31:00 +01:00
Paolo Tranquilli
875d1d3be4 Merge pull request #17172 from github/redsun82/bazel-lfs
Bazel: make `git_lfs_probe.py` try all available endpoints
2024-08-08 11:06:19 +02:00
Cornelius Riemenschneider
081b8759d4 Merge remote-tracking branch 'origin/main' into criemen/pytest-swift 2024-08-08 10:33:05 +02:00
Cornelius Riemenschneider
de40dfdc17 Merge pull request #17167 from github/criemen/pytest-csharp
Port C# tests to pytest.
2024-08-08 10:32:30 +02:00
Cornelius Riemenschneider
2b0ff17884 Fix test expectations. 2024-08-08 10:28:42 +02:00
Erik Krogh Kristensen
41506fbfef Merge pull request #14666 from am0o0/amammad-js-hardcodedJWTKey
JS: Extends CredentialsNode class mostly related to JWT authentication packages
2024-08-08 10:20:45 +02:00
Cornelius Riemenschneider
718d46ed2f Merge remote-tracking branch 'origin/main' into criemen/pytest-csharp 2024-08-08 09:27:19 +02:00
Cornelius Riemenschneider
e5261f8bfc Port Swift integration tests to pytest. 2024-08-08 08:47:49 +02:00
Erik Krogh Kristensen
2d3d46e0e2 Merge pull request #17166 from erik-krogh/arbitarySpecifiers
JS: Parse arbitary module specifiers
2024-08-08 08:29:13 +02:00
dependabot[bot]
c1e242ecda 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.23.0 to 0.24.0
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.23.0...v0.24.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-08 03:50:32 +00:00
Tamás Vajk
ef21ee53a5 Merge pull request #17169 from tamasvajk/buildless/db-quality-query
C#: Add diagnostic query indicating low database quality
2024-08-07 21:36:37 +02:00
Paolo Tranquilli
e451f2b343 Bazel: fix typo 2024-08-07 20:54:40 +02:00
am0o0
b64cb4da09 remove a part of code related to debugging :) 2024-08-07 20:37:20 +02:00
Cornelius Riemenschneider
16e19a6b04 Port missing test. 2024-08-07 18:43:41 +02:00
Cornelius Riemenschneider
a38b6abdbe Merge branch 'main' into criemen/pytest-csharp 2024-08-07 18:34:46 +02:00
Paolo Tranquilli
58088b62df Bazel: make git_lfs_probe.py a bit more backward compatible 2024-08-07 16:46:31 +02:00
Tamas Vajk
0263cc1609 Improve code quality 2024-08-07 15:27:14 +02:00
Cornelius Riemenschneider
67331fb810 Accept test output changes.
These test expectations change, as the test is now
run in a temp directory that's not located in our checkout.
Previously, `dotnet build` was picking up files from the repository,
like the editor config and the sourcelink (which requires a git repository
in a parent directory).
2024-08-07 12:53:06 +02:00
Cornelius Riemenschneider
59922e5c46 Port C# tests to pytest. 2024-08-07 12:53:05 +02:00
Tom Hvitved
d9ff4ef567 Merge pull request #17155 from hvitved/java/array-ref-bad-join
Java: Fix bad join
2024-08-07 12:39:40 +02:00
Paolo Tranquilli
c576a116f5 Bazel: make git_lfs_probe.py try all available endpoints 2024-08-07 12:38:43 +02:00
Owen Mansel-Chan
40282daeb5 Merge pull request #17152 from github/workflow/coverage/update
Update CSV framework coverage reports
2024-08-07 11:04:02 +01:00
Paolo Tranquilli
b63bd2ad14 Bazel: format git_lfs_probe.py 2024-08-07 11:57:35 +02:00
Owen Mansel-Chan
5fe3d17a26 Merge branch 'main' into workflow/coverage/update 2024-08-07 10:52:55 +01:00
Tamás Vajk
42be9e98c8 Merge pull request #16938 from tamasvajk/feature/extract-files-multiple
C#: Do not skip extraction of already seen source files
2024-08-07 11:23:48 +02:00
Tamas Vajk
2a2b371244 Add change note 2024-08-07 11:15:10 +02:00
Tamas Vajk
7388c6db24 Downgrade buildless TSP warnings to notes 2024-08-07 11:14:16 +02:00
Tamas Vajk
139e09d5d3 C#: Add diagnostic query indicating low database quality 2024-08-07 10:49:12 +02:00
erik-krogh
bef4fe627d make sure the new identifiers have end-locations 2024-08-07 10:25:22 +02:00
Joe Farebrother
62c2fe6b17 Merge pull request #16933 from joefarebrother/python-cookie-concept-promote
Python: Promote the insecure cookie query from experimental
2024-08-07 09:06:05 +01:00
github-actions[bot]
d88b25c243 Add changed framework coverage reports 2024-08-07 00:18:15 +00:00
Joe Farebrother
24df54804a Review suggestion - Add link to qldoc
Co-authored-by: yoff <lerchedahl@gmail.com>
2024-08-06 22:59:14 +01:00
erik-krogh
b8187ed294 support arbitary export specifiers 2024-08-06 20:45:57 +02:00
erik-krogh
5f7f37f6c8 support arbitary import specifiers 2024-08-06 20:45:53 +02:00
Dave Bartolomeo
e222b49258 Merge pull request #17160 from hvitved/csharp/update-expected
C#: Update expected test output
2024-08-06 13:27:49 -04:00
Dave Bartolomeo
b2d20f1fed Merge pull request #17161 from geoffw0/madfix
C++: Accept test changes caused by new CLI version.
2024-08-06 12:25:27 -04:00
Angela P Wen
1f37662e3b Merge pull request #17158 from github/angelapwen/update-codeql-docs
Docs: remove `ubuntu-18.04`, indicate Swift requires macOS
2024-08-06 18:17:15 +02:00
Cornelius Riemenschneider
b4db86491d Merge remote-tracking branch 'origin/main' into criemen/pytest-go 2024-08-06 18:09:55 +02:00
Cornelius Riemenschneider
c88ed68766 Merge pull request #17151 from github/criemen/pytest-ruby
Ruby: Port integration tests to pytest.
2024-08-06 18:09:34 +02:00
Cornelius Riemenschneider
46cf779062 Address review. 2024-08-06 18:08:25 +02:00
Geoffrey White
bf66a787ab C++: Accept test changes caused by new CLI version. 2024-08-06 16:45:48 +01:00
Cornelius Riemenschneider
ffde68aaec Merge remote-tracking branch 'origin/main' into criemen/pytest-go 2024-08-06 17:03:16 +02:00
Cornelius Riemenschneider
def662d641 Merge branch 'main' into criemen/pytest-ruby 2024-08-06 16:41:23 +02:00
Tom Hvitved
00d447ba4b C#: Update expected test output 2024-08-06 15:43:08 +02:00
Owen Mansel-Chan
f0d1740ff8 Update text expectations 2024-08-06 13:48:45 +01:00
Angela P Wen
4489749ce4 Docs: indicate Swift support requires macOS 2024-08-06 14:33:03 +02:00
Angela P Wen
14977a7917 Docs: remove deprecated ubuntu-18.04 2024-08-06 14:30:40 +02:00
Owen Mansel-Chan
572c773345 Change provenance for MaD models that use package grouping 2024-08-06 13:13:39 +01:00
Tom Hvitved
a7410e4a16 Java: Fix bad join
Before
```
[2024-08-06 10:37:59] Evaluated non-recursive predicate BoundingChecks::arrayReference/1#754911ba@0628dahn in 20981ms (size: 2009682526).
Evaluated relational algebra for predicate BoundingChecks::arrayReference/1#754911ba@0628dahn with tuple counts:
             94480   ~0%    {2} r1 = SCAN `Expr::ArrayAccess.getArray/0#dispred#b90c658a` OUTPUT In.1, In.0

                32   ~0%    {2} r2 = JOIN r1 WITH `Expr::MethodCall.getMethod/0#dispred#41989dc9` ON FIRST 1 OUTPUT Rhs.1, Lhs.1
              1013   ~1%    {2}    | JOIN WITH `Expr::MethodCall.getMethod/0#dispred#41989dc9_10#join_rhs` ON FIRST 1 OUTPUT Lhs.1, Rhs.1

             92091   ~4%    {2} r3 = JOIN r1 WITH variableBinding ON FIRST 1 OUTPUT Rhs.1, Lhs.1
        2009681513   ~0%    {2}    | JOIN WITH variableBinding_10#join_rhs ON FIRST 1 OUTPUT Lhs.1, Rhs.1

        2009682526   ~0%    {2} r4 = r2 UNION r3
                            return r4

[2024-08-06 10:38:02] Evaluated non-recursive predicate BoundingChecks::lessthanLength/1#48b5e1b7@2885308n in 0ms (size: 108).
Evaluated relational algebra for predicate BoundingChecks::lessthanLength/1#48b5e1b7@2885308n with tuple counts:
        1518  ~0%    {2} r1 = JOIN `Expr::ComparisonExpr.isStrict/0#dispred#fd8c6ddb` WITH `Expr::ComparisonExpr.getGreaterOperand/0#dispred#e8df4b14` ON FIRST 1 OUTPUT Rhs.1, Lhs.0
         455  ~2%    {2}    | JOIN WITH Expr::FieldAccess#2b664c37 ON FIRST 1 OUTPUT Lhs.1, Lhs.0
         455  ~1%    {3}    | JOIN WITH `Expr::ComparisonExpr.getLesserOperand/0#dispred#d7744bc2` ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Rhs.1
         455  ~0%    {5}    | JOIN WITH `Expr::FieldAccess.getField/0#dispred#29ef4aa0` ON FIRST 1 OUTPUT Rhs.1, _, Lhs.1, Lhs.0, Lhs.2
         455  ~0%    {5}    | REWRITE WITH Out.1 := "length"
         116  ~0%    {3}    | JOIN WITH `Element::Element.hasName/1#dispred#8acbbbde` ON FIRST 2 OUTPUT Lhs.4, Lhs.2, Lhs.3
          93  ~0%    {3}    | JOIN WITH variableBinding ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Rhs.1
          93  ~1%    {3}    | JOIN WITH `Expr::VarAccess.getQualifier/0#dispred#2b0f1cd1` ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Rhs.1
         484  ~2%    {3}    | JOIN WITH variableBinding_10#join_rhs ON FIRST 1 OUTPUT Lhs.1, Rhs.1, Lhs.2
         277  ~3%    {2}    | JOIN WITH `BoundingChecks::conditionHolds/2#fa0354b9#bb` ON FIRST 2 OUTPUT Lhs.1, Lhs.2
         166  ~5%    {2}    | JOIN WITH `Expr::ArrayAccess.getIndexExpr/0#dispred#345f6cf4_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1
         110  ~0%    {1}    | JOIN WITH `BoundingChecks::arrayReference/1#754911ba` ON FIRST 2 OUTPUT Lhs.0
                     return r1
```

After
```
[2024-08-06 13:29:50] Evaluated non-recursive predicate BoundingChecks::lengthAccess/2#54b10eff@719e68tb in 0ms (size: 309).
Evaluated relational algebra for predicate BoundingChecks::lengthAccess/2#54b10eff@719e68tb with tuple counts:
        6241  ~0%    {2} r1 = JOIN `BoundingChecks::getAnAccess/1#152ad44e_10#join_rhs` WITH `Expr::VarAccess.getQualifier/0#dispred#2b0f1cd1_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1
        6240  ~0%    {4}    | JOIN WITH `Expr::FieldAccess.getField/0#dispred#29ef4aa0` ON FIRST 1 OUTPUT Rhs.1, _, Lhs.1, Lhs.0
        6240  ~0%    {4}    | REWRITE WITH Out.1 := "length"
         309  ~2%    {2}    | JOIN WITH `Element::Element.hasName/1#dispred#8acbbbde` ON FIRST 2 OUTPUT Lhs.3, Lhs.2
                     return r1

[2024-08-06 13:29:50] Evaluated non-recursive predicate BoundingChecks::lessthanLength/1#48b5e1b7@0fcac509 in 1ms (size: 108).
Evaluated relational algebra for predicate BoundingChecks::lessthanLength/1#48b5e1b7@0fcac509 with tuple counts:
        94480  ~0%    {3} r1 = JOIN `Expr::ArrayAccess.getArray/0#dispred#b90c658a` WITH `Expr::ArrayAccess.getIndexExpr/0#dispred#345f6cf4` ON FIRST 1 OUTPUT Rhs.1, Lhs.0, Lhs.1
          648  ~4%    {4}    | JOIN WITH variableBinding ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Lhs.0, Rhs.1
          621  ~1%    {4}    | JOIN WITH `BoundingChecks::getAnAccess/1#152ad44e_10#join_rhs` ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Lhs.3, Rhs.1
          344  ~0%    {4}    | JOIN WITH `BoundingChecks::conditionHolds/2#fa0354b9#bb_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2, Lhs.3
          341  ~0%    {4}    | JOIN WITH `Expr::ComparisonExpr.isStrict/0#dispred#fd8c6ddb` ON FIRST 1 OUTPUT Lhs.0, Lhs.1, Lhs.2, Lhs.3
          341  ~0%    {5}    | JOIN WITH `Expr::ComparisonExpr.getGreaterOperand/0#dispred#e8df4b14` ON FIRST 1 OUTPUT Rhs.1, Lhs.3, Lhs.1, Lhs.2, Lhs.0
          110  ~2%    {3}    | JOIN WITH `BoundingChecks::lengthAccess/2#54b10eff` ON FIRST 2 OUTPUT Lhs.4, Lhs.2, Lhs.3
          110  ~0%    {3}    | JOIN WITH `Expr::ComparisonExpr.getLesserOperand/0#dispred#d7744bc2` ON FIRST 1 OUTPUT Rhs.1, Lhs.2, Lhs.1
          110  ~0%    {1}    | JOIN WITH variableBinding ON FIRST 2 OUTPUT Lhs.2
                      return r1
```
2024-08-06 13:30:19 +02:00
Rasmus Wriedt Larsen
d50898e114 Python: Downgrade packaging for Python 3.7 support 2024-08-06 11:15:48 +02:00
Cornelius Riemenschneider
d42e424289 Port integration tests to pytest. 2024-08-05 22:07:42 +02:00
Tamas Vajk
a4e357e46d Remove unused FileIsUpToDate 2024-08-05 15:56:12 +02:00
Tamas Vajk
ec9de41fea Add change note 2024-08-05 15:55:32 +02:00
Tamas Vajk
968c279fd7 Add DB upgrade/downgrade scripts 2024-08-05 15:55:29 +02:00
Tamas Vajk
a31d90897d C#: Do not skip extraction of already seen source files 2024-08-05 15:55:26 +02:00
am0o0
e4deb7d304 apply autoformating for HardcodedCredentials.ql 2024-08-05 14:58:37 +02:00
am0o0
fce183c7cb apply autoformat to HardcodedCredentialsCustomizations.qll 2024-08-05 14:25:15 +02:00
Rasmus Wriedt Larsen
4eb6afa880 Python: Update poetry.lock 2024-08-05 14:14:41 +02:00
Cornelius Riemenschneider
133a0914b5 Delete old go integration test library. 2024-08-05 13:31:33 +02:00
Cornelius Riemenschneider
6cb6aeffbb Rename build-environment.expected to build_environment.expected.
This follows the convention of our other expected files.
2024-08-05 13:30:23 +02:00
Cornelius Riemenschneider
aec06c8100 Port go tests. 2024-08-05 13:22:03 +02:00
am0o0
354fcbe7fe apply changes from @erik-krogh 2024-08-01 20:14:36 +02:00
Joe Farebrother
e68ef87662 update inline tests for rest_framework tests 2024-07-29 23:35:36 +01:00
Joe Farebrother
82da8b95a7 Fix typo 2024-07-29 23:29:19 +01:00
Joe Farebrother
f10d007496 Add additional test for kwargs case 2024-07-29 23:27:22 +01:00
Joe Farebrother
68512eea14 Remove remaining files from experimental tests 2024-07-29 11:19:33 +01:00
Joe Farebrother
ef3bbeacd6 Add check for kwargs in cookie attribute predicates 2024-07-29 11:17:42 +01:00
Joe Farebrother
90e87a1752 Factor each framework implementation of the cookie parameters to a common concept 2024-07-29 10:51:24 +01:00
Joe Farebrother
c7f9095739 Apply similar changes to httponly 2024-07-29 10:29:59 +01:00
Joe Farebrother
1127b08635 Merge branch 'main' into python-cookie-concept-promote 2024-07-29 10:26:03 +01:00
Joe Farebrother
d997eee6e6 Code review suggestions - make definitions clearer
Co-authored-by: yoff <lerchedahl@gmail.com>
2024-07-29 10:22:33 +01:00
Joe Farebrother
8f714c631f Code reveiw suggestions. correction in changenote + style in example
Co-authored-by: yoff <lerchedahl@gmail.com>
2024-07-24 21:37:12 +01:00
Anders Schack-Mulligen
86c63dbedf Dataflow: Fix bug causing spurious flow for FeatureHasSinkCallContext. 2024-07-23 14:59:24 +02:00
Anders Schack-Mulligen
f598a0b607 Dataflow: Add test highlighting bug. 2024-07-23 14:34:33 +02:00
Joe Farebrother
db27fd934a Add tests for tornado and twisted 2024-07-23 13:21:37 +01:00
Joe Farebrother
44271813a5 Add change note 2024-07-23 10:15:28 +01:00
Joe Farebrother
93f70b3ad9 Add unit tests 2024-07-23 10:15:23 +01:00
Joe Farebrother
b28d79960b Update ConceptsTests and make a fix 2024-07-23 10:15:09 +01:00
Joe Farebrother
be87eb50d4 Add cookie models to each framework 2024-07-23 10:15:02 +01:00
Joe Farebrother
a73d675e6e Remove experimental query versions 2024-07-23 10:14:55 +01:00
Joe Farebrother
226e4eb8a5 Use a 3-valued newtype for hasSameSiteAttribute 2024-07-23 10:14:45 +01:00
Joe Farebrother
df5569fda9 Add documentation 2024-07-23 10:14:40 +01:00
Joe Farebrother
32fbe52f0f Model cookie attributes for Django and Flask 2024-07-23 10:14:33 +01:00
Joe Farebrother
6a7bdaf284 Fix experimental query compilation 2024-07-23 10:14:29 +01:00
Joe Farebrother
033dd9f8a6 Promote insecure cookie query 2024-07-23 10:14:22 +01:00
Joe Farebrother
9ad6c8c5eb Implement cookie attributes for cases in which a raw header is set 2024-07-23 10:14:16 +01:00
Joe Farebrother
2df09f6194 Change flag predicates to boolean parameters rather than boolean results 2024-07-23 10:14:08 +01:00
Joe Farebrother
6f7b2a2d20 Add cookie flags to cookie write concept, and alter experimental queries to use them 2024-07-23 10:14:00 +01:00
Anders Schack-Mulligen
272e523323 Dataflow: Add provenance to StagePathGraph. 2024-07-22 15:02:13 +02:00
Michael Nebel
2796597d1a Code quality improvements. 2024-07-19 09:36:17 +02:00
Michael Nebel
0bf1ed1d96 C#/Java: Update model generator expected output. 2024-07-18 16:35:40 +02:00
Michael Nebel
ca4bd0c606 C#/Java/Go: Neutrals are split into seperate classes. 2024-07-18 16:29:38 +02:00
Michael Nebel
c9832df3c0 C#/Java: Add test for missing neutral summary generation. 2024-07-18 16:29:34 +02:00
Tom Hvitved
0459422a6c C#: Restrict multi-body dataflow dispatch based on file-system distance 2024-07-11 16:52:20 +02:00
Tom Hvitved
35bf990f23 C#: Add data flow test for multi-body dispatch 2024-07-11 16:52:18 +02:00
am0o0
b360c8adb8 Update hardcodedCredentials query file to only exclude 'jwt key' kind from with the isTestFile predicate.
According to expected test results, with a new query, the jwt sinks of __test__/ dir have been exluded from query results.
2024-07-01 15:00:08 +02:00
am0o0
5a1877547f update test cases of __tests__/ dir
since we want to check if a jwt related sink is in this dir or not
2024-07-01 14:50:07 +02:00
am0o0
6ecd8b7ee8 add new default cred kind 2024-07-01 14:42:34 +02:00
am0o0
fa8c457015 move the TextEncoder and Buffer jose.base64url taint steps to a local query taint step 2024-07-01 12:11:53 +02:00
am0o0
60aa711005 implement TextEncoderStep taint step with globalVarRef predicate 2024-07-01 11:59:05 +02:00
am0o0
65fdb8ccce move jose SharedTaintStep to a local taint step, add more additional steps with test cases, update test cases and expected test results 2024-07-01 11:38:17 +02:00
Jonathan Leitschuh
472cca9221 Align Java CommandInjectionRuntimeExec.ql Severity
Align severity with other command injection vulnerabilities:

- 4a448f445e/cpp/ql/src/Security/CWE/CWE-078/ExecTainted.ql (L8)
- 4a448f445e/go/ql/src/Security/CWE-078/CommandInjection.ql (L7)
- 4a448f445e/swift/ql/src/queries/Security/CWE-078/CommandInjection.ql (L7)
- 4a448f445e/javascript/ql/src/Security/CWE-078/CommandInjection.ql (L7)
2024-06-21 10:29:27 -04:00
Jonathan Leitschuh
1728e5dfd5 Align Ruby NonConstantKernelOpen.ql Severity
Align severity with other command injection vulnerabilities:

 - 4a448f445e/cpp/ql/src/Security/CWE/CWE-078/ExecTainted.ql (L8)
- 4a448f445e/go/ql/src/Security/CWE-078/CommandInjection.ql (L7)
- 4a448f445e/swift/ql/src/queries/Security/CWE-078/CommandInjection.ql (L7)
- 4a448f445e/javascript/ql/src/Security/CWE-078/CommandInjection.ql (L7)
2024-06-21 10:27:47 -04:00
am0o0
5a69bbf6b0 use isTestFile from ClassifyFiles module file instead previous where condition, update tests accordingly 2024-06-07 06:11:48 +02:00
am0o0
e4ffdb848e add tests for new where condition, update expected test results 2024-06-06 14:30:06 +02:00
am0o0
ee05ec0386 remove sanitnzer and add a where condition instead
use a simpler where condition(the former sanitizer) for overcoming performance problems
2024-06-06 14:16:41 +02:00
am0o0
61a11c6512 Or to or in docs 2024-06-06 14:10:15 +02:00
am0o0
71dfdfaa92 remove the debug query 2024-05-27 09:33:10 +02:00
am0o0
c2f96a1352 fix a document 2024-05-25 19:35:20 +02:00
am0o0
5d98ec33ab stash: add debug query 2024-05-25 13:06:41 +02:00
am0o0
d77513579f update tests 2024-05-25 12:15:25 +02:00
Am
2226f5126b Merge branch 'main' into amammad-js-hardcodedJWTKey 2024-05-25 13:40:46 +03:30
am0o0
4e365e242c fix conflict 2024-05-25 12:08:05 +02:00
am0o0
20c087ce39 update tests 2024-05-25 12:06:07 +02:00
am0o0
c299b5657a Revert "stash"
This reverts commit bdee99ae88.
2024-05-25 12:03:00 +02:00
am0o0
1860af075d fix conflict 2024-05-25 12:01:12 +02:00
amammad
bdee99ae88 stash 2024-05-13 14:37:05 +02:00
amammad
01fb29e8dc remove my Hardcoded secret key query in favor of CWE-798:HardcodedCredentials 2023-11-02 16:29:36 +01:00
amammad
e1d42fad2c move new secret key sinks to existing CredentialsNode class,
add new additional global taint and dataflow steps
update tests of CWE-798
add a new sanitizer for `semmle.javascript.security.dataflow.HardcodedCredentialsQuery`
2023-11-02 16:09:01 +01:00
amammad
8e0f52cebc remove noverification query 2023-10-19 11:57:06 +02:00
788 changed files with 111804 additions and 4464 deletions

View File

@@ -1,5 +1,17 @@
# allow automatic platform-specific configurations (:linux, :macos, :windows)
common --enable_platform_specific_config
# do not shut down the bazel server on idleness
startup --max_idle_secs=0
common --enable_bzlmod
# use stricter environment filtering for actions
build --incompatible_strict_action_env
# Enable verbose failures so debugging the build is easier
build --verbose_failures
# print test output, like sembuild does.
# Set to `errors` if this is too verbose.
test --test_output all
# because we use --override_module with `%workspace%`, the lock file is not stable
common --lockfile_mode=off
@@ -24,5 +36,10 @@ common --registry=file:///%workspace%/misc/bazel/registry
common --registry=https://bcr.bazel.build
common --@rules_dotnet//dotnet/settings:strict_deps=false
common --experimental_isolated_extension_usages
# performance improvement on Windows
common --incompatible_use_plus_in_repo_names
try-import %workspace%/local.bazelrc

View File

@@ -8,3 +8,4 @@ common --registry=https://bcr.bazel.build
# its implementation packages without providing any code itself.
# We either can depend on internal implementation details, or turn of strict deps.
common --@rules_dotnet//dotnet/settings:strict_deps=false
common --experimental_isolated_extension_usages

View File

@@ -1 +1 @@
7.2.1
7.3.1

View File

@@ -1,6 +1,7 @@
module(
name = "codeql",
name = "ql",
version = "0.0",
repo_name = "codeql",
)
# this points to our internal repository when `codeql` is checked out as a submodule thereof
@@ -30,11 +31,13 @@ bazel_dep(name = "rules_rust", version = "0.49.1")
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
crate = use_extension(
# crate_py but shortened due to Windows file path considerations
cp = use_extension(
"@rules_rust//crate_universe:extension.bzl",
"crate",
isolate = True,
)
crate.from_cargo(
cp.from_cargo(
name = "py_deps",
cargo_lockfile = "//python/extractor/tsg-python:Cargo.lock",
manifests = [
@@ -42,15 +45,23 @@ crate.from_cargo(
"//python/extractor/tsg-python/tsp:Cargo.toml",
],
)
crate.from_cargo(
name = "ruby_deps",
use_repo(cp, "py_deps")
# crate_ruby, but shortened due to windows file paths
r = use_extension(
"@rules_rust//crate_universe:extension.bzl",
"crate",
isolate = True,
)
r.from_cargo(
name = "rd",
cargo_lockfile = "//ruby/extractor:Cargo.lock",
manifests = [
"//ruby/extractor:Cargo.toml",
"//ruby/extractor/codeql-extractor-fake-crate:Cargo.toml",
],
)
use_repo(crate, "py_deps", "ruby_deps")
use_repo(r, ruby_deps = "rd")
dotnet = use_extension("@rules_dotnet//dotnet:extensions.bzl", "dotnet")
dotnet.toolchain(dotnet_version = "8.0.101")

View File

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

View File

@@ -953,21 +953,3 @@ private class SummarizedCallableAdapter extends SummarizedCallable {
interpretSummary(this, _, _, _, provenance, _)
}
}
// adapter class for converting Mad neutrals to `NeutralCallable`s
private class NeutralCallableAdapter extends NeutralCallable {
string kind;
string provenance_;
NeutralCallableAdapter() {
// Neutral models have not been implemented for CPP.
none() and
exists(this) and
exists(kind) and
exists(provenance_)
}
override string getKind() { result = kind }
override predicate hasProvenance(Provenance provenance) { provenance = provenance_ }
}

View File

@@ -1,11 +1,9 @@
int factor = atoi(getenv("BRANCHING_FACTOR"));
// GOOD: Prevent overflow by checking the input
if (factor < 0 || factor > 1000) {
log("Factor out of range (%d)\n", factor);
return -1;
}
// This line can allocate too little memory if factor
// is very large.
// BAD: This can allocate too little memory if factor is very large due to overflow.
char **root_node = (char **) malloc(factor * sizeof(char *));
// GOOD: Prevent overflow and unbounded allocation size by checking the input.
if (factor > 0 && factor <= 1000) {
char **root_node = (char **) malloc(factor * sizeof(char *));
}

View File

@@ -3,12 +3,16 @@
"qhelp.dtd">
<qhelp>
<overview>
<p>This code calculates an allocation size by multiplying a user input
by a <code>sizeof</code> expression. Since the user input has no
apparent guard on its magnitude, this multiplication can
overflow. When an integer multiply overflows in C, the result can wrap
around and be much smaller than intended. A later attempt to put data
into the allocated buffer can then overflow.</p>
<p>This code allocates memory using a size value based on user input,
with no apparent bound on its magnitude being established. This allows
for arbitrary amounts of memory to be allocated.</p>
<p>If the allocation size is calculated by multiplying user input by a
<code>sizeof</code> expression, the multiplication can overflow. When
an integer multiplication overflows in C, the result wraps around and
can be much smaller than intended. A later attempt to write data into
the allocated memory can then be out of bounds.</p>
</overview>
<recommendation>

View File

@@ -1,7 +1,7 @@
/**
* @name Overflow in uncontrolled allocation size
* @description Allocating memory with a size controlled by an external
* user can result in integer overflow.
* @name Uncontrolled allocation size
* @description Allocating memory with a size controlled by an external user can result in
* arbitrary amounts of memory being allocated.
* @kind path-problem
* @problem.severity error
* @security-severity 8.1
@@ -104,5 +104,6 @@ where
isFlowSource(source.getNode(), taintCause) and
TaintedAllocationSize::flowPath(source, sink) and
allocSink(alloc, sink.getNode())
select alloc, source, sink, "This allocation size is derived from $@ and might overflow.",
select alloc, source, sink,
"This allocation size is derived from $@ and could allocate arbitrary amounts of memory.",
source.getNode(), "user input (" + taintCause + ")"

View File

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

View File

@@ -79,21 +79,21 @@ nodes
| test.cpp:356:35:356:38 | size | semmle.label | size |
subpaths
#select
| test.cpp:43:31:43:36 | call to malloc | test.cpp:39:27:39:30 | **argv | test.cpp:43:38:43:44 | tainted | This allocation size is derived from $@ and might overflow. | test.cpp:39:27:39:30 | **argv | user input (a command-line argument) |
| test.cpp:44:31:44:36 | call to malloc | test.cpp:39:27:39:30 | **argv | test.cpp:44:38:44:63 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:39:27:39:30 | **argv | user input (a command-line argument) |
| test.cpp:46:31:46:36 | call to malloc | test.cpp:39:27:39:30 | **argv | test.cpp:46:38:46:63 | ... + ... | This allocation size is derived from $@ and might overflow. | test.cpp:39:27:39:30 | **argv | user input (a command-line argument) |
| test.cpp:49:25:49:30 | call to malloc | test.cpp:39:27:39:30 | **argv | test.cpp:49:32:49:35 | size | This allocation size is derived from $@ and might overflow. | test.cpp:39:27:39:30 | **argv | user input (a command-line argument) |
| test.cpp:50:17:50:30 | new[] | test.cpp:39:27:39:30 | **argv | test.cpp:50:17:50:30 | size | This allocation size is derived from $@ and might overflow. | test.cpp:39:27:39:30 | **argv | user input (a command-line argument) |
| test.cpp:53:21:53:27 | call to realloc | test.cpp:39:27:39:30 | **argv | test.cpp:53:35:53:60 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:39:27:39:30 | **argv | user input (a command-line argument) |
| test.cpp:128:17:128:22 | call to malloc | test.cpp:124:18:124:31 | *call to getenv | test.cpp:128:24:128:41 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:124:18:124:31 | *call to getenv | user input (an environment variable) |
| test.cpp:135:3:135:8 | call to malloc | test.cpp:133:19:133:32 | *call to getenv | test.cpp:135:10:135:27 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:133:19:133:32 | *call to getenv | user input (an environment variable) |
| test.cpp:152:4:152:9 | call to malloc | test.cpp:148:20:148:33 | *call to getenv | test.cpp:152:11:152:28 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:148:20:148:33 | *call to getenv | user input (an environment variable) |
| test.cpp:231:14:231:19 | call to malloc | test.cpp:237:24:237:37 | *call to getenv | test.cpp:231:21:231:21 | s | This allocation size is derived from $@ and might overflow. | test.cpp:237:24:237:37 | *call to getenv | user input (an environment variable) |
| test.cpp:239:2:239:7 | call to malloc | test.cpp:237:24:237:37 | *call to getenv | test.cpp:239:9:239:18 | local_size | This allocation size is derived from $@ and might overflow. | test.cpp:237:24:237:37 | *call to getenv | user input (an environment variable) |
| test.cpp:241:2:241:7 | call to malloc | test.cpp:211:14:211:27 | *call to getenv | test.cpp:241:9:241:24 | call to get_tainted_size | This allocation size is derived from $@ and might overflow. | test.cpp:211:14:211:27 | *call to getenv | user input (an environment variable) |
| test.cpp:245:2:245:9 | call to my_alloc | test.cpp:237:24:237:37 | *call to getenv | test.cpp:245:11:245:20 | local_size | This allocation size is derived from $@ and might overflow. | test.cpp:237:24:237:37 | *call to getenv | user input (an environment variable) |
| test.cpp:263:4:263:9 | call to malloc | test.cpp:259:20:259:33 | *call to getenv | test.cpp:263:11:263:29 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:259:20:259:33 | *call to getenv | user input (an environment variable) |
| test.cpp:291:4:291:9 | call to malloc | test.cpp:251:18:251:31 | *call to getenv | test.cpp:291:11:291:28 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:251:18:251:31 | *call to getenv | user input (an environment variable) |
| test.cpp:308:3:308:8 | call to malloc | test.cpp:251:18:251:31 | *call to getenv | test.cpp:308:10:308:27 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:251:18:251:31 | *call to getenv | user input (an environment variable) |
| test.cpp:355:25:355:33 | call to MyMalloc1 | test.cpp:353:18:353:31 | *call to getenv | test.cpp:355:35:355:38 | size | This allocation size is derived from $@ and might overflow. | test.cpp:353:18:353:31 | *call to getenv | user input (an environment variable) |
| test.cpp:356:25:356:33 | call to MyMalloc2 | test.cpp:353:18:353:31 | *call to getenv | test.cpp:356:35:356:38 | size | This allocation size is derived from $@ and might overflow. | test.cpp:353:18:353:31 | *call to getenv | user input (an environment variable) |
| test.cpp:43:31:43:36 | call to malloc | test.cpp:39:27:39:30 | **argv | test.cpp:43:38:43:44 | tainted | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:39:27:39:30 | **argv | user input (a command-line argument) |
| test.cpp:44:31:44:36 | call to malloc | test.cpp:39:27:39:30 | **argv | test.cpp:44:38:44:63 | ... * ... | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:39:27:39:30 | **argv | user input (a command-line argument) |
| test.cpp:46:31:46:36 | call to malloc | test.cpp:39:27:39:30 | **argv | test.cpp:46:38:46:63 | ... + ... | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:39:27:39:30 | **argv | user input (a command-line argument) |
| test.cpp:49:25:49:30 | call to malloc | test.cpp:39:27:39:30 | **argv | test.cpp:49:32:49:35 | size | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:39:27:39:30 | **argv | user input (a command-line argument) |
| test.cpp:50:17:50:30 | new[] | test.cpp:39:27:39:30 | **argv | test.cpp:50:17:50:30 | size | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:39:27:39:30 | **argv | user input (a command-line argument) |
| test.cpp:53:21:53:27 | call to realloc | test.cpp:39:27:39:30 | **argv | test.cpp:53:35:53:60 | ... * ... | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:39:27:39:30 | **argv | user input (a command-line argument) |
| test.cpp:128:17:128:22 | call to malloc | test.cpp:124:18:124:31 | *call to getenv | test.cpp:128:24:128:41 | ... * ... | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:124:18:124:31 | *call to getenv | user input (an environment variable) |
| test.cpp:135:3:135:8 | call to malloc | test.cpp:133:19:133:32 | *call to getenv | test.cpp:135:10:135:27 | ... * ... | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:133:19:133:32 | *call to getenv | user input (an environment variable) |
| test.cpp:152:4:152:9 | call to malloc | test.cpp:148:20:148:33 | *call to getenv | test.cpp:152:11:152:28 | ... * ... | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:148:20:148:33 | *call to getenv | user input (an environment variable) |
| test.cpp:231:14:231:19 | call to malloc | test.cpp:237:24:237:37 | *call to getenv | test.cpp:231:21:231:21 | s | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:237:24:237:37 | *call to getenv | user input (an environment variable) |
| test.cpp:239:2:239:7 | call to malloc | test.cpp:237:24:237:37 | *call to getenv | test.cpp:239:9:239:18 | local_size | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:237:24:237:37 | *call to getenv | user input (an environment variable) |
| test.cpp:241:2:241:7 | call to malloc | test.cpp:211:14:211:27 | *call to getenv | test.cpp:241:9:241:24 | call to get_tainted_size | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:211:14:211:27 | *call to getenv | user input (an environment variable) |
| test.cpp:245:2:245:9 | call to my_alloc | test.cpp:237:24:237:37 | *call to getenv | test.cpp:245:11:245:20 | local_size | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:237:24:237:37 | *call to getenv | user input (an environment variable) |
| test.cpp:263:4:263:9 | call to malloc | test.cpp:259:20:259:33 | *call to getenv | test.cpp:263:11:263:29 | ... * ... | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:259:20:259:33 | *call to getenv | user input (an environment variable) |
| test.cpp:291:4:291:9 | call to malloc | test.cpp:251:18:251:31 | *call to getenv | test.cpp:291:11:291:28 | ... * ... | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:251:18:251:31 | *call to getenv | user input (an environment variable) |
| test.cpp:308:3:308:8 | call to malloc | test.cpp:251:18:251:31 | *call to getenv | test.cpp:308:10:308:27 | ... * ... | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:251:18:251:31 | *call to getenv | user input (an environment variable) |
| test.cpp:355:25:355:33 | call to MyMalloc1 | test.cpp:353:18:353:31 | *call to getenv | test.cpp:355:35:355:38 | size | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:353:18:353:31 | *call to getenv | user input (an environment variable) |
| test.cpp:356:25:356:33 | call to MyMalloc2 | test.cpp:353:18:353:31 | *call to getenv | test.cpp:356:35:356:38 | size | This allocation size is derived from $@ and could allocate arbitrary amounts of memory. | test.cpp:353:18:353:31 | *call to getenv | user input (an environment variable) |

View File

@@ -40,10 +40,10 @@ int main(int argc, char **argv) {
int tainted = atoi(argv[1]);
MyStruct *arr1 = (MyStruct *)malloc(sizeof(MyStruct)); // GOOD
MyStruct *arr2 = (MyStruct *)malloc(tainted); // DUBIOUS (not multiplied by anything)
MyStruct *arr2 = (MyStruct *)malloc(tainted); // BAD
MyStruct *arr3 = (MyStruct *)malloc(tainted * sizeof(MyStruct)); // BAD
MyStruct *arr4 = (MyStruct *)malloc(getTainted() * sizeof(MyStruct)); // BAD [NOT DETECTED]
MyStruct *arr5 = (MyStruct *)malloc(sizeof(MyStruct) + tainted); // DUBIOUS (not multiplied by anything)
MyStruct *arr5 = (MyStruct *)malloc(sizeof(MyStruct) + tainted); // BAD
int size = tainted * 8;
char *chars1 = (char *)malloc(size); // BAD

View File

@@ -10,7 +10,7 @@ Internal.IL,,,46,,,,,,,,,,,,,,,,,,,44,2
Internal.Pgo,,,9,,,,,,,,,,,,,,,,,,,8,1
Internal.TypeSystem,,,315,,,,,,,,,,,,,,,,,,,299,16
JsonToItemsTaskFactory,,,10,,,,,,,,,,,,,,,,,,,10,
Microsoft.Android.Build,,,16,,,,,,,,,,,,,,,,,,,16,
Microsoft.Android.Build,,1,16,,,,,,,,,,,,,1,,,,,,16,
Microsoft.Apple.Build,,,8,,,,,,,,,,,,,,,,,,,8,
Microsoft.ApplicationBlocks.Data,28,,,,,,,,,,,,28,,,,,,,,,,
Microsoft.CSharp,,,13,,,,,,,,,,,,,,,,,,,13,
@@ -19,9 +19,9 @@ Microsoft.DotNet.Build.Tasks,,,6,,,,,,,,,,,,,,,,,,,6,
Microsoft.EntityFrameworkCore,6,,12,,,,,,,,,,6,,,,,,,,,,12
Microsoft.Extensions.Caching.Distributed,,,10,,,,,,,,,,,,,,,,,,,10,
Microsoft.Extensions.Caching.Memory,,,39,,,,,,,,,,,,,,,,,,,38,1
Microsoft.Extensions.Configuration,,2,90,,,,,,,,,,,,,2,,,,,,89,1
Microsoft.Extensions.Configuration,,3,90,,,,,,,,,,,,,3,,,,,,89,1
Microsoft.Extensions.DependencyInjection,,,134,,,,,,,,,,,,,,,,,,,133,1
Microsoft.Extensions.DependencyModel,,,18,,,,,,,,,,,,,,,,,,,18,
Microsoft.Extensions.DependencyModel,,1,18,,,,,,,,,,,,,1,,,,,,18,
Microsoft.Extensions.Diagnostics.Metrics,,,15,,,,,,,,,,,,,,,,,,,15,
Microsoft.Extensions.FileProviders,,,15,,,,,,,,,,,,,,,,,,,15,
Microsoft.Extensions.FileSystemGlobbing,,,18,,,,,,,,,,,,,,,,,,,16,2
@@ -41,5 +41,5 @@ MySql.Data.MySqlClient,48,,,,,,,,,,,,48,,,,,,,,,,
Newtonsoft.Json,,,91,,,,,,,,,,,,,,,,,,,73,18
ServiceStack,194,,7,27,,,,,75,,,,92,,,,,,,,,7,
SourceGenerators,,,5,,,,,,,,,,,,,,,,,,,5,
System,60,44,10614,,7,6,5,,,4,5,,33,2,,3,15,17,3,4,,8709,1905
System,54,47,10626,,6,5,5,,,4,1,,33,2,,6,15,17,3,4,,8721,1905
Windows.Security.Cryptography.Core,1,,,,,,,1,,,,,,,,,,,,,,,
1 package sink source summary sink:code-injection sink:encryption-decryptor sink:encryption-encryptor sink:encryption-keyprop sink:encryption-symmetrickey sink:file-content-store sink:html-injection sink:js-injection sink:log-injection sink:sql-injection source:commandargs source:database source:environment source:file source:file-write source:local source:remote source:windows-registry summary:taint summary:value
10 Internal.Pgo 9 8 1
11 Internal.TypeSystem 315 299 16
12 JsonToItemsTaskFactory 10 10
13 Microsoft.Android.Build 1 16 1 16
14 Microsoft.Apple.Build 8 8
15 Microsoft.ApplicationBlocks.Data 28 28
16 Microsoft.CSharp 13 13
19 Microsoft.EntityFrameworkCore 6 12 6 12
20 Microsoft.Extensions.Caching.Distributed 10 10
21 Microsoft.Extensions.Caching.Memory 39 38 1
22 Microsoft.Extensions.Configuration 2 3 90 2 3 89 1
23 Microsoft.Extensions.DependencyInjection 134 133 1
24 Microsoft.Extensions.DependencyModel 1 18 1 18
25 Microsoft.Extensions.Diagnostics.Metrics 15 15
26 Microsoft.Extensions.FileProviders 15 15
27 Microsoft.Extensions.FileSystemGlobbing 18 16 2
41 Newtonsoft.Json 91 73 18
42 ServiceStack 194 7 27 75 92 7
43 SourceGenerators 5 5
44 System 60 54 44 47 10614 10626 7 6 6 5 5 4 5 1 33 2 3 6 15 17 3 4 8709 8721 1905
45 Windows.Security.Cryptography.Core 1 1

View File

@@ -8,7 +8,7 @@ C# framework & library support
Framework / library,Package,Flow sources,Taint & value steps,Sinks (total),`CWE-079` :sub:`Cross-site scripting`
`ServiceStack <https://servicestack.net/>`_,"``ServiceStack.*``, ``ServiceStack``",,7,194,
System,"``System.*``, ``System``",44,10614,60,9
Others,"``Amazon.Lambda.APIGatewayEvents``, ``Amazon.Lambda.Core``, ``Dapper``, ``ILCompiler``, ``ILLink.RoslynAnalyzer``, ``ILLink.Shared``, ``ILLink.Tasks``, ``Internal.IL``, ``Internal.Pgo``, ``Internal.TypeSystem``, ``JsonToItemsTaskFactory``, ``Microsoft.Android.Build``, ``Microsoft.Apple.Build``, ``Microsoft.ApplicationBlocks.Data``, ``Microsoft.CSharp``, ``Microsoft.Diagnostics.Tools.Pgo``, ``Microsoft.DotNet.Build.Tasks``, ``Microsoft.EntityFrameworkCore``, ``Microsoft.Extensions.Caching.Distributed``, ``Microsoft.Extensions.Caching.Memory``, ``Microsoft.Extensions.Configuration``, ``Microsoft.Extensions.DependencyInjection``, ``Microsoft.Extensions.DependencyModel``, ``Microsoft.Extensions.Diagnostics.Metrics``, ``Microsoft.Extensions.FileProviders``, ``Microsoft.Extensions.FileSystemGlobbing``, ``Microsoft.Extensions.Hosting``, ``Microsoft.Extensions.Http``, ``Microsoft.Extensions.Logging``, ``Microsoft.Extensions.Options``, ``Microsoft.Extensions.Primitives``, ``Microsoft.Interop``, ``Microsoft.NET.Build.Tasks``, ``Microsoft.NET.WebAssembly.Webcil``, ``Microsoft.VisualBasic``, ``Microsoft.WebAssembly.Build.Tasks``, ``Microsoft.Win32``, ``Mono.Linker``, ``MySql.Data.MySqlClient``, ``Newtonsoft.Json``, ``SourceGenerators``, ``Windows.Security.Cryptography.Core``",54,1821,148,
Totals,,98,12442,402,9
System,"``System.*``, ``System``",47,10626,54,5
Others,"``Amazon.Lambda.APIGatewayEvents``, ``Amazon.Lambda.Core``, ``Dapper``, ``ILCompiler``, ``ILLink.RoslynAnalyzer``, ``ILLink.Shared``, ``ILLink.Tasks``, ``Internal.IL``, ``Internal.Pgo``, ``Internal.TypeSystem``, ``JsonToItemsTaskFactory``, ``Microsoft.Android.Build``, ``Microsoft.Apple.Build``, ``Microsoft.ApplicationBlocks.Data``, ``Microsoft.CSharp``, ``Microsoft.Diagnostics.Tools.Pgo``, ``Microsoft.DotNet.Build.Tasks``, ``Microsoft.EntityFrameworkCore``, ``Microsoft.Extensions.Caching.Distributed``, ``Microsoft.Extensions.Caching.Memory``, ``Microsoft.Extensions.Configuration``, ``Microsoft.Extensions.DependencyInjection``, ``Microsoft.Extensions.DependencyModel``, ``Microsoft.Extensions.Diagnostics.Metrics``, ``Microsoft.Extensions.FileProviders``, ``Microsoft.Extensions.FileSystemGlobbing``, ``Microsoft.Extensions.Hosting``, ``Microsoft.Extensions.Http``, ``Microsoft.Extensions.Logging``, ``Microsoft.Extensions.Options``, ``Microsoft.Extensions.Primitives``, ``Microsoft.Interop``, ``Microsoft.NET.Build.Tasks``, ``Microsoft.NET.WebAssembly.Webcil``, ``Microsoft.VisualBasic``, ``Microsoft.WebAssembly.Build.Tasks``, ``Microsoft.Win32``, ``Mono.Linker``, ``MySql.Data.MySqlClient``, ``Newtonsoft.Json``, ``SourceGenerators``, ``Windows.Security.Cryptography.Core``",57,1821,148,
Totals,,104,12454,396,5

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: Add unique constraint on preprocessor directive and compilation pairs
compatibility: backwards

View File

@@ -189,13 +189,13 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
/// (together with used package information) required for compilation.
/// </summary>
/// <returns>True if parsing succeeds, otherwise false.</returns>
public bool TryParse(string json)
public bool TryParse(string json, string jsonPath)
{
try
{
var obj = JObject.Parse(json);
AddPackageDependencies(obj, json);
AddFrameworkDependencies(obj, json);
AddPackageDependencies(obj, jsonPath);
AddFrameworkDependencies(obj, jsonPath);
return true;
}
catch (Exception e)
@@ -228,7 +228,7 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
{
if (TryReadAllText(asset, logger, out var json))
{
TryParse(json);
TryParse(json, asset);
}
}

View File

@@ -667,7 +667,7 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
"Found unreachable Nuget feed in C# analysis with build-mode 'none'",
visibility: new DiagnosticMessage.TspVisibility(statusPage: true, cliSummaryTable: true, telemetry: true),
markdownMessage: "Found unreachable Nuget feed in C# analysis with build-mode 'none'. This may cause missing dependencies in the analysis.",
severity: DiagnosticMessage.TspSeverity.Warning
severity: DiagnosticMessage.TspSeverity.Note
));
}
compilationInfoContainer.CompilationInfos.Add(("All Nuget feeds reachable", allFeedsReachable ? "1" : "0"));

View File

@@ -21,7 +21,6 @@ namespace Semmle.Extraction.CSharp.Entities
protected override void Populate(TextWriter trapFile)
{
// The below doesn't limit the extractor messages to the exact limit, but it's good enough.
var key = diagnostic.Id;
var messageCount = compilation.messageCounts.AddOrUpdate(key, 1, (_, c) => c + 1);
if (messageCount > limit)

View File

@@ -20,6 +20,7 @@ namespace Semmle.Extraction.CSharp.Entities
public override void WriteId(EscapingTextWriter trapFile)
{
trapFile.WriteSubId(Context.CreateLocation(ReportingLocation));
trapFile.WriteSubId(start);
trapFile.Write(Symbol.IsActive);
trapFile.Write(',');
trapFile.Write(Symbol.BranchTaken);

View File

@@ -18,6 +18,7 @@ namespace Semmle.Extraction.CSharp.Entities
public override void WriteId(EscapingTextWriter trapFile)
{
trapFile.WriteSubId(Context.CreateLocation(ReportingLocation));
trapFile.WriteSubId(start);
trapFile.Write(Symbol.IsActive);
trapFile.Write(',');
trapFile.Write(Symbol.BranchTaken);

View File

@@ -13,6 +13,14 @@ namespace Semmle.Extraction.CSharp.Entities
this.start = start;
}
public override void WriteId(EscapingTextWriter trapFile)
{
trapFile.WriteSubId(Context.CreateLocation(ReportingLocation));
trapFile.WriteSubId(start);
trapFile.Write(Symbol.IsActive);
trapFile.Write(";trivia");
}
protected override void PopulatePreprocessor(TextWriter trapFile)
{
trapFile.directive_endifs(this, start);

View File

@@ -190,37 +190,29 @@ namespace Semmle.Extraction.CSharp
var transformedSourcePath = PathTransformer.Transform(sourcePath);
var trapPath = transformedSourcePath.GetTrapPath(Logger, options.TrapCompression);
var upToDate = false;
// compilation.Clone() is used to allow symbols to be garbage collected.
using var trapWriter = transformedSourcePath.CreateTrapWriter(Logger, options.TrapCompression, discardDuplicates: false);
upToDate = FileIsUpToDate(sourcePath, trapWriter.TrapFile);
var currentTaskId = IncrementTaskCount();
ReportProgressTaskStarted(currentTaskId, sourcePath);
if (!upToDate)
var cx = new Context(ExtractionContext, compilation, trapWriter, new SourceScope(tree), addAssemblyTrapPrefix);
// Ensure that the file itself is populated in case the source file is totally empty
var root = tree.GetRoot();
Entities.File.Create(cx, root.SyntaxTree.FilePath);
var csNode = (CSharpSyntaxNode)root;
var directiveVisitor = new DirectiveVisitor(cx);
csNode.Accept(directiveVisitor);
foreach (var branch in directiveVisitor.BranchesTaken)
{
var cx = new Context(ExtractionContext, compilation, trapWriter, new SourceScope(tree), addAssemblyTrapPrefix);
// Ensure that the file itself is populated in case the source file is totally empty
var root = tree.GetRoot();
Entities.File.Create(cx, root.SyntaxTree.FilePath);
var csNode = (CSharpSyntaxNode)root;
var directiveVisitor = new DirectiveVisitor(cx);
csNode.Accept(directiveVisitor);
foreach (var branch in directiveVisitor.BranchesTaken)
{
cx.TrapStackSuffix.Add(branch);
}
csNode.Accept(new CompilationUnitVisitor(cx));
cx.PopulateAll();
CommentPopulator.ExtractCommentBlocks(cx, cx.CommentGenerator);
cx.PopulateAll();
cx.TrapStackSuffix.Add(branch);
}
csNode.Accept(new CompilationUnitVisitor(cx));
cx.PopulateAll();
CommentPopulator.ExtractCommentBlocks(cx, cx.CommentGenerator);
cx.PopulateAll();
ReportProgressTaskDone(currentTaskId, sourcePath, trapPath, stopwatch.Elapsed, upToDate ? AnalysisAction.UpToDate : AnalysisAction.Extracted);
ReportProgressTaskDone(currentTaskId, sourcePath, trapPath, stopwatch.Elapsed, AnalysisAction.Extracted);
}
catch (Exception ex) // lgtm[cs/catch-of-all-exceptions]
{
@@ -268,12 +260,6 @@ namespace Semmle.Extraction.CSharp
extractionTasks.Add(() => DoAnalyseCompilation());
}
private static bool FileIsUpToDate(string src, string dest)
{
return File.Exists(dest) &&
File.GetLastWriteTime(dest) >= File.GetLastWriteTime(src);
}
private static void AnalyseNamespace(Context cx, INamespaceSymbol ns)
{
foreach (var memberNamespace in ns.GetNamespaceMembers())

View File

@@ -16,7 +16,7 @@ namespace Semmle.Extraction.Tests
var json = assetsJson1;
// Execute
var success = assets.TryParse(json);
var success = assets.TryParse(json, "");
// Verify
Assert.True(success);
@@ -46,7 +46,7 @@ namespace Semmle.Extraction.Tests
var json = "garbage data";
// Execute
var success = assets.TryParse(json);
var success = assets.TryParse(json, "");
// Verify
Assert.False(success);
@@ -61,7 +61,7 @@ namespace Semmle.Extraction.Tests
var json = assetsNet70;
// Execute
var success = assets.TryParse(json);
var success = assets.TryParse(json, "");
// Verify
Assert.True(success);
@@ -91,7 +91,7 @@ namespace Semmle.Extraction.Tests
var json = assetsNet48;
// Execute
var success = assets.TryParse(json);
var success = assets.TryParse(json, "");
// Verify
Assert.True(success);
@@ -117,7 +117,7 @@ namespace Semmle.Extraction.Tests
var json = assetsNetstandard21;
// Execute
var success = assets.TryParse(json);
var success = assets.TryParse(json, "");
// Verify
Assert.True(success);
@@ -144,7 +144,7 @@ namespace Semmle.Extraction.Tests
var json = assetsNetstandard16;
// Execute
var success = assets.TryParse(json);
var success = assets.TryParse(json, "");
// Verify
Assert.True(success);
@@ -175,7 +175,7 @@ namespace Semmle.Extraction.Tests
var json = assetsNetcoreapp20;
// Execute
var success = assets.TryParse(json);
var success = assets.TryParse(json, "");
// Verify
Assert.True(success);
@@ -202,7 +202,7 @@ namespace Semmle.Extraction.Tests
var json = assetsNetcoreapp31;
// Execute
var success = assets.TryParse(json);
var success = assets.TryParse(json, "");
// Verify
Assert.True(success);

View File

@@ -10,27 +10,36 @@ namespace Semmle.Extraction.Entities
private static int messageCount = 0;
private readonly Message msg;
private readonly bool bypassLimit;
public ExtractionMessage(Context cx, Message msg) : base(cx)
public ExtractionMessage(Context cx, Message msg) : this(cx, msg, bypassLimit: false)
{
}
private ExtractionMessage(Context cx, Message msg, bool bypassLimit) : base(cx)
{
this.bypassLimit = bypassLimit;
this.msg = msg;
TryPopulate();
}
protected override void Populate(TextWriter trapFile)
{
// The below doesn't limit the extractor messages to the exact limit, but it's good enough.
Interlocked.Increment(ref messageCount);
if (messageCount > limit)
if (!bypassLimit)
{
if (messageCount == limit + 1)
var val = Interlocked.Increment(ref messageCount);
if (val > limit)
{
Context.ExtractionContext.Logger.LogWarning($"Stopped logging extractor messages after reaching {limit}");
if (val == limit + 1)
{
Context.ExtractionContext.Logger.LogWarning($"Stopped logging extractor messages after reaching {limit}");
_ = new ExtractionMessage(Context, new Message($"Stopped logging extractor messages after reaching {limit}", null, null, null, Util.Logging.Severity.Warning), bypassLimit: true);
}
return;
}
return;
}
trapFile.extractor_messages(this, msg.Severity, "C# extractor", msg.Text, msg.EntityText ?? string.Empty,
trapFile.extractor_messages(this, msg.Severity, msg.Text, msg.EntityText ?? string.Empty,
msg.Location ?? Context.CreateLocation(), msg.StackTrace ?? string.Empty);
}
}

View File

@@ -194,8 +194,11 @@ namespace Semmle.Extraction
var hash = FileUtils.ComputeFileHash(tmpFile);
if (existingHash != hash)
{
var root = TrapFile.Substring(0, TrapFile.Length - 8); // Remove trailing ".trap.gz"
if (TryMove(tmpFile, $"{root}-{hash}.trap{TrapExtension(trapCompression)}"))
var extension = TrapExtension(trapCompression);
var root = TrapFile[..^extension.Length]; // Remove trailing ".trap", ".trap.gz", or ".trap.br"
var newTrapName = $"{root}-{hash}{extension}";
logger.LogInfo($"Identical trap file for {TrapFile} already exists, renaming to {newTrapName}");
if (TryMove(tmpFile, $"{newTrapName}"))
return;
}
logger.LogInfo($"Identical trap file for {TrapFile} already exists");
@@ -217,16 +220,16 @@ namespace Semmle.Extraction
{
switch (compression)
{
case CompressionMode.None: return "";
case CompressionMode.Gzip: return ".gz";
case CompressionMode.Brotli: return ".br";
case CompressionMode.None: return ".trap";
case CompressionMode.Gzip: return ".trap.gz";
case CompressionMode.Brotli: return ".trap.br";
default: throw new ArgumentOutOfRangeException(nameof(compression), compression, "Unsupported compression type");
}
}
public static string TrapPath(ILogger logger, string? folder, PathTransformer.ITransformedPath path, TrapWriter.CompressionMode trapCompression)
{
var filename = $"{path.Value}.trap{TrapExtension(trapCompression)}";
var filename = $"{path.Value}{TrapExtension(trapCompression)}";
if (string.IsNullOrEmpty(folder))
folder = Directory.GetCurrentDirectory();

View File

@@ -12,9 +12,9 @@ namespace Semmle.Extraction
trapFile.WriteTuple("containerparent", parent, child);
}
internal static void extractor_messages(this System.IO.TextWriter trapFile, ExtractionMessage error, Semmle.Util.Logging.Severity severity, string origin, string errorMessage, string entityText, Location location, string stackTrace)
internal static void extractor_messages(this System.IO.TextWriter trapFile, ExtractionMessage error, Semmle.Util.Logging.Severity severity, string errorMessage, string entityText, Location location, string stackTrace)
{
trapFile.WriteTuple("extractor_messages", error, (int)severity, origin, errorMessage, entityText, location, stackTrace);
trapFile.WriteTuple("extractor_messages", error, (int)severity, "C# extractor", errorMessage, entityText, location, stackTrace);
}
public static void files(this System.IO.TextWriter trapFile, File file, string fullName)

View File

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

View File

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

View File

@@ -1,3 +1,2 @@
from create_database_utils import *
run_codeql_database_create([], lang="csharp")
def test(codeql, csharp):
codeql.database.create()

View File

@@ -1,7 +1,6 @@
import subprocess
from create_database_utils import *
from diagnostics_test_utils import *
import commands
subprocess.check_call(["dotnet", "build", "test.sln", "/bl:test.binlog"])
run_codeql_database_create([], lang="csharp", extra_args=["--build-mode=none", "-Obinlog=test.binlog"])
check_diagnostics()
def test(codeql, csharp):
commands.run(["dotnet", "build", "test.sln", "/bl:test.binlog"])
codeql.database.create(build_mode="none", extractor_option="binlog=test.binlog")

View File

@@ -0,0 +1,4 @@
| Program.cs:3:24:3:27 | Main | 2 |
| Program.cs:10:17:10:33 | GreetConditional1 | 2 |
| Program.cs:19:17:19:21 | Greet | 2 |
| Program.cs:25:17:25:33 | GreetConditional2 | 2 |

View File

@@ -0,0 +1,5 @@
import csharp
from Method m
where m.fromSource()
select m, count(m.getBody())

View File

@@ -0,0 +1,40 @@
public class Test
{
public static void Main()
{
Greet();
GreetConditional1();
GreetConditional2();
}
static void GreetConditional1()
{
#if A
Console.WriteLine("Hello, A!");
#elif C
Console.WriteLine("Hello, C!");
#endif
}
static void Greet()
{
Console.WriteLine("Hello, World!");
}
#if A
static void GreetConditional2()
{
Console.WriteLine("Hello, A!");
}
#elif B
static void GreetConditional2()
{
Console.WriteLine("Hello, B!");
}
#else
static void GreetConditional2()
{
Console.WriteLine("Hello, Others!");
}
#endif
}

View File

@@ -0,0 +1,5 @@
{
"sdk": {
"version": "8.0.101"
}
}

View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Remove="**/*.cs" />
<Compile Include="Program.cs" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,8 @@
import os
def test(codeql, csharp):
os.environ["CODEQL_EXTRACTOR_CSHARP_OPTION_TRAP_COMPRESSION"] = "none"
codeql.database.create(
command=["dotnet build /p:DefineConstants=A", "dotnet build /p:DefineConstants=B"]
)

View File

@@ -1,3 +1,2 @@
from create_database_utils import *
run_codeql_database_create(['dotnet build'], lang="csharp")
def test(codeql, csharp):
codeql.database.create(command="dotnet build")

View File

@@ -1,4 +1,4 @@
| Program.cs |
| Views/Home/Index.cshtml |
| _semmle_code_target_codeql_csharp_integration_tests_ql_csharp_ql_integration_tests_all_platforms_cshtml_standalone_Views_Home_Index_cshtml.g.cs |
| _ql_csharp_ql_integration_tests_all_platforms_cshtml_standalone_test_test_Views_Home_Index_cshtml.g.cs |
| test-db/working/implicitUsings/GlobalUsings.g.cs |

View File

@@ -2,15 +2,12 @@ import csharp
private string getPath(File f) {
result = f.getRelativePath() and
not exists(
result
.indexOf("_semmle_code_target_codeql_csharp_integration_tests_ql_csharp_ql_integration_tests_all_platforms_cshtml_standalone_")
)
not exists(result.indexOf("_ql_csharp_ql_integration_tests_all_platforms_cshtml_standalone_"))
or
exists(int index |
index =
f.getRelativePath()
.indexOf("_semmle_code_target_codeql_csharp_integration_tests_ql_csharp_ql_integration_tests_all_platforms_cshtml_standalone_") and
.indexOf("_ql_csharp_ql_integration_tests_all_platforms_cshtml_standalone_") and
result = f.getRelativePath().substring(index, f.getRelativePath().length())
)
}

View File

@@ -1,4 +1,2 @@
import os
from create_database_utils import *
run_codeql_database_create(lang="csharp", extra_args=["--build-mode=none"])
def test(codeql, csharp):
codeql.database.create(build_mode="none")

View File

@@ -1,5 +1,6 @@
import os
from create_database_utils import *
os.environ['CODEQL_EXTRACTOR_CSHARP_BUILDLESS_EXTRACT_WEB_VIEWS'] = 'false'
run_codeql_database_create(lang="csharp", extra_args=["--build-mode=none"])
def test(codeql, csharp):
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_EXTRACT_WEB_VIEWS"] = "false"
codeql.database.create(build_mode="none")

View File

@@ -1,4 +1,2 @@
import os
from create_database_utils import *
run_codeql_database_create(lang="csharp", extra_args=["--build-mode=none"])
def test(codeql, csharp):
codeql.database.create(build_mode="none")

View File

@@ -1,4 +1,4 @@
| Program.cs |
| Views/Home/Index.cshtml |
| _semmle_code_target_codeql_csharp_integration_tests_ql_csharp_ql_integration_tests_all_platforms_cshtml_standalone_net6_Views_Home_Index_cshtml.g.cs |
| _ql_csharp_ql_integration_tests_all_platforms_cshtml_standalone_net6_test_test_Views_Home_Index_cshtml.g.cs |
| test-db/working/implicitUsings/GlobalUsings.g.cs |

View File

@@ -2,15 +2,12 @@ import csharp
private string getPath(File f) {
result = f.getRelativePath() and
not exists(
result
.indexOf("_semmle_code_target_codeql_csharp_integration_tests_ql_csharp_ql_integration_tests_all_platforms_cshtml_standalone_")
)
not exists(result.indexOf("_ql_csharp_ql_integration_tests_all_platforms_cshtml_standalone_"))
or
exists(int index |
index =
f.getRelativePath()
.indexOf("_semmle_code_target_codeql_csharp_integration_tests_ql_csharp_ql_integration_tests_all_platforms_cshtml_standalone_") and
.indexOf("_ql_csharp_ql_integration_tests_all_platforms_cshtml_standalone_") and
result = f.getRelativePath().substring(index, f.getRelativePath().length())
)
}

View File

@@ -1,4 +1,2 @@
import os
from create_database_utils import *
run_codeql_database_create(lang="csharp", extra_args=["--build-mode=none"])
def test(codeql, csharp):
codeql.database.create(build_mode="none")

View File

@@ -1,5 +1,2 @@
from create_database_utils import *
from diagnostics_test_utils import *
run_codeql_database_create([], db=None, lang="csharp", runFunction=runUnsuccessfully)
check_diagnostics()
def test(codeql, csharp):
codeql.database.create(_assert_failure=True)

View File

@@ -1,5 +1,2 @@
from create_database_utils import *
from diagnostics_test_utils import *
run_codeql_database_create([], db=None, lang="csharp", runFunction=runUnsuccessfully)
check_diagnostics()
def test(codeql, csharp):
codeql.database.create(_assert_failure=True)

View File

@@ -1,5 +1,2 @@
from create_database_utils import *
from diagnostics_test_utils import *
run_codeql_database_create([], db=None, lang="csharp", runFunction=runUnsuccessfully)
check_diagnostics()
def test(codeql, csharp):
codeql.database.create(_assert_failure=True)

View File

@@ -1,3 +1,2 @@
from create_database_utils import *
run_codeql_database_create(['dotnet build'], lang="csharp")
def test(codeql, csharp):
codeql.database.create(command="dotnet build")

View File

@@ -1,16 +1,21 @@
from create_database_utils import *
from diagnostics_test_utils import *
def check_build_out(msg, s):
if "[build-stdout] " + msg not in s:
raise Exception("The C# tracer did not interpret the dotnet path-to-application command correctly.")
assert (
"[build-stdout] " + msg in s
), f"The C# tracer did not interpret the dotnet path-to-application command correctly."
def test1(codeql, csharp):
codeql.database.create(command="dotnet build")
run_codeql_database_create(['dotnet build'], test_db="test1-db", lang="csharp")
check_diagnostics(test_db="test1-db")
# This test checks that we don't inject any flags when running the application using `dotnet`
my_dir = "my_program"
my_abs_path = os.path.abspath(f"{my_dir}/dotnet_build.dll")
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test1-db', 'dotnet build -o my_program', f'dotnet {my_abs_path} build is not a subcommand'], "test2-db", "csharp")
check_build_out("<arguments>build,is,not,a,subcommand</arguments>", s)
check_diagnostics(test_db="test2-db")
def test2(codeql, csharp, cwd):
s = codeql.database.create(
command=[
"dotnet build -o my_program",
f"dotnet {cwd / 'my_program'}/dotnet_build.dll build is not a subcommand",
],
_capture="stdout",
)
check_build_out("<arguments>build,is,not,a,subcommand</arguments>", s)

View File

@@ -1,9 +1,9 @@
from create_database_utils import *
from diagnostics_test_utils import *
# the tracer configuration should not inject the extra command-line arguments for these commands
# and they should therefore run successfully
run_codeql_database_init(lang="csharp")
# this command fails on Windows for some reason, so we comment it out for now
# run_codeql_database_trace_command(['dotnet', 'tool', 'search', 'publish'])
run_codeql_database_trace_command(['dotnet', 'new', 'console', '--force', '--name', 'build', '--output', '.'])
def test(codeql, csharp):
codeql.database.init("test-db", source_root=".")
# the tracer configuration should not inject the extra command-line arguments for these commands
# and they should therefore run successfully
# this command fails on Windows for some reason, so we comment it out for now
# run_codeql_database_trace_command(['dotnet', 'tool', 'search', 'publish'])
codeql.database.trace_command(
"test-db", "dotnet", "new", "console", "--force", "--name", "build", "--output", "."
)

View File

@@ -1,11 +1,8 @@
import os
from create_database_utils import *
from diagnostics_test_utils import *
run_codeql_database_create(['dotnet pack -o nugetpackage'], db=None, lang="csharp")
## Check that the NuGet package is created.
if not os.path.isfile("nugetpackage/dotnet_pack.1.0.0.nupkg"):
raise Exception("The NuGet package was not created.")
check_diagnostics()
def test(codeql, csharp):
codeql.database.create(command="dotnet pack -o nugetpackage")
assert os.path.isfile(
"nugetpackage/dotnet_pack.1.0.0.nupkg"
), "The NuGet package was not created."

View File

@@ -1,12 +1,7 @@
import os
from create_database_utils import *
from diagnostics_test_utils import *
artifacts = 'bin/Temp'
run_codeql_database_create([f"dotnet publish -o {artifacts}"], db=None, lang="csharp")
## Check that the publish folder is created.
if not os.path.isdir(artifacts):
raise Exception("The publish artifact folder was not created.")
check_diagnostics()
def test(codeql, csharp):
artifacts = "bin/Temp"
codeql.database.create(command=f"dotnet publish -o {artifacts}")
assert os.path.isdir(artifacts), "The publish artifact folder was not created."

View File

@@ -1,57 +1,69 @@
from create_database_utils import *
from diagnostics_test_utils import *
def check_build_out(msg, s):
if "[build-stdout] " + msg not in s:
raise Exception("The C# tracer did not interpret the 'dotnet run' command correctly")
assert (
"[build-stdout] " + msg in s
), "The C# tracer did not interpret the 'dotnet run' command correctly"
# no arguments
s = run_codeql_database_create_stdout(['dotnet run'], "test-db", "csharp")
check_build_out("Default reply", s)
check_diagnostics()
def test_no_args(codeql, csharp):
s = codeql.database.create(command="dotnet run", _capture="stdout")
check_build_out("Default reply", s)
# no arguments, but `--`
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test-db', 'dotnet run --'], "test2-db", "csharp")
check_build_out("Default reply", s)
check_diagnostics(test_db="test2-db")
def test_no_arg_dash_dash(codeql, csharp):
s = codeql.database.create(command="dotnet run --", _capture="stdout")
check_build_out("Default reply", s)
# one argument, no `--`
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test2-db', 'dotnet run hello'], "test3-db", "csharp")
check_build_out("Default reply", s)
check_diagnostics(test_db="test3-db")
def test_one_arg_no_dash_dash(codeql, csharp):
s = codeql.database.create(command="dotnet run hello", _capture="stdout")
check_build_out("Default reply", s)
# one argument, but `--`
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test3-db', 'dotnet run -- hello'], "test4-db", "csharp")
check_build_out("Default reply", s)
check_diagnostics(test_db="test4-db")
def test_one_arg_dash_dash(codeql, csharp):
s = codeql.database.create(command="dotnet run -- hello", _capture="stdout")
check_build_out("Default reply", s)
# two arguments, no `--`
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test4-db', 'dotnet run hello world'], "test5-db", "csharp")
check_build_out("hello, world", s)
check_diagnostics(test_db="test5-db")
def test_two_args_no_dash_dash(codeql, csharp):
s = codeql.database.create(command="dotnet run hello world", _capture="stdout")
check_build_out("hello, world", s)
# two arguments, and `--`
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test5-db', 'dotnet run -- hello world'], "test6-db", "csharp")
check_build_out("hello, world", s)
check_diagnostics(test_db="test6-db")
def test_two_args_dash_dash(codeql, csharp):
s = codeql.database.create(command="dotnet run -- hello world", _capture="stdout")
check_build_out("hello, world", s)
# shared compilation enabled; tracer should override by changing the command
# to `dotnet run -p:UseSharedCompilation=true -p:UseSharedCompilation=false -- hello world`
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test6-db', 'dotnet run -p:UseSharedCompilation=true -- hello world'], "test7-db", "csharp")
check_build_out("hello, world", s)
check_diagnostics(test_db="test7-db")
def test_shared_compilation(codeql, csharp):
s = codeql.database.create(
command="dotnet run -p:UseSharedCompilation=true -- hello world", _capture="stdout"
)
check_build_out("hello, world", s)
# option passed into `dotnet run`
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test7-db', 'dotnet build', 'dotnet run --no-build hello world'], "test8-db", "csharp")
check_build_out("hello, world", s)
check_diagnostics(test_db="test8-db")
def test_option(codeql, csharp):
s = codeql.database.create(
command=["dotnet build", "dotnet run --no-build hello world"], _capture="stdout"
)
check_build_out("hello, world", s)
# two arguments, no '--' (first argument quoted)
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test8-db', 'dotnet run "hello world part1" part2'], "test9-db", "csharp")
check_build_out("hello world part1, part2", s)
check_diagnostics(test_db="test9-db")
def test_two_args_no_dash_dash_quote_first(codeql, csharp):
s = codeql.database.create(command='dotnet run "hello world" part2', _capture="stdout")
check_build_out("hello world, part2", s)
# two arguments, no '--' (second argument quoted) and using dotnet to execute dotnet
s = run_codeql_database_create_stdout(['dotnet clean', 'rm -rf test9-db', 'dotnet dotnet run part1 "hello world part2"'], "test10-db", "csharp")
check_build_out("part1, hello world part2", s)
check_diagnostics(test_db="test10-db")
def test_two_args_no_dash_dash_quote_second(codeql, csharp):
s = codeql.database.create(command='dotnet dotnet run hello "world part2"', _capture="stdout")
check_build_out("hello, world part2", s)

View File

@@ -1,6 +1,3 @@
from create_database_utils import *
from diagnostics_test_utils import *
# force CodeQL to use MSBuild by setting `LGTM_INDEX_MSBUILD_TARGET`
run_codeql_database_create([], db=None, lang="csharp", extra_env={ 'LGTM_INDEX_MSBUILD_TARGET': 'Build' })
check_diagnostics()
def test(codeql, csharp):
# force CodeQL to use MSBuild by setting `LGTM_INDEX_MSBUILD_TARGET`
codeql.database.create(_env={"LGTM_INDEX_MSBUILD_TARGET": "Build"})

View File

@@ -1,3 +1,2 @@
from create_database_utils import *
run_codeql_database_create(['dotnet build'], lang="csharp")
def test(codeql, csharp):
codeql.database.create(command="dotnet build")

View File

@@ -0,0 +1,6 @@
diagnosticAttributes
| Scanning C# code completed successfully, but the scan encountered issues. This may be caused by problems identifying dependencies or use of generated source code, among other reasons -- see other CodeQL diagnostics reported on the CodeQL status page for more details of possible causes. Addressing these warnings is advisable to avoid false-positive or missing results. If they cannot be addressed, consider scanning C# using either the `autobuild` or `manual` [build modes](https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages#comparison-of-the-build-modes). | visibilityCliSummaryTable | true |
| Scanning C# code completed successfully, but the scan encountered issues. This may be caused by problems identifying dependencies or use of generated source code, among other reasons -- see other CodeQL diagnostics reported on the CodeQL status page for more details of possible causes. Addressing these warnings is advisable to avoid false-positive or missing results. If they cannot be addressed, consider scanning C# using either the `autobuild` or `manual` [build modes](https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages#comparison-of-the-build-modes). | visibilityStatusPage | true |
| Scanning C# code completed successfully, but the scan encountered issues. This may be caused by problems identifying dependencies or use of generated source code, among other reasons -- see other CodeQL diagnostics reported on the CodeQL status page for more details of possible causes. Addressing these warnings is advisable to avoid false-positive or missing results. If they cannot be addressed, consider scanning C# using either the `autobuild` or `manual` [build modes](https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages#comparison-of-the-build-modes). | visibilityTelemetry | true |
#select
| Scanning C# code completed successfully, but the scan encountered issues. This may be caused by problems identifying dependencies or use of generated source code, among other reasons -- see other CodeQL diagnostics reported on the CodeQL status page for more details of possible causes. Addressing these warnings is advisable to avoid false-positive or missing results. If they cannot be addressed, consider scanning C# using either the `autobuild` or `manual` [build modes](https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages#comparison-of-the-build-modes). | Scanning C# code completed successfully, but the scan encountered issues. This may be caused by problems identifying dependencies or use of generated source code, among other reasons -- see other CodeQL diagnostics reported on the CodeQL status page for more details of possible causes. Addressing these warnings is advisable to avoid false-positive or missing results. If they cannot be addressed, consider scanning C# using either the `autobuild` or `manual` [build modes](https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages#comparison-of-the-build-modes). | 1 |

View File

@@ -0,0 +1 @@
Telemetry/DatabaseQualityDiagnostics.ql

View File

@@ -1,7 +1,9 @@
extractorMessages
| 5 |
| 6 |
compilerDiagnostics
| 4 |
extractorMessagesLeachedLimit
| Program.cs:1:1:1:0 | Stopped logging extractor messages after reaching 5 |
compilationInfo
| Compiler diagnostic count for CS0103 | 3.0 |
| Compiler diagnostic count for CS8019 | 7.0 |

View File

@@ -5,6 +5,10 @@ query predicate extractorMessages(int c) { c = count(ExtractorMessage msg) }
query predicate compilerDiagnostics(int c) { c = count(Diagnostic diag) }
query predicate extractorMessagesLeachedLimit(ExtractorMessage msg) {
msg.getText().indexOf("Stopped logging") = 0
}
query predicate compilationInfo(string key, float value) {
exists(Compilation c, string infoValue |
infoValue = c.getInfo(key) and key.matches("Compiler diagnostic count for%")

View File

@@ -1,9 +1,7 @@
import os
from create_database_utils import *
from diagnostics_test_utils import *
os.environ['CODEQL_EXTRACTOR_CSHARP_OPTION_COMPILER_DIAGNOSTIC_LIMIT'] = '2'
os.environ['CODEQL_EXTRACTOR_CSHARP_OPTION_MESSAGE_LIMIT'] = '5'
run_codeql_database_create([], lang="csharp", extra_args=["--build-mode=none"])
check_diagnostics()
def test(codeql, csharp):
os.environ["CODEQL_EXTRACTOR_CSHARP_OPTION_COMPILER_DIAGNOSTIC_LIMIT"] = "2"
os.environ["CODEQL_EXTRACTOR_CSHARP_OPTION_MESSAGE_LIMIT"] = "5"
codeql.database.create(build_mode="none")

View File

@@ -0,0 +1,2 @@
diagnosticAttributes
#select

View File

@@ -0,0 +1 @@
Telemetry/DatabaseQualityDiagnostics.ql

View File

@@ -1,8 +1,6 @@
import os
from create_database_utils import *
from diagnostics_test_utils import *
os.environ['CODEQL_EXTRACTOR_CSHARP_OPTION_BUILDLESS'] = 'true'
run_codeql_database_create([], lang="csharp")
check_diagnostics()
def test(codeql, csharp):
os.environ["CODEQL_EXTRACTOR_CSHARP_OPTION_BUILDLESS"] = "true"
codeql.database.create()

View File

@@ -1,3 +1,2 @@
from create_database_utils import *
run_codeql_database_create([], lang="csharp", extra_args=["--build-mode=none"])
def test(codeql, csharp):
codeql.database.create(build_mode="none")

View File

@@ -1,6 +1,2 @@
from create_database_utils import *
from diagnostics_test_utils import *
run_codeql_database_create([], db=None, lang="csharp", extra_args=["--build-mode=none"], runFunction=runUnsuccessfully)
check_diagnostics()
def test(codeql, csharp):
codeql.database.create(build_mode="none", _assert_failure=True)

View File

@@ -1,6 +1,6 @@
import os
from create_database_utils import *
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_EXTRACT_RESOURCES"] = "true"
run_codeql_database_create(lang="csharp", extra_args=["--build-mode=none"])
def test(codeql, csharp):
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_EXTRACT_RESOURCES"] = "true"
codeql.database.create(build_mode="none")

View File

@@ -1,3 +1,2 @@
from create_database_utils import *
run_codeql_database_create(lang="csharp", extra_args=["--build-mode=none"])
def test(codeql, csharp):
codeql.database.create(build_mode="none")

View File

@@ -1 +0,0 @@
These tests are still run with the legacy test runner

View File

@@ -183,25 +183,19 @@
| 182 | /warnaserror- |
| 183 | /utf8output |
| 184 | /deterministic+ |
| 185 | /sourcelink:obj/Debug/net8.0/test.sourcelink.json |
| 186 | /langversion:12.0 |
| 187 | /embed:Program.cs |
| 188 | /embed:obj/Debug/net8.0/test.GlobalUsings.g.cs |
| 189 | /embed:"obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs" |
| 190 | /embed:obj/Debug/net8.0/test.AssemblyInfo.cs |
| 191 | /analyzerconfig:/home/runner/work/semmle-code/semmle-code/.editorconfig |
| 192 | /analyzerconfig:obj/Debug/net8.0/test.GeneratedMSBuildEditorConfig.editorconfig |
| 193 | /analyzerconfig:[...]/8.0.101/Sdks/Microsoft.NET.Sdk/analyzers/build/config/analysislevel_8_default.globalconfig |
| 194 | /analyzer:[...]/8.0.101/Sdks/Microsoft.NET.Sdk/targets/../analyzers/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll |
| 195 | /analyzer:[...]/8.0.101/Sdks/Microsoft.NET.Sdk/targets/../analyzers/Microsoft.CodeAnalysis.NetAnalyzers.dll |
| 196 | /analyzer:[...]/8.0.1/analyzers/dotnet/cs/Microsoft.Interop.ComInterfaceGenerator.dll |
| 197 | /analyzer:[...]/8.0.1/analyzers/dotnet/cs/Microsoft.Interop.JavaScript.JSImportGenerator.dll |
| 198 | /analyzer:[...]/8.0.1/analyzers/dotnet/cs/Microsoft.Interop.LibraryImportGenerator.dll |
| 199 | /analyzer:[...]/8.0.1/analyzers/dotnet/cs/Microsoft.Interop.SourceGeneration.dll |
| 200 | /analyzer:[...]/8.0.1/analyzers/dotnet/cs/System.Text.Json.SourceGeneration.dll |
| 201 | /analyzer:[...]/8.0.1/analyzers/dotnet/cs/System.Text.RegularExpressions.Generator.dll |
| 202 | Program.cs |
| 203 | obj/Debug/net8.0/test.GlobalUsings.g.cs |
| 204 | obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs |
| 205 | obj/Debug/net8.0/test.AssemblyInfo.cs |
| 206 | /warnaserror+:NU1605,SYSLIB0011 |
| 185 | /langversion:12.0 |
| 186 | /analyzerconfig:obj/Debug/net8.0/test.GeneratedMSBuildEditorConfig.editorconfig |
| 187 | /analyzerconfig:[...]/8.0.101/Sdks/Microsoft.NET.Sdk/analyzers/build/config/analysislevel_8_default.globalconfig |
| 188 | /analyzer:[...]/8.0.101/Sdks/Microsoft.NET.Sdk/targets/../analyzers/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll |
| 189 | /analyzer:[...]/8.0.101/Sdks/Microsoft.NET.Sdk/targets/../analyzers/Microsoft.CodeAnalysis.NetAnalyzers.dll |
| 190 | /analyzer:[...]/8.0.1/analyzers/dotnet/cs/Microsoft.Interop.ComInterfaceGenerator.dll |
| 191 | /analyzer:[...]/8.0.1/analyzers/dotnet/cs/Microsoft.Interop.JavaScript.JSImportGenerator.dll |
| 192 | /analyzer:[...]/8.0.1/analyzers/dotnet/cs/Microsoft.Interop.LibraryImportGenerator.dll |
| 193 | /analyzer:[...]/8.0.1/analyzers/dotnet/cs/Microsoft.Interop.SourceGeneration.dll |
| 194 | /analyzer:[...]/8.0.1/analyzers/dotnet/cs/System.Text.Json.SourceGeneration.dll |
| 195 | /analyzer:[...]/8.0.1/analyzers/dotnet/cs/System.Text.RegularExpressions.Generator.dll |
| 196 | Program.cs |
| 197 | obj/Debug/net8.0/test.GlobalUsings.g.cs |
| 198 | obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs |
| 199 | obj/Debug/net8.0/test.AssemblyInfo.cs |
| 200 | /warnaserror+:NU1605,SYSLIB0011 |

View File

@@ -1,3 +1,6 @@
from create_database_utils import *
import runs_on
run_codeql_database_create([], lang="csharp")
@runs_on.linux
def test(codeql, csharp):
codeql.database.create()

View File

@@ -1,8 +1,10 @@
from create_database_utils import *
import runs_on
path = b'\xd2abcd.cs'
with open(path, 'w') as file:
file.write('class X { }\n')
@runs_on.linux
def test(codeql, csharp):
path = b"\xd2abcd.cs"
run_codeql_database_create([], lang="csharp", extra_args=["--build-mode=none"])
with open(path, "w") as file:
file.write("class X { }\n")
codeql.database.create(build_mode="none")

View File

@@ -1,5 +1,6 @@
from create_database_utils import *
from diagnostics_test_utils import *
import runs_on
run_codeql_database_create([], db=None, lang="csharp", runFunction=runUnsuccessfully)
check_diagnostics()
@runs_on.posix
def test(codeql, csharp):
codeql.database.create(_assert_failure=True)

View File

@@ -1,5 +1,6 @@
from create_database_utils import *
from diagnostics_test_utils import *
import runs_on
run_codeql_database_create([], db=None, lang="csharp", runFunction=runUnsuccessfully)
check_diagnostics()
@runs_on.posix
def test(codeql, csharp):
codeql.database.create(_assert_failure=True)

View File

@@ -1,15 +1,19 @@
from create_database_utils import *
from diagnostics_test_utils import *
import runs_on
# Implicitly build and then run tests.
run_codeql_database_create(['dotnet test'], test_db="test-db", lang="csharp")
check_diagnostics()
# Explicitly build and then run tests.
run_codeql_database_create(['dotnet clean', 'rm -rf test-db', 'dotnet build -o myout', 'dotnet test myout/dotnet_test.dll'], test_db="test2-db", lang="csharp")
check_diagnostics(test_db="test2-db")
@runs_on.posix
def test_implicit_build_then_run(codeql, csharp):
codeql.database.create(command="dotnet test")
@runs_on.posix
def test_explicit_build_then_run(codeql, csharp):
codeql.database.create(command=["dotnet build -o myout", "dotnet test myout/dotnet_test.dll"])
thisDir = os.path.abspath(os.getcwd())
# Explicit build and then run tests using the absolute path.
run_codeql_database_create(['dotnet clean', 'rm -rf test2-db', 'dotnet build -o myout', f'dotnet test {thisDir}/myout/dotnet_test.dll'], test_db="test3-db", lang="csharp")
check_diagnostics(test_db="test3-db")
@runs_on.posix
def test_explicit_build_then_run_abs_path(codeql, csharp, cwd):
codeql.database.create(
command=["dotnet build -o myout", f"dotnet test {cwd}/myout/dotnet_test.dll"]
)

View File

@@ -1,14 +1,19 @@
import platform
from create_database_utils import *
from diagnostics_test_utils import *
import runs_on
# Implicitly build and then run tests.
run_codeql_database_create(['dotnet test'], test_db="test-db", lang="csharp")
check_diagnostics()
# Fix `dotnet test` picking `x64` on arm-based macOS
architecture = '-a arm64' if platform.machine() == 'arm64' else ''
@runs_on.posix
def test_implicit_build_and_test(codeql, csharp):
codeql.database.create(command="dotnet test")
# Explicitly build and then run tests.
run_codeql_database_create(['dotnet clean', 'rm -rf test-db', 'dotnet build -o myout --os win', 'dotnet test myout/dotnet_test_mstest.exe ' + architecture], test_db="test2-db", lang="csharp")
check_diagnostics(test_db="test2-db")
@runs_on.posix
def test_explicit_build_and_test(codeql, csharp):
# Fix `dotnet test` picking `x64` on arm-based macOS
architecture = "-a arm64" if runs_on.arm64 else ""
codeql.database.create(
command=[
"dotnet build -o myout --os win",
f"dotnet test myout/dotnet_test_mstest.exe {architecture}",
]
)

View File

@@ -1,8 +1,8 @@
from create_database_utils import *
from diagnostics_test_utils import *
import os
import runs_on
os.environ["PROJECT_TO_BUILD"] = "proj.csproj.no_auto"
run_codeql_database_create([], db=None, lang="csharp")
check_diagnostics()
@runs_on.posix
def test(codeql, csharp):
os.environ["PROJECT_TO_BUILD"] = "proj.csproj.no_auto"
codeql.database.create()

View File

@@ -1,3 +1,6 @@
from create_database_utils import *
import runs_on
run_codeql_database_create([], lang="csharp", extra_args=["--build-mode=none"])
@runs_on.posix
def test(codeql, csharp):
codeql.database.create(build_mode="none")

View File

@@ -1,3 +1,6 @@
from create_database_utils import *
import runs_on
run_codeql_database_create([], lang="csharp", extra_args=["--build-mode=none"])
@runs_on.posix
def test(codeql, csharp):
codeql.database.create(build_mode="none")

View File

@@ -1,3 +1,6 @@
from create_database_utils import *
import runs_on
run_codeql_database_create([], lang="csharp", extra_args=["--build-mode=none"])
@runs_on.posix
def test(codeql, csharp):
codeql.database.create(build_mode="none")

View File

@@ -1,3 +1,6 @@
from create_database_utils import *
import runs_on
run_codeql_database_create([], lang="csharp", extra_args=["--build-mode=none"])
@runs_on.posix
def test(codeql, csharp):
codeql.database.create(build_mode="none")

View File

@@ -1 +0,0 @@
Skipping the test on the ARM runners, as we're running into trouble with Mono and nuget.

View File

@@ -1,5 +1,12 @@
from create_database_utils import *
import runs_on
import pytest
import os
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_DOTNET_FRAMEWORK_REFERENCES"] = "/non-existent-path"
run_codeql_database_create([], lang="csharp", extra_args=["--build-mode=none"])
# Skipping the test on the ARM runners, as we're running into trouble with Mono and nuget.
@pytest.mark.only_if(runs_on.linux or (runs_on.macos and runs_on.x86_64))
def test(codeql, csharp):
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_DOTNET_FRAMEWORK_REFERENCES"] = (
"/non-existent-path"
)
codeql.database.create(build_mode="none")

View File

@@ -1 +0,0 @@
Skipping the test on the ARM runners, as we're running into trouble with Mono and nuget.

View File

@@ -1,8 +1,12 @@
from create_database_utils import *
import os
import runs_on
import pytest
# making sure we're not doing any fallback restore:
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK_FALLBACK_TIMEOUT"] = "1"
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK_FALLBACK_LIMIT"] = "1"
run_codeql_database_create([], lang="csharp", extra_args=["--build-mode=none"])
# Skipping the test on the ARM runners, as we're running into trouble with Mono and nuget.
@pytest.mark.only_if(runs_on.linux or (runs_on.macos and runs_on.x86_64))
def test(codeql, csharp):
# making sure we're not doing any fallback restore:
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK_FALLBACK_TIMEOUT"] = "1"
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK_FALLBACK_LIMIT"] = "1"
codeql.database.create(build_mode="none")

View File

@@ -1 +0,0 @@
Skipping the test on the ARM runners, as we're running into trouble with Mono and nuget.

View File

@@ -1,3 +1,8 @@
from create_database_utils import *
import runs_on
import pytest
run_codeql_database_create([], lang="csharp", extra_args=["--build-mode=none"])
# Skipping the test on the ARM runners, as we're running into trouble with Mono and nuget.
@pytest.mark.only_if(runs_on.linux or (runs_on.macos and runs_on.x86_64))
def test(codeql, csharp):
codeql.database.create(build_mode="none")

View File

@@ -1,3 +1,6 @@
from create_database_utils import *
import runs_on
run_codeql_database_create([], lang="csharp", extra_args=["--build-mode=none"])
@runs_on.posix
def test(codeql, csharp):
codeql.database.create(build_mode="none")

View File

@@ -28,7 +28,7 @@
}
{
"markdownMessage": "Found unreachable Nuget feed in C# analysis with build-mode 'none'. This may cause missing dependencies in the analysis.",
"severity": "warning",
"severity": "note",
"source": {
"extractorName": "csharp",
"id": "csharp/autobuilder/buildless/unreachable-feed",

View File

@@ -1,17 +1,26 @@
from create_database_utils import *
from diagnostics_test_utils import *
import os
import runs_on
# os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK"] = "true" # Nuget feed check is enabled by default
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK_TIMEOUT"] = "1" # 1ms, the GET request should fail with such short timeout
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK_LIMIT"] = "1" # Limit the count of checks to 1
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK_EXCLUDED"] = "https://abc.de:8000/packages/" # Exclude this feed from check
# Making sure the reachability test of `nuget.org` succeeds:
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK_FALLBACK_TIMEOUT"] = "1000"
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK_FALLBACK_LIMIT"] = "5"
# The second feed is ignored in the fallback restore, because of network issues:
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_FALLBACK"] = "https://api.nuget.org/v3/index.json https://abc.def:8000/packages/"
@runs_on.posix
def test(codeql, csharp):
# os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK"] = "true" # Nuget feed check is enabled by default
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK_TIMEOUT"] = (
"1" # 1ms, the GET request should fail with such short timeout
)
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK_LIMIT"] = (
"1" # Limit the count of checks to 1
)
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK_EXCLUDED"] = (
"https://abc.de:8000/packages/" # Exclude this feed from check
)
run_codeql_database_create([], lang="csharp", extra_args=["--build-mode=none"])
check_diagnostics()
# Making sure the reachability test of `nuget.org` succeeds:
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK_FALLBACK_TIMEOUT"] = "1000"
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK_FALLBACK_LIMIT"] = "5"
# The second feed is ignored in the fallback restore, because of network issues:
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_FALLBACK"] = (
"https://api.nuget.org/v3/index.json https://abc.def:8000/packages/"
)
codeql.database.create(build_mode="none")

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