Compare commits

..

3093 Commits

Author SHA1 Message Date
Dave Bartolomeo
d42788844f Merge pull request #18436 from github/release-prep/2.20.1
Release preparation for version 2.20.1
2025-01-07 15:59:15 -05:00
Dave Bartolomeo
4c53caf021 Update python/ql/lib/change-notes/released/3.1.0.md 2025-01-07 15:58:28 -05:00
Dave Bartolomeo
45c00d6880 Update python/ql/lib/CHANGELOG.md 2025-01-07 15:58:19 -05:00
github-actions[bot]
88b6f1e79a Release preparation for version 2.20.1 2025-01-07 20:50:36 +00:00
Dave Bartolomeo
1fb597376e Merge pull request #18434 from github/dbartol/revert-go
Revert two Go PRs
2025-01-07 15:43:46 -05:00
Dave Bartolomeo
1323b3f067 Revert "Merge pull request #18235 from owen-mc/go/varargs-out-param"
This reverts commit 4f8645b4dd, reversing
changes made to 22aaf74184.
2025-01-07 14:59:31 -05:00
Dave Bartolomeo
3dcf49cea0 Revert "Merge pull request #18275 from owen-mc/go/mad/variadic-params-sources"
This reverts commit 7ab06fca2f, reversing
changes made to 0c5e260ae6.
2025-01-07 14:55:06 -05:00
Dave Bartolomeo
f12ff2d77f Merge pull request #18432 from github/revert-18430-release-prep/2.20.1
Revert "Release preparation for version 2.20.1"
2025-01-07 13:35:59 -05:00
Dave Bartolomeo
72a53c4b23 Revert "Release preparation for version 2.20.1" 2025-01-07 13:32:23 -05:00
Dave Bartolomeo
3da6adf1e8 Merge pull request #18430 from github/release-prep/2.20.1
Release preparation for version 2.20.1
2025-01-07 12:24:41 -05:00
Dave Bartolomeo
cb31394729 Update python/ql/lib/CHANGELOG.md 2025-01-07 12:23:52 -05:00
Dave Bartolomeo
2e46d26eca Update python/ql/lib/change-notes/released/3.1.0.md 2025-01-07 12:22:31 -05:00
github-actions[bot]
fbf9f2fff8 Release preparation for version 2.20.1 2025-01-07 17:20:13 +00:00
Dave Bartolomeo
de2460e8b1 Merge pull request #18428 from github/revert-18419-release-prep/2.20.1
Revert "Release preparation for version 2.20.1"
2025-01-07 12:17:25 -05:00
Dave Bartolomeo
22e030584c Revert "Release preparation for version 2.20.1" 2025-01-07 12:14:27 -05:00
Dave Bartolomeo
5d0c55ec33 Merge pull request #18419 from github/release-prep/2.20.1
Release preparation for version 2.20.1
2025-01-06 13:27:00 -05:00
Dave Bartolomeo
8a2398aaf0 Update python/ql/lib/CHANGELOG.md 2025-01-06 13:26:09 -05:00
github-actions[bot]
a121c5a5d0 Release preparation for version 2.20.1 2025-01-06 18:20:22 +00:00
Cornelius Riemenschneider
0c2e05717f Merge pull request #18417 from github/redsun82/cpp-analysis
Swift: fix CodeQL analysis workflow
2025-01-06 17:53:21 +01:00
Paolo Tranquilli
370af8ac18 Swift: fix CodeQL analysis workflow 2025-01-06 17:12:37 +01:00
Mathias Vorreiter Pedersen
493e75728c Merge pull request #18386 from MathiasVP/more-robust-param-name-matching
C++: Resolve `typedef`s when matching MaD parameters
2025-01-06 14:40:17 +00:00
Mathias Vorreiter Pedersen
99ad184f57 Update cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2025-01-06 13:32:11 +00:00
Mathias Vorreiter Pedersen
75a3b6b613 Update cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2025-01-06 13:32:04 +00:00
Mathias Vorreiter Pedersen
f3085fc865 Update cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2025-01-06 13:30:59 +00:00
Mathias Vorreiter Pedersen
bfd18bc3e3 Update cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2025-01-06 13:30:50 +00:00
Simon Friis Vindum
7248fb70c3 Merge pull request #18394 from paldepind/rust-format
Rust: Value flow and taint flow through formatting strings
2025-01-06 13:55:04 +01:00
Jeroen Ketema
01a7a5323b Merge pull request #18360 from github/jketema/template-parameters-3
C++: Support arguments and instantiations of template template parameters
2025-01-06 13:41:45 +01:00
Jeroen Ketema
0942945fa1 Update cpp/ql/lib/semmle/code/cpp/TemplateParameter.qll
Co-authored-by: Calum Grant <42069085+calumgrant@users.noreply.github.com>
2025-01-06 13:30:43 +01:00
Simon Friis Vindum
c55b256d47 Rust: Remove accidentally commited expected files 2025-01-06 12:01:03 +01:00
Paolo Tranquilli
2e1e46c866 Merge pull request #18352 from github/redsun82/rust-codeql-config
Rust: extend `paths-ignore` to all `rust/ql`
2025-01-06 11:53:33 +01:00
Simon Friis Vindum
5c64a8c948 Rust: Accept expected changes and fix other CI complaints 2025-01-03 16:38:11 +01:00
Jeroen Ketema
b0062fc727 Merge pull request #18387 from jketema/change-tweak
C++: Slightly tweak change note to make it more consistent with others
2025-01-03 15:32:56 +01:00
Michael Nebel
7a7d8e40a7 Merge pull request #18384 from michaelnebel/csharp13/escapechars
C# 13: [TEST ONLY] Add test using the new escape char for ESCAPE.
2025-01-03 15:09:27 +01:00
Michael Nebel
49abfdfe4a Merge pull request #18348 from michaelnebel/csharp/locktype
C# 13: [TEST ONLY] Add test using the System.Threading.Lock type.
2025-01-03 15:08:46 +01:00
Michael Nebel
7cdaa799fc Merge pull request #18329 from michaelnebel/csharp/params
C# 13: params modifier on collection types.
2025-01-03 15:07:47 +01:00
Simon Friis Vindum
cd957ba63b Rust: Add models for functions used inside format! macro 2025-01-03 14:09:23 +01:00
Simon Friis Vindum
0d19fb6040 Rust: Add taint from children of format_args to format_args 2025-01-03 14:06:47 +01:00
Simon Friis Vindum
2ef9339d00 Rust: Generate CFG node for FormatArgsArg 2025-01-03 13:58:25 +01:00
Simon Friis Vindum
42d125676e Rust: Value flow through macro calls 2025-01-03 13:47:29 +01:00
Simon Friis Vindum
f09632df58 Rust: Add data flow tests for macros and format_args 2025-01-03 13:28:19 +01:00
Mathias Vorreiter Pedersen
9672af333a C++: Cache 'interpretElement'. This reduces DIL size of 'cpp/unbounded-write' by about 8%. 2025-01-03 10:46:57 +01:00
Jeroen Ketema
8e660190a9 C++: Add dbscheme upgrade and downgrade script 2025-01-02 21:32:03 +01:00
Jeroen Ketema
795278d5ac C++: Add change note 2025-01-02 21:31:58 +01:00
Jeroen Ketema
cfb98acbf1 C++: Slightly tweak change note to make it more consistent with others 2025-01-02 21:29:04 +01:00
Jeroen Ketema
6bf08f550e C++: Update dbscheme stats file 2025-01-02 17:59:16 +01:00
Jeroen Ketema
84775b71c3 C++: Support arguments and instantiations of template template parameters 2025-01-02 17:59:06 +01:00
Mathias Vorreiter Pedersen
682dd42caa C++: Accept test changes. 2025-01-02 16:10:19 +01:00
Mathias Vorreiter Pedersen
3d3feb6354 C++: Also resolve typedefs when parsing MaD model parameter names. 2025-01-02 16:06:46 +01:00
Mathias Vorreiter Pedersen
5ccc12cea1 C++: Add a testcase that demonstrates the problem with MaD and typedefs. 2025-01-02 16:06:45 +01:00
Mathias Vorreiter Pedersen
f23e56bdca Merge pull request #18261 from MathiasVP/add-more-atl-string-models
C++: Add more MaD models for ATL string classes
2025-01-02 15:06:04 +00:00
Mathias Vorreiter Pedersen
cda007bae7 C++: Fix constructor model. 2025-01-02 15:39:31 +01:00
Mathias Vorreiter Pedersen
289b938b4d C++: Fix testcase. 2025-01-02 15:37:39 +01:00
Mathias Vorreiter Pedersen
d8cfa711ad C++: Fix testcase for conversion operator. 2025-01-02 15:35:21 +01:00
Mathias Vorreiter Pedersen
c1b997b2cb C++: Make the string constructors value-preserving. 2025-01-02 15:25:23 +01:00
Mathias Vorreiter Pedersen
b8e54627f4 C++: Make some of the string models taint instead of value-preserving. 2025-01-02 15:22:42 +01:00
Mathias Vorreiter Pedersen
052b6f6ec4 C++: Accept test changes. 2025-01-02 15:22:10 +01:00
Mathias Vorreiter Pedersen
71ca9412b0 Update cpp/ql/lib/ext/CSimpleStringT.model.yml
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2025-01-02 14:16:31 +00:00
Michael Nebel
75e562d0f0 C#: Add test using the new escape char for ESCAPE. 2025-01-02 12:51:22 +01:00
Michael Nebel
fe4ec59b4e C#: Address review comments. 2025-01-02 11:21:29 +01:00
Michael Nebel
596fdf0cfa C#: Add change-note. 2025-01-02 11:13:14 +01:00
Michael Nebel
4b7a6c5c7f C#: Let the params test look in reference assemblies and update params to allow ParamsCollectionType. 2025-01-02 11:13:13 +01:00
Michael Nebel
c8e72c08fb C#: Update tests expected output. 2025-01-02 11:13:12 +01:00
Michael Nebel
8f5b8f494f C#: Update dispatch logic and other libraries to handle params collection types. 2025-01-02 11:13:10 +01:00
Michael Nebel
89c16abf59 C#: Add more tests for params and update expected output. 2025-01-02 11:13:09 +01:00
Michael Nebel
8e9551dff7 C#: Exclude non source parameters from arguments test cases (otherwise the test reports indexer access and calls to Add for list and collection creations). 2025-01-02 11:13:07 +01:00
Michael Nebel
68ca307ac9 Merge pull request #18357 from github/workflow/coverage/update
Update CSV framework coverage reports
2025-01-02 10:15:04 +01:00
github-actions[bot]
829cfa9517 Add changed framework coverage reports 2025-01-02 00:20:39 +00:00
Mathias Vorreiter Pedersen
e7773770fa C++: Fix missing return value flow out of 'operator=' in lots of MaD models. 2024-12-23 12:00:41 +01:00
Paolo Tranquilli
c95f8d797c Merge pull request #18347 from github/redsun82/rust-include-test-code-again
Rust: reinstate extraction of test code
2024-12-21 09:00:37 +01:00
Edward Minnix III
f06ad7c728 Merge pull request #18322 from egregius313/egregius313/csharp/blazor/modeling/sources
C#: Add common sources for Blazor components
2024-12-20 17:11:48 -05:00
Dave Bartolomeo
2aba49f074 Merge pull request #18356 from github/dbartol/actions-suites
Update suites for Actions queries
2024-12-20 15:54:44 -05:00
Dave Bartolomeo
90efbf5172 Update suites for Actions queries 2024-12-20 14:37:46 -05:00
Dave Bartolomeo
e9a04b8839 Mark UnversionedImmutableAction query as internal 2024-12-20 14:37:32 -05:00
Andrew Eisenberg
553e2c5757 Merge pull request #18354 from github/aeisenberg/actions-ownership
Update CODEOWNERS
2024-12-20 11:10:29 -08:00
Jeroen Ketema
b60c86077d Merge pull request #18353 from jketema/template-parameters-2
C++: Handle `sizeof...` for types and template template parameters
2024-12-20 19:15:50 +01:00
Andrew Eisenberg
9bff89c910 Update CODEOWNERS
Add ownership for the actions queries.

We don't yet have a `codeql-actions` team. So, using the dynamic team for this.
2024-12-20 09:30:15 -08:00
Andrew Eisenberg
fd7bd6b07d Merge pull request #18351 from KyFaSt/clarify-immutable-actions-text
Clarify immutable actions help text
2024-12-20 09:28:01 -08:00
Kylie Stradley
690924f72b Update actions/ql/src/Security/CWE-829/UnversionedImmutableAction.md
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2024-12-20 12:04:42 -05:00
Jeroen Ketema
659ec66b5e Merge pull request #18350 from jketema/test-cleanup-2
C++: Simplify more `semmle-extractor-options`
2024-12-20 17:23:54 +01:00
Kylie Stradley
dc705ad623 indicate immutable actions are only available for internal use at this time 2024-12-20 11:19:15 -05:00
Jeroen Ketema
e9b9dc23f8 Update cpp/ql/lib/change-notes/2024-12-20-sizeof-pack.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2024-12-20 17:11:38 +01:00
Jeroen Ketema
46e9d0aa0c Merge pull request #18334 from jketema/template-parameters-1
C++: Update test after extractor changes
2024-12-20 17:08:31 +01:00
Paolo Tranquilli
b7437a4550 Rust: extend paths-ignore to all rust/ql
This will also exclude code examples in `rust/ql/src/queries`.
2024-12-20 16:13:51 +01:00
Jeroen Ketema
46b230ae92 C++: Simplify more semmle-extractor-options
This will allow us to drop a number of special cases from the
extractor.
2024-12-20 16:01:19 +01:00
Kylie Stradley
2dd3adac51 clarify immutable actions help text 2024-12-20 09:51:51 -05:00
Michael Nebel
1aa7c3fdcc C#: Add test for the new lock type. 2024-12-20 15:02:36 +01:00
Michael Nebel
29a0db8053 C#: Update test expected output. 2024-12-20 15:00:54 +01:00
Michael Nebel
4a716c6005 C#: Add a test example in the statements test. 2024-12-20 15:00:30 +01:00
Paolo Tranquilli
f13d03b18c Rust: fix typo (thanks copilot!) 2024-12-20 14:18:36 +01:00
Florin Coada
5f812342a8 Merge pull request #18338 from github/changedocs/2.20.0
Update CodeQL changelog for versions 2.19.4 and 2.20.0
2024-12-20 15:12:55 +02:00
Paolo Tranquilli
485586f780 Rust: reinstate extraction of test code
Users will still be able to opt out:
* for unit tests, by providing the `cargo_cfg_overrides=-test` extractor
  option
* for integration tests, by excluding the test files from the analysis
  using `paths-ignore` in the codescanning configuration file

We may want to revisit whether we want a single option for both. Also
further work will be needed to restrict our security queries to non-test
code on the QL side.
2024-12-20 14:12:41 +01:00
Jeroen Ketema
6ecaf20cdd C++: Update expected test results 2024-12-20 13:53:35 +01:00
Jeroen Ketema
ecf3c53eba C++: Introduce SizeofPackOperator subclasses for expressions and types
Note that template template parameters are considered types in this context.
2024-12-20 13:51:45 +01:00
Jeroen Ketema
90d8fb1a05 Merge pull request #18335 from jketema/test-cleanup
C++: Simplify some semmle-extractor-options in tests
2024-12-20 13:43:59 +01:00
Arthur Baars
2b2a37353b Merge pull request #18328 from github/redsun82/fix-cargo-fmt-checks
CI: fix rust formatting
2024-12-20 13:41:28 +01:00
Calum Grant
d5571c5f68 Merge pull request #18309 from github/calumgrant/bmn/return-stack-allocated-memory
C++: Fix FPs to cpp/return-stack-allocated-memory
2024-12-20 10:54:24 +00:00
Florin Coada
82fdd1125c Update docs/codeql/codeql-overview/codeql-changelog/codeql-cli-2.20.0.rst
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-12-20 12:50:05 +02:00
Jeroen Ketema
dd021fdcbf Merge pull request #18339 from jketema/typo
C++: Remove duplicate word from change note
2024-12-20 11:50:01 +01:00
Jeroen Ketema
51f625b90c C++: Allow sizeof pack in sizeof_bind 2024-12-20 11:49:37 +01:00
Florin Coada
5c5049e5fd Fix typo in CodeQL changelog entry 2024-12-20 12:35:40 +02:00
Florin Coada
66f3b718a6 Update docs/codeql/codeql-overview/codeql-changelog/codeql-cli-2.20.0.rst
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-12-20 12:19:53 +02:00
Jeroen Ketema
757d5d6e6d C++: Remove duplicate word from change note 2024-12-20 11:18:26 +01:00
Paolo Tranquilli
8e28d99a62 QL for QL: accept test changes 2024-12-20 10:42:19 +01:00
Florin Coada
3bd8d7c0bb Update CodeQL changelog for versions 2.19.4 and 2.20.0 2024-12-20 11:37:33 +02:00
Calum Grant
3193fe856a C++: Update comments 2024-12-20 09:11:58 +00:00
Jeroen Ketema
6f9968d2c2 C++: Update test after extractor changes 2024-12-20 08:27:39 +01:00
Edward Minnix III
453913cd9f Remove Parameter from this PR 2024-12-19 23:11:07 -05:00
Dave Bartolomeo
772b972e7d Merge pull request #18321 from github/dbartol/actions-merge
Migrate Actions queries to public repo
2024-12-19 16:04:49 -05:00
Jeroen Ketema
6200a1d5b9 C++: Simplify some semmle-extractor-options in tests 2024-12-19 21:46:33 +01:00
Rasmus Wriedt Larsen
22b35f5fe7 Merge pull request #18318 from RasmusWL/fastapi-request
Python: Model FastAPI requests
2024-12-19 19:52:17 +01:00
Dave Bartolomeo
30dbc3b172 Merge pull request #18332 from github/dbartol/actions-changenote
Add `actions` as a supported language for change notes
2024-12-19 12:23:52 -05:00
Dave Bartolomeo
2b4161e16c Add actions as a supported language for change notes 2024-12-19 12:15:00 -05:00
Paolo Tranquilli
42422632ba Merge pull request #18331 from github/redsun82/rust-paths-exclude
Rust: support `paths` and `paths-ignore` from the code scanning configuration file
2024-12-19 17:59:49 +01:00
Paolo Tranquilli
73a5a3f7ee Rust: support paths and paths-ignore from the code scanning configuration file
This is done by simply adding the autobuilder from the shared
tree-sitter extractor library.
2024-12-19 17:37:56 +01:00
Calum Grant
7abe7003dc Update cpp/ql/test/query-tests/Likely Bugs/Memory Management/ReturnStackAllocatedMemory/test.cpp
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-12-19 16:01:05 +00:00
Dave Bartolomeo
e4bce701a0 Add change notes 2024-12-19 10:53:23 -05:00
Jeroen Ketema
84b60d2676 Merge pull request #18320 from jketema/template-parameters
C++: Support non-type template parameters
2024-12-19 16:21:49 +01:00
Dave Bartolomeo
bfa105fc0d Fix typo 2024-12-19 10:00:20 -05:00
Paolo Tranquilli
2ff0394a10 Rust: add --no-deps to clippy checks 2024-12-19 15:58:45 +01:00
Paolo Tranquilli
2e150772fd Merge branch 'main' into redsun82/fix-cargo-fmt-checks 2024-12-19 15:52:36 +01:00
Dave Bartolomeo
8b132274b5 Revert "Accept DB consistency check for now"
This reverts commit dba6f0bb9f.
2024-12-19 09:47:42 -05:00
Dave Bartolomeo
3e2fe46993 Merge remote-tracking branch 'origin/main' into dbartol/actions-merge 2024-12-19 09:34:29 -05:00
Calum Grant
e067ac92a7 C++: Address review comments 2024-12-19 14:27:13 +00:00
Ed Minnix
d0c9ba19d7 Fix test results 2024-12-19 09:02:06 -05:00
Ed Minnix
ae6752adf7 Update tests 2024-12-19 09:02:05 -05:00
Ed Minnix
84936c0fc0 Change note 2024-12-19 09:02:02 -05:00
Ed Minnix
b618ae06e8 Model Blazor attributes as marking sources
The attributes

- `[Parameter]`
- `[SupplyParameterFromFormAttribute]`
- `[SupplyParameterFromQueryAttribute]`

Tell Blazor to initialize the variables with parameters defined by the
route/form values/query parameters/etc. Values derived from the URI or
form should be classified as `remote` flow sources.
2024-12-19 09:01:56 -05:00
Edward Minnix III
90dbc34c16 Merge pull request #18323 from egregius313/egregius313/csharp/blazor/navigation-manager/typo
Fix typo in `NavigationManager` name in models
2024-12-19 09:00:17 -05:00
Rasmus Wriedt Larsen
a9704d8de0 Update change-note wording
Co-authored-by: Aditya Sharad <6874315+adityasharad@users.noreply.github.com>
2024-12-19 14:08:23 +01:00
Simon Friis Vindum
5141f7b87c Merge pull request #18330 from paldepind/rust-variables-macro
Rust: Add variables example with let statement in macro
2024-12-19 13:47:43 +01:00
Simon Friis Vindum
a28ddd642c Rust: Add variables example with let statement in macro 2024-12-19 13:12:45 +01:00
Paolo Tranquilli
df39610029 Rust: skip injected sources in clippy and fmt checks 2024-12-19 12:29:27 +01:00
Paolo Tranquilli
110d3994ea Rust: fix workflow 2024-12-19 12:23:36 +01:00
Paolo Tranquilli
7f5b8fdcec Rust: remove clippy warnings 2024-12-19 12:22:40 +01:00
Paolo Tranquilli
1d9a9fef76 CI: fix rust formatting
`cargo fmt --all` should be avoided in CI as that will include `rust/ast-generator`
which has sources provided by bazel (`bazel run //rust/ast-generator:inject_sources`
can provide those sources in-tree).

Now the formatting checks are limited to the sources that trigger the jobs, and a
check is added to `rust/ast-generator`.
2024-12-19 12:01:53 +01:00
Paolo Tranquilli
b392391138 Merge pull request #18319 from github/redsun82/rust-fetch-ungram
Rust: fetch ungram and rust-analyzer code instead of checking it in
2024-12-19 08:16:09 +01:00
Ed Minnix
b1bba731b4 Remove irrelevant test results 2024-12-18 21:05:52 -05:00
Ed Minnix
00ecdb0a83 Fix typo in NavigationManager name in model 2024-12-18 20:52:00 -05:00
Dave Bartolomeo
9b9df4c7e0 Temporarily disable QlDoc checks for Actions
https://github.com/github/codeql-team/issues/3656
2024-12-18 17:02:02 -05:00
Dave Bartolomeo
dba6f0bb9f Accept DB consistency check for now
Failure tracked in https://github.com/github/codeql-team/issues/3655
2024-12-18 16:54:34 -05:00
Dave Bartolomeo
4743dfa601 Fix result of getAPrimaryQlClass() 2024-12-18 16:22:37 -05:00
Dave Bartolomeo
a66ba4ebae Remove printCfg.ql
This file not yet fully implemented and does not compile
2024-12-18 16:11:54 -05:00
Dave Bartolomeo
99bdef1268 Fix compilation warnings 2024-12-18 15:56:49 -05:00
Dave Bartolomeo
d66cb7e8c7 Fix formatting 2024-12-18 15:48:34 -05:00
Dave Bartolomeo
7891134a87 Fix formatting 2024-12-18 15:43:53 -05:00
Jeroen Ketema
2209ee6747 C++: Update stats file 2024-12-18 20:53:34 +01:00
Dave Bartolomeo
47e364a13b Remove placeholder code 2024-12-18 14:51:24 -05:00
Dave Bartolomeo
c7efe5d0f5 Update lock files 2024-12-18 14:42:13 -05:00
Dave Bartolomeo
dbc1fa6450 Merge Actions queries from github/codeql-actions 2024-12-18 14:39:43 -05:00
Dave Bartolomeo
ee7680df84 Move into actions subdirectory to prepare for migration to github/codeql 2024-12-18 14:35:15 -05:00
Dave Bartolomeo
237a6f11f9 Bump version 2024-12-18 13:32:55 -05:00
Dave Bartolomeo
501e3b3e92 Merge remote-tracking branch 'origin/master' into dbartol/move-to-codeql 2024-12-18 13:26:21 -05:00
Jeroen Ketema
87f12ac801 C++: Add NonTypeTemplateParameter class 2024-12-18 17:37:15 +01:00
Paolo Tranquilli
c4a7abda0a Bazel: resync 3rd party dependencies and skip buildifier on them 2024-12-18 17:33:39 +01:00
Paolo Tranquilli
d6b8d42936 Bazel: fix 3rdparty update script 2024-12-18 17:20:05 +01:00
Jeroen Ketema
a99c9b58bb C++: Add upgrade and downgrade scripts for non-type template parameters 2024-12-18 17:01:51 +01:00
Jeroen Ketema
8b626266c4 C++: Support non-type template parameters in the database scheme 2024-12-18 16:53:06 +01:00
Paolo Tranquilli
290a1043b1 Rust: fetch ungram and rust-analyzer code instead of checking it in
* The ungram file is now taken from the rust-analyzer dependencies
  pulled in by bazel
* the grammar parsing code is not published, so it must be taken
  directly from rust-analyzer code. That part should be less prone to be
  updated than the ungram file, so it does not necessarily need to be
  in sync with the rust-analyzer version is used elsewhere.
* both need some patches. The former is patched during build, the latter
  during loading in `MODULE.bazel`.
2024-12-18 16:37:24 +01:00
Rasmus Wriedt Larsen
2b3fc9b36c Python: Add change-note 2024-12-18 16:02:02 +01:00
Arthur Baars
023f48ff1c Merge pull request #18295 from github/aibaars/update-rust-ungram
Rust: update rust-analyzer
2024-12-18 16:01:50 +01:00
Rasmus Wriedt Larsen
34631a8784 Python: Model FastAPI requests
Co-authored-by: Joe Farebrother <joefarebrother@github.com>
2024-12-18 15:58:51 +01:00
Rasmus Wriedt Larsen
79dfbf7b21 Python: Add FastAPI request test
Co-authored-by: Joe Farebrother <joefarebrother@github.com>
2024-12-18 15:48:29 +01:00
Calum Grant
fabacebd4b C++: Change note 2024-12-18 14:37:43 +00:00
Simon Friis Vindum
508c7e6e85 Merge pull request #18314 from paldepind/rust-tuple-ref-patterns
Rust: Add read steps for tuple and reference patterns
2024-12-18 14:13:08 +01:00
Asger F
be939dca29 Merge pull request #14350 from asgerf/shared/deduplicate-path-graph
Shared: Add DataFlow::DeduplicatePathGraph
2024-12-18 14:04:29 +01:00
Tom Hvitved
00688ebd79 Merge pull request #18312 from hvitved/rust/operator-overloading-test
Rust: Add data flow tests for operator overloading
2024-12-18 13:58:39 +01:00
Simon Friis Vindum
09fd27af80 Rust: Add read steps for tuple and reference patterns 2024-12-18 13:22:05 +01:00
Mathias Vorreiter Pedersen
927d359cfa Merge pull request #18310 from MathiasVP/fix-recursion-through-forex-in-sign-analysis
C++: Fix `forex` recursion in sign analysis
2024-12-18 12:19:33 +00:00
Simon Friis Vindum
b5b8af3aa2 Rust: Add data flow tests for borrows 2024-12-18 13:00:38 +01:00
Arthur Baars
a6ec51a951 Rust: update expected output 2024-12-18 13:00:14 +01:00
Arthur Baars
71959f5faa Rust: address clippy warnings 2024-12-18 13:00:13 +01:00
Tom Hvitved
3a63dbcd5d Apply suggestions from code review
Co-authored-by: Simon Friis Vindum <paldepind@github.com>
2024-12-18 12:46:11 +01:00
Mathias Vorreiter Pedersen
4ffe70dd3b C++: Respond to review comments. 2024-12-18 11:26:41 +00:00
Simon Friis Vindum
87b9e6001d Merge pull request #18291 from paldepind/rust-data-flow-models
Rust: Data flow improvements to unlock flow in sqlx test
2024-12-18 11:53:26 +01:00
Michael Nebel
ef2215dd53 Merge pull request #18303 from michaelnebel/refactorlibrarylocations
C#: Move external api declarations to the library pack.
2024-12-18 11:43:35 +01:00
Simon Friis Vindum
049fab4c72 Rust: Remove taint steps 2024-12-18 11:22:56 +01:00
Jeroen Ketema
66b2b5df8d Merge pull request #18308 from jketema/template-parameters
C++: Introduce a new base class for template parameters
2024-12-18 10:38:03 +01:00
Jeroen Ketema
ccd3681f83 C++: Expand QLDoc of TemplateParameterBase 2024-12-18 09:45:51 +01:00
Tom Hvitved
025a67384f Rust: Add data flow tests for operator overloading 2024-12-18 09:26:17 +01:00
Mathias Vorreiter Pedersen
0b2b341283 C++: Work around suboptimal codegen for recursive 'forex'. 2024-12-17 23:58:57 +00:00
Jeroen Ketema
b7d1da8741 C++: Introduce a new base class for template parameters
This will enable us to support non-type template parameters, which we
currently do not support, and error template parameters, which might
become relevant in the `build-mode: none` context.
2024-12-17 20:25:41 +01:00
Mathias Vorreiter Pedersen
dfb34832fd Merge pull request #18307 from MathiasVP/fix-more-join-orders-in-dataflow
C++: Fix two more dataflow-related joins
2024-12-17 18:56:12 +00:00
Mathias Vorreiter Pedersen
2cc6ffbd28 C++: Fix ql-for-ql findings. 2024-12-17 16:55:52 +00:00
Simon Friis Vindum
c1e21974c6 Rust: Address review comments 2024-12-17 17:24:42 +01:00
Calum Grant
14cef6a207 C++: Fix FPs to cpp/return-stack-allocated-memory 2024-12-17 15:58:39 +00:00
Mathias Vorreiter Pedersen
5ed0222b1a C++: Sync identical files. 2024-12-17 15:28:04 +00:00
Mathias Vorreiter Pedersen
f351558547 C++: While here, let's avoid materializing 'ensuresEq' and 'ensuresLt' when computing unreachable nodes in dataflow. 2024-12-17 15:27:54 +00:00
Mathias Vorreiter Pedersen
9b6f39c1fe C++: Apply similar join order fixes to the other cases. 2024-12-17 15:26:49 +00:00
Mathias Vorreiter Pedersen
eea7804b62 C++: Join with value number only after joining with 'controls'. 2024-12-17 15:25:16 +00:00
Simon Friis Vindum
d8c301a96b Merge branch 'main' into rust-data-flow-models 2024-12-17 16:09:59 +01:00
Michael Nebel
1ef5b595ae C#: Add change-note. 2024-12-17 15:11:27 +01:00
Michael Nebel
bd9f656be2 C#: Add ql doc to TestLibrary. 2024-12-17 14:40:01 +01:00
Michael Nebel
a91c1dc715 C#: Move external api declarations to the library pack. 2024-12-17 14:39:59 +01:00
Arthur Baars
23e6a825aa Rust: fix QL code 2024-12-17 14:07:48 +01:00
Arthur Baars
029e2604a3 Rust: //rust/codegen 2024-12-17 14:07:44 +01:00
Arthur Baars
c13e173681 Rust: fix codegeneration for AsmOptions 2024-12-17 14:05:53 +01:00
Arthur Baars
93972fcb2e Run: misc/bazel/3rdparty/update_cargo_deps.sh 2024-12-17 14:05:51 +01:00
Arthur Baars
8e7eedc172 Update codegen/grammar 2024-12-17 14:05:50 +01:00
Arthur Baars
3928efe05f Rust: update rust.ungram 2024-12-17 14:05:12 +01:00
Tom Hvitved
8efd870192 Merge pull request #18292 from hvitved/rust/never-skip-lhs
Rust: Never skip assignment LHS in data flow
2024-12-17 13:18:17 +01:00
Tom Hvitved
d8c05b5388 Merge pull request #18290 from hvitved/rust/perf-fixes
Rust: Fix two bad joins
2024-12-17 13:18:05 +01:00
Simon Friis Vindum
ee87d4c948 Merge branch 'main' into rust-data-flow-models 2024-12-17 13:12:32 +01:00
Asger F
e34fbc8bd1 Shared: autoformat 2024-12-17 11:26:56 +01:00
Asger F
8340841d54 Shared: Fix propagation of call bit 2024-12-17 11:16:04 +01:00
Asger F
950ae44d03 Shared: Show test failures 2024-12-17 11:15:57 +01:00
Michael Nebel
132dbd7517 Merge pull request #18285 from github/workflow/coverage/update
Update CSV framework coverage reports
2024-12-17 09:17:33 +01:00
github-actions[bot]
f9d739c173 Add changed framework coverage reports 2024-12-17 00:22:24 +00:00
Jeroen Ketema
fa5cc90167 Merge pull request #18281 from jketema/changenote
C++: Add word missing from change note
2024-12-16 20:23:47 +01:00
Mathias Vorreiter Pedersen
a3ef0b94b9 Merge pull request #18207 from MathiasVP/fix-fp-in-missing-check-scanf-fixing-take-3
C++: Fix some FPs in cpp/missing-check-scanf (third attempt!)
2024-12-16 16:55:44 +00:00
Andrew Eisenberg
91f4ffafd1 Merge pull request #111 from github/UnversionedImmutableAction-typo
Fix typo in UnversionedImmutableAction.md
2024-12-16 08:06:22 -08:00
Paolo Tranquilli
d6246707e4 Merge pull request #18294 from github/redsun82/extract-self-param-ref
Rust: extract `isRef` for `SelfParam`
2024-12-16 17:00:47 +01:00
Sam Partington
2949098a27 Fix typo in UnversionedImmutableAction.md 2024-12-16 15:40:38 +00:00
Simon Friis Vindum
402d4e11c4 Rust: Re-add inline expectations query tags 2024-12-16 16:36:30 +01:00
Edward Minnix III
9a80c403a0 Merge pull request #18278 from egregius313/egregius313/csharp/markup-string
C#: Add `html-injection` sinks for Blazor `MarkupString`
2024-12-16 10:21:04 -05:00
Edward Minnix III
360398481b Merge pull request #18280 from egregius313/egregius313/csharp/blazor/runtime-helpers/typecheck
C#: Add summary for `Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelper::TypeCheck<T>`
2024-12-16 10:19:38 -05:00
Paolo Tranquilli
a333453bd7 Merge pull request #18289 from github/redsun82/swift-remove-linux
Swift: improve diagnostics for OS incompatibility
2024-12-16 15:18:52 +01:00
Tom Hvitved
ddd05b5d1b Rust: Never skip match scrutinee/patterns in data flow 2024-12-16 15:12:16 +01:00
Tom Hvitved
9f2b436d35 Rust: Never skip assignment LHS in data flow 2024-12-16 15:12:15 +01:00
Paolo Tranquilli
54ba14d181 Merge pull request #18276 from github/redsun82/bazel-installer-as-test
Bazel: add a test wrapper around installation scripts
2024-12-16 15:07:19 +01:00
Paolo Tranquilli
4975e7b739 Merge branch 'main' into redsun82/extract-self-param-ref 2024-12-16 15:06:16 +01:00
Paolo Tranquilli
9f2b962fe8 Merge pull request #18297 from hvitved/rust/fix-semantic-merge
Rust: Fix semantic merge conflicts
2024-12-16 15:06:00 +01:00
Mathias Vorreiter Pedersen
913357b70d C++: Fix incorrect QLDoc. 2024-12-16 14:02:50 +00:00
Mathias Vorreiter Pedersen
5a90b25c45 C++: Remove the released change note and add a new change note. 2024-12-16 14:02:48 +00:00
Mathias Vorreiter Pedersen
5327847744 C++: No need to exclude static and global initializers now that we inline the predicates. 2024-12-16 14:02:46 +00:00
Mathias Vorreiter Pedersen
3bdfdd0573 C++: Change all the 'ensures' and (and most 'compares') predicates to be inlined to prevent explosions. Also remove the caching since this is't necessary now that the main recursion is cached. 2024-12-16 14:02:44 +00:00
Mathias Vorreiter Pedersen
404dd33498 C++: Move the main recursion into to a cached module. 2024-12-16 14:02:42 +00:00
Mathias Vorreiter Pedersen
6f73aa552d C++: Convert IRGuards to use final abstract classes. 2024-12-16 14:02:40 +00:00
Mathias Vorreiter Pedersen
20dfbdc5cc Revert "Merge pull request #18057 from jketema/codeql-cli-2.19.4"
This reverts commit ed922f6519, reversing
changes made to aa4cc72f30.
2024-12-16 14:02:38 +00:00
Tom Hvitved
5ed03e266a Rust: Fix semantic merge conflicts 2024-12-16 14:47:13 +01:00
Michael Nebel
32bfbb832b Merge pull request #18293 from michaelnebel/fixmain
Fix failing tests on main.
2024-12-16 14:26:25 +01:00
Jeroen Ketema
da3fcda4fc C++: Address review comments 2024-12-16 14:25:41 +01:00
Paolo Tranquilli
4c4a8d7619 Rust: extract isRef for SelfParam 2024-12-16 14:24:56 +01:00
Michael Nebel
d0e9c3bb70 Fix failing tests on main. 2024-12-16 14:16:47 +01:00
Paolo Tranquilli
e4eb2697eb Swift: fix typo in autobuild.cmd 2024-12-16 13:44:33 +01:00
Michael Nebel
aaf0cd5dee Merge pull request #17968 from michaelnebel/java/movetestutils
Move test utilities to the query pack.
2024-12-16 13:41:30 +01:00
Asger F
f2968f4e14 Shared: Ensure subpath-induced edges are handled properly
Argument-passing and flow-through edges are present in 'edges' in addition to 'subpaths', but the implementation didn't take this into account.
2024-12-16 13:21:43 +01:00
Simon Friis Vindum
cad4f39aee Rust: Database name capitalization 2024-12-16 13:15:42 +01:00
Asger F
0edb30638a Apply suggestions from code review
Co-authored-by: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
2024-12-16 13:14:27 +01:00
Simon Friis Vindum
defbbb2a24 Rust: Add additional models for stdlib and sqlx 2024-12-16 11:46:57 +01:00
Simon Friis Vindum
aab3428bc7 Rust: Model address-of and dereference as stores and loads 2024-12-16 11:31:15 +01:00
Simon Friis Vindum
df0375103c Rust: Add data flow tests 2024-12-16 11:09:22 +01:00
Tom Hvitved
aabcc108dd Rust: Fix bad join
```
[2024-12-16 10:10:36] (247s) Tuple counts for DataFlowImpl::RustDataFlow::storeStep/3#98e80e57/3@0618fdm6 after 3m8s:
                      33711       ~0%        {3} r1 = SCAN `DataFlowImpl::VariableCapture::storeStep/3#cb0fdcf6` OUTPUT In.1, In.0 'node1', In.2 'node2'
                      33711       ~6%        {3}    | JOIN WITH DataFlowImpl::TSingletonContentSet#9b15eaba ON FIRST 1 OUTPUT Lhs.1 'node1', Rhs.1 'cs', Lhs.2 'node2'

                      0           ~0%        {3} r2 = JOIN `FlowSummaryImpl::Private::Steps::summaryStoreStep/3#2c853d0d` WITH DataFlowImpl::TFlowSummaryNode#2b28ecb7 ON FIRST 1 OUTPUT Lhs.2, Lhs.1 'cs', Rhs.1 'node1'
                      0           ~0%        {3}    | JOIN WITH DataFlowImpl::TFlowSummaryNode#2b28ecb7 ON FIRST 1 OUTPUT Lhs.2 'node1', Lhs.1 'cs', Rhs.1 'node1'

                      1554        ~0%        {3} r3 = JOIN _DataFlowImpl::TExprNode#83a34c2e__DataFlowImpl::TArrayElement#b9fb9b7b_DataFlowImpl::TSingletonCont__#shared WITH `CfgNodes::ArrayRepeatExprCfgNode.getRepeatOperand/0#dispred#b264e402_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1 'cs', Lhs.2 'node1'
                      1554        ~0%        {3}    | JOIN WITH DataFlowImpl::TExprNode#83a34c2e ON FIRST 1 OUTPUT Lhs.2 'node1', Lhs.1 'cs', Rhs.1 'node2'

                      870         ~2%        {3} r4 = SCAN `DataFlowImpl::RustDataFlow::tupleAssignment/3#bf3c8690` OUTPUT In.2, In.0 'node1', In.1
                      870         ~0%        {3}    | JOIN WITH DataFlowImpl::TSingletonContentSet#9b15eaba ON FIRST 1 OUTPUT Lhs.2, Rhs.1 'cs', Lhs.1 'node1'
                      870         ~0%        {3}    | JOIN WITH `DataFlowImpl::Node::PostUpdateNode.getPreUpdateNode/0#dispred#53daedc2_10#join_rhs` ON FIRST 1 OUTPUT Lhs.2 'node1', Lhs.1 'cs', Rhs.1 'node2'

                      40037       ~4%        {3} r5 = JOIN _DataFlowImpl::TExprNode#83a34c2e__DataFlowImpl::TArrayElement#b9fb9b7b_DataFlowImpl::TSingletonCont__#shared WITH `CfgNodes::ArrayExprCfgNode.getAnExpr/0#dispred#9d00a6f1_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1 'cs', Lhs.2 'node1'
                      36929       ~4%        {3}    | JOIN WITH CfgNodes::ArrayListExprCfgNode#07eee614 ON FIRST 1 OUTPUT Lhs.0, Lhs.1 'cs', Lhs.2 'node1'
                      36929       ~0%        {3}    | JOIN WITH DataFlowImpl::TExprNode#83a34c2e ON FIRST 1 OUTPUT Lhs.2 'node1', Lhs.1 'cs', Rhs.1 'node2'

                      14          ~0%        {2} r6 = JOIN DataFlowImpl::TTuplePositionContent#f1d90606_10#join_rhs WITH DataFlowImpl::TSingletonContentSet#9b15eaba ON FIRST 1 OUTPUT Lhs.1, Rhs.1 'cs'
                      47949       ~0%        {3}    | JOIN WITH `CfgNodes::TupleExprCfgNode.getField/1#dispred#9f7c9c63_102#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1 'cs', Rhs.2
                      47949       ~0%        {3}    | JOIN WITH DataFlowImpl::TExprNode#83a34c2e ON FIRST 1 OUTPUT Lhs.2, Lhs.1 'cs', Rhs.1 'node2'
                      47949       ~2%        {3}    | JOIN WITH DataFlowImpl::TExprNode#83a34c2e ON FIRST 1 OUTPUT Rhs.1 'node2', Lhs.1 'cs', Lhs.2 'node2'

                      59801       ~0%        {3} r7 = JOIN _DataFlowImpl::TSingletonContentSet#9b15eaba_DataFlowImpl::TVariantPositionContent#ca6baca0_201#join__#shared WITH `DataFlowImpl::RustDataFlow::tupleVariantConstruction/2#10613c55_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1 'cs', Lhs.2
                      45509       ~0%        {3}    | JOIN WITH CfgNodes::CallExprCfgNode#9c2a4686_10#join_rhs ON FIRST 1 OUTPUT Rhs.1, Lhs.1 'cs', Lhs.2
                      45509       ~2%        {4}    | JOIN WITH DataFlowImpl::TExprNode#83a34c2e ON FIRST 1 OUTPUT Lhs.0, Lhs.2, Lhs.1 'cs', Rhs.1 'node2'
                      45509       ~0%        {3}    | JOIN WITH `CfgNodes::CallExprBaseCfgNode.getArgument/1#dispred#9ebb27c0` ON FIRST 2 OUTPUT Rhs.2, Lhs.2 'cs', Lhs.3 'node2'
                      45509       ~0%        {3}    | JOIN WITH DataFlowImpl::TExprNode#83a34c2e ON FIRST 1 OUTPUT Rhs.1 'node2', Lhs.1 'cs', Lhs.2 'node2'

                      75147       ~1%        {3} r8 = JOIN _DataFlowImpl::TSingletonContentSet#9b15eaba_DataFlowImpl::TStructFieldContent#1d6d7b05_201#join_rhs#shared WITH `DataFlowImpl::RustDataFlow::structConstruction/2#a9656db0_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1 'cs', Lhs.2
                      59186       ~3%        {3}    | JOIN WITH `CfgNodes::RecordExprCfgNode.getRecordExpr/0#dispred#659ad1af_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1 'cs', Lhs.2

                      5641        ~2%        {3} r9 = JOIN _DataFlowImpl::TSingletonContentSet#9b15eaba_DataFlowImpl::TVariantFieldContent#4e05bcf1_201#join_rh__#shared WITH `DataFlowImpl::RustDataFlow::recordVariantConstruction/2#34b016f6_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1 'cs', Lhs.2
                      5268        ~0%        {3}    | JOIN WITH `CfgNodes::RecordExprCfgNode.getRecordExpr/0#dispred#659ad1af_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1 'cs', Lhs.2

                      64454       ~1%        {3} r10 = r8 UNION r9
                      64454       ~0%        {4}    | JOIN WITH DataFlowImpl::TExprNode#83a34c2e ON FIRST 1 OUTPUT Lhs.0, Lhs.2, Lhs.1 'cs', Rhs.1 'node2'
                      25923       ~0%        {3}    | JOIN WITH `CfgNodes::RecordExprCfgNode.getFieldExpr/1#d72dca6e` ON FIRST 2 OUTPUT Rhs.2, Lhs.2 'cs', Lhs.3 'node2'
                      25923       ~0%        {3}    | JOIN WITH DataFlowImpl::TExprNode#83a34c2e ON FIRST 1 OUTPUT Rhs.1 'node2', Lhs.1 'cs', Lhs.2 'node2'

                      67759289500 ~251%      {4} r11 = JOIN DataFlowImpl::TSingletonContentSet#9b15eaba WITH DataFlowImpl::TExprNode#83a34c2e CARTESIAN PRODUCT OUTPUT Lhs.0, Lhs.1 'cs', Rhs.0, Rhs.1 'node2'
                      3568000     ~1488%     {3}    | JOIN WITH DataFlowImpl::TArrayElement#b9fb9b7b ON FIRST 1 OUTPUT Lhs.3, Lhs.1 'cs', Lhs.2
                      1223000     ~1291%     {3}    | JOIN WITH `DataFlowImpl::Node::PostUpdateNode.getPreUpdateNode/0#dispred#53daedc2_10#join_rhs` ON FIRST 1 OUTPUT Lhs.2, Lhs.1 'cs', Rhs.1 'node2'
                      11500       ~0%        {3}    | JOIN WITH `CfgNodes::IndexExprCfgNode.getBase/0#dispred#19aba7d8_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1 'cs', Lhs.2 'node2'
                      1000        ~3%        {3}    | JOIN WITH `CfgNodes::BinaryExprCfgNode.getLhs/0#dispred#bd1c02e7_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1 'cs', Lhs.2 'node2'
                      500         ~3%        {3}    | JOIN WITH CfgNodes::AssignmentExprCfgNode#a9a5c022 ON FIRST 1 OUTPUT Lhs.0, Lhs.1 'cs', Lhs.2 'node2'
                      0           ~0%        {3}    | JOIN WITH `CfgNodes::BinaryExprCfgNode.getRhs/0#dispred#4a1146e4` ON FIRST 1 OUTPUT Rhs.1, Lhs.1 'cs', Lhs.2 'node2'
                      0           ~0%        {3}    | JOIN WITH DataFlowImpl::TExprNode#83a34c2e ON FIRST 1 OUTPUT Rhs.1 'node2', Lhs.1 'cs', Lhs.2 'node2'

                      192445      ~1%        {3} r12 = r1 UNION r2 UNION r3 UNION r4 UNION r5 UNION r6 UNION r7 UNION r10 UNION r11
                                             return r12
```
2024-12-16 10:20:30 +01:00
Tom Hvitved
2d16b5276d Rust: Fix bad join
```
Evaluated relational algebra for predicate DataFlowImpl::RustDataFlow::pathResolveToVariantCanonicalPath/2#dc73aca0@34414869 with tuple counts:
          422639   ~3%    {3} r1 = JOIN `DataFlowImpl::resolveExtendedCanonicalPath/3#0454a346` WITH Synth::Synth::TPathAstNode#a7913307 ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Lhs.2
        73033499   ~7%    {6}    | JOIN WITH DataFlowImpl::MkVariantCanonicalPath#ab1ecb00 ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Rhs.3, _, Rhs.1, Rhs.2
                          {4}    | REWRITE WITH Tmp.3 := "::", Out.3 := (In.4 ++ Tmp.3 ++ In.5), TEST Out.3 = InOut.1 KEEPING 4
          170993   ~1%    {2}    | SCAN OUTPUT In.0, In.2
                          return r1
```
2024-12-16 10:20:01 +01:00
Paolo Tranquilli
8efd127010 Swift: improve diagnostics for OS incompatibility
* do not mention any more that one might make analysis happen on Linux with
  advanced setup
* say that outright Swift analysis is only supported on macOS, not just
  autobuild.
* emit the error diagnostics even for traced builds, not only for autobuilds
  (by using a dummy `extractor` executable).
2024-12-16 10:12:31 +01:00
Simon Friis Vindum
31717524f0 Merge pull request #18270 from paldepind/rust-captured-variables
Rust: Flow through captured variables
2024-12-16 10:08:53 +01:00
Simon Friis Vindum
9da5d7128b Rust: Add test with data flow inconsistency 2024-12-16 09:40:13 +01:00
Owen Mansel-Chan
7ab06fca2f Merge pull request #18275 from owen-mc/go/mad/variadic-params-sources
Go: Make models-as-data source models for variadic parameters work
2024-12-15 13:22:21 +00:00
Alvaro Muñoz
1370102d45 Bump qlpack versions 2024-12-14 10:10:50 +01:00
Alvaro Muñoz
b8e23c1f01 Merge pull request #110 from github/ext_prefix
Expect external workflows and actions in .github/workflow/external and .github/actions/external
2024-12-14 10:06:55 +01:00
Paolo Tranquilli
0c5e260ae6 Merge pull request #18282 from github/redsun82/swift-remove-linux
Swift: remove linux from standard pack
2024-12-13 22:44:44 +01:00
Owen Mansel-Chan
906c51733c Merge pull request #18266 from owen-mc/misc/prepare-db-upgrade-improvement
Misc: Look up remote name instead of using `origin` in `misc/prepare-db-upgrade.sh`
2024-12-13 21:42:18 +00:00
Edward Minnix III
9948f6e255 Merge pull request #18284 from egregius313/egregius313/go/dataflow/sources/commandargs/os-args
Go: Model `os.Args` as a `commandargs` source
2024-12-13 16:33:45 -05:00
Ed Minnix
7852c8666c Update provenance in test results 2024-12-13 15:22:17 -05:00
Ed Minnix
88256e269a Convert model from QL to MaD 2024-12-13 14:59:32 -05:00
Edward Minnix III
f844105722 Fix test result 2024-12-13 14:53:58 -05:00
Dave Bartolomeo
4a9355c5de Add required signature predicate implementation 2024-12-13 14:39:19 -05:00
Dave Bartolomeo
1fb707f080 Bump minor version to prepare for public release 2024-12-13 13:00:24 -05:00
Ed Minnix
129388c78a Fix change note 2024-12-13 12:48:01 -05:00
Dave Bartolomeo
5aa3328b07 Upgrade to latest package versions 2024-12-13 12:46:39 -05:00
Ed Minnix
4ee60138b7 Fix test results 2024-12-13 12:44:57 -05:00
Ed Minnix
f8cfa39492 Change note 2024-12-13 12:42:02 -05:00
Ed Minnix
3f9af5bfe4 Tests 2024-12-13 12:42:01 -05:00
Ed Minnix
63a3054aeb os.Args variable read 2024-12-13 12:41:59 -05:00
Dave Bartolomeo
34844539d7 Fix pack names 2024-12-13 12:33:22 -05:00
Dave Bartolomeo
f99f5e8309 Merge remote-tracking branch 'origin/master' into dbartol/move-to-codeql 2024-12-13 11:49:32 -05:00
Paolo Tranquilli
a8238b1896 Swift: fix pack 2024-12-13 17:39:16 +01:00
Paolo Tranquilli
a75f5fac15 Swift: remove linux from standard pack
This still defines a pack with linux included for development.
`//swift:install` will still also include linux.
2024-12-13 17:01:22 +01:00
Alvaro Muñoz
455afc2bb2 Expect external workflows and actions in .github/workflow/external and .github/actions/external 2024-12-13 16:50:21 +01:00
Owen Mansel-Chan
e9dcd69cc0 Add readStep back to local taint flow 2024-12-13 13:30:18 +00:00
Owen Mansel-Chan
3a3e053f12 Only add taint steps for implicit varargs slice post-update nodes 2024-12-13 13:17:44 +00:00
Paolo Tranquilli
2cbb072668 Merge pull request #17699 from github/redsun82/swift-6
Swift: make extractor compilable with Swift 6
2024-12-13 12:27:35 +01:00
Jeroen Ketema
d6964ff755 C++: Add word missing from change note 2024-12-13 10:48:46 +01:00
Paolo Tranquilli
92ec7e89ab Merge branch 'main' into redsun82/swift-6 2024-12-13 09:38:15 +01:00
Ed Minnix
68e2f27180 Add summary Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers::TypeCheck<T> 2024-12-12 22:10:15 -05:00
Ed Minnix
8e37a5cd55 Fix test case 2024-12-12 22:05:26 -05:00
Owen Mansel-Chan
b58e6ebade Address review comments for localTaintStep 2024-12-12 22:07:15 +00:00
Ed Minnix
0a967325e7 Change note 2024-12-12 16:22:09 -05:00
Ed Minnix
40ea5f582c MarkupString models 2024-12-12 16:18:29 -05:00
Jeroen Ketema
792504434a Merge pull request #18277 from jketema/printast
C++: Fix small PrintAST and PrintIR issue
2024-12-12 19:17:43 +01:00
Jeroen Ketema
8e458f4651 C++: Simplify local variable names 2024-12-12 17:13:02 +01:00
Jeroen Ketema
f9bfd969a9 C++: Address review comments 2024-12-12 16:49:24 +01:00
Simon Friis Vindum
1d8e7fd9ea Rust: Accept differences 2024-12-12 16:47:51 +01:00
Simon Friis Vindum
0fa40fcdcc Rust: Fix captured variable data flow inconsistency 2024-12-12 16:28:19 +01:00
Tom Hvitved
20db548fef Merge pull request #18263 from hvitved/dataflow/remove-column
Data flow: Remove unused column from `flowThroughOutOfCall`
2024-12-12 15:41:20 +01:00
Geoffrey White
03f962ed86 Merge pull request #18226 from geoffw0/badcrypto
Rust: Weak encryption algorithm query.
2024-12-12 14:21:16 +00:00
Michael Nebel
a52a549945 Merge pull request #18246 from michaelnebel/csharp/fixwarnings
C#: Fix some new compiler warnings
2024-12-12 15:07:23 +01:00
Michael Nebel
0bfc1b6ea8 Also move the postprocessing queries to the library pack. 2024-12-12 15:03:03 +01:00
Michael Nebel
941b0abbf6 Move modules to the library packs. 2024-12-12 15:03:01 +01:00
Michael Nebel
864c34fc03 Rust: Update all test util paths to point to the new location. 2024-12-12 15:02:59 +01:00
Tom Hvitved
5d18e23979 Merge pull request #18269 from hvitved/csharp/dataflow-reflection-call
C#: Remove false-positive reflection calls in dataflow
2024-12-12 14:43:13 +01:00
Owen Mansel-Chan
26b52078c0 Add change note 2024-12-12 13:41:35 +00:00
Owen Mansel-Chan
8703e21f62 Merge pull request #17996 from owen-mc/java/lightweight-IR-layer-classes
Java: Make separate classes for different control flow node kinds
2024-12-12 13:36:54 +00:00
Geoffrey White
44a0ad2942 Update data-flow -> data flow in all versions of ConceptsShared.qll. 2024-12-12 13:36:26 +00:00
Michael Nebel
9c0dddb4d8 Merge pull request #18267 from michaelnebel/csharp/updateglobaljson
C#: Update global.json for cshtml_standalone_flowsteps.
2024-12-12 13:55:03 +01:00
Michael Nebel
cbae2cf7fa Rust: Move test utilities into the query pack. 2024-12-12 13:54:42 +01:00
Michael Nebel
9ecacddf79 Swift: Update all test util paths to point to the new location. 2024-12-12 13:54:40 +01:00
Michael Nebel
ca66153a3b Swift: Move test utilities into the query pack. 2024-12-12 13:54:38 +01:00
Michael Nebel
138e294dae Ruby: Update all test util paths to point to the new location. 2024-12-12 13:54:37 +01:00
Michael Nebel
157afff135 Ruby: Move test utilities into the query pack. 2024-12-12 13:54:35 +01:00
Michael Nebel
2ca6147932 QL: Update all test util paths to point to the new location. 2024-12-12 13:54:33 +01:00
Michael Nebel
dd06d50b7f QL: Move test utilities into the src folder. 2024-12-12 13:54:32 +01:00
Michael Nebel
2321ca59f6 Python: Update all test util paths to point to the new location. 2024-12-12 13:54:30 +01:00
Michael Nebel
1490400ab0 Python: Move test utilities into the query pack. 2024-12-12 13:54:28 +01:00
Michael Nebel
c3fe3e468c Javascript: Update all test util paths to point to the new location. 2024-12-12 13:54:25 +01:00
Michael Nebel
0f146f1486 Javascript: Move test utilities into the query pack. 2024-12-12 13:54:23 +01:00
Michael Nebel
96fe1449f8 Go: Update all test util paths to point to the new location. 2024-12-12 13:54:21 +01:00
Jeroen Ketema
35403d4299 C++: Fix IR printing when multiple edges point to the same block 2024-12-12 13:46:45 +01:00
Jeroen Ketema
e43f7fbb48 C++: Fix AST printing for OverloadedArrayExpr 2024-12-12 13:44:24 +01:00
Jeroen Ketema
0a7ed159a4 C++: Add test that show that PrintAST is broekn for OverloadedArrayExpr 2024-12-12 13:40:22 +01:00
Owen Mansel-Chan
8e11789186 Restore asStmt, asExpr and asCall to Node
It doesn't really make sense to define them in terms of dispatch.
2024-12-12 12:30:01 +00:00
Michael Nebel
f8e0c4799d Go: Move test utilities into the query pack. 2024-12-12 13:21:35 +01:00
Michael Nebel
12008b4b4e C++: Update all test util paths to point to the new location. 2024-12-12 13:21:34 +01:00
Michael Nebel
47813e17c9 C++: Move test utilities into the query pack. 2024-12-12 13:21:32 +01:00
Michael Nebel
82f8a796e1 C#: Update all test util paths to point to the new location. 2024-12-12 13:21:31 +01:00
Michael Nebel
c4b4be9372 C#: Move test utilities into the query pack. 2024-12-12 13:21:29 +01:00
Michael Nebel
c7c3f6bd80 C#: Update inline-tests query paths. 2024-12-12 13:21:28 +01:00
Michael Nebel
8fbd4a2cd5 C#: Move inline-tests into the utils test folder. 2024-12-12 13:21:26 +01:00
Michael Nebel
0a1d2d0bbb Java: Update all test util paths to point to the new location. 2024-12-12 13:21:25 +01:00
Michael Nebel
91cfb30513 Java: Move test utilities to the java query pack. 2024-12-12 13:21:22 +01:00
Paolo Tranquilli
173d11d544 Bazel: add a test wrapper around installation scripts
This hack is meant to be an optimization when using install for tests,
where the install step is skipped if nothing changed. If the
installation directory is somehow messed up, `bazel run` can be used to
force install.

This is added as a `<name>-installer-as-test` target, which we can now
use in our internal pytest integration to skip the installation step if
nothing changed on the CLI + language packs side.
2024-12-12 13:08:58 +01:00
Owen Mansel-Chan
3f7c37e1ed Treat container flow as taint flow in global taint flow 2024-12-12 11:41:32 +00:00
Geoffrey White
611d04e221 Rust: Revert stylistic change in shared file. 2024-12-12 11:30:23 +00:00
Geoffrey White
1d72b750b7 Rust: data-flow -> data flow. 2024-12-12 11:29:23 +00:00
Paolo Tranquilli
5ca89eaede Merge branch 'main' into redsun82/swift-6 2024-12-12 12:28:47 +01:00
Geoffrey White
d2cfcb4c9e Update rust/ql/lib/codeql/rust/internal/ConceptsShared.qll
Co-authored-by: Simon Friis Vindum <paldepind@github.com>
2024-12-12 11:28:04 +00:00
Owen Mansel-Chan
e13c4b7550 Treat container flow as taint flow in localTaintStep 2024-12-12 10:41:23 +00:00
Simon Friis Vindum
16dcc5c278 Rust: Add variable capture consistency query 2024-12-12 11:23:22 +01:00
Simon Friis Vindum
9fe7bb3e2b Rust: Address PR comments 2024-12-12 11:19:14 +01:00
Simon Friis Vindum
2cf043cfbc Rust: Address PR comments 2024-12-12 10:19:53 +01:00
Simon Friis Vindum
59f3f1f1e9 Apply suggestions from code review
Co-authored-by: intrigus-lgtm <60750685+intrigus-lgtm@users.noreply.github.com>
2024-12-12 08:58:35 +01:00
Owen Mansel-Chan
8d5759dbdf Update remote repository to github/codeql 2024-12-11 21:51:19 +00:00
Geoffrey White
591db05610 Rust: Formatting. 2024-12-11 16:49:29 +00:00
Geoffrey White
ad75906672 Apply suggestions from code review
Co-authored-by: Tom Hvitved <hvitved@github.com>
2024-12-11 16:44:00 +00:00
Owen Mansel-Chan
066db766ef Merge pull request #18153 from owen-mc/java/resttemplate-getforobject
Java: add SSRF sink model for the third parameter of `RestTemplate.getForObject`
2024-12-11 16:37:35 +00:00
Jami
538dee81b6 Merge pull request #18214 from jcogs33/jcogs33/java/file-getname-path-sanitizer
Java: add File.getName as a path injection sanitizer
2024-12-11 10:18:02 -05:00
Simon Friis Vindum
94b037fad1 Rust: Instantiate variable capture library for data flow 2024-12-11 15:44:17 +01:00
Owen Mansel-Chan
1420bce36a Move import statement in SpringWebClient.qll 2024-12-11 14:19:24 +00:00
Simon Friis Vindum
e8357a648d Rust: Add additional data flow tests 2024-12-11 14:56:16 +01:00
Tom Hvitved
40d9460698 Data flow: Remove unused column from flowThroughOutOfCall 2024-12-11 14:35:32 +01:00
Anders Schack-Mulligen
066cfa31d2 Merge pull request #18258 from aschackmull/dataflow/simplify-apapprox3
Dataflow: Simplify references to access paths from prior stage.
2024-12-11 14:23:31 +01:00
Owen Mansel-Chan
4f8645b4dd Merge pull request #18235 from owen-mc/go/varargs-out-param
Go: Improve data flow out of variadic parameter
2024-12-11 13:18:29 +00:00
Tom Hvitved
fc70024f52 C#: Remove false-positive reflection calls in dataflow 2024-12-11 14:15:58 +01:00
Tom Hvitved
22aaf74184 Merge pull request #18231 from hvitved/rust/models-as-data-summaries
Rust: Models-as-data for flow summaries
2024-12-11 13:37:09 +01:00
Asger F
889100a243 Java: update test output with provenance 2024-12-11 13:19:47 +01:00
Asger F
afdbf2c3c6 Java: update test to account for key,val 2024-12-11 13:19:36 +01:00
Asger F
736388809d Java: MethodAccess -> MethodCall 2024-12-11 13:19:25 +01:00
Ian Lynagh
34aefb4bc5 Merge pull request #18268 from igfoo/igfoo/kot-tests-ignore
Kotlin: git-ignore .testproj directories in tests
2024-12-11 12:08:44 +00:00
Ian Lynagh
699734611e Kotlin: git-ignore .testproj directories in tests 2024-12-11 12:00:23 +00:00
Michael Nebel
f7ad150636 C#: Update global.json for cshtml_standalone_flowsteps. 2024-12-11 12:57:42 +01:00
Owen Mansel-Chan
ec5d655d7f Look up remote name instead of using origin 2024-12-11 11:02:45 +00:00
Asger F
f9c0ba3826 Ruby: use DeduplicatePathGraph in CodeInjection query 2024-12-11 11:48:15 +01:00
Asger F
815581dc11 JS: Update to account for key,val pairs on edges 2024-12-11 11:48:13 +01:00
Owen Mansel-Chan
aaa4361120 Rearrange member predicates in ControlFlow::Node
Put all the ones which might need to be overrridden by subclasses
together for ease of reading.
2024-12-11 10:34:18 +00:00
Owen Mansel-Chan
79f4f78fc2 Make separate classes for control flow node kinds
This puts all the logic of a particular control flow node kind into one
place and makes it easier to add new kinds.
2024-12-11 10:34:16 +00:00
Asger F
5aa1242117 Shared: use a call bit when tracking reachability to/from a discriminator 2024-12-11 11:29:14 +01:00
Asger F
0eb543e0a9 Java: add test for spurious flow from path graph deduplication 2024-12-11 11:29:13 +01:00
Asger F
8efdc2df7b Shared: change note 2024-12-11 11:29:11 +01:00
Asger F
cba7b98f7a Shared: Add DataFlow::DeduplicatePathGraph 2024-12-11 11:29:10 +01:00
Anders Schack-Mulligen
cac131df37 Dataflow: Rename a couple of predicates. 2024-12-11 11:22:42 +01:00
Anders Schack-Mulligen
d6a4080baf Dataflow: Address review comment. 2024-12-11 11:18:57 +01:00
Cornelius Riemenschneider
f0971684e3 Merge pull request #18257 from github/criemen/bazel-8-00
Upgrade bazel to 8.0.0.
2024-12-11 11:14:41 +01:00
Paolo Tranquilli
a36d226d0c Merge pull request #18247 from github/redsun82/executable-scripts
Make scripts executable
2024-12-11 10:42:57 +01:00
Tom Hvitved
baf186fed7 Address review comments 2024-12-11 10:28:32 +01:00
Owen Mansel-Chan
ba9d21ec98 Merge pull request #17970 from owen-mc/java/lightweight-IR-layer
Java: IPA the CFG (second try)
2024-12-10 23:57:52 +00:00
Mathias Vorreiter Pedersen
0acef590b1 C++: Add more MaD models. 2024-12-10 18:29:48 +00:00
Mathias Vorreiter Pedersen
64464b39c6 C++: Add tests for a few string-related classes. 2024-12-10 18:28:12 +00:00
Mathias Vorreiter Pedersen
c5bb907fe0 C++: Also handle varargs in MaD parsing. 2024-12-10 18:25:56 +00:00
Mathias Vorreiter Pedersen
c604c44a55 C++: Add CStringT model and accept tests. 2024-12-10 18:22:06 +00:00
Mathias Vorreiter Pedersen
73ff33888b C++: Add CStringT tests. 2024-12-10 18:18:37 +00:00
Mathias Vorreiter Pedersen
ba0ba15e88 C++: Add CSimpleStringT model and accept tests. 2024-12-10 18:13:42 +00:00
Mathias Vorreiter Pedersen
b42bffc55c C++: Add CSimpleStringT tests. 2024-12-10 18:10:54 +00:00
Mathias Vorreiter Pedersen
fb75f54951 C++: Add another typedef. 2024-12-10 18:07:45 +00:00
Owen Mansel-Chan
5b575113c3 Update test-kotlin2 2024-12-10 15:56:15 +00:00
Owen Mansel-Chan
4978a6eb37 Fix getasuccessor kotlin
The change in results shows that there are now fewer control flow nodes.
We have removed precisely those with no successor or predecessor.
2024-12-10 15:26:20 +00:00
Owen Mansel-Chan
5e0c3ab715 Fix kotlin tests 2024-12-10 15:26:19 +00:00
Owen Mansel-Chan
3f5886ef7a Accept another review suggestion 2024-12-10 15:26:17 +00:00
Owen Mansel-Chan
2da9bfb1a6 Finish renaming getCFGNode to getCfgNode 2024-12-10 15:26:16 +00:00
Owen Mansel-Chan
274281f61e Apply all suggestions from code review
Co-authored-by: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
2024-12-10 15:26:14 +00:00
Owen Mansel-Chan
d06dfe0ca3 Add change note 2024-12-10 15:26:13 +00:00
Owen Mansel-Chan
0f3dd6d8f1 Java: IPA the CFG 2024-12-10 15:26:11 +00:00
Anders Schack-Mulligen
da179705c3 Java: Accept expected file changes. 2024-12-10 14:52:06 +01:00
Mathias Vorreiter Pedersen
0f5786e4e6 Merge pull request #18251 from MathiasVP/fix-uncertain-array-writes
C++: Consider writes to arrays as uncertain
2024-12-10 12:38:47 +00:00
Michael Nebel
828818d355 Merge pull request #18248 from michaelnebel/csharp/enabletests
C#: Enable Semmle.Util.Tests.
2024-12-10 13:30:15 +01:00
Anders Schack-Mulligen
40f7713678 Dataflow: Minor simplification. 2024-12-10 13:28:43 +01:00
Anders Schack-Mulligen
4e155f8542 Dataflow: Insert a few getApprox calls to remove ApApprox from fwdFlow. 2024-12-10 13:23:51 +01:00
Anders Schack-Mulligen
231bf9d1c9 Dataflow: Drop ApApprox join in fwdFlowStore. 2024-12-10 13:20:27 +01:00
Michael Nebel
684c80c31a C#: Address review comments. 2024-12-10 13:13:11 +01:00
Anders Schack-Mulligen
501cbdab3c Dataflow: Remove another ApApprox join and related columns. 2024-12-10 13:12:32 +01:00
Anders Schack-Mulligen
22e0636cba Dataflow: Insert a few getApprox calls to remove even more columns. 2024-12-10 13:09:38 +01:00
Anders Schack-Mulligen
a77adadd01 Dataflow: Remove more unused columns. 2024-12-10 12:57:24 +01:00
Anders Schack-Mulligen
882a985788 Dataflow: Remove useless join. 2024-12-10 12:53:30 +01:00
Anders Schack-Mulligen
262f64f037 Dataflow: Remove unused columns. 2024-12-10 12:53:29 +01:00
Anders Schack-Mulligen
d4044062c5 Dataflow: Remove ApApprox column in out-flow. 2024-12-10 12:53:29 +01:00
Anders Schack-Mulligen
7c888ebe06 Dataflow: Replace some allowsFieldFlow,apa pairs with emptyAp boolean. 2024-12-10 12:53:29 +01:00
Anders Schack-Mulligen
c8046fa8e0 Dataflow: Drop some ApApprox columns and joins. 2024-12-10 12:53:28 +01:00
Joe Farebrother
c41c2adf38 Merge pull request #17922 from joefarebrother/python-promote-template-injection
Python: Promote Template Injection query from experimental
2024-12-10 11:12:23 +00:00
Cornelius Riemenschneider
53ca5083a9 Upgrade bazel to 8.0.0.
Previously, we were using 8.0.0rc1.
In particular, this upgrade means we need to explicitly
import more rules, as they've been moved out of the core bazel repo.
2024-12-10 12:05:37 +01:00
Michael Nebel
86c6df5cbd C#: Log warning when chain or certificate is not provided in the validation. 2024-12-10 10:35:48 +01:00
Michael Nebel
547af6c3c9 C#: Introduce null checks in the NugetPackageRestorer. 2024-12-10 10:31:12 +01:00
Michael Nebel
083533a673 C#: Update paket dependencies lock file. 2024-12-10 10:31:11 +01:00
Michael Nebel
37982f5854 C#: Update paket dotnet tool. 2024-12-10 10:31:09 +01:00
Michael Nebel
4275813b87 C#: Make the path tests independent. 2024-12-10 09:58:14 +01:00
Michael Nebel
0580ad060b Merge pull request #18255 from github/workflow/coverage/update
Update CSV framework coverage reports
2024-12-10 09:12:10 +01:00
github-actions[bot]
8f5822e4c6 Add changed framework coverage reports 2024-12-10 00:22:53 +00:00
Alvaro Muñoz
d0c761bb23 Bump qlpack versions 2024-12-09 21:48:17 +01:00
Alvaro Muñoz
bee0668cd0 Add tests and update expected results 2024-12-09 21:47:28 +01:00
Alvaro Muñoz
b80d3d56a3 exclude Simple refereces from GitHub context 2024-12-09 21:47:09 +01:00
Joe Farebrother
f82fa20249 Update test outputs 2024-12-09 20:37:11 +00:00
Joe Farebrother
8a778da253 Apply suggestions from docs review
Co-authored-by: Ben Ahmady <32935794+subatoi@users.noreply.github.com>
2024-12-09 19:58:00 +00:00
Joe Farebrother
462be46be9 Update test output 2024-12-09 19:57:52 +00:00
Joe Farebrother
ef1d898b0d Add qldoc 2024-12-09 19:57:39 +00:00
Joe Farebrother
ebaab89933 Formatting updates 2024-12-09 19:57:25 +00:00
Joe Farebrother
dd8b7a4a8f Add additional test for safe case in documentation 2024-12-09 19:57:19 +00:00
Joe Farebrother
55557f8dd3 Use API graohs directly 2024-12-09 19:57:07 +00:00
Joe Farebrother
6e16ed52e8 Reveiw suggestions: Spelling/grammar fixes
Co-authored-by: Taus <tausbn@github.com>
2024-12-09 19:56:59 +00:00
Joe Farebrother
0f0c1e1609 Test update 2024-12-09 19:56:46 +00:00
Joe Farebrother
494d779541 Add changenote 2024-12-09 19:56:38 +00:00
Joe Farebrother
f0163894b6 fix link in qhelp refs 2024-12-09 19:56:25 +00:00
Joe Farebrother
4602c5c905 Remove experimental version + qhelp fixes 2024-12-09 19:56:18 +00:00
Joe Farebrother
e4e02ec674 Add security severity + fix qhelp 2024-12-09 19:56:03 +00:00
Joe Farebrother
02f395f5f8 Add qhelp 2024-12-09 19:55:57 +00:00
Joe Farebrother
cea196ec61 Add concepts tests + some fixes 2024-12-09 19:55:42 +00:00
Joe Farebrother
1cb01a286d Add tests for jinja 2024-12-09 19:55:36 +00:00
Joe Farebrother
71ab82dee0 Fix qldoc, formatting, and redundant import warnings 2024-12-09 19:55:21 +00:00
Joe Farebrother
b2c13fe351 Promote template injection sinks for each framework covered
`Cheetah` was excluded as it was last updated 15 years ago and its documentation links are dead.
2024-12-09 19:55:17 +00:00
Joe Farebrother
60d8a85a9c Promote jinja sinks 2024-12-09 19:54:57 +00:00
Joe Farebrother
8647073433 Copy template injection to standard pack + add jinja sinks 2024-12-09 19:47:06 +00:00
Alvaro Muñoz
f6d20195b1 When trigger event is not known, do not check context trigger maps 2024-12-09 17:33:13 +01:00
Alvaro Muñoz
f3ada4a92b Update CompositeActionSources expected file 2024-12-09 17:32:26 +01:00
Alvaro Muñoz
3591db9e9c Remove artifact source as a source of PR refs 2024-12-09 17:32:09 +01:00
Alvaro Muñoz
ef713ff13b Extract GitHub context access expression into its own class 2024-12-09 17:30:10 +01:00
Mathias Vorreiter Pedersen
1266b244f5 Merge pull request #18136 from MathiasVP/model-active-template-library
C++: Model Microsoft's "Active Template Library"
2024-12-09 16:05:19 +00:00
Mathias Vorreiter Pedersen
0f49ba848d C++: Accept test changes. Nothing exciting to see here. 2024-12-09 16:04:46 +00:00
Mathias Vorreiter Pedersen
9bcdfb6d01 C++: VariableAddressInstructions with array types are not single-object types. 2024-12-09 15:06:22 +00:00
Mathias Vorreiter Pedersen
8bdd10c0c2 C++: Fix spurious columns in 'CRegKey'. 2024-12-09 14:31:17 +00:00
Mathias Vorreiter Pedersen
5f33733b6e C++: Fix 'QueryValue' model. 2024-12-09 14:27:24 +00:00
Cornelius Riemenschneider
7dd10f72cb Merge pull request #18243 from github/post-release-prep/codeql-cli-2.20.0
Post-release preparation for codeql-cli-2.20.0
2024-12-09 14:58:01 +01:00
Mathias Vorreiter Pedersen
184dfc24b9 C++: Fix 'QueryStringValue' model. 2024-12-09 13:42:39 +00:00
Mathias Vorreiter Pedersen
7f87a25768 C++: Fix 'QueryMultiStringValue' model. 2024-12-09 13:41:14 +00:00
Mathias Vorreiter Pedersen
674dbce36d C++: Add taint flow through 'CRegKey::Create'. 2024-12-09 13:38:37 +00:00
Mathias Vorreiter Pedersen
db86f6aaf9 C++: Fix annotation. 2024-12-09 13:32:22 +00:00
Alvaro Muñoz
1fa00f1065 Capture the event name rathen than the whole event 2024-12-09 14:31:10 +01:00
Cornelius Riemenschneider
badc927cf8 Merge branch 'main' into post-release-prep/codeql-cli-2.20.0 2024-12-09 14:30:53 +01:00
Mathias Vorreiter Pedersen
d3dc318ba1 C++: Make 'GetValueAt' a value-preserving step. 2024-12-09 13:26:46 +00:00
Mathias Vorreiter Pedersen
d735a1433b C++: Also flow to the return value of 'operator='. 2024-12-09 13:24:21 +00:00
Mathias Vorreiter Pedersen
dcc35a5724 Merge pull request #18221 from MathiasVP/add-microsoft-aspnetcore-mvc-model
C#: Add a MaD model for `Microsoft.AspNetCore.Mvc.Controller.View`
2024-12-09 13:24:02 +00:00
Michael Nebel
5624a77176 C#: Use TEST_TEMPDIR when set for test files. 2024-12-09 13:59:59 +01:00
Tom Hvitved
2f8b04b225 Rust: Models-as-data for flow summaries 2024-12-09 13:41:55 +01:00
Michael Nebel
baa248ce65 C#: Enable Semmle.Util.Tests. 2024-12-09 13:00:52 +01:00
Cornelius Riemenschneider
57053e8ba1 Merge pull request #18245 from github/criemen/csharp-win-tests
C#: Shorten test target names to make Windows happy.
2024-12-09 12:57:40 +01:00
Cornelius Riemenschneider
798b86f6af Disable semmle.util.tests again. 2024-12-09 12:27:49 +01:00
Cornelius Riemenschneider
526dbe5901 Address review, also run semmle-util tests. 2024-12-09 12:19:01 +01:00
Jeroen Ketema
fb5aa97077 Merge pull request #18239 from jketema/typo
C++: Fix word duplication in change note
2024-12-09 10:55:13 +01:00
Cornelius Riemenschneider
18560cde9d C#: Shorten test target names to make Windows happy. 2024-12-09 10:54:04 +01:00
Paolo Tranquilli
3bc822f021 Swift: add change note for Swift 6 upgrade 2024-12-09 10:31:15 +01:00
Paolo Tranquilli
f74dcc7036 Make scripts executable 2024-12-09 10:20:46 +01:00
Geoffrey White
97ab31ab00 Merge pull request #18229 from geoffw0/self
Rust: Fix unwanted 'self' results from rust/unused-variable
2024-12-09 08:50:03 +00:00
Michael Nebel
127518e91a Merge pull request #18234 from michaelnebel/csharp/projectdependencies
C#: Clean up dependencies Newtonsoft.Json.
2024-12-09 09:08:27 +01:00
Mathias Vorreiter Pedersen
41425b157f C++: Add test with missing flow. 2024-12-08 23:47:34 +00:00
Jami Cogswell
214da9e9ad Java: add change note 2024-12-06 19:59:40 -05:00
Angela P Wen
406ac15863 Merge branch 'main' into post-release-prep/codeql-cli-2.20.0 2024-12-06 14:51:56 -08:00
github-actions[bot]
dbe8f98e18 Post-release preparation for codeql-cli-2.20.0 2024-12-06 21:19:19 +00:00
Henry Mercer
3b2e55bc2a Merge pull request #18242 from github/release-prep/2.20.0
Release preparation for version 2.20.0
2024-12-06 19:41:03 +00:00
Simon Friis Vindum
70501008b0 Merge pull request #18232 from paldepind/rust-self-capture
Rust: Fix a bug where captured `self` parameters where not considered captured
2024-12-06 20:23:38 +01:00
Mathias Vorreiter Pedersen
8a6c52967d Merge pull request #18233 from MathiasVP/fix-join-order-in-barrier-guards
C++: Fix two bad joins in barrier guards
2024-12-06 19:13:51 +00:00
Henry Mercer
92d614dbcd Add periods for consistency 2024-12-06 19:13:05 +00:00
github-actions[bot]
8c64648520 Release preparation for version 2.20.0 2024-12-06 19:10:28 +00:00
Henry Mercer
f7174f6e4d Merge pull request #18240 from github/revert-18208-release-prep/2.20.0
Revert "Release preparation for version 2.20.0"
2024-12-06 19:04:23 +00:00
Henry Mercer
a6a4ad6400 Revert "Release preparation for version 2.20.0" 2024-12-06 19:00:27 +00:00
Jeroen Ketema
3a3eb001e3 C++: Fix word duplication in change note 2024-12-06 19:53:06 +01:00
Jeroen Ketema
ee8ce1c84d Merge pull request #18222 from github/calumgrant/bmn/badly-bounded-write
C++: Fix FPs in cpp/badly-bounded-write caused by extraction errors
2024-12-06 19:50:06 +01:00
Simon Friis Vindum
9b34615a64 Rust: Update test assertions to match results 2024-12-06 19:05:53 +01:00
Michael B. Gale
5a2a784ed5 Merge pull request #18238 from github/mbg/csharp/codeql-cli-2.20.0/set-proxy-cert-file 2024-12-06 17:57:32 +00:00
Calum Grant
fa123a7215 Merge pull request #18200 from github/calumgrant/bmn/wrong-type-format-args2
C++: Fix more FPs with extraction errors on cpp/wrong-type-format-arguments
2024-12-06 17:50:56 +00:00
Paolo Tranquilli
a555a44a20 Merge pull request #18236 from geoffw0/percent
Rust: Add % of files extracted without errors to summary stats.
2024-12-06 18:01:04 +01:00
Michael B. Gale
32d757f65c C#: Create certificate from string, rather than file 2024-12-06 16:41:31 +00:00
Michael B. Gale
0d206bd0bb C#: Explicitly close writer in DependabotProxy 2024-12-06 16:41:30 +00:00
Michael B. Gale
671e61f3b3 C#: Fix possible null dereference 2024-12-06 16:41:29 +00:00
Michael B. Gale
1569621605 C#: Don't initialise DependabotProxy on Windows or macOS 2024-12-06 16:41:28 +00:00
Michael B. Gale
2bb59e2850 C#: Apply suggestions from code review for DependabotProxy 2024-12-06 16:41:27 +00:00
Michael B. Gale
174cb7c0e2 C#: Load Dependabot Proxy certificate in DependabotProxy, and implement IDisposable 2024-12-06 16:41:26 +00:00
Michael B. Gale
8886292eec C#: Set up proxy for IsFeedReachable, if configured 2024-12-06 16:41:22 +00:00
Michael B. Gale
4d5c55e533 C#: Propagate DependabotProxy instance down from DependencyManager 2024-12-06 16:39:49 +00:00
Michael B. Gale
8b5050e427 C# Expose CertificatePath from DependabotProxy 2024-12-06 16:39:48 +00:00
Michael B. Gale
4a7413cf11 C#: Use Add for environment variables 2024-12-06 16:39:47 +00:00
Michael B. Gale
84d3532a05 C#: Add more logging to DependabotProxy 2024-12-06 16:39:46 +00:00
Michael B. Gale
d6fda1ae72 C#: Set environment variables for proxy for calls to dotnet 2024-12-06 16:39:46 +00:00
Michael B. Gale
c6f089585a C#: Initialise DependabotProxy in DotNetCliInvoker 2024-12-06 16:39:45 +00:00
Michael B. Gale
459b76ac3f C#: Add DependabotProxy class 2024-12-06 16:39:44 +00:00
Michael B. Gale
a0cb9c19fa C#: Add CODEQL_PROXY_* environment variable names 2024-12-06 16:39:43 +00:00
Mathias Vorreiter Pedersen
59f4b3c0db C++: Get rid of the model for 'Create'. 2024-12-06 15:58:07 +00:00
Geoffrey White
1ceee76919 Rust: Get the .expected values right this time. 2024-12-06 15:53:42 +00:00
Mathias Vorreiter Pedersen
3d0a2057f6 C++: Fix 'BSTRToArray' stub and MaD model. 2024-12-06 15:46:14 +00:00
Owen Mansel-Chan
7e5e634bc7 Update .expected files (no new results) 2024-12-06 15:41:28 +00:00
Calum Grant
e98129c402 Update cpp/ql/src/change-notes/2024-12-05-badly-bounded-write.md
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-12-06 15:36:24 +00:00
Calum Grant
5aa604b42c Update cpp/ql/src/change-notes/2024-12-05-wrong-type-format-args.md
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-12-06 15:34:57 +00:00
Mathias Vorreiter Pedersen
66de42c576 C++: Fix MaD row for 'operator&' on 'CComBSTR's. 2024-12-06 15:33:29 +00:00
Mathias Vorreiter Pedersen
6388a9af95 C++: Delete duplicated MaD row. 2024-12-06 15:31:33 +00:00
Mathias Vorreiter Pedersen
f7b55e05eb C++: 'Attach' is value-preserving. 2024-12-06 15:30:34 +00:00
Geoffrey White
4024968e46 Rust: Accept integration test changes. 2024-12-06 15:30:02 +00:00
Mathias Vorreiter Pedersen
904db38a5f C++: Add missing space between type name and '&'. 2024-12-06 15:29:13 +00:00
Paolo Tranquilli
198417c63a Swift: fix filename case for prebuilt artifacts 2024-12-06 16:28:04 +01:00
Mathias Vorreiter Pedersen
d0bf3b84e4 C++: Add missing MaD row for move constructor. 2024-12-06 15:27:17 +00:00
Mathias Vorreiter Pedersen
9f31116630 C#: Accept test changes. 2024-12-06 15:18:03 +00:00
Mathias Vorreiter Pedersen
c51153203b C++: Fix two bad joins that happen in 'UnboundedWrite' on #18207. 2024-12-06 15:10:08 +00:00
Owen Mansel-Chan
75331ea268 Add change note 2024-12-06 15:03:34 +00:00
Owen Mansel-Chan
67572712ea Fix flow out of varargs param with models-as-data
This still doesn't allow for a variadic out parameter to be defined as
a source using MaD. This is due to the lack of an implicit store step
at sources, to match implicit read steps at sinks.
2024-12-06 15:00:40 +00:00
Owen Mansel-Chan
8cc4cd58c6 Add failing test for flow out of varargs param with models-as-data 2024-12-06 15:00:37 +00:00
Owen Mansel-Chan
96c8af8943 Test flow out of varargs param with function models 2024-12-06 15:00:34 +00:00
Owen Mansel-Chan
1612a7a9a0 Delete accidentally committed binary 2024-12-06 15:00:33 +00:00
Owen Mansel-Chan
69f087a46d Fix pre-existing failing test in VarArgsWithFunctionModels
It was failing for a silly reason.
2024-12-06 15:00:31 +00:00
Owen Mansel-Chan
ec7cbf93d9 Add failing test for flow out of varargs parameter 2024-12-06 15:00:30 +00:00
Owen Mansel-Chan
1935c26b56 Trivial variable name fixes 2024-12-06 15:00:28 +00:00
Michael Nebel
4e079d34b9 C#: Clean up dependencies Newtonsoft.Json and dont override nowarn. 2024-12-06 15:55:30 +01:00
Geoffrey White
d7d4658aae Rust: Add % of files extractor without errors to summary stats. 2024-12-06 14:54:21 +00:00
Michael Nebel
9513b6c3a9 Merge pull request #18199 from michaelnebel/csharp/updateroslyn
C#: Update Roslyn nuget dependencies.
2024-12-06 15:41:23 +01:00
Paolo Tranquilli
926d65bcec Swift: update LFS artifacts and remove override 2024-12-06 15:28:22 +01:00
Paolo Tranquilli
263bd69636 Swift: fix artifact update infrastructure 2024-12-06 15:28:13 +01:00
Geoffrey White
4b93325914 Merge branch 'main' into badcrypto 2024-12-06 14:21:11 +00:00
Geoffrey White
f637b3b1f3 Apply suggestions from code review
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
2024-12-06 14:20:40 +00:00
Michael B. Gale
e16adda74d Merge pull request #18029 from github/mbg/csharp/set-proxy-cert-file 2024-12-06 14:03:43 +00:00
Paolo Tranquilli
a82d37e05c Swift: fix gracefully accepting missing ForEachStmt.iteratorVar 2024-12-06 14:45:24 +01:00
Paolo Tranquilli
a4f7981d93 Swift: accept test changes 2024-12-06 14:44:01 +01:00
Michael Nebel
af2234453b C#: Update dependencies (binlog package needs to be updated). 2024-12-06 14:30:51 +01:00
Michael Nebel
b9253222a6 C#: Add change-note. 2024-12-06 14:30:50 +01:00
Michael Nebel
d83f2215f6 C#: Update Parameters test to only inspect parameters from source code. 2024-12-06 14:30:49 +01:00
Michael Nebel
f94aaee53c C#: Update integration tests expected output. 2024-12-06 14:30:47 +01:00
Michael Nebel
61fa889190 C#: Update the format test expected output as the params keyword is now extracted correctly. 2024-12-06 14:30:46 +01:00
Michael Nebel
6a0d56a146 C#: Update DataQuality output. Roslyn now correctly finds the compile time target. 2024-12-06 14:30:45 +01:00
Michael Nebel
347fb1cfd9 C#: Update dependencies. 2024-12-06 14:30:44 +01:00
Michael Nebel
4013eeba8b C#: Use the newest version of packages instead of the minimum version. 2024-12-06 14:30:42 +01:00
Michael Nebel
2816234359 C#: Update Roslyn. 2024-12-06 14:30:41 +01:00
Michael B. Gale
c8ccfe40a5 C#: Create certificate from string, rather than file 2024-12-06 13:13:41 +00:00
Michael B. Gale
653d68ea94 C#: Explicitly close writer in DependabotProxy 2024-12-06 13:13:15 +00:00
Simon Friis Vindum
ed68423d6e Rust: Handle captured self parameter in variable implementation 2024-12-06 14:12:27 +01:00
Calum Grant
d38975bb99 C++: Use getType() instead of getUnderlyingType() 2024-12-06 13:07:58 +00:00
Simon Friis Vindum
43dd3ebf14 Rust: Add variables test with captured self parameter 2024-12-06 14:07:42 +01:00
Geoffrey White
281f8b1828 Rust: Fix the unwanted results. 2024-12-06 12:29:07 +00:00
Geoffrey White
e52e1b0c1f Rust: Add test case for 'self' in unused entities. 2024-12-06 12:24:11 +00:00
Mathias Vorreiter Pedersen
0d616ca7ef C#: Respond to PR comments. 2024-12-06 12:23:35 +00:00
Tom Hvitved
3ba87de260 Merge pull request #18220 from hvitved/rust/cache-default-additional-taint-step
Rust: Cache `defaultAdditionalTaintStep`
2024-12-06 13:04:11 +01:00
Paolo Tranquilli
f81f30cc4d Swift: accept test changes 2024-12-06 12:47:54 +01:00
Paolo Tranquilli
bed638793c Swift: remove linux QL tests check 2024-12-06 12:36:19 +01:00
Paolo Tranquilli
7ee3bf9fc8 Swift: add update/downgrade scripts 2024-12-06 12:35:01 +01:00
Paolo Tranquilli
4ac602ccd7 Merge branch 'main' into redsun82/swift-6 2024-12-06 12:31:40 +01:00
Calum Grant
defa4cc19f Merge pull request #18194 from github/calumgrant/bmn/wrong-number-format-arguments2
C++: Fix a FP in cpp/wrong-number-format-arguments caused by an extraction error
2024-12-06 10:14:06 +00:00
Calum Grant
2cd4e1af9f C++: Use Expr.stripType() 2024-12-06 09:55:05 +00:00
Geoffrey White
129f21af29 Rust: Make a predicate private. 2024-12-06 09:37:41 +00:00
Calum Grant
2da3d36092 C++: Change note 2024-12-06 09:36:51 +00:00
Michael Nebel
9715ffd9a4 Merge pull request #18205 from michaelnebel/csharp/narrowpatterntypes
C#: Narrow pattern types
2024-12-06 10:33:13 +01:00
Paolo Tranquilli
f8976142f5 Merge pull request #18224 from github/redsun82/rust-tweaks
Rust: tweak/define more `toString` implementations
2024-12-06 09:27:40 +01:00
Paolo Tranquilli
b59b90ba6d Rust: accept test changes 2024-12-06 09:12:16 +01:00
Paolo Tranquilli
d0804ac726 Merge branch 'main' into redsun82/rust-tweaks 2024-12-06 09:11:58 +01:00
Geoffrey White
4e418d3d4d Rust: Update for latest main, and autoformat. 2024-12-05 19:09:40 +00:00
Geoffrey White
de042ea9d7 Merge branch 'main' into badcrypto 2024-12-05 18:36:47 +00:00
Jeroen Ketema
829a934ccb Merge pull request #18049 from microsoft/brodes/seh_flow_phase2_splitting_seh_edges
Brodes/seh flow phase2 splitting seh edges
2024-12-05 19:36:39 +01:00
Geoffrey White
dd0fa791aa Rust: Add qhelp. 2024-12-05 18:02:44 +00:00
Geoffrey White
6eb850c8cb Rust: Improve the model. 2024-12-05 16:49:27 +00:00
Geoffrey White
94dbad7c95 Rust: Model for cipher traits. 2024-12-05 16:49:19 +00:00
Paolo Tranquilli
720bfc8ff1 Rust: tweak/define more toString implementations 2024-12-05 17:43:47 +01:00
REDMOND\brodes
3619b01ace Merge branch 'brodes/seh_flow_phase2_splitting_seh_edges' of https://github.com/microsoft/codeql into brodes/seh_flow_phase2_splitting_seh_edges 2024-12-05 10:50:17 -05:00
REDMOND\brodes
48c86979f0 Deleting unused predicate. 2024-12-05 10:50:06 -05:00
Ben Rodes
3115833847 Update cpp/ql/lib/semmle/code/cpp/ir/implementation/EdgeKind.qll
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-12-05 10:49:33 -05:00
Ben Rodes
6cbaa73d58 Update cpp/ql/lib/semmle/code/cpp/ir/implementation/EdgeKind.qll
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-12-05 10:48:40 -05:00
Ben Rodes
1fbd75fee3 Update cpp/ql/lib/semmle/code/cpp/ir/implementation/EdgeKind.qll
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-12-05 10:48:34 -05:00
Ben Rodes
e9ccf37d4d Update cpp/ql/lib/semmle/code/cpp/ir/implementation/EdgeKind.qll
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-12-05 10:48:23 -05:00
Ben Rodes
008d58b425 Update cpp/ql/lib/semmle/code/cpp/ir/implementation/EdgeKind.qll
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-12-05 10:48:16 -05:00
Ben Rodes
ca6d3b0038 Update cpp/ql/lib/semmle/code/cpp/ir/implementation/EdgeKind.qll
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-12-05 10:48:00 -05:00
Calum Grant
12b4c0a2dd C++: Change note 2024-12-05 15:40:50 +00:00
Ben Rodes
befca9ba0e Merge branch 'main' into brodes/seh_flow_phase2_splitting_seh_edges 2024-12-05 10:34:08 -05:00
Mathias Vorreiter Pedersen
dce29dbbd0 Merge pull request #18218 from MathiasVP/final-alias-edge-kind
C++: Use a final alias for `EdgeKind`
2024-12-05 15:32:59 +00:00
Geoffrey White
eeeb142f0b Rust: Implement the query. 2024-12-05 15:22:10 +00:00
Geoffrey White
07e3421f6f Rust: Add shared ConceptsShared.qll, CryptoAlgorithms.qll and CryptoAlgorithmNames.qll to Rust. 2024-12-05 15:22:09 +00:00
Geoffrey White
6c4e0a99e2 Rust: A few more test cases. 2024-12-05 15:17:22 +00:00
Calum Grant
7aed4c3cbf C++: Change note 2024-12-05 15:13:38 +00:00
REDMOND\brodes
57fc3fbfe3 Switching from isSeh bools to sublcassed ExceptionEdge. 2024-12-05 10:10:56 -05:00
Mathias Vorreiter Pedersen
41f08d9b84 C#: Accept test changes. 2024-12-05 14:59:37 +00:00
Mathias Vorreiter Pedersen
4af18be70b C#: Add change note. 2024-12-05 14:42:59 +00:00
Calum Grant
b7f47f752b C++: Remove FPs from cpp/badly-bounded-write 2024-12-05 14:37:19 +00:00
REDMOND\brodes
defa8696d3 Merge remote-tracking branch 'mathiasvp/final-alias-edge-kind' into brodes/seh_flow_phase2_splitting_seh_edges
# Conflicts:
#	cpp/ql/lib/semmle/code/cpp/ir/implementation/EdgeKind.qll
2024-12-05 09:35:13 -05:00
Tom Hvitved
ed4819aeab Rust: Cache defaultAdditionalTaintStep 2024-12-05 15:19:11 +01:00
Tom Hvitved
7eb3b40977 Merge pull request #18219 from hvitved/rust/update-inline-expectations
Rust: update inline expectations
2024-12-05 15:11:25 +01:00
yoff
81c8a702ff Merge pull request #18112 from github/tausbn/add-api-graph-support-for-parameter-annotations 2024-12-05 15:05:27 +01:00
Mathias Vorreiter Pedersen
5bebfdeb2a C#: Add a MaD model for the 'Microsoft.AspNetCore.Mvc.Controller.View' method. 2024-12-05 13:59:59 +00:00
Tom Hvitved
1c56692c02 Rust: update inline expectations 2024-12-05 14:43:39 +01:00
Geoffrey White
bdb2f3d091 Rust: Add placeholder query and tests for 'cipher' module. 2024-12-05 13:38:57 +00:00
Calum Grant
fd7469848e C++: Test case for cpp/badly-bounded-write 2024-12-05 13:16:59 +00:00
Mathias Vorreiter Pedersen
667abb19d7 C++: Expose a final alias instead of the abstract class. 2024-12-05 13:13:44 +00:00
Michael B. Gale
952488c2d8 C#: Fix possible null dereference 2024-12-05 12:32:55 +00:00
Michael B. Gale
7369d043ed C#: Don't initialise DependabotProxy on Windows or macOS 2024-12-05 12:25:45 +00:00
Michael B. Gale
2e80e09f52 C#: Apply suggestions from code review for DependabotProxy 2024-12-05 12:15:27 +00:00
Michael B. Gale
ee7f0b0f2a C#: Load Dependabot Proxy certificate in DependabotProxy, and implement IDisposable 2024-12-05 12:15:26 +00:00
Michael B. Gale
ca251fb840 C#: Set up proxy for IsFeedReachable, if configured 2024-12-05 12:15:23 +00:00
Michael B. Gale
984091d4a4 C#: Propagate DependabotProxy instance down from DependencyManager 2024-12-05 12:14:29 +00:00
Michael B. Gale
e999ec1ecf C# Expose CertificatePath from DependabotProxy 2024-12-05 12:14:28 +00:00
Michael B. Gale
87bd21e12c C#: Use Add for environment variables 2024-12-05 12:14:27 +00:00
Michael B. Gale
de415d68cf C#: Add more logging to DependabotProxy 2024-12-05 12:14:26 +00:00
Michael B. Gale
6cd5711313 C#: Set environment variables for proxy for calls to dotnet 2024-12-05 12:14:25 +00:00
Michael B. Gale
8ca75602d8 C#: Initialise DependabotProxy in DotNetCliInvoker 2024-12-05 12:14:25 +00:00
Michael B. Gale
232caa7185 C#: Add DependabotProxy class 2024-12-05 12:14:24 +00:00
Michael B. Gale
537601290b C#: Add CODEQL_PROXY_* environment variable names 2024-12-05 12:14:23 +00:00
Michael B. Gale
05f9a90fd7 Merge pull request #18216 from github/dependabot/go_modules/go/extractor/extractor-dependencies-288d2c81da
Bump golang.org/x/tools from 0.27.0 to 0.28.0 in /go/extractor in the extractor-dependencies group
2024-12-05 11:53:11 +00:00
Owen Mansel-Chan
347fd575a2 Refactor to avoid duplicated logic 2024-12-05 11:15:43 +00:00
Simon Friis Vindum
43e3f8406d Merge pull request #18188 from paldepind/rust-df-array
Rust: Basic data flow through arrays
2024-12-05 12:09:22 +01:00
Simon Friis Vindum
3061d4a516 Rust: Minor tweaks 2024-12-05 11:53:12 +01:00
Owen Mansel-Chan
b20b7c7572 Remove escaped "{" and "}" before counting placeholders 2024-12-05 10:43:13 +00:00
Simon Friis Vindum
1f4e7d1f37 Rust: Handle arrays in taint tracking 2024-12-05 11:41:32 +01:00
Simon Friis Vindum
44239cbf2e Rust: Add taint tests for arrays 2024-12-05 11:39:05 +01:00
Simon Friis Vindum
27de43fed8 Merge branch 'main' into rust-df-array 2024-12-05 11:08:54 +01:00
Michael Nebel
80be95dbf9 Merge pull request #18090 from michaelnebel/csharp/locks
C#: Use dedicated lock type where applicable.
2024-12-05 10:52:34 +01:00
Jeroen Ketema
65a4dc31c1 Merge pull request #18213 from MathiasVP/fix-join-order-in-guarded-free
C++: Fix a join-order problem that happens on #18207
2024-12-05 10:39:51 +01:00
Simon Friis Vindum
1dbcaa0ece Merge pull request #18202 from paldepind/rust-taint
Rust: Add default taint flow steps
2024-12-05 10:31:11 +01:00
Anders Schack-Mulligen
4bf63fedc9 Merge pull request #18179 from aschackmull/dataflow/accesspath-notypes
Dataflow: Remove tracked types from Access Paths, track tainted object type, and tweak type pruning.
2024-12-05 09:58:36 +01:00
Simon Friis Vindum
5b6ce3e0d0 Merge branch 'main' into rust-taint 2024-12-05 09:34:25 +01:00
Paolo Tranquilli
c4e53b842d Merge pull request #18165 from github/redsun82/rust-less-canonical-paths
Rust: restrict canonical path calculations
2024-12-05 08:57:41 +01:00
dependabot[bot]
d25045c936 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.27.0 to 0.28.0
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.27.0...v0.28.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-12-05 03:26:59 +00:00
Jami Cogswell
121780c55a Java: add File.getName as a path injection sanitizer 2024-12-04 18:57:51 -05:00
Henry Mercer
ccfb32e989 Merge pull request #18211 from github/post-release-prep/codeql-cli-2.20.0
Post-release preparation for codeql-cli-2.20.0
2024-12-04 20:45:07 +00:00
Andrew Eisenberg
515c65058e Merge pull request #18212 from github/aeisenberg/artifacts-v4
Update action.yml to use artifacts@v4
2024-12-04 12:26:41 -08:00
Mathias Vorreiter Pedersen
6fd9e19673 C++: Fix a join-order problem that happens on #18207. 2024-12-04 20:10:45 +00:00
Andrew Eisenberg
1ac6c3751b Update action.yml to use artifacts@v4
v3 is getting deprecated.
2024-12-04 11:41:40 -08:00
github-actions[bot]
cf71a1525b Post-release preparation for codeql-cli-2.20.0 2024-12-04 18:36:17 +00:00
Ben Rodes
779376e281 Merge branch 'main' into brodes/seh_flow_phase2_splitting_seh_edges 2024-12-04 13:30:21 -05:00
REDMOND\brodes
cc43bb1969 Merge branch 'brodes/seh_flow_phase1_throwing_models' into brodes/seh_flow_phase2_splitting_seh_edges 2024-12-04 13:28:21 -05:00
Henry Mercer
80bd129621 Merge pull request #18208 from github/release-prep/2.20.0
Release preparation for version 2.20.0
2024-12-04 16:06:17 +00:00
Henry Mercer
e0e82ad7ad Add periods for consistency 2024-12-04 16:05:15 +00:00
github-actions[bot]
96564b7128 Release preparation for version 2.20.0 2024-12-04 16:01:14 +00:00
Calum Grant
147d699133 C++: Add another test case 2024-12-04 15:45:17 +00:00
Simon Friis Vindum
d6ab7d2aff Merge branch 'main' into rust-taint 2024-12-04 15:28:30 +01:00
Owen Mansel-Chan
f56b2c912a Merge pull request #18201 from owen-mc/go/mad/improve-externalflowinheritance-tests
Go: Fix some spurious results in ExternalFlowInheritance tests
2024-12-04 14:24:30 +00:00
Henry Mercer
02752fa051 Merge pull request #18206 from github/henrymercer/merge-back-rc-3.16
Merge `rc/3.16` back to `main`
2024-12-04 14:20:49 +00:00
Mathias Vorreiter Pedersen
4f00e229e0 C++: Accept more test changes. 2024-12-04 13:49:07 +00:00
Michael Nebel
38e3913fa9 C#: Remove redundant using statements. 2024-12-04 14:46:15 +01:00
Michael Nebel
dde0281d25 C#: Use dedicated lock type where applicable. 2024-12-04 14:46:14 +01:00
Michael Nebel
57c3b571ab C#: Narrow types to SingleVariableDesignation syntax (to avoid future compiler warning). 2024-12-04 14:43:52 +01:00
Michael Nebel
c6d2bf2046 C#: Add extra flag to tracing debugging launch. 2024-12-04 14:43:51 +01:00
Michael Nebel
4a0875f78d Merge pull request #18091 from michaelnebel/csharp/net9-3
C#: Bazel build should target .NET9 framework.
2024-12-04 14:41:38 +01:00
Henry Mercer
963f084d87 Merge branch 'main' into henrymercer/merge-back-rc-3.16 2024-12-04 13:39:10 +00:00
Paolo Tranquilli
08de0b40ed Merge branch 'main' into redsun82/rust-less-canonical-paths 2024-12-04 14:35:10 +01:00
Paolo Tranquilli
80d466ffea Merge pull request #18116 from github/redsun82/rust-perf-measures
Rust: add some performance diagnostics
2024-12-04 14:31:06 +01:00
Simon Friis Vindum
3004639fca Rust: Add default taint flow steps 2024-12-04 14:11:05 +01:00
Simon Friis Vindum
a19f1d0b8b Rust: Remove store step for repeat operand in array expression 2024-12-04 14:01:53 +01:00
Simon Friis Vindum
c62b7d139f Merge branch 'main' into rust-df-array 2024-12-04 13:55:26 +01:00
Jeroen Ketema
9c4030ed45 Merge pull request #18014 from microsoft/brodes/seh_flow_phase1_throwing_models
Brodes/seh flow phase1 throwing models
2024-12-04 13:55:05 +01:00
Mathias Vorreiter Pedersen
279a30c7e8 C++: Make 'SetAt' a value-preserving step. 2024-12-04 12:52:41 +00:00
Mathias Vorreiter Pedersen
c7dee4b020 C++: Remove more taint to POSITIONs. 2024-12-04 12:52:13 +00:00
Mathias Vorreiter Pedersen
9dc3aecf67 C++: Remove more taint to POSITIONs. 2024-12-04 12:48:55 +00:00
Mathias Vorreiter Pedersen
de75e033be C++: Remove taint to POSITIONs. 2024-12-04 12:46:14 +00:00
Mathias Vorreiter Pedersen
8d035e61a3 C++: Fix test. 2024-12-04 12:33:02 +00:00
Simon Friis Vindum
70a296be89 Rust: Add string slice taint flow test 2024-12-04 13:24:15 +01:00
yoff
f2d457d083 Merge pull request #18145 from github/tausbn/python-add-guide-for-extending-the-parser
Python: Add guide describing how to extend the parser
2024-12-04 13:07:05 +01:00
Owen Mansel-Chan
ec0c0f1b35 Fix some spurious results in ExternalFlowInheritance tests
Several struct types were being considered as the same. The fix is to
give them unique fields.
2024-12-04 11:57:32 +00:00
Simon Friis Vindum
2ada999728 Rust: Include as expression in CFG nodes 2024-12-04 12:56:54 +01:00
Simon Friis Vindum
f10ffa39e4 Rust: Add tests for taint flow 2024-12-04 12:54:36 +01:00
Simon Friis Vindum
b7792d690c Merge pull request #18163 from paldepind/rust-df-try-expr
Rust: Add flow through `?` operator
2024-12-04 12:45:32 +01:00
Geoffrey White
b54d8dc6bd Merge pull request #18176 from geoffw0/ctor2
Rust: Improve rust/ctor-initialization
2024-12-04 11:07:51 +00:00
Calum Grant
28c5187a3c C++: Remove FPs in cpp/wrong-type-format-argument when string type is an error 2024-12-04 11:02:19 +00:00
Calum Grant
19424020c3 C++: Test for erroneous string types 2024-12-04 10:57:15 +00:00
Jeroen Ketema
10592bb1c4 Merge pull request #18192 from jketema/inline-rm
Remove deprecated `InlineExpectationsTest` class-based API
2024-12-04 11:34:39 +01:00
Simon Friis Vindum
ed6f873478 Merge branch 'main' into rust-df-try-expr 2024-12-04 11:33:41 +01:00
Anders Schack-Mulligen
03fdceb0fd Merge pull request #18191 from aschackmull/dataflow/remove-deprecated-lib
Dataflow: Delete the old configuration-class based api.
2024-12-04 11:31:46 +01:00
Paolo Tranquilli
7e107a4520 Merge branch 'main' into redsun82/rust-less-canonical-paths 2024-12-04 11:24:48 +01:00
Anders Schack-Mulligen
c187a7ad34 Dataflow: Address review comments. 2024-12-04 11:22:51 +01:00
Paolo Tranquilli
c0676f4269 Merge pull request #18198 from github/redsun82/rust-tuple-struct-pat-to-string
Rust: improve `TupleStructPat.toString`
2024-12-04 11:20:42 +01:00
Mathias Vorreiter Pedersen
eefa066d44 Merge pull request #18195 from MathiasVP/dynamic-property-field-flow
C#: Add field-flow for dynamic fields
2024-12-04 10:09:20 +00:00
Paolo Tranquilli
9da7e8a04f Merge pull request #18142 from github/redsun82/swift-6-for-each-vars
Swift: extract variables as children of `ForEachStmt`
2024-12-04 11:08:35 +01:00
Paolo Tranquilli
b6f0ae0460 Rust: accept test changes 2024-12-04 11:05:01 +01:00
Simon Friis Vindum
7092f13584 Merge branch 'main' into rust-df-try-expr 2024-12-04 10:59:07 +01:00
Jonas Jensen
5285fc0698 Merge pull request #18197 from github/cklin/restrict-alerts-to-all-or-none
AlertFiltering: prohibit partial filtering
2024-12-04 10:58:03 +01:00
Paolo Tranquilli
66e4acf53e Rust: accept test changes 2024-12-04 10:56:14 +01:00
Simon Friis Vindum
4371433eb6 Merge pull request #18160 from paldepind/rust-df-closure
Rust: Handle closures/lambdas in data flow
2024-12-04 10:53:45 +01:00
Paolo Tranquilli
31b9b3adaa Merge branch 'main' into redsun82/rust-perf-measures 2024-12-04 10:50:37 +01:00
Paolo Tranquilli
b9be002e01 Rust: improve TupleStructPat.toString 2024-12-04 10:47:41 +01:00
Paolo Tranquilli
59ea563d2a Merge branch 'main' into redsun82/rust-less-canonical-paths 2024-12-04 10:44:11 +01:00
Michael Nebel
7463c51026 Merge pull request #18189 from michaelnebel/csharp/updatemessagepack
C#: Update the MessagePack nuget dependency.
2024-12-04 10:37:38 +01:00
Simon Friis Vindum
33fe51da4e Update rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll
Co-authored-by: Tom Hvitved <hvitved@github.com>
2024-12-04 10:37:30 +01:00
Simon Friis Vindum
547e232d3b Merge pull request #18174 from github/redsun82/rust-tweaks
Rust: rename `TypeRef` and `*Type` to `*TypeRepr`, `ty` to `type_repr`, and expand some abbreviations in generated docs
2024-12-04 10:36:48 +01:00
Paolo Tranquilli
e30a429c3d Rust: revert TupleStructPat.toString improvements 2024-12-04 10:34:28 +01:00
Anders Schack-Mulligen
5042753b29 C#/Java: Add change notes. 2024-12-04 10:20:43 +01:00
Michael Nebel
c6e936f2c3 C#: Update generics test and expected output from other tests. 2024-12-04 09:56:12 +01:00
Michael Nebel
a1e2e920f4 C#: Run unit tests on bazel changes. 2024-12-04 09:56:11 +01:00
Michael Nebel
1aa6056bd8 C#: Bazel build should target .NET9 framework. 2024-12-04 09:56:09 +01:00
Michael Nebel
801f696bbb Merge pull request #18159 from michaelnebel/csharp/publicprotected
C#: Only extract public and protected members from metadata.
2024-12-04 09:48:36 +01:00
Paolo Tranquilli
53503002a1 Merge branch 'main' into redsun82/rust-tweaks 2024-12-04 09:35:01 +01:00
Paolo Tranquilli
4bf7bbb696 Merge pull request #18190 from github/redsun82/rust-array-expr
Rust: distinguish `[a, b]` from `[a; b]`
2024-12-04 09:30:19 +01:00
Simon Friis Vindum
bb015cf56d Merge branch 'main' into rust-df-closure 2024-12-04 09:25:18 +01:00
Simon Friis Vindum
f4aa3603ad Rust: Do not consider async blocks as lambda expressions 2024-12-04 09:23:12 +01:00
Chuan-kai Lin
63c8769323 AlertFiltering: prohibit partial filtering
This documentation-only commit clarifies that a query should either
ignore restrictAlertsTo completely or apply restrictAlertsTo filtering
to all alerts.  This update eliminates the ambiguity on whether a query
may choose to apply restrictAlertsTo filtering to only some alerts but
not others (it may not).
2024-12-03 12:26:35 -08:00
Mathias Vorreiter Pedersen
9885a1cad1 Update csharp/ql/lib/change-notes/2024-12-03-dynamic-field-flow.md 2024-12-03 19:58:22 +00:00
Mathias Vorreiter Pedersen
919405e586 C#: Support mixing dynamic properties and fields (instead of just properties) and accept test changes. 2024-12-03 19:36:42 +00:00
Mathias Vorreiter Pedersen
14c4d949d6 C#: Include tests with fields as well as properties. 2024-12-03 19:34:06 +00:00
Mathias Vorreiter Pedersen
c3086d4ecd C++: Fix models and accept test changes. 2024-12-03 19:13:00 +00:00
Anders Schack-Mulligen
8c99ad4fcb Ruby: Remove deprecated configuration classes referencing deleted api. 2024-12-03 20:08:46 +01:00
Anders Schack-Mulligen
8a5fc97b06 Python: Remove deprecated configuration classes referencing deleted api. 2024-12-03 20:08:45 +01:00
Anders Schack-Mulligen
f38602e9fe Java: Update references to deleted aliases. 2024-12-03 20:08:45 +01:00
Anders Schack-Mulligen
b12a1c078c Java: Delete deprecated extension points referencing deleted api. 2024-12-03 20:08:44 +01:00
Anders Schack-Mulligen
e846855bca Go: Remove deprecated configuration classes referencing deleted api. 2024-12-03 20:08:44 +01:00
Anders Schack-Mulligen
dbb260dfd2 C#: Remove reference to the deleted api. 2024-12-03 20:08:44 +01:00
Anders Schack-Mulligen
a66de28d8e C++: Remove references to the deleted api. 2024-12-03 20:08:32 +01:00
Mathias Vorreiter Pedersen
3abb9049bb C++: Fix testcase to reveal problematic models. 2024-12-03 19:06:20 +00:00
Anders Schack-Mulligen
cca27e4c77 Add change notes for all languages. 2024-12-03 19:42:33 +01:00
Jeroen Ketema
3d8493757e JS: Update expected test results 2024-12-03 19:19:01 +01:00
Jeroen Ketema
89d20fd086 Java: Update expected test results 2024-12-03 19:18:59 +01:00
Jeroen Ketema
c3ea883b11 Python: Update expected test results 2024-12-03 19:18:57 +01:00
Jeroen Ketema
1420f564a5 C++: Update expected test results 2024-12-03 19:18:55 +01:00
Jeroen Ketema
e89f37df1a Rust: Update expected test results 2024-12-03 19:18:52 +01:00
Jeroen Ketema
99cbeb7eb6 Go: Update expected test results 2024-12-03 19:18:50 +01:00
Jeroen Ketema
67052bf9e5 Swift: Update expected test results 2024-12-03 19:18:48 +01:00
Jeroen Ketema
ca40b60e62 Ruby: update expected test results 2024-12-03 19:18:46 +01:00
Jeroen Ketema
8271ad60c1 Remove deprecated InlineExpectationsTest class-based API 2024-12-03 19:18:37 +01:00
Mathias Vorreiter Pedersen
593e2233f8 C++: Update test changes after 0c8245f727. 2024-12-03 17:55:59 +00:00
Mathias Vorreiter Pedersen
0c8245f727 Update cpp/ql/test/library-tests/dataflow/taint-tests/atl.cpp
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2024-12-03 17:53:01 +00:00
Mathias Vorreiter Pedersen
2c58279137 C++: Add QLDoc to 'isClassConstructedFrom' and 'isFunctionConstructedFrom'. 2024-12-03 17:52:29 +00:00
Mathias Vorreiter Pedersen
da7bfb9297 C#: Add change note. 2024-12-03 17:38:26 +00:00
Mathias Vorreiter Pedersen
4a2c02543c C#: Accept test changes. 2024-12-03 17:34:57 +00:00
Mathias Vorreiter Pedersen
041df780c1 C#: Add field-flow through dynamic members. 2024-12-03 17:34:55 +00:00
Mathias Vorreiter Pedersen
d22ef44f44 C#: Add tests with missing flow through dynamic members. 2024-12-03 17:27:59 +00:00
Calum Grant
99efff2217 C++: Fix a FP in cpp/wrong-number-format-arguments caused by extraction error 2024-12-03 16:40:02 +00:00
Calum Grant
08859be07b C++: Test case for cpp/wrong-number-format-arguments 2024-12-03 16:33:40 +00:00
REDMOND\brodes
e6641e7630 Code and comment simplifications 2024-12-03 11:06:08 -05:00
Simon Friis Vindum
70c60868a6 Rust: Model ? as reading from Option and Result 2024-12-03 17:01:34 +01:00
Michael Nebel
395bdd0cec C#: Address more review comments. 2024-12-03 16:58:30 +01:00
Michael Nebel
6928f7d443 C#: Address review comment. 2024-12-03 16:36:16 +01:00
Michael Nebel
309202ef89 C#: Update the MessagePack nuget dependency. 2024-12-03 16:24:05 +01:00
Paolo Tranquilli
8a1136ddcb Merge branch 'main' into redsun82/rust-less-canonical-paths 2024-12-03 16:23:22 +01:00
Simon Friis Vindum
b50834aee8 Rust: Add data flow tests for question mark operator 2024-12-03 16:21:26 +01:00
Paolo Tranquilli
277c9f4087 Rust: add back getAttr to ArrayExpr 2024-12-03 16:12:56 +01:00
Anders Schack-Mulligen
8ea973f838 C++: Update use of deleted api. 2024-12-03 15:20:07 +01:00
Paolo Tranquilli
c113503b41 Rust: fix doc typo 2024-12-03 15:18:17 +01:00
Paolo Tranquilli
353f1cafe6 Rust: distinguish [a, b] from [a; b]
This splits the `ArrayExpr` class into `ArrayListExpr` and `ArrayRepeatExpr`.
This uses the `synth.from_class` machinery to integrate seamlessly into the
generated code, by hiding the extracted `ArrayExpr` behind an internal class
and replacing it with a hierarchy of those two classes under a new
`ArrayExpr` class.
2024-12-03 15:09:20 +01:00
Anders Schack-Mulligen
c654a05998 Dataflow: Remove identical-files entries for deleted api. 2024-12-03 14:52:30 +01:00
Anders Schack-Mulligen
371a11e6da C++: Delete deprecated data flow api. 2024-12-03 14:52:14 +01:00
Anders Schack-Mulligen
0d9e578857 C#: Delete deprecated data flow api. 2024-12-03 14:42:34 +01:00
Anders Schack-Mulligen
fbff4b6e21 Go: Delete deprecated data flow api. 2024-12-03 14:42:14 +01:00
Anders Schack-Mulligen
acc260cc3c Python: Delete deprecated data flow api. 2024-12-03 14:41:49 +01:00
Anders Schack-Mulligen
20f06abe6f Ruby: Delete deprecated data flow api. 2024-12-03 14:41:14 +01:00
Anders Schack-Mulligen
f07f2b0f4a Swift: Delete deprecated data flow api. 2024-12-03 14:40:43 +01:00
Simon Friis Vindum
cac4514eae Rust: Add basic data flow through arrays 2024-12-03 14:15:54 +01:00
Simon Friis Vindum
3346b64e96 Rust: Add variables and data flow array tests 2024-12-03 14:14:41 +01:00
Anders Schack-Mulligen
2c0baff76a Java: Delete deprecated data flow api. 2024-12-03 14:13:03 +01:00
Michael Nebel
4675426241 C#: Update change note with info on private fields. 2024-12-03 14:12:09 +01:00
Tom Hvitved
06b1d8e448 Merge pull request #18177 from hvitved/rust/dataflow-variant-canonical-path
Rust: Use canonical paths for variants in data flow
2024-12-03 14:01:28 +01:00
Anders Schack-Mulligen
9734cff15b Java/C#: Update expected files. 2024-12-03 12:57:44 +01:00
Paolo Tranquilli
ebe38bca23 Merge branch 'main' into redsun82/rust-less-canonical-paths 2024-12-03 12:19:08 +01:00
Paolo Tranquilli
952f41e17e Rust: fix broken test 2024-12-03 12:06:39 +01:00
Michael Nebel
cc4382c785 Merge pull request #18186 from michaelnebel/csharp/removechangenote
C#: Remove change note.
2024-12-03 11:45:34 +01:00
Paolo Tranquilli
db18d1046b Rust: rename getTy -> getTypeRepr 2024-12-03 11:17:08 +01:00
Paolo Tranquilli
8287cdd7b3 Rust: accept test changes 2024-12-03 11:01:05 +01:00
Anders Schack-Mulligen
b65a4e45ab Dataflow: Postpone type pruning until stage 5. 2024-12-03 10:59:12 +01:00
Anders Schack-Mulligen
4933e803cf Dataflow: Track stored type. 2024-12-03 10:59:11 +01:00
Paolo Tranquilli
b99e234cdc Merge branch 'main' into redsun82/rust-tweaks 2024-12-03 10:47:03 +01:00
Tom Hvitved
3c767b086b Rust: Use canonical paths for variants in data flow 2024-12-03 10:19:33 +01:00
Michael Nebel
27d2f9e402 C#: Add change-note. 2024-12-03 10:14:22 +01:00
Tom Hvitved
0bebfa6e45 Merge pull request #18130 from hvitved/rust/flow-summary-impl
Rust: Adopt shared flow summaries library
2024-12-03 10:14:21 +01:00
Simon Friis Vindum
e377a0e05a Merge branch 'main' into rust-df-closure 2024-12-03 10:09:52 +01:00
Napalys Klicius
1e1674a08a Merge pull request #18089 from Napalys/napalys/regexp-unknown-flags
JS: RegExp unknown flags support and enhanced compatibility with RegExp objects
2024-12-03 09:43:13 +01:00
Tom Hvitved
6b7522fe77 Merge pull request #18178 from hvitved/csharp/unsafe-crypto-transform-from-source
C#: Restrict `cs/thread-unsafe-icryptotransform-field-in-class` to source fields
2024-12-03 09:30:28 +01:00
Tom Hvitved
52dc79eb7d Address review comments 2024-12-03 09:28:21 +01:00
Tom Hvitved
3e5f4b7f89 Rust: Add a model for unwrap 2024-12-03 09:12:01 +01:00
Tom Hvitved
fbeb6f3940 Shared: Move shared logic into FlowSummaryImpl.qll 2024-12-03 09:11:11 +01:00
Tom Hvitved
395901b8e0 Rust: Adopt shared flow summaries library 2024-12-03 09:11:06 +01:00
Michael Nebel
86515b0140 C#: Remove change note. 2024-12-03 08:55:04 +01:00
Owen Mansel-Chan
61cb03ea3f Merge pull request #18001 from owen-mc/go/fix/missing-promoted-fields
Go: Fix missing promoted fields due to name clash
2024-12-02 20:15:26 +00:00
Simon Friis Vindum
8e2beb7410 Merge pull request #18131 from paldepind/rust-field-flow
Rust: Data flow through tuple and struct fields
2024-12-02 20:44:37 +01:00
Paolo Tranquilli
e89cf303e7 Rust: rename TypeRef -> TypeRepr 2024-12-02 17:58:40 +01:00
Paolo Tranquilli
4bd5cc458b Rust: accept test changes 2024-12-02 16:07:00 +01:00
Paolo Tranquilli
c0e55a06e7 Merge branch 'main' into redsun82/rust-perf-measures 2024-12-02 15:20:42 +01:00
Paolo Tranquilli
b57a37479b Rust: make File usable in codegen 2024-12-02 15:15:46 +01:00
Geoffrey White
0865397e29 Rust: Address nit. 2024-12-02 14:06:00 +00:00
Tamás Vajk
8375c49ce1 Merge pull request #18166 from tamasvajk/fix/db-quality-query-2
C#: Fix calls with no target in DB quality query
2024-12-02 14:59:33 +01:00
Geoffrey White
ed22f49cdd Rust: Make ql-for-ql happy. 2024-12-02 13:58:06 +00:00
Paolo Tranquilli
0a93a31565 Rust: accept all test changes after merge 2024-12-02 14:48:40 +01:00
Simon Friis Vindum
e1c65aae90 Rust: Tuple writes target post update node 2024-12-02 14:48:20 +01:00
Paolo Tranquilli
43eba85589 Merge branch 'main' into redsun82/rust-tweaks 2024-12-02 14:48:03 +01:00
Geoffrey White
1e656a49b0 Rust: Rewrite the query to (1) include functions and (2) minimize output. 2024-12-02 13:37:44 +00:00
Tamas Vajk
b8fd20eb05 Add explanation todo comments in the missing call target test file 2024-12-02 13:52:46 +01:00
Tom Hvitved
972cd2b21a C#: Restrict cs/thread-unsafe-icryptotransform-field-in-class to source fields 2024-12-02 13:45:51 +01:00
Napalys Klicius
08ef0dc1f2 Update javascript/ql/lib/change-notes/2024-11-28-regexp-unknown-flags.md
Co-authored-by: Asger F <asgerf@github.com>
2024-12-02 13:35:52 +01:00
Napalys Klicius
f56e337a7f Merge pull request #18164 from Napalys/napalys/ql-validate-predicate-get-returns
Add query to ensure predicates starting with 'get' return a value
2024-12-02 13:32:38 +01:00
Anders Schack-Mulligen
e9bd1e5b79 Dataflow: Remove types from access paths. 2024-12-02 13:31:51 +01:00
Simon Friis Vindum
3420f1f43f Address review comments, store step for tuple indexing 2024-12-02 13:27:26 +01:00
Anders Schack-Mulligen
5d13d3b434 Dataflow: Refactor - deduplicate fwdFlowRead+consCand join. 2024-12-02 13:02:33 +01:00
Napalys
7db9b7d758 Now flag aliases with the 'get' or 'as' prefix that resolve to predicates lacking a return type.
Co-authored-by: asgerf <asgerf@github.com>
2024-12-02 12:50:46 +01:00
Anders Schack-Mulligen
70a8bc302c Dataflow: Rename typecheckStore. 2024-12-02 12:48:19 +01:00
Tom Hvitved
012ea4bbf1 Merge pull request #18113 from hvitved/dataflow/more-common
Data flow: Move more logic into `DataFlowImplCommon`
2024-12-02 12:38:39 +01:00
Paolo Tranquilli
2a7ce9a0ab Rust: accept all test changes 2024-12-02 12:06:51 +01:00
Tom Hvitved
7f9adbd371 Address review comments 2024-12-02 11:44:17 +01:00
Cornelius Riemenschneider
2e9f8574a3 Merge pull request #18133 from github/oscarsj/upgrade-codespaces-ubuntu-2404
Update codespaces default config to ubuntu 24
2024-12-02 11:38:50 +01:00
Tamas Vajk
b0d3c11885 Add a new test case 2024-12-02 11:03:53 +01:00
Geoffrey White
4f08fdd232 Rust: Make the two cases read more similarly. 2024-12-02 09:56:32 +00:00
Geoffrey White
3e0e374783 Rust: Remove unnecessary edges. 2024-12-02 09:54:18 +00:00
Simon Friis Vindum
10be890cab Merge pull request #18144 from paldepind/rust-df-inconsistency-no-location
Rust: Exclude data flow inconsistencies that stem from other inconsis…
2024-12-02 10:48:51 +01:00
Geoffrey White
4d0c53d493 Rust: Add support for transitive results via calls in the ctor query. 2024-12-02 09:46:40 +00:00
Geoffrey White
14c0bbf531 Rust: Add another test case, fix an annotation. 2024-12-02 09:34:47 +00:00
Paolo Tranquilli
e7ffddd52c Rust: rename all *Type to *TypeRef 2024-12-02 10:13:05 +01:00
Paolo Tranquilli
99bd75c429 Rust: expand Ty in documentation 2024-12-02 09:51:15 +01:00
Paolo Tranquilli
5d3c9d050d Rust: expand Pat in documentation 2024-12-02 09:48:10 +01:00
Michael Nebel
824aab884a Merge pull request #18169 from github/workflow/coverage/update
Update CSV framework coverage reports
2024-12-02 09:42:19 +01:00
Paolo Tranquilli
d02f7971a3 Merge pull request #18173 from github/redsun82/rust-windows-flaky-test
Rust: elaborate on `path_to_file_id` comment
2024-12-02 09:39:23 +01:00
Napalys
67745e6332 Reused isGetPredicate to retrieve the prefix of the predicate 2024-12-02 09:10:54 +01:00
Michael Nebel
2a33539e01 Merge pull request #18162 from michaelnebel/csharp/launchtracing
C#: Add launch task for debugging the tracing extractor.
2024-12-02 09:08:55 +01:00
Paolo Tranquilli
6a8188f8eb Rust: fix QL compilation errors after merge from main 2024-12-02 08:30:16 +01:00
Paolo Tranquilli
31775e21b7 Merge branch 'main' into redsun82/rust-less-canonical-paths 2024-12-02 08:27:05 +01:00
Paolo Tranquilli
bb83641634 Rust: accept all test changes for now 2024-12-02 08:22:51 +01:00
Paolo Tranquilli
9486e8b734 Rust: elaborate on path_to_file_id comment
This is a follow up to https://github.com/github/codeql/pull/18167, addressing a
review comment from @paldepind.
2024-12-02 08:16:52 +01:00
github-actions[bot]
f87024c620 Add changed framework coverage reports 2024-12-02 00:23:11 +00:00
Paolo Tranquilli
7cd344caff Merge pull request #18167 from github/redsun82/rust-windows-flaky-test
Rust: fix windows flakiness
2024-11-29 22:04:20 +01:00
Geoffrey White
fbf7e0584f Merge pull request #18129 from geoffw0/sinkmodels
Rust: Sink models for rust/sql-injection
2024-11-29 19:11:27 +00:00
Geoffrey White
eeed2c22be Merge pull request #18154 from geoffw0/swift6models4
Swift: Fix for OptionSet and BinaryInteger models
2024-11-29 17:30:51 +00:00
Paolo Tranquilli
6cb0866d0f Revert "Rust: test running windows flaky test multiple times"
This reverts commit 90fa3ec4ed.
2024-11-29 17:41:49 +01:00
Napalys
7c1aa84459 Fixed bug where some predicates were flagged without return type even thought they had 2024-11-29 17:38:30 +01:00
Edward Minnix III
f7aab2e3e7 Merge pull request #18139 from egregius313/egregius313/csharp/uri-models
C#: `NavigationManager::Uri` and URI query-string parsing utilities
2024-11-29 11:37:56 -05:00
Paolo Tranquilli
488903280f Rust: tentative windows fix 2024-11-29 17:23:30 +01:00
Geoffrey White
e9deec7217 Rust: Autoformat. 2024-11-29 16:03:06 +00:00
Paolo Tranquilli
90fa3ec4ed Rust: test running windows flaky test multiple times 2024-11-29 16:46:41 +01:00
Tamas Vajk
11dedbef1b Exclude property call with object initializer r-value from DB quality query 2024-11-29 16:26:40 +01:00
Tamas Vajk
b3896df15c Exclude type parameter instantiations from DB quality query 2024-11-29 16:05:33 +01:00
Napalys
a462ec91f5 Now the error message reflects properly the prefix 2024-11-29 15:57:28 +01:00
Paolo Tranquilli
c46f44da5f Rust: fix QL compilation errors 2024-11-29 15:55:51 +01:00
Napalys
96c1086dfc Modified comments to reflect 'as' changes 2024-11-29 15:35:18 +01:00
Napalys
e33f7aa1c7 Added test cases for 'as' prefix 2024-11-29 15:23:06 +01:00
Napalys Klicius
029b567bb7 Update ql/ql/src/queries/style/ValidatePredicateGetReturns.ql
Co-authored-by: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
2024-11-29 15:19:19 +01:00
Napalys Klicius
a5521b90fc Update ql/ql/src/queries/style/ValidatePredicateGetReturns.ql
Co-authored-by: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
2024-11-29 15:18:06 +01:00
Tamas Vajk
5d79ed6a9e C#: WIP: Fix calls with no target in DB quality query 2024-11-29 15:08:33 +01:00
Napalys
a763dd7267 Fixed github-advanced-security bot warning 2024-11-29 14:58:22 +01:00
Paolo Tranquilli
9cf2420c3b Rust: restrict canonical path calculations 2024-11-29 14:43:51 +01:00
Napalys
986e1cb597 Add ValidatePredicateGetReturns query and tests 2024-11-29 14:33:40 +01:00
Michael Nebel
a09262b4c6 C#: Update expected test output. 2024-11-29 13:49:25 +01:00
Michael Nebel
f7874c37c4 C#: Only extract Public and Protected members from reference assemblies. 2024-11-29 13:49:23 +01:00
Simon Friis Vindum
5b6a4e616c Rust: Update stats queries to use shared data flow consistency module 2024-11-29 13:42:30 +01:00
Alexander Eyers-Taylor
f63f80ab68 Merge pull request #18157 from github/post-release-prep/codeql-cli-2.19.4
Post-release preparation for codeql-cli-2.19.4
2024-11-29 12:40:12 +00:00
Michael Nebel
5020e36d0a C#: Add launch task for debugging the tracing extractor. 2024-11-29 13:06:20 +01:00
Óscar San José
647515bd84 Merge pull request #18138 from github/oscarsj/compile-queries-paths
Include paths on pull_request event trigger for compile-queries.yml workflow
2024-11-29 13:02:03 +01:00
Óscar San José
e93ce7c7d5 Add .devcontainer folder to CODEOWNERS 2024-11-29 12:55:11 +01:00
Paolo Tranquilli
7e0e5a3f4e Rust: move rust_sysroot_src to its own session fixture 2024-11-29 12:01:50 +01:00
Paolo Tranquilli
4bcc4254c6 Merge branch 'main' into redsun82/rust-perf-measures 2024-11-29 11:59:22 +01:00
Geoffrey White
f8af648524 Merge pull request #18097 from geoffw0/ctor
Rust: New query for bad 'ctor' initialization
2024-11-29 10:57:54 +00:00
Paolo Tranquilli
bd56a3564a Merge pull request #18147 from github/redsun82/rust-windows-semantics
Rust: add diagnostics queries to integration tests
2024-11-29 11:45:48 +01:00
Napalys
9d4e737bc2 JS: follow proper code standards for get predicates
Co-authored-by: asgerf <asgerf@github.com>
2024-11-29 11:32:10 +01:00
Napalys
3171f38cdd JS: fixed bad alert messages when it came to incomplete sanitization for new RegExp objects 2024-11-29 11:14:45 +01:00
Simon Friis Vindum
06746e540f Merge pull request #18140 from paldepind/rust-get-target
Rust: Add `getStaticTarget` to `CallExprBase`
2024-11-29 11:02:15 +01:00
Owen Mansel-Chan
2c061b0d56 Add QLDoc for HostnameSanitizingPrefix 2024-11-29 09:46:44 +00:00
Owen Mansel-Chan
7f8a1ae941 Add change note 2024-11-29 09:46:42 +00:00
Owen Mansel-Chan
7648d397f8 Improve model to remove some false positives 2024-11-29 09:46:41 +00:00
Owen Mansel-Chan
617f4f140e Make HostnameSanitizingPrefix public 2024-11-29 09:46:39 +00:00
Owen Mansel-Chan
ba3f9d6134 Convert model to QL 2024-11-29 09:46:38 +00:00
Jeroen Ketema
bcb7901758 Merge pull request #18111 from jketema/guarded-free
C++: Promote `cpp/guarded-free` out of experimental
2024-11-29 10:43:02 +01:00
Geoffrey White
49b569cc4b Rust: Update for changes on main. 2024-11-29 09:37:32 +00:00
Geoffrey White
0f3469313f Merge branch 'main' into ctor 2024-11-29 09:37:23 +00:00
Michael Nebel
47487cca0e Merge pull request #18158 from github/workflow/coverage/update
Update CSV framework coverage reports
2024-11-29 10:21:09 +01:00
Geoffrey White
a6f20a6ac1 Apply suggestions from code review
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
2024-11-29 09:09:59 +00:00
Simon Friis Vindum
b8d60cbb13 Rust: Implement predicates for lambdas/closures in the data flow library 2024-11-29 09:32:04 +01:00
Simon Friis Vindum
ad7480591b Rust: Add data flow tests involving closures 2024-11-29 09:30:26 +01:00
Tamás Vajk
5f41b6d3f2 Merge pull request #18141 from tamasvajk/fix/db-quality-query
C#: Exclude `get`-only property accesses from `CallTargetStats`
2024-11-29 08:49:55 +01:00
Napalys Klicius
13afd6310b Update javascript/ql/lib/change-notes/2024-11-28-regexp-unknown-flags.md
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2024-11-29 08:26:04 +01:00
github-actions[bot]
8feca3d532 Add changed framework coverage reports 2024-11-29 00:21:55 +00:00
github-actions[bot]
32bfaa8569 Post-release preparation for codeql-cli-2.19.4 2024-11-28 19:40:05 +00:00
Alexander Eyers-Taylor
de325133c7 Merge pull request #18156 from github/release-prep/2.19.4
Release preparation for version 2.19.4
2024-11-28 19:32:51 +00:00
Alex Eyers-Taylor
dbe9f22034 Fix broken changelog. 2024-11-28 19:31:25 +00:00
github-actions[bot]
b36f3f97ee Release preparation for version 2.19.4 2024-11-28 19:28:05 +00:00
Alexander Eyers-Taylor
f7896b4c2b Merge pull request #18155 from github/revert-18065-release-prep/2.19.4
Revert "Release preparation for version 2.19.4"
2024-11-28 19:22:36 +00:00
Alexander Eyers-Taylor
6f18d69925 Revert "Release preparation for version 2.19.4" 2024-11-28 19:19:56 +00:00
Geoffrey White
1fc112e7a7 Swift: Fix for OptionSet. 2024-11-28 18:48:23 +00:00
Geoffrey White
e08eac03d8 Swift: Fix for Int.description. 2024-11-28 18:18:23 +00:00
Owen Mansel-Chan
b5fbf2e944 Add models for third arg of getForObject
No attempt to stop FPs.
2024-11-28 16:51:13 +00:00
Owen Mansel-Chan
65fb895ed5 (Unrelated) Fix typo in class name 2024-11-28 16:51:09 +00:00
Jeroen Ketema
6d37efc0d8 Update cpp/ql/src/Best Practices/GuardedFree.qhelp
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
2024-11-28 16:36:13 +01:00
Jeroen Ketema
f9d9f9ba62 Update cpp/ql/src/Best Practices/GuardedFree.qhelp
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
2024-11-28 16:36:04 +01:00
Jeroen Ketema
088a3ef15c Update cpp/ql/src/Best Practices/GuardedFree.qhelp
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
2024-11-28 16:35:39 +01:00
Paolo Tranquilli
9f6a2e090e Rust: add diagnostics queries to integration tests 2024-11-28 15:33:10 +01:00
Ed Minnix
a7a77a5f23 Added NavigationManager::BaseUri 2024-11-28 09:16:45 -05:00
Geoffrey White
5b50a8270d Rust: Clarify the doc on the two models a little. 2024-11-28 14:11:15 +00:00
Geoffrey White
1d0338444a Rust: Fix SqlExecute. 2024-11-28 14:11:14 +00:00
Ed Minnix
5bcc694f6a Fix typo 2024-11-28 09:06:18 -05:00
Simon Friis Vindum
08648f912e Merge branch 'main' into rust-df-inconsistency-no-location 2024-11-28 15:03:52 +01:00
Ed Minnix
1c06c4aae0 Fix summaries 2024-11-28 08:59:58 -05:00
Ed Minnix
61a4b251c0 NavigationManager::Uri and URI-parsing utilities 2024-11-28 08:59:57 -05:00
Edward Minnix III
418ab4b22a Merge pull request #18123 from egregius313/egregius313/csharp/ijsruntime-models
C#: Add `js-interop` sinks for `Microsoft.JSInterop.IJSRuntime`
2024-11-28 08:58:23 -05:00
Tamas Vajk
7acbf1a984 Add change note 2024-11-28 14:40:20 +01:00
Tamas Vajk
072713f771 C#: Exclude more property access expressions from DB quality metric 2024-11-28 14:34:35 +01:00
Napalys
d2de9a2238 Fixed change notes 2024-11-28 14:24:27 +01:00
Napalys Klicius
9ca0fe4cbf Update RegExp handling and add test case
Co-authored-by: erik-krogh <erik-krogh@github.com>
2024-11-28 14:13:40 +01:00
Geoffrey White
2810d64b22 Rust: Fix ql-for-ql warning. 2024-11-28 12:43:24 +00:00
Taus
a9817a0281 Python: Add guide describing how to extend the parser 2024-11-28 12:32:00 +00:00
Geoffrey White
14b70b856a Merge pull request #18143 from geoffw0/swift6models3
Swift: Fix makeIterator() models
2024-11-28 12:11:26 +00:00
Simon Friis Vindum
b05d290bf0 Rust: Exclude data flow inconsistencies that stem from other inconsistencies 2024-11-28 12:46:32 +01:00
Napalys
fd773603e6 Added change notes 2024-11-28 12:04:09 +01:00
Napalys
9a1c1f4be3 JS: Added in RegExpCreationNode maybeGlobal predicate for more convenience. 2024-11-28 12:03:51 +01:00
Paolo Tranquilli
50c917d2eb Rust: restrict extracted files queries 2024-11-28 12:02:57 +01:00
yoff
c1937ea549 Merge pull request #18117 from github/tausbn/python-fix-match-literal-pruning
Python: Add change note for CFG pruning fix
2024-11-28 11:40:21 +01:00
Napalys
1d2e08a3b6 JS: now Reg Exp injection treats unknownFlags as sanitization, MetacharEscapeSanitizer 2024-11-28 11:26:58 +01:00
Napalys
62194f5337 JS: add test cases RegExp with unknown flags 2024-11-28 11:26:57 +01:00
Napalys
e673348ed3 JS: now RegExp with unknown flags is not flagged as an issue within password Clear text storage of sensitive information 2024-11-28 11:26:56 +01:00
Napalys
a2c46749c6 JS: fixed issue where MaskingReplacer would work only with regexp literals but not objects 2024-11-28 11:26:55 +01:00
Napalys
1ca57cfb9d JS: add test cases with RegExp object for MaskingReplacer, currently gives wrong results 2024-11-28 11:26:54 +01:00
Napalys
c71778f1aa JS: xss does not flag anymore replace with RegExp unknown flags 2024-11-28 11:26:53 +01:00
Napalys
dbae553146 JS: add xss test cases with unknownflags for replace using RegExp 2024-11-28 11:26:52 +01:00
Napalys
fe28657c7d JS: add test cases with unknown flags for double escaping, works as expected. 2024-11-28 11:26:51 +01:00
Napalys
98fd97799c JS: imcomplete sanization now handles properly maybe global 2024-11-28 11:26:50 +01:00
Napalys
1ae174849f JS: incomplete sanitization now also works with RegExp objects 2024-11-28 11:26:48 +01:00
Napalys
76318035ff JS: Add test cases for RegExp object usage in replace within incomplete sanitization 2024-11-28 11:26:47 +01:00
Napalys
9c2366a660 JS: Added tests for ReDos with unknownFlags, everything seems to be good 2024-11-28 11:26:46 +01:00
Napalys
875478c1c6 JS: Fixed path query not flagging new RegExp with DotRemovingReplaceCall 2024-11-28 11:26:45 +01:00
Napalys
aa557cf950 JS: Added tests for DotRemovingReplaceCall with RegExp Object. 2024-11-28 11:26:44 +01:00
Napalys
a0df33c3ac JS: UnsafeShellCommand Using unknown flags in the RegExp object is no longer flagged as bad sanitization to reduce false positives. 2024-11-28 11:26:43 +01:00
Napalys
155f1fca85 JS: Added test cases for unsafe shell command sanitization with RegExpr Object, instead of literal 2024-11-28 11:26:42 +01:00
Napalys
23b18aeca9 JS: Now unknown flags are not flagged in taint paths 2024-11-28 11:26:41 +01:00
Napalys
eca7a88615 JS: Fixed docs description 2024-11-28 11:26:40 +01:00
Napalys
7db6f7c721 JS: Added test cases with new RegExp for Tainted paths, currently works only with literals 2024-11-28 11:26:39 +01:00
Napalys
faef9dd877 JS: protyte poluting now treats unknownFlags as potentially good sanitization. 2024-11-28 11:26:38 +01:00
Napalys
41fef0f2b3 JS: Added test cases which cover new RegExp creation with replace on protytpe pulluting 2024-11-28 11:26:37 +01:00
Napalys
18c7b18f82 JS: Now BadHtmlSanitizers new RegExp with unknown flags is also flagged. 2024-11-28 11:26:36 +01:00
Napalys
89f3b6f8d3 JS: Added test case for bad sanitizer with unknown flags, currently not flagged. 2024-11-28 11:26:35 +01:00
Napalys
38be0e4c0a JS: Now BadHtmlSanitizers also flags new RegExp as potential issue 2024-11-28 11:26:34 +01:00
Napalys
41f21d429b JS: Added test case which is not flagged but should be abusing new RegExp with global flag 2024-11-28 11:26:33 +01:00
Geoffrey White
23ed48ea12 Swift: Add a couple more makeIterator() implementations to be safe. 2024-11-28 10:18:13 +00:00
Geoffrey White
1d43abfe4d Swift: Model Collection.makeIterator(). 2024-11-28 10:11:55 +00:00
Paolo Tranquilli
814218c7a8 Swift: extract variables as children of ForEachStmt 2024-11-28 11:03:46 +01:00
Tamas Vajk
5727fda07a C#: Exclude get-only property accesses from CallTargetStats 2024-11-28 11:02:39 +01:00
Simon Friis Vindum
e8ddb6b180 Rust: Add getStaticTarget to CallExprBase 2024-11-28 10:57:07 +01:00
Edward Minnix III
1b224c1ab2 Merge pull request #17258 from egregius313/egregius313/go/mad/documentation
Go: Models as Data Documentation
2024-11-27 22:55:50 -05:00
Mathias Vorreiter Pedersen
3c0af498db C++: Fix bug introduced in an earlier commit and accept test changes. They all look good. 2024-11-27 19:04:25 +00:00
Óscar San José
1a0442c5a6 Adding correct wildcard 2024-11-27 19:34:34 +01:00
Óscar San José
5790f5d5dc Include paths on pull_request event trigger for compile-queries.yml workflow 2024-11-27 18:37:12 +01:00
Mathias Vorreiter Pedersen
02428745bd C++: Add change note. 2024-11-27 16:42:00 +00:00
Mathias Vorreiter Pedersen
19e7c37760 C++: Update the final test changes. Nothing exciting here. 2024-11-27 16:41:58 +00:00
Mathias Vorreiter Pedersen
d69de0cc76 C++: Add a MaD model for 'CRegKey' and mark query calls as local flow sources. 2024-11-27 16:41:57 +00:00
Mathias Vorreiter Pedersen
5aada39a4e C++: Add failing tests for 'CRegKey'. 2024-11-27 16:41:55 +00:00
Mathias Vorreiter Pedersen
33212da876 C++: Add a MaD model for 'CAtlTemporaryFile' and mark reads as local flow sources. 2024-11-27 16:41:53 +00:00
Mathias Vorreiter Pedersen
67ba85a0a3 C++: Add failing tests for 'CAtlTemporaryFile'. 2024-11-27 16:41:52 +00:00
Mathias Vorreiter Pedersen
3709151353 C++: Add a MaD model for 'CAtlFileMappingBase' and mark reads as local flow sources. 2024-11-27 16:41:51 +00:00
Mathias Vorreiter Pedersen
ac0599cf75 C++: Add a failing test with 'CAtlFileMapping'. 2024-11-27 16:41:50 +00:00
Mathias Vorreiter Pedersen
74eae4a18d C++: Add a MaD model for 'CAtlFile' and mark reads as local flow sources. 2024-11-27 16:41:48 +00:00
Mathias Vorreiter Pedersen
dee47f2111 C++: Add a failing test with 'CAtlFile'. 2024-11-27 16:41:47 +00:00
Mathias Vorreiter Pedersen
e73fccdb4a C++: Add more types that we'll need for later. 2024-11-27 16:41:46 +00:00
Mathias Vorreiter Pedersen
300e3eaba6 C++: Add MaD model for 'CUrl'. 2024-11-27 16:41:45 +00:00
Mathias Vorreiter Pedersen
1ea879a880 C++: Add failing tests for 'CUrl'. 2024-11-27 16:41:43 +00:00
Mathias Vorreiter Pedersen
74b6c9dcc7 C++: Add MaD model for 'CSimpleMap'. 2024-11-27 16:41:42 +00:00
Mathias Vorreiter Pedersen
12674ea2e6 C++: Add failing tests with 'CSimpleMap'. 2024-11-27 16:41:41 +00:00
Mathias Vorreiter Pedersen
02b88d5dbd C++: Add MaD model for 'CSimpleArray'. 2024-11-27 16:41:40 +00:00
Mathias Vorreiter Pedersen
029c0134eb C++: Add failing tests with 'CSimpleArray'. 2024-11-27 16:41:38 +00:00
Mathias Vorreiter Pedersen
c61395b973 C++: Add implicit read of the 'm_strPath' member. 2024-11-27 16:41:37 +00:00
Mathias Vorreiter Pedersen
354361952a C++: Add MaD model for 'CPathT'. 2024-11-27 16:41:36 +00:00
Mathias Vorreiter Pedersen
1a79290fd6 C++: Add failing tests with 'CPathT'. 2024-11-27 16:41:35 +00:00
Mathias Vorreiter Pedersen
5f05417890 C++: Add MaD model for 'CComSafeArray'. 2024-11-27 16:41:33 +00:00
Mathias Vorreiter Pedersen
e831cb5f26 C++: Add failing tests with 'CComSafeArray'. 2024-11-27 16:41:32 +00:00
Mathias Vorreiter Pedersen
948be09257 C++: Add an taint step from object to field for 'CComBSTR's. 2024-11-27 16:41:31 +00:00
Mathias Vorreiter Pedersen
9b004848a3 C++: Add MaD model for 'CComBSTR'. 2024-11-27 16:41:30 +00:00
Mathias Vorreiter Pedersen
68ee8da574 C++: Add failing tests with 'CComBSTR'. 2024-11-27 16:41:28 +00:00
Mathias Vorreiter Pedersen
2b8ef5a8c8 C++: Add MaD model for 'CAtlList'. 2024-11-27 16:41:27 +00:00
Mathias Vorreiter Pedersen
c604a93d16 C++: Add failing tests with 'CAtlList'. 2024-11-27 16:41:26 +00:00
Mathias Vorreiter Pedersen
0f8df1cd9f C++: Add MaD model for 'CAtlArray'. 2024-11-27 16:41:24 +00:00
Mathias Vorreiter Pedersen
1cd426e9f9 C++: Add failing tests with 'CAtlArray'. 2024-11-27 16:41:23 +00:00
Mathias Vorreiter Pedersen
4f2cd81f9e C++: Accept test changes. 2024-11-27 16:41:22 +00:00
Mathias Vorreiter Pedersen
c00f84d74a C++: Work around the 'wrong' function name for conversion operators. 2024-11-27 16:41:20 +00:00
Mathias Vorreiter Pedersen
2c7d0dec7d C++: Accept test changes. 2024-11-27 16:41:19 +00:00
Mathias Vorreiter Pedersen
763b991408 C++: Add models. 2024-11-27 16:41:18 +00:00
Mathias Vorreiter Pedersen
749602c982 C++: Add failing tests with CA2AEX and friends. 2024-11-27 16:41:17 +00:00
Mathias Vorreiter Pedersen
f688470324 C++: Since isConstructedFrom only holds for templates we need to explicitly handle the case where the function (or class) is not a template. 2024-11-27 16:41:16 +00:00
Mathias Vorreiter Pedersen
bf36f00bb0 C++: Add model. Observe that flow still fails. 2024-11-27 15:49:41 +00:00
Mathias Vorreiter Pedersen
16e5fa34d1 C++: Add failing tests with U_STRINGorID. 2024-11-27 15:49:39 +00:00
Mathias Vorreiter Pedersen
fe9feb900d C++: We will need all these types. 2024-11-27 15:49:38 +00:00
Óscar San José
2bc89900fb Update codespaces default config to ubuntu 24 2024-11-27 16:16:45 +01:00
Paolo Tranquilli
5c2a6b8865 Merge pull request #18083 from github/redsun82/rust-canonical-enum
Rust: add extended canonical paths on enum variants
2024-11-27 15:22:07 +01:00
Paolo Tranquilli
a8188598b0 Merge branch 'main' into redsun82/rust-canonical-enum 2024-11-27 15:01:47 +01:00
Paolo Tranquilli
4e7115538b Rust: move steps breakdown from JSON diagnostics to the DB 2024-11-27 14:55:46 +01:00
Simon Friis Vindum
d89678f49f Rust: Data flow through tuple and struct fields 2024-11-27 14:53:01 +01:00
Paolo Tranquilli
5251dc2058 Rust: use check_diagnostics improvements 2024-11-27 13:36:27 +01:00
Mathias Vorreiter Pedersen
d86fea5ba5 Merge pull request #18114 from MathiasVP/actually-check-func-name-in-mad
C++: Actually check function names in MaD
2024-11-27 11:22:10 +00:00
Paolo Tranquilli
27738eaacc Rust: reorganize perf diagnostics 2024-11-27 12:05:06 +01:00
Geoffrey White
c113a0b5a1 Rust: Fix typo. 2024-11-27 10:51:42 +00:00
Geoffrey White
60c212bb10 Rust: Update for changes on main. 2024-11-27 10:42:24 +00:00
Geoffrey White
ba560f2fe9 Rust: Model SQLx. 2024-11-27 10:31:05 +00:00
Geoffrey White
e96f15d9b4 Rust: Add a test exposing SQL Injection sinks directly. 2024-11-27 10:31:04 +00:00
Anders Schack-Mulligen
df2e2e503a Merge pull request #17901 from aschackmull/java/allowlist-sanitizer
Java: Add a default taint sanitizer for contains-checks on lists of constants
2024-11-27 11:09:05 +01:00
Owen Mansel-Chan
c580046f8c Merge pull request #18121 from github/workflow/coverage/update
Update CSV framework coverage reports
2024-11-27 09:37:19 +00:00
Simon Friis Vindum
9ec9d79b4f Rust: Add additional tests for flow through structs 2024-11-27 10:10:49 +01:00
Simon Friis Vindum
46abb9083b Merge pull request #18115 from paldepind/rust-rename-expr
Rust: Rename `expr` on `CallExpr` and `LetExpr`
2024-11-27 09:41:04 +01:00
Anders Schack-Mulligen
5ef496dd1b Java: Add more qldoc. 2024-11-27 09:07:35 +01:00
Tom Hvitved
7402276ec7 Data flow: Move more logic into DataFlowImplCommon 2024-11-27 09:03:37 +01:00
Anders Schack-Mulligen
85778f7fea Java: Fix semantic merge conflict in expected file. 2024-11-27 08:53:41 +01:00
Simon Friis Vindum
8f886c6603 Merge pull request #18088 from paldepind/rust-self-parameters
Rust: Handle `self` parameters in variables and SSA library
2024-11-27 08:42:58 +01:00
Ed Minnix
2b0c7a209b Fix test results 2024-11-26 22:42:24 -05:00
Ed Minnix
a4b2ee1205 Fix generic 2024-11-26 22:42:13 -05:00
Ed Minnix
b820b324bd Change note 2024-11-26 22:32:45 -05:00
Ed Minnix
216d298780 Microsoft.JSInterop models 2024-11-26 22:29:43 -05:00
github-actions[bot]
89b2a6b726 Add changed framework coverage reports 2024-11-27 00:21:55 +00:00
Owen Mansel-Chan
0e94ee81ae Don't getUnderlyingType before looking through pointer type
If `T` is the type of an embedded field, it is invalid for `T` to be a
named type defined to be a pointer type (`type T *S`). It is also
invalid for `T` to be a type parameter. So this `getUnderlyingType()` is
redundant.
2024-11-26 22:25:56 +00:00
Owen Mansel-Chan
2cba97e87d Small stylistic improvement 2024-11-26 22:25:55 +00:00
Owen Mansel-Chan
1bc1472b0b Add change note 2024-11-26 22:25:53 +00:00
Owen Mansel-Chan
4990f16ba5 Refactor struct field predicate to remove redundancy 2024-11-26 22:25:48 +00:00
Owen Mansel-Chan
8dc0688b6f Fix bug 2024-11-26 22:25:47 +00:00
Owen Mansel-Chan
593896b40e Add test showing promoted field bug
NCField should be promoted to EmbedsNameClash. Currently it isn't
because its embedded parent pkg2.NameClash is not a promoted field in
EmbedsNameClash (because of a name clash with pkg1.NameClash), but this
should not make a difference.
2024-11-26 22:25:41 +00:00
Owen Mansel-Chan
553bc8c13d Merge pull request #18108 from owen-mc/go/mad/model-slices-package
Go: model `slices` package (skipping functions that involve iterating over a function)
2024-11-26 21:24:22 +00:00
Edward Minnix III
86c7a49264 Apply suggestions from code review
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2024-11-26 13:12:16 -05:00
Paolo Tranquilli
556774edc7 Rust: do not put extraction steps in the expected diagnostics 2024-11-26 18:00:15 +01:00
Simon Friis Vindum
92427ab0c1 Merge branch 'main' into rust-rename-expr 2024-11-26 17:40:47 +01:00
Paolo Tranquilli
8abd3c4707 Rust: Remove windows difference from diagnostics 2024-11-26 16:48:49 +01:00
Taus
d779ae5c3e Python: Add change note for CFG pruning fix
... And also bump the extractor version.
2024-11-26 15:39:15 +00:00
Paolo Tranquilli
24eb65692f Rust: add some performance diagnostics
This outputs some duration counts for various parts of the extraction
process in the database in the form of telemetry diagnostics.

The diagnostics format was preferred to putting things in the relational
database as that will scale better to code scanning and is more flexible
as for the data we can put into it without passing through the dbscheme.
Also, although it's not the case yet, it will be possible to output
diagnostics even if creation of the database fails.
2024-11-26 16:35:38 +01:00
Owen Mansel-Chan
141259c003 Update go/ql/lib/ext/slices.model.yml
Co-authored-by: Chris Smowton <smowton@github.com>
2024-11-26 14:48:20 +00:00
Simon Friis Vindum
7ab5663fa6 Rust: Address PR feedback 2024-11-26 15:42:19 +01:00
Jeroen Ketema
8d59159691 C++: Fix qlref file 2024-11-26 15:35:52 +01:00
Simon Friis Vindum
d30f3e2822 Rust: Renamed expr on CallExpr and LetExpr 2024-11-26 15:22:14 +01:00
Mathias Vorreiter Pedersen
e42c7452ef C++: Cleanup conjuncts. This doesn't change any behavior. 2024-11-26 13:57:51 +00:00
Mathias Vorreiter Pedersen
39b61598e9 C++: Accept test changes. 2024-11-26 13:57:38 +00:00
Mathias Vorreiter Pedersen
f7cf5af720 C++: Actually check the function name. 2024-11-26 13:56:22 +00:00
Jami
36acfeb305 Merge pull request #18087 from jcogs33/jcogs33/java-sha2
Java: add SHA-384 to list of secure crypto algorithms
2024-11-26 08:51:58 -05:00
yoff
6d6f269e6c Merge pull request #17997 from yoff/java/inline-range-tests 2024-11-26 14:48:07 +01:00
Tom Hvitved
0c6b4cdb8f Merge pull request #18078 from hvitved/rust/variant-flow
Rust: Data flow through variants
2024-11-26 14:45:00 +01:00
Mathias Vorreiter Pedersen
f65f11b404 C++: Add a test for a somewhat embarrasing bug: MaD didn't check the function name in some cases. 2024-11-26 13:43:42 +00:00
Taus
2734377e5d Python: Add API graph support for parameter annotations
Adds API graph support for observing that in
```python
def foo(x : Bar): ...
```
The variable `x` is likely to be an instance of the type `Bar` inside
this function.
In particular, we add `getInstanceFromAnnotation` as a predicate on API
graph nodes that tracks this step (corresponding to a new edge type
labeled with "annotation" in the API graph), and extend the existing
`getAnInstance` predicate to also include instances arising from type
annotations.

A more complete solution would also add support for annotated
assignments (`x : Foo = ...` or just `x : Foo`) as well as track types
through type aliases (`type Foo = Bar`). This turns out to be
non-trivial, however, as these type constructs don't have any CFG nodes
(and so no data-flow nodes by default either). In order to not have
perfect be the enemy of good, this commit is only targeting the type
parameter case (which is also likely to be the most common use case
anyway).

The tests for API graphs have been extended accordingly, including tests
for the kinds of type ascriptions that we _don't_ currently model in API
graphs (marked with `MISSING:` in the inline tests).
2024-11-26 13:03:06 +00:00
Jeroen Ketema
6aa7c93af2 C++: More qlhelp fixes 2024-11-26 13:58:54 +01:00
Jeroen Ketema
fc6c327ab7 C++: Add change note 2024-11-26 13:55:30 +01:00
Taus
047e9742a0 Merge pull request #18086 from github/tausbn/add-vscode-task-for-creating-change-notes
Add script and VSCode task for creating change notes
2024-11-26 13:55:21 +01:00
Jeroen Ketema
e1f70a0dec C++: Add missing </p> to qlhelp 2024-11-26 13:50:09 +01:00
Taus
5279857d06 Fix comment 2024-11-26 12:48:20 +00:00
Taus
adbd4d35ed Add support for both query and library change notes 2024-11-26 12:39:17 +00:00
Anders Schack-Mulligen
a6fc41ec4b Java: Accept consistency failure. 2024-11-26 13:25:44 +01:00
Anders Schack-Mulligen
38eb3e4952 Java: Adjust expected output. 2024-11-26 13:25:44 +01:00
Anders Schack-Mulligen
2ff2d25784 Java: Cherry-pick test from https://github.com/github/codeql/pull/17051 2024-11-26 13:25:43 +01:00
Anders Schack-Mulligen
408a38d9fb Java: Address review comment, include addFirst,addLast. 2024-11-26 13:25:43 +01:00
Anders Schack-Mulligen
0d45f0efb2 Java: Accept consistency check result. 2024-11-26 13:25:43 +01:00
Anders Schack-Mulligen
2b1caa8a35 Java: Add test. 2024-11-26 13:25:42 +01:00
Anders Schack-Mulligen
5a4b720322 Java: Add change note. 2024-11-26 13:25:42 +01:00
Anders Schack-Mulligen
6f32c4129d Java: Add a default taint sanitizer for contains-checks on lists of constants. 2024-11-26 13:25:41 +01:00
Anders Schack-Mulligen
7f86f8cac7 Java: Prepare TypeFlow for separate instantiation of universal flow. 2024-11-26 13:25:41 +01:00
Owen Mansel-Chan
bcc89ecb7c Add change note 2024-11-26 12:07:32 +00:00
Owen Mansel-Chan
196634ecdb Model slices package
Skipping functions that involve iterators for now.
2024-11-26 12:01:09 +00:00
Tom Hvitved
8c111382ad Address review comments 2024-11-26 13:00:59 +01:00
Owen Mansel-Chan
47eb407be9 Update Go version in stdlib tests 2024-11-26 12:00:10 +00:00
Paolo Tranquilli
9f09454db9 Merge pull request #18107 from github/redsun82/rust-rename
Rust: rename `MatchExpr.expr` to `scrutinee` in all layers
2024-11-26 12:59:06 +01:00
Geoffrey White
d1915c707d Swift: Add a test revealing the issue in pure dataflow. 2024-11-26 11:24:42 +00:00
Geoffrey White
45858527e2 Swift: Add another test case. 2024-11-26 11:15:24 +00:00
Geoffrey White
6130679c34 Swift: Label the now missing cases for CWE-020 and dataflow. 2024-11-26 11:13:19 +00:00
Paolo Tranquilli
cb0ac61db6 Merge pull request #18069 from geoffw0/sourcemodels
Rust: Add some flow source models
2024-11-26 12:08:02 +01:00
Jeroen Ketema
d9b278de66 C++: Promote cpp/guarded-free 2024-11-26 11:45:55 +01:00
Rasmus Lerchedahl Petersen
f508f8eb83 Java: address review comments 2024-11-26 11:44:16 +01:00
Paolo Tranquilli
7a86257968 Merge branch 'main' into redsun82/rust-rename 2024-11-26 10:48:19 +01:00
Paolo Tranquilli
d73dcd6753 Merge pull request #18105 from paldepind/rust-string-to-str
Rust: Change `&String` to `&str`
2024-11-26 10:45:44 +01:00
Paolo Tranquilli
8a01161d4a Rust: rename MatchExpr.expr to scrutinee in all layers
This doesn't require `ql.name` and is simpler while we don't have
to write upgrade scripts. The `ql.name` mechanism might get useful
once we do have to write upgrade scripts, as that doesn't change the
dbscheme.
2024-11-26 10:42:13 +01:00
Simon Friis Vindum
8252e1da02 Rust: Change &String to &str 2024-11-26 09:21:44 +01:00
Simon Friis Vindum
44b1ad52d9 Rust: Support self parameters in variable and SSA library 2024-11-26 09:02:13 +01:00
Ed Minnix
8c6e08c94e Add `slices.Concat` example 2024-11-25 21:57:24 -05:00
Ed Minnix
96a796585f fix formatting issue 2024-11-25 21:57:09 -05:00
Ed Minnix
460df89f28 Add `slices.Max` example 2024-11-25 21:56:52 -05:00
Geoffrey White
1090164b77 Merge branch 'main' into sourcemodels 2024-11-25 21:12:24 +00:00
Geoffrey White
28c0e899b7 Rust: Autoformat. 2024-11-25 20:50:56 +00:00
Geoffrey White
e6302cae53 Rust: Address CI and ql-for-ql issues. 2024-11-25 20:07:47 +00:00
Geoffrey White
e8981a505d Rust: Fix qhelp. 2024-11-25 20:00:22 +00:00
Geoffrey White
77f5168590 Rust: Query metadata and path edges. 2024-11-25 19:54:06 +00:00
Geoffrey White
be5bd1da0a Rust: Also add the good example and a couple of other cited good cases to the test. 2024-11-25 19:54:04 +00:00
Geoffrey White
82f2c6075f Rust: Add qhelp + examples. 2024-11-25 19:54:03 +00:00
Geoffrey White
88fc7be0a2 Rust: Implement the query. 2024-11-25 19:22:13 +00:00
Geoffrey White
9ead2dc03c Rust: Add a query test. 2024-11-25 19:14:16 +00:00
Geoffrey White
93e7202a69 Merge pull request #17940 from geoffw0/resolvable
Rust: Add unresolved macro calls diagnostic
2024-11-25 19:08:29 +00:00
Tom Hvitved
5e7cd46117 Rust: Flow through variants 2024-11-25 19:17:57 +01:00
Tom Hvitved
2fb670a27c Rust: Do not print unit type in data flow 2024-11-25 19:14:44 +01:00
Tom Hvitved
511f791511 Rust: Add more flow tests 2024-11-25 19:14:42 +01:00
Paolo Tranquilli
c3b4447586 Merge branch 'main' into redsun82/rust-canonical-enum 2024-11-25 17:46:48 +01:00
Paolo Tranquilli
74aa47a809 Merge pull request #18094 from github/redsun82/rust-rename
Codegen/Rust: allow renaming in QL
2024-11-25 17:42:25 +01:00
Paolo Tranquilli
269ea75036 Rust: matched_expr -> scrutinee 2024-11-25 17:23:47 +01:00
Paolo Tranquilli
b47e9612eb Rust: fix MatchExpr.getExpr renaming 2024-11-25 17:14:05 +01:00
Paolo Tranquilli
261e0a1a53 Codegen/Rust: allow renaming in QL
This adds a `ql.name` codegen pragma to change the name of a property on
the QL side. This is useful to give more meaningful names than what we
get from the generated rust AST.
2024-11-25 17:04:03 +01:00
Mathias Vorreiter Pedersen
8fd581dd7e Merge pull request #18093 from MathiasVP/more-win32-command-execution-functions
C++: Add more `CommandExecutionFunction`s
2024-11-25 15:26:50 +00:00
Simon Friis Vindum
d06b5833cf Rust: Add an additional variables test with a self parameter 2024-11-25 16:08:26 +01:00
Geoffrey White
f92e8555a6 Rust: update for toString changes in main. 2024-11-25 14:35:12 +00:00
Geoffrey White
e9a13aec1d Merge branch 'main' into resolvable 2024-11-25 14:33:56 +00:00
Paolo Tranquilli
adafe3e5b0 Merge branch 'main' into redsun82/rust-canonical-enum 2024-11-25 15:28:45 +01:00
Jami Cogswell
05b6700607 Java: add SHA384 to list of secure algorithms 2024-11-25 09:27:53 -05:00
Arthur Baars
c2b342f1a0 Merge pull request #18084 from github/aibaars/java-sha3
Java: add SHA3 family to list of secure crypto algorithms
2024-11-25 15:07:43 +01:00
Simon Friis Vindum
d5c8dfd88c Merge pull request #18092 from paldepind/rust-param-base
Rust: Generate `ParamBase`, a superclass of `Param` and `SelfParam`
2024-11-25 14:58:07 +01:00
Rasmus Lerchedahl Petersen
25664d0e53 Java: Add support for non-integer bounds in inline expectations 2024-11-25 14:48:17 +01:00
Mathias Vorreiter Pedersen
03ab74e07d C++: Add more 'CommandExecutionFunction's. 2024-11-25 13:43:20 +00:00
Simon Friis Vindum
0de6658660 Rust: Use ParamBase in data flow implementation 2024-11-25 14:18:08 +01:00
Napalys Klicius
e9dff4d68f Merge pull request #17953 from Napalys/napalys/ts57
JS: upgrade TypeScript to 5.7
2024-11-25 14:16:40 +01:00
Simon Friis Vindum
0d02126f12 Generate ParamBase, superclass of Param and SelfParam 2024-11-25 14:07:50 +01:00
Rasmus Lerchedahl Petersen
37935eea3b java: separate bounds onto different lines 2024-11-25 12:32:11 +01:00
Napalys Klicius
d6372aebc7 Update javascript/ql/src/Security/CWE-178/CaseSensitiveMiddlewarePath.ql
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2024-11-25 12:12:12 +01:00
Napalys
e38b63ebcd JS: previously js/case-sensitive-middleware-path was not taking into consideration unknown flags 2024-11-25 11:56:06 +01:00
Napalys
178da21fb8 JS: Added test case for CWE-178 RegExp with unknown flags 2024-11-25 11:53:00 +01:00
Tom Hvitved
e6161a5019 Merge pull request #18070 from hvitved/rust/canonical-path-dataflow
Rust: Use extended canonical paths to resolve calls in data flow
2024-11-25 11:48:19 +01:00
Arthur Baars
5eb91fd516 Drop SHA3-224
Drop the 224bits variant as it looks like SHA3-224 may be deprecated soon based on NIST's most recent draft revision of Transitioning the Use of Cryptographic Algorithms and Key Lengths
2024-11-25 11:25:45 +01:00
Geoffrey White
68a4ea3be0 Rust: New query rust/ctor-initialization (placeholder).
undo
2024-11-25 10:09:42 +00:00
Geoffrey White
bded7085f0 Rust: Effect of toString changes in main. 2024-11-25 10:01:57 +00:00
Geoffrey White
d38f0eec7b Merge branch 'main' into sourcemodels 2024-11-25 09:59:08 +00:00
Napalys
3d467b24f8 Added change notes 2024-11-25 09:30:01 +01:00
Tom Hvitved
4b0b038513 Merge pull request #18035 from github/redsun82/rust-str
Rust: add some `toString` implementations
2024-11-25 09:29:18 +01:00
Napalys
f8d623e905 JS: Bumped TS version to 5.7.2 2024-11-25 09:08:51 +01:00
Edward Minnix III
940a99db3b Fix typo
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2024-11-24 21:25:09 -05:00
Edward Minnix III
fb04e39935 ReturnValue[i] text
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2024-11-24 21:24:53 -05:00
Edward Minnix III
7210786721 Subtypes/overrides documentation
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2024-11-24 21:24:24 -05:00
Jami
f0045692a7 Merge pull request #17869 from jcogs33/jcogs33/improve-weak-crypto
Java: Improve weak crypto query
2024-11-24 12:04:00 -05:00
Taus
addef2f171 Add script and VSCode task for creating change notes
Adds a VSCode Task (accessible from the "Run Task" menu) for creating
change notes, prompting the user for the language, name, and category of
the change.

The language options presented are based on the existing occurrences of
`change-notes` folders in the repo. There are more such files (in
particular every shared library has a `change-notes` directory), but it
seemed to me that the language change notes are the ones that are most
common, and so in an effort to not clutter the list too much, I only
included the languages.

The selection of categories is based on existing usage -- more
specifically the result of grepping for occurrences of '^category: ' in
the repo. It's possible there are more change categories that could be
added.

Hopefully this should make it more convenient to create change notes
from within VSCode.
2024-11-22 22:32:15 +00:00
Arthur Baars
c6eaed343d Java: add SHA3 family to list of secure crypto algorithms 2024-11-22 19:03:00 +01:00
Arthur Baars
7f84cf6d72 Add test case 2024-11-22 19:02:11 +01:00
Calum Grant
7baaa2373f Merge pull request #18080 from github/revert-18072-revert-18009-calumgrant/bmn/record-build-mode
C++: Implement compilation_build_mode
2024-11-22 17:15:26 +00:00
Geoffrey White
4c50c083fb Rust: Implement good suggestions from ql-for-ql. 2024-11-22 17:12:09 +00:00
Geoffrey White
f2f577f86c Rust: Fix toString(). 2024-11-22 17:09:52 +00:00
Geoffrey White
d8b58f21c7 Rust: Restrict ReqwestGet by crate origin. 2024-11-22 16:42:24 +00:00
Calum Grant
b1b62f2362 Merge pull request #17919 from github/calumgrant/bmn/too-few-arguments
C++: Remove FPs from cpp/too-few-arguments
2024-11-22 16:40:07 +00:00
Paolo Tranquilli
b32e578580 Rust: accept test changes 2024-11-22 17:18:32 +01:00
Calum Grant
4dab0390c9 C++: Update expected output 2024-11-22 16:10:23 +00:00
Paolo Tranquilli
f3cd61f043 Rust: add extended canonical paths on enum variants 2024-11-22 17:00:57 +01:00
Calum Grant
fcf16848d2 Revert "Revert "C++: Implement compilation_build_mode"" 2024-11-22 15:48:50 +00:00
Calum Grant
3b4fdb3fc2 Update cpp/ql/test/query-tests/Likely Bugs/Underspecified Functions/test.c
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-11-22 15:39:28 +00:00
Calum Grant
60155ce205 C++: Address review comments 2024-11-22 15:30:24 +00:00
Calum Grant
4fa8c6ae65 C++: Add change note 2024-11-22 15:12:09 +00:00
Calum Grant
227f9c7c1b C++: Update the test.c comments 2024-11-22 15:12:07 +00:00
Calum Grant
4d851440b6 C++: Remove FPs from cpp/too-few-arguments 2024-11-22 15:12:05 +00:00
Paolo Tranquilli
e7c10c6325 Merge branch 'main' into redsun82/rust-str 2024-11-22 14:44:48 +01:00
Paolo Tranquilli
86c25d0396 Merge pull request #18074 from github/redsun82/rust-format-parent-child
Rust: fix regression in `getFormat` indexing
2024-11-22 14:37:50 +01:00
Paolo Tranquilli
28d517da59 Rust: fix regression in getFormat indexing 2024-11-22 14:13:15 +01:00
Paolo Tranquilli
626b1cef17 Merge pull request #18071 from github/redsun82/rust-format-parent-child
Rust: fix parent/child relationship for format entities
2024-11-22 14:03:53 +01:00
Paolo Tranquilli
2e90c80a6f Rust: accept test changes 2024-11-22 13:45:00 +01:00
Tom Hvitved
143d7e2084 Rust: Use extended canonical paths to resolve calls in data flow 2024-11-22 13:23:39 +01:00
Tom Hvitved
faabc9982e Merge pull request #18056 from paldepind/rust-df-global
Rust: Extend data flow library instantiation for global data flow
2024-11-22 13:23:02 +01:00
Geoffrey White
6e627f6543 Rust: Add new consistency check failure. 2024-11-22 12:21:13 +00:00
Jeroen Ketema
cdfb085e99 Merge pull request #18072 from github/revert-18009-calumgrant/bmn/record-build-mode
Revert "C++: Implement compilation_build_mode"
2024-11-22 13:03:43 +01:00
Alexander Eyers-Taylor
d2021b9c65 Merge pull request #18067 from github/post-release-prep/codeql-cli-2.19.4
Post-release preparation for codeql-cli-2.19.4
2024-11-22 12:01:42 +00:00
Geoffrey White
75a3c931d1 Rust: Autoformat (again). 2024-11-22 11:58:23 +00:00
Geoffrey White
fa7c6f8b5e Merge branch 'main' into resolvable 2024-11-22 11:45:47 +00:00
Calum Grant
169671ad93 Revert "C++: Implement compilation_build_mode" 2024-11-22 11:42:39 +00:00
Geoffrey White
fe2d0b631c Rust: Autoformat. 2024-11-22 11:37:15 +00:00
Geoffrey White
194f967d74 Rust: Required doc comments. 2024-11-22 11:36:54 +00:00
Geoffrey White
ed67dae850 Rust: Make ql-for-ql happy. 2024-11-22 11:33:35 +00:00
Paolo Tranquilli
9a07b3c3d4 Rust: remove obsolete expected files 2024-11-22 12:24:44 +01:00
Paolo Tranquilli
e49a5be62f Rust: fix parent/child relationship for format entities 2024-11-22 12:20:49 +01:00
Calum Grant
ab9a2bdf9a Merge pull request #18009 from github/calumgrant/bmn/record-build-mode
C++: Implement compilation_build_mode
2024-11-22 11:00:17 +00:00
yoff
44c94e02fe Merge pull request #18037 from joefarebrother/pythob-test-global-capture
Python: Add some test cases for flow involving global and captured variables
2024-11-22 11:33:31 +01:00
Geoffrey White
20eaaa5699 Rust: Use final extensions. 2024-11-22 09:22:11 +00:00
Simon Friis Vindum
e81c3483db Rust: Apply suggestions from PR comments 2024-11-22 10:19:13 +01:00
Geoffrey White
292b29b0e3 Rust: Fix following rebase on main. 2024-11-22 09:13:48 +00:00
Geoffrey White
176e9a425f Rust: Model reqwest. 2024-11-22 09:13:47 +00:00
Geoffrey White
e64f139c98 Rust: Model std::env. 2024-11-22 09:13:44 +00:00
Geoffrey White
374769873a Rust: Add Frameworks.qll infrastructure. 2024-11-22 09:13:43 +00:00
Geoffrey White
be40085982 Rust: Add a test of flow sources reaching sinks as well. 2024-11-22 09:13:42 +00:00
Geoffrey White
a85ad4ec29 Rust: Add a dataflow/sources test. 2024-11-22 09:13:41 +00:00
Geoffrey White
ca424d1e61 Rust: Add a count of flow sources to rust/summary/summary-statistics. 2024-11-22 09:13:39 +00:00
Geoffrey White
3fa93e5ca9 Rust: Add rust/summary/taint-sources query. 2024-11-22 09:13:38 +00:00
Stephan Brandauer
30581d7c1d Merge pull request #18022 from github/kaeluka/4648-remove-automodel-queries
Delete Automodel Queries
2024-11-22 10:13:11 +01:00
Geoffrey White
b6cdae20d8 Merge pull request #18025 from geoffw0/sql1
Rust: SQL Injection Query
2024-11-21 22:48:54 +00:00
Tom Hvitved
d3dd94433b Merge pull request #18053 from hvitved/compile-queries-ram
CI: Set `--ram` in `compile-queries.yml`
2024-11-21 19:22:40 +01:00
Napalys Klicius
61e00861e5 Merge pull request #18008 from Napalys/napalys/ES2024-group-functions
JS: Added support for [Object, Map].groupBy ES2024 feature
2024-11-21 19:03:57 +01:00
github-actions[bot]
258f72db46 Post-release preparation for codeql-cli-2.19.4 2024-11-21 18:01:56 +00:00
REDMOND\brodes
37365c746c Updating to NonCppThrowingFunction use in IncorrectALlocationErrorHandling.ql 2024-11-21 12:59:56 -05:00
REDMOND\brodes
66cf736b4c printf formatting. 2024-11-21 12:44:28 -05:00
REDMOND\brodes
583651ba40 Missing NonCppThrowingFunction changes in Printf.qll 2024-11-21 12:41:26 -05:00
REDMOND\brodes
248f1c4ebe Updating change log 2024-11-21 12:15:14 -05:00
REDMOND\brodes
7059fc3e31 Adding intermediate solution towards deprecating ThrowingFunction 2024-11-21 12:10:42 -05:00
Geoffrey White
01cddcc042 Rust: Suggestions from docs review. 2024-11-21 17:08:51 +00:00
REDMOND\brodes
44126913cd Delaying deprecation of ThrowingFunction. 2024-11-21 12:08:04 -05:00
Geoffrey White
f8fff4b18c Update rust/ql/src/queries/security/CWE-089/SqlInjection.ql
Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com>
2024-11-21 17:06:32 +00:00
Alexander Eyers-Taylor
c65ce97ada Merge pull request #18065 from github/release-prep/2.19.4
Release preparation for version 2.19.4
2024-11-21 17:06:14 +00:00
Alex Eyers-Taylor
602f52f09b Fix broken changelog. 2024-11-21 16:57:41 +00:00
github-actions[bot]
f7448f5b43 Release preparation for version 2.19.4 2024-11-21 16:55:07 +00:00
Alexander Eyers-Taylor
40bb7ec6ef Merge pull request #18063 from github/revert-18059-revert-18039-post-release-prep/codeql-cli-2.19.4
Revert "Revert "Post-release preparation for codeql-cli-2.19.4""
2024-11-21 16:32:38 +00:00
Alexander Eyers-Taylor
f4d6db4c79 Merge pull request #18062 from github/alexet/revert-release-prep
Revert "Merge pull request #18036 from github/release-prep/2.19.4"
2024-11-21 16:32:34 +00:00
REDMOND\brodes
9b2590ec7a Updating PR per review comments. Moving more towards a simplified model. 2024-11-21 11:28:11 -05:00
Alex Eyers-Taylor
50ec400fe4 Revert "Merge pull request #18036 from github/release-prep/2.19.4"
This reverts commit aa4cc72f30, reversing
changes made to e5951516b8.
2024-11-21 15:41:08 +00:00
Alexander Eyers-Taylor
c0474c4e45 Revert "Revert "Post-release preparation for codeql-cli-2.19.4"" 2024-11-21 15:37:52 +00:00
Alexander Eyers-Taylor
ed922f6519 Merge pull request #18057 from jketema/codeql-cli-2.19.4
Revert "Merge pull request #17938 from MathiasVP/fix-fp-in-missing-check-scanf-fixing-take-2"
2024-11-21 15:31:23 +00:00
Alexander Eyers-Taylor
7c8ca7a4d3 Merge pull request #18059 from github/revert-18039-post-release-prep/codeql-cli-2.19.4
Revert "Post-release preparation for codeql-cli-2.19.4"
2024-11-21 15:24:07 +00:00
Paolo Tranquilli
a82d267223 Rust: accept test changes 2024-11-21 16:03:56 +01:00
Alexander Eyers-Taylor
4effe9e364 Revert "Post-release preparation for codeql-cli-2.19.4" 2024-11-21 14:43:15 +00:00
Jeroen Ketema
fa8aba88af Revert "Merge pull request #17938 from MathiasVP/fix-fp-in-missing-check-scanf-fixing-take-2"
This reverts commit 6785b93ed8, reversing
changes made to d9b86f55c8.
2024-11-21 15:39:00 +01:00
Paolo Tranquilli
6776b31c0d Rust: tweak PathType string representations and add one for InferType 2024-11-21 15:27:34 +01:00
Geoffrey White
b7c7a9ee7c Rust: Accept consistency check failures. 2024-11-21 14:23:51 +00:00
Geoffrey White
ae6b7b0277 Merge branch 'main' into sql1 2024-11-21 14:18:04 +00:00
Simon Friis Vindum
fffeac6a13 Rust: Extend data flow library instantiation for global data flow 2024-11-21 15:11:25 +01:00
Geoffrey White
49e002843e Rust: Restore some documentation. 2024-11-21 14:05:24 +00:00
Simon Friis Vindum
bb70bfce43 Rust: Tweak global data flow test and add inline flow test 2024-11-21 15:03:58 +01:00
Geoffrey White
636c047c41 Rust: Use final class. 2024-11-21 13:57:33 +00:00
Calum Grant
0836c3d6a5 C++: Update stats 2024-11-21 13:45:22 +00:00
Calum Grant
38fa3c10d6 Update cpp/downgrades/f0156f5f88ab5967c79162012c20f30600ca5ebf/upgrade.properties
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-11-21 13:45:20 +00:00
Calum Grant
d3e44028ea C++: Fix upgrade.properties 2024-11-21 13:45:18 +00:00
Calum Grant
8050b8246b C++: Update stats 2024-11-21 13:45:17 +00:00
Calum Grant
10f692b57c C++: DB upgrade scripts 2024-11-21 13:45:16 +00:00
Calum Grant
d3e8292db9 C++: Update dbscheme 2024-11-21 13:45:15 +00:00
Calum Grant
ac4121dd6c C++: Describe compilation_build_mode using a case 2024-11-21 13:45:14 +00:00
Calum Grant
6f3e6edd0e C++: Implement compilation_build_mode 2024-11-21 13:45:13 +00:00
Napalys Klicius
7ee0a7b398 Update javascript/ql/lib/semmle/javascript/Collections.qll
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2024-11-21 14:02:42 +01:00
Napalys Klicius
edb9b47111 Merge pull request #18047 from Napalys/napalys/ES2023-string-protytpe-toWellFormed
JS: Added taint-step String.prototype.toWellFormed ES2023 feature
2024-11-21 14:01:21 +01:00
Tom Hvitved
65be8a8aed CI: Set --ram in compile-queries.yml 2024-11-21 13:44:31 +01:00
Owen Mansel-Chan
c80a45f2a3 Merge pull request #18051 from github/workflow/coverage/update
Update CSV framework coverage reports
2024-11-21 12:19:43 +00:00
Paolo Tranquilli
c2b426df76 Rust: accept test changes 2024-11-21 12:54:13 +01:00
Paolo Tranquilli
6a6154913b Merge branch 'main' into redsun82/rust-str 2024-11-21 11:50:38 +01:00
Paolo Tranquilli
36d8a6d05f Rust: add class printouts to AstConsistency.ql 2024-11-21 11:42:00 +01:00
Tom Hvitved
295626d53b Merge pull request #17918 from hvitved/rust/cfg-codegen
Rust: Add (auto-generated) CFG node wrapper classes
2024-11-21 11:20:51 +01:00
Paolo Tranquilli
d8b453fc0d Rust: add consistency query printing AST classes of nodes with wrong toString 2024-11-21 11:14:59 +01:00
Paolo Tranquilli
5012332bb2 Rust: fix Path.toString and address some review comments 2024-11-21 11:13:06 +01:00
Tom Hvitved
86a7c486f9 Rust: "control-flow" -> "control flow" 2024-11-21 10:42:11 +01:00
Tom Hvitved
be7aca9780 Address review comments 2024-11-21 10:32:06 +01:00
Tom Hvitved
e6887f982e Rust: Use nodes from CfgNodes.qll in DataFlowImpl.qll 2024-11-21 10:21:13 +01:00
Tom Hvitved
ca18005e44 Rust: Add some manual classes to CfgNodes.qll 2024-11-21 10:21:12 +01:00
Tom Hvitved
c8736e8a3d Rust: Auto-generate CfgNodes.qll 2024-11-21 10:21:11 +01:00
Tom Hvitved
1c2fdc29a3 Rust: Add more local data flow tests 2024-11-21 10:21:09 +01:00
Tom Hvitved
fab29361cb Rust: Add more CFG tests 2024-11-21 10:21:06 +01:00
Tom Hvitved
6dc599c200 Merge pull request #17876 from hvitved/dataflow/param-flow-call-ctx
Data flow: Track call contexts in `parameterValueFlow`
2024-11-21 10:20:27 +01:00
Michael Nebel
932ced4ace Merge pull request #18052 from ewillonermsft/javascriptserializer-deserializ-stubs
Add Deserialize() and Deserialize<T> to System.Web.Serialization stubs
2024-11-21 09:09:12 +01:00
Simon Friis Vindum
8c74478ef4 Merge pull request #18041 from paldepind/rust-cfg-self
Rust: Include `self` parameters in the CFG
2024-11-21 08:53:52 +01:00
Napalys Klicius
82ca369dce Merge pull request #18005 from Napalys/napalys/ES2022-find-functions
JS: Added support for Array.prototype.[findLastIndex, findLast] ES2022 feature
2024-11-21 08:01:19 +01:00
ewillonermsft
d6ceb89324 Add Deserialize() and Deserialize<T> to System.Web.Serialization stub.s 2024-11-20 21:01:20 -08:00
github-actions[bot]
f25c16245c Add changed framework coverage reports 2024-11-21 00:21:44 +00:00
Geoffrey White
d828941b7c Rust: Address review comments. 2024-11-20 22:39:27 +00:00
REDMOND\brodes
007dd83799 Updating ir test expected files. 2024-11-20 14:40:58 -05:00
REDMOND\brodes
4078d79f2a Adds SEH exception edge types, disjoint from normal C++ edges. Does not apply the edges yet, just stipulates the types. 2024-11-20 14:37:32 -05:00
Ben Rodes
6aa74123af Merge branch 'main' into brodes/seh_flow_phase1_throwing_models 2024-11-20 12:48:54 -05:00
Napalys
43eda58f83 Added change notes 2024-11-20 17:44:36 +01:00
Napalys
afc2d3e6d2 JS: Add: String.protytpe.toWellFormed to StringManipulationTaintStep 2024-11-20 17:42:25 +01:00
Napalys
09f73d8d6f JS: Add: test cases for toWellFormed 2024-11-20 17:36:43 +01:00
Paolo Tranquilli
d609c1b7e6 Rust: fix OrPat.toString 2024-11-20 17:00:13 +01:00
Paolo Tranquilli
fd45e11f4b Rust: accept test changes 2024-11-20 16:49:20 +01:00
Paolo Tranquilli
b4af5a61d1 Rust: more advanced toString 2024-11-20 16:21:23 +01:00
Tom Hvitved
596cfcfb42 Merge pull request #18042 from hvitved/shared/dense-rank-refactor
Util: Refactor `DenseRank` implementation
2024-11-20 15:57:09 +01:00
Owen Mansel-Chan
9aede5f433 Merge pull request #17494 from owen-mc/go/reinstate-mad-with-fixes
Go: reinstate models-as-data sink conversions with fixes
2024-11-20 14:50:47 +00:00
Alvaro Muñoz
9a137db12b Bump qlpack versions 2024-11-20 15:36:20 +01:00
Alvaro Muñoz
082b4c3ca2 Add poisonable step for pip install . 2024-11-20 15:35:49 +01:00
Owen Mansel-Chan
69ad69c38a Move change note out of C# folder 2024-11-20 14:21:28 +00:00
Ben Rodes
69df07ed12 Update cpp/ql/lib/change-notes/2024-11-18-throwing-functions.md
Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
2024-11-20 09:06:44 -05:00
Napalys
64c45debdb JS: removed unnecessary getALocalSource from ArrayCallBackDataFlowStep 2024-11-20 14:57:00 +01:00
Napalys
9dbf7d1828 JS: removed unnecessary getALocalSource from ArrayCallBackDataTaintStep 2024-11-20 14:54:06 +01:00
Owen Mansel-Chan
dcf3b31f62 Move and update change note 2024-11-20 13:52:22 +00:00
Owen Mansel-Chan
d9a830e008 Add log function prefix "With" for heuristic logger 2024-11-20 13:50:59 +00:00
Napalys Klicius
59df4de8af Merge branch 'main' into napalys/ES2024-group-functions 2024-11-20 14:50:25 +01:00
Napalys
cdf43f7118 Added change notes 2024-11-20 14:06:44 +01:00
Napalys Klicius
a957e00fe5 Merge branch 'main' into napalys/ES2024-group-functions 2024-11-20 14:03:31 +01:00
Jeroen Ketema
b4718792d1 Merge pull request #17986 from jketema/guarded-free2
C++: Reduce number of FPs `cpp/guarded-free` and turn `if(x) { free(x) }` cases from FNs to TPs
2024-11-20 13:58:48 +01:00
Napalys
58faa2d71e JS: Add: dataflow step for static method of groupBy from Map. 2024-11-20 13:34:11 +01:00
Napalys
6344f83e4b JS: Add: tests for taint tracking in groupBy functions 2024-11-20 13:22:53 +01:00
Tom Hvitved
3f56fc9e89 Address review comments 2024-11-20 13:15:50 +01:00
Tom Hvitved
42e0d7ce10 Util: Refactor DenseRank implementation 2024-11-20 13:09:59 +01:00
Tom Hvitved
5f9b8c05bd Java: Update expected test output 2024-11-20 12:58:00 +01:00
Tom Hvitved
e5eed2302f Data flow: Track call contexts in parameterFlow 2024-11-20 12:57:56 +01:00
Simon Friis Vindum
93f6f042e1 Rust: Update expected file 2024-11-20 12:39:31 +01:00
Simon Friis Vindum
aab0d5e9e4 Rust: Refactor to avoid needing getNumberOfSelfParams 2024-11-20 12:35:52 +01:00
Joe Farebrother
52cd7f2c5c Add 2 more cases 2024-11-20 11:22:42 +00:00
Paolo Tranquilli
4d04c5af83 Rust: fix non-existent string representations 2024-11-20 12:08:51 +01:00
Joe Farebrother
9b4b01a442 Fix typo 2024-11-20 10:59:27 +00:00
Simon Friis Vindum
24adbb80c7 Rust: Include self parameters in the CFG 2024-11-20 11:50:46 +01:00
Simon Friis Vindum
55121d866c Rust: Add CFG tests for method definitions with self parameters 2024-11-20 11:45:42 +01:00
Nora Dimitrijević
6a3e34cc4c Merge pull request #17987 from d10c/d10c/bigint-ga
BigInt GA: update docs
2024-11-20 10:34:42 +01:00
Paolo Tranquilli
57973df795 Rust: make CallExpr.toString use call identifier if present 2024-11-20 10:00:10 +01:00
Michael Nebel
745e52f659 Merge pull request #18033 from michaelnebel/csharp/net9-2
C#: Update to .NET 9
2024-11-20 09:53:58 +01:00
Michael Nebel
9a8a27750e Merge pull request #18040 from github/workflow/coverage/update
Update CSV framework coverage reports
2024-11-20 09:51:59 +01:00
Paolo Tranquilli
4fb028cbb2 Rust: accept last integration test changes
Also make `--learn` work with the nested qltest tests.
2024-11-20 09:45:15 +01:00
github-actions[bot]
d80aa6fa6a Add changed framework coverage reports 2024-11-20 00:21:24 +00:00
Owen Mansel-Chan
cf84c08abf Add change note 2024-11-20 00:18:55 +00:00
REDMOND\brodes
4e777561f0 Changing terminology back to "throws" vs "rasis" for alwaysThrowsException to be consistent with other backward compatibility changes. 2024-11-19 15:10:15 -05:00
Owen Mansel-Chan
f21439a6e3 Merge pull request #18034 from owen-mc/go/mad/package-level-variables
Go: Allow package-level variables in models-as-data models
2024-11-19 19:49:02 +00:00
REDMOND\brodes
23485f185b Merge branch 'brodes/seh_flow_phase1_throwing_models' of https://github.com/microsoft/codeql into brodes/seh_flow_phase1_throwing_models 2024-11-19 13:36:01 -05:00
REDMOND\brodes
a69daa0d20 Missing change to 'mayThrowException' in StructuredExceptionHandling.qll 2024-11-19 13:35:45 -05:00
Ben Rodes
ae1ed385f6 Merge branch 'main' into brodes/seh_flow_phase1_throwing_models 2024-11-19 13:33:25 -05:00
REDMOND\brodes
07847762e1 bringing back mayThrowException to make it cleaner/easier for backwards compatibility. 2024-11-19 13:17:10 -05:00
Alexander Eyers-Taylor
38a5f63437 Merge pull request #18039 from github/post-release-prep/codeql-cli-2.19.4
Post-release preparation for codeql-cli-2.19.4
2024-11-19 18:07:25 +00:00
Jeroen Ketema
5a18f1ff07 Merge pull request #18038 from github/nickrolfe/typo-manger
C++: fix typo in qhelp
2024-11-19 19:02:31 +01:00
REDMOND\brodes
63ddd81059 Merge branch 'brodes/seh_flow_phase1_throwing_models' of https://github.com/microsoft/codeql into brodes/seh_flow_phase1_throwing_models 2024-11-19 12:58:51 -05:00
REDMOND\brodes
26d590a616 Putting back deleted file, and deprecating instead. Deprecating mayThrowException as well. 2024-11-19 12:57:50 -05:00
github-actions[bot]
3909df75dc Post-release preparation for codeql-cli-2.19.4 2024-11-19 17:54:03 +00:00
Nick Rolfe
a2c6278282 C++: fix typo in qhelp 2024-11-19 17:39:05 +00:00
Alexander Eyers-Taylor
aa4cc72f30 Merge pull request #18036 from github/release-prep/2.19.4
Release preparation for version 2.19.4
2024-11-19 17:15:02 +00:00
Owen Mansel-Chan
dd87b1a9de Convert os.stdin model to MaD 2024-11-19 16:59:47 +00:00
Owen Mansel-Chan
bf824cac0a Allow package-level variables in MaD 2024-11-19 16:59:42 +00:00
Paolo Tranquilli
e4f982c12c Rust: accept integration test changes 2024-11-19 17:50:57 +01:00
Paolo Tranquilli
fce13aeb35 Rust: accept test changes 2024-11-19 17:50:14 +01:00
Joe Farebrother
a398f707fe Add some test cases for flow involving global variables and captured variables 2024-11-19 16:34:59 +00:00
Alex Eyers-Taylor
ef3fc5e29f Fix broken changelog. 2024-11-19 16:34:30 +00:00
github-actions[bot]
9783a11565 Release preparation for version 2.19.4 2024-11-19 16:21:37 +00:00
Paolo Tranquilli
a709fc6a54 Rust: add some toString implementations 2024-11-19 17:21:08 +01:00
yoff
d4ec8f650a Merge pull request #18030 from github/tausbn/python-fix-match-literal-pruning
Python: Fix pruning of literals in `match` pattern
2024-11-19 17:16:22 +01:00
Michael Nebel
3b01efaf5d C#: Update launch.json. 2024-11-19 17:08:08 +01:00
Ben Rodes
5bb765d834 Merge branch 'main' into brodes/seh_flow_phase1_throwing_models 2024-11-19 10:46:17 -05:00
Michael Nebel
0fc46f5855 C#: Fix compiler warnings related to errors in XML comments. 2024-11-19 16:30:48 +01:00
Nora Dimitrijević
2da1d6aaa8 BigInt GA: remove mention of experimental status from .rst docs 2024-11-19 16:05:20 +01:00
Nora Dimitrijević
54e7db2294 BigInt GA: s/arbitrary-precision/arbitrary-range/g in .rst docs 2024-11-19 16:05:20 +01:00
REDMOND\brodes
1c874d3221 Fixed usage raisesException 2024-11-19 10:04:11 -05:00
Simon Friis Vindum
e5951516b8 Merge pull request #18026 from paldepind/rust-df-local
Rust: Add local data flow edge for SSA nodes
2024-11-19 15:41:25 +01:00
yoff
22287be5d1 Merge pull request #17370 from Kwstubbs/Bottle/Tornado-HeaderSupport
Python: Bottle Framework Support
2024-11-19 15:34:26 +01:00
Tom Hvitved
7a065746d6 Merge pull request #18024 from hvitved/rust/cfg/async-block-return
Rust: Handle early returns in `async` blocks in CFG
2024-11-19 15:21:34 +01:00
Taus
e2530cf14f Python: Update expected test output
Co-authored-by: yoff <lerchedahl@gmail.com>
2024-11-19 14:10:50 +00:00
Michael Nebel
358098230c C#: Address review comment from previous PR. 2024-11-19 14:58:21 +01:00
Taus
a4ccda5fe3 Python: Fix pruning of literals in match pattern
Co-authored-by: yoff <lerchedahl@gmail.com>
2024-11-19 13:48:13 +00:00
Simon Friis Vindum
2c9bee6208 Rust: Only add data flow edge to SSA write definitions from their underlying CFG node 2024-11-19 14:32:31 +01:00
Michael Nebel
95a8881428 Merge pull request #17999 from michaelnebel/csharp/net9
C#: Update to .NET9.
2024-11-19 14:28:59 +01:00
Napalys
28ead4011a JS: Add: taint step to handle propagation of data flow from the array to callback 2024-11-19 14:15:15 +01:00
Napalys
f1e95a8a1d JS: Add: taint step test cases for findLastIndex, findLast, find 2024-11-19 14:09:58 +01:00
Paolo Tranquilli
2f3624b625 Merge pull request #18023 from github/redsun82/installer-shortcut
Bazel: add an `install` shortcut and an `experimental` attribute to `codeql_pack`
2024-11-19 14:00:52 +01:00
yoff
6ed895064f Apply suggestions from code review
Co-authored-by: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
2024-11-19 13:37:53 +01:00
Simon Friis Vindum
6ae979293c Rust: Accept inconsistencies 2024-11-19 13:26:01 +01:00
Geoffrey White
758092b1d6 Rust: Add consistency check failures. 2024-11-19 12:04:15 +00:00
Geoffrey White
49eefccde1 Rust: Autoformat. 2024-11-19 11:49:02 +00:00
Paolo Tranquilli
918b0bfc53 Bazel: add experimental to codeql_pack 2024-11-19 12:48:36 +01:00
Owen Mansel-Chan
307fdc0864 Add tests for heuristic logger calls 2024-11-19 11:41:53 +00:00
Owen Mansel-Chan
e57d8983f5 Add heuristic logger calls 2024-11-19 11:41:51 +00:00
Owen Mansel-Chan
9fc0dc5690 Fix typo in unrelated QLDoc 2024-11-19 11:41:40 +00:00
Owen Mansel-Chan
874dc83f3f Update test expectations 2024-11-19 11:28:43 +00:00
Owen Mansel-Chan
81907bc743 Set Subtypes column correctly
We set it to False when it has no meaning and True otherwise.
2024-11-19 11:22:36 +00:00
Simon Friis Vindum
23bfa8a9bc Rust: Add local data flow edge for SSA definitons 2024-11-19 12:19:47 +01:00
Owen Mansel-Chan
bc784268fd Make Logrus log injection tests more comprehensive 2024-11-19 11:18:28 +00:00
Owen Mansel-Chan
791313fbdf Add tests for logrus.FieldLogger 2024-11-19 11:18:26 +00:00
Owen Mansel-Chan
cc62db796c Add tests for Xorm first argument of varargs slice 2024-11-19 11:18:24 +00:00
Owen Mansel-Chan
5a0cd2e7d6 Add tests for squirrel.Eq 2024-11-19 11:18:22 +00:00
Owen Mansel-Chan
8cbab0c66e Model logrus.FieldLogger using models-as-data 2024-11-19 11:18:20 +00:00
Owen Mansel-Chan
d37c816bd9 Model some Xorm methods in QL 2024-11-19 11:18:17 +00:00
Owen Mansel-Chan
25cd4d4585 Model some squirrel methods in QL
We need to put a restriction on the type of the argument.
2024-11-19 11:18:15 +00:00
Owen Mansel-Chan
a0729fc760 Fix typo in package path
Co-authored-by: Edward Minnix III <egregius313@github.com>
2024-11-19 11:18:13 +00:00
Owen Mansel-Chan
35cbc162b0 Convert logging sinks to use MaD 2024-11-19 11:18:11 +00:00
Owen Mansel-Chan
85c7e8c221 Convert gocb nosql-injection sinks to MaD 2024-11-19 11:18:09 +00:00
Owen Mansel-Chan
fbaad09179 Convert mongodb nosql-injection sinks to MaD 2024-11-19 11:18:02 +00:00
Owen Mansel-Chan
b4c84be3be Convert database/sql/driver sql-injection sinks to MaD 2024-11-19 11:15:48 +00:00
Owen Mansel-Chan
e4eef6791a Convert database/sql sql-injection sinks to MaD 2024-11-19 11:15:42 +00:00
Owen Mansel-Chan
4cca6cff59 Convert Beego orm sql-injection sinks to MaD 2024-11-19 11:13:32 +00:00
Owen Mansel-Chan
2282a8184b Convert Bun sql-injection sinks to MaD 2024-11-19 11:13:30 +00:00
Owen Mansel-Chan
1c305aa8f3 Convert Xorm sql-injection sinks to MaD 2024-11-19 11:13:28 +00:00
Owen Mansel-Chan
1ab50fc62c Convert Gorm sql-injection sinks to MaD 2024-11-19 11:13:26 +00:00
Owen Mansel-Chan
fb050e8b43 Convert sqlx sql-injection sinks to MaD 2024-11-19 11:13:23 +00:00
Owen Mansel-Chan
d9d3e74e8c Convert gogf/gf sql-injection sinks to MaD 2024-11-19 11:13:17 +00:00
Owen Mansel-Chan
1315a1e9ae Upgrade and convert gorqlite sql-injection sinks to MaD 2024-11-19 11:13:13 +00:00
Owen Mansel-Chan
924467bebe Convert squirrel sql-injection sinks to MaD (non-existent methods removed)
Various non-existent methods were modeled, and I couldn't find any
evidence that they used to exist. They aren't in the stubs or tests. I
have removed them.
2024-11-19 11:13:10 +00:00
Geoffrey White
c7c6924fda Rust: Implement query, source/sink/barrier classes and concepts. All of this is framework, nothing is concretely modelled yet. 2024-11-19 11:09:43 +00:00
Geoffrey White
6a7fb06086 Rust: Add .qhelp and examples. 2024-11-19 11:09:42 +00:00
Simon Friis Vindum
bacc37d886 Rust: Add additional tests for intraprocedural data flow 2024-11-19 12:07:26 +01:00
Geoffrey White
2df565c84f Rust: Add options.yml and sqlx 'query cache' (result of 'sqlx prepare') so that the query test can function. 2024-11-19 10:56:37 +00:00
Geoffrey White
28d0ad94d5 Rust: Add placeholder SQL injection query, linked in test. 2024-11-19 10:56:36 +00:00
Geoffrey White
3673c7c813 Rust: Add SQL injection test cases (complete and functioning). 2024-11-19 10:56:35 +00:00
Michael Nebel
45458ed72b Merge pull request #17845 from michaelnebel/csharp/net8runtimehigherorder
C#: Add generated higher order models for .NET8 Runtime.
2024-11-19 11:52:34 +01:00
Alvaro Muñoz
afb7967a0c Delete .actual test files 2024-11-19 11:31:59 +01:00
Alvaro Muñoz
3ce3cf43be refactor common code to identify untrusted checkouts 2024-11-19 11:31:35 +01:00
Simon Friis Vindum
b3668f8183 Merge pull request #17971 from paldepind/rust-df-patterns
Rust: Include patterns as data flow nodes
2024-11-19 11:12:12 +01:00
Simon Friis Vindum
2307df41ed Merge pull request #18010 from paldepind/rust-df-viable-callable
Rust: Include method calls in DataFlowCall and implement simple call target resolution
2024-11-19 11:10:34 +01:00
Michael Nebel
e3990b7d04 C#: Add change-note. 2024-11-19 10:56:19 +01:00
Stephan Brandauer
4208f031e3 Java: drop automodel queries 2024-11-19 10:40:22 +01:00
Stephan Brandauer
aea7c3fc81 Java: drop automodel change note 2024-11-19 10:40:17 +01:00
Paolo Tranquilli
e8677b46d5 Bazel: rename shortcut to install 2024-11-19 10:34:40 +01:00
Tom Hvitved
bb8d0b4881 Rust: Handle early returns in async blocks in CFG 2024-11-19 10:33:25 +01:00
Tom Hvitved
b6103e1ef4 Rust: Add CFG test for early return in async block
Also made the test comply with `cargo check`.
2024-11-19 10:32:43 +01:00
Paolo Tranquilli
40b8406d62 Bazel: use installer shortcut in docs and workflows 2024-11-19 10:32:21 +01:00
Michael Nebel
263a4a9fcb C#: Allow other characters between build-stdput and the expected message. 2024-11-19 10:26:07 +01:00
Michael Nebel
f89e80f402 C#: Update integration tests expected output. 2024-11-19 10:26:06 +01:00
Michael Nebel
05a19adc8f C#: Update global.json files. 2024-11-19 10:26:04 +01:00
Michael Nebel
d8313fc7b4 C#: Update .NET version in project files. 2024-11-19 10:26:02 +01:00
Michael Nebel
6b9d9a2c94 C#: Update stub generator script. 2024-11-19 10:26:00 +01:00
Michael Nebel
57e0e2dba1 C#: Update workflow files and scripts. 2024-11-19 10:25:58 +01:00
Michael Nebel
201a5e9faa C#: Update the extractor to target .NET 9. 2024-11-19 10:25:52 +01:00
Paolo Tranquilli
6e33f979c7 Bazel: add an installer shortcut to codeql_pack
This makes the first `codeql_pack` in a package add an `installer` target
aliasing the `<name>-installer` one. This makes it so that one can for
example do `bazel run //rust:installer` instead of the stuttering
`bazel run //rust:rust-installer`. If a bazel package defines multiple
`codeql_pack` targets, the first one only will get the `installer` alias.
2024-11-19 10:25:31 +01:00
Tom Hvitved
ef9f3835e5 Merge pull request #18007 from hvitved/rust/cfg/and-let
Rust: Improve CFG for `let` expressions
2024-11-19 10:23:32 +01:00
Calum Grant
2bfd7326d9 Merge pull request #18004 from github/revert-17948-revert-17694-multiple-entry-point
Revert "Revert "C++: Do not generate IR for functions with multiple entry points""
2024-11-19 09:20:24 +00:00
Napalys
c03d69af1e JS: Add: dataflow step for find, findLast, findLastIndex callback functions 2024-11-19 09:42:11 +01:00
Napalys
b64b837db3 JS: Add: test cases for find, findLast, findLastIndex with callbacks 2024-11-19 09:35:43 +01:00
Napalys
1b0f8aa657 JS: removed unnecessary findlast module import 2024-11-19 09:30:05 +01:00
Paolo Tranquilli
99494dd540 Merge pull request #18012 from github/revert-18011-revert-17937-redsun82/rust-cargo-options
Revert "Revert "Rust: allow to specify more cargo configuration options""
2024-11-19 09:03:52 +01:00
Tom Hvitved
46b4bad510 Rust: Update expected test output 2024-11-19 08:59:12 +01:00
Tom Hvitved
c85a5f9644 Rust: Run cargo fmt 2024-11-19 08:58:34 +01:00
Napalys
72a69cfa17 Added change notes 2024-11-19 08:24:36 +01:00
Owen Mansel-Chan
e2f17c63d7 Merge pull request #17988 from owen-mc/java/fix-unreachable-blocks-in-const-switch-stmt
Java: fix unreachable basic blocks in const switch stmt
2024-11-19 00:48:12 +00:00
Owen Mansel-Chan
c5bec1cc7f Merge pull request #17966 from owen-mc/go/mad/subtypes-true
Go: set `subtypes` column to true for models where it has a meaning
2024-11-19 00:43:55 +00:00
Jeroen Ketema
b622c6e9ca Merge pull request #18015 from jketema/cpu-cleanup
Remove duplicated "Supported CPU architectures" from "Supported platforms" table
2024-11-18 21:10:17 +01:00
REDMOND\brodes
792231c949 Removing SEH default case for function calls as the logic to handle SEH is not yet part of the IR generation to make this logic work. 2024-11-18 14:43:44 -05:00
Jeroen Ketema
ba545ca5d8 Remove duplicated "Supported CPU architectures" from "Supported platforms" table 2024-11-18 19:18:35 +01:00
Jeroen Ketema
84f3e6a0d3 Merge branch 'main' into guarded-free2 2024-11-18 19:09:23 +01:00
Ben Rodes
1c7b5aebb5 Merge branch 'main' into brodes/seh_flow_phase1_throwing_models 2024-11-18 12:48:38 -05:00
Mathias Vorreiter Pedersen
f2f83f77e0 Merge pull request #18013 from MathiasVP/non-boolean-consistency-check
C++: Add another IR consistency query
2024-11-18 17:27:33 +00:00
Paolo Tranquilli
f7ee5f4bf5 Merge pull request #18003 from github/redsun82/rust-qltest
Rust: only accept `options.yml` in QL tests
2024-11-18 17:24:57 +01:00
Paolo Tranquilli
8377ee545f Rust: fix reading lists from options.yml 2024-11-18 17:22:23 +01:00
REDMOND\brodes
4b83a451bd Change log 2024-11-18 11:14:46 -05:00
REDMOND\brodes
de05aee483 Adding model transition to using Throwing.qll. 2024-11-18 11:11:25 -05:00
Mathias Vorreiter Pedersen
ccca0b6ba4 C++: Also update syntax-zoo tests. 2024-11-18 15:56:41 +00:00
Mathias Vorreiter Pedersen
4a4552bbc1 C++: Also update the consistency query itself. 2024-11-18 15:55:25 +00:00
Jeroen Ketema
08bf6d7d30 Merge branch 'main' into guarded-free2 2024-11-18 16:50:22 +01:00
Mathias Vorreiter Pedersen
28391d19b6 C++: Add some more tests to expose consistency issues. 2024-11-18 15:25:57 +00:00
Mathias Vorreiter Pedersen
493ea6da31 C++: Add a new consistency check for branching on non-boolean values. 2024-11-18 15:21:28 +00:00
Paolo Tranquilli
0943389ca1 Rust: add rust-specific deps updater script 2024-11-18 16:16:54 +01:00
Paolo Tranquilli
e077bf0732 Rust: update vendored dependencies 2024-11-18 16:06:27 +01:00
Mathias Vorreiter Pedersen
6785b93ed8 Merge pull request #17938 from MathiasVP/fix-fp-in-missing-check-scanf-fixing-take-2
C++: Fix some FPs in `cpp/missing-check-scanf` (second attempt)
2024-11-18 15:05:18 +00:00
Simon Friis Vindum
86672b7e8c Merge branch 'main' into rust-df-viable-callable 2024-11-18 15:52:57 +01:00
Paolo Tranquilli
abd73e16d4 Revert "Revert "Rust: allow to specify more cargo configuration options"" 2024-11-18 15:52:03 +01:00
Tom Hvitved
74b5ebe4bf Rust: Improve CFG for let expressions 2024-11-18 15:51:16 +01:00
Tom Hvitved
8be1127e8c Rust: Add more CFG tests 2024-11-18 15:51:15 +01:00
Paolo Tranquilli
d9b86f55c8 Merge pull request #18011 from github/revert-17937-redsun82/rust-cargo-options
Revert "Rust: allow to specify more cargo configuration options"
2024-11-18 15:46:55 +01:00
Mathias Vorreiter Pedersen
86e95f14e0 Update cpp/ql/lib/change-notes/2024-11-18-guard-conditions.md
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-11-18 14:37:52 +00:00
Paolo Tranquilli
04072591c4 Revert "Rust: allow to specify more cargo configuration options" 2024-11-18 15:36:06 +01:00
Mathias Vorreiter Pedersen
90d7616f14 C++: Add change note. 2024-11-18 14:31:36 +00:00
Simon Friis Vindum
58a1b004ab Rust: Include method calls in DataFlowCall and implement simple call
target resolution
2024-11-18 15:27:21 +01:00
Simon Friis Vindum
4e97a9554a Rust: Add interprocedural tests 2024-11-18 15:21:15 +01:00
Napalys Klicius
9457bc3548 Merge pull request #17993 from Napalys/napalys/ES2023-array-protype-with
JS: Added support for Array.prototype.with() ES2023 feature
2024-11-18 14:37:53 +01:00
Jeroen Ketema
88be4b88ab C++: Address review comments 2024-11-18 14:27:01 +01:00
Paolo Tranquilli
fa52d03194 Merge pull request #17937 from github/redsun82/rust-cargo-options
Rust: allow to specify more cargo configuration options
2024-11-18 13:24:39 +01:00
Napalys
213ce225e0 JS: Add: taint step for Object.groupBy function, fixed test cases from 8ae05d8be4 2024-11-18 12:58:07 +01:00
Napalys
8ae05d8be4 JS: Add: test case for Object.groupBy 2024-11-18 12:55:17 +01:00
Napalys
c02ad65fdc JS: Add: taint step for Map.groupBy function 2024-11-18 12:50:06 +01:00
Napalys
3786ad4277 JS: Add: test case for Map.groupBy 2024-11-18 12:44:49 +01:00
Paolo Tranquilli
b11388c49b Rust: accept test changes 2024-11-18 12:06:25 +01:00
Paolo Tranquilli
8bcc5f4bf8 Merge pull request #17989 from geoffw0/swift6models2
Swift: More model repairs for Swift 6
2024-11-18 11:52:14 +01:00
Calum Grant
6a0a7dda76 Revert "Revert "C++: Do not generate IR for functions with multiple entry points"" 2024-11-18 10:31:04 +00:00
Tamás Vajk
b84b687b0d Merge pull request #17992 from tamasvajk/binlog/no-compilations
C#: Consider the extraction of empty binlog files acceptable
2024-11-18 11:09:57 +01:00
Paolo Tranquilli
8137419d93 Rust: only accept options.yml in QL tests 2024-11-18 10:40:29 +01:00
Geoffrey White
fa43207538 Swift: Autoformat. 2024-11-18 09:40:06 +00:00
Paolo Tranquilli
0356cdc3cc Merge pull request #18002 from github/redsun82/rust-ql-test-deps
Rust: add optional dependencies to ql tests
2024-11-18 10:32:09 +01:00
Simon Friis Vindum
1a198bfb3a Merge branch 'main' into rust-df-patterns 2024-11-18 10:06:01 +01:00
Paolo Tranquilli
75375be7ac Rust: add optional dependencies to ql tests
Also accept `options.yml` and `options.yaml` files as well for test options,
to get YAML syntax highlighting. In a follow up PR we might make the extension
mandatory.
2024-11-18 09:42:01 +01:00
Simon Friis Vindum
d178d84ea9 Merge pull request #17995 from paldepind/rust-df-source-sink-fix
Rust: Fix default source and sink in inline flow test
2024-11-18 09:19:08 +01:00
Simon Friis Vindum
0e025abd13 Rust: Add custom toString predicate for path expression 2024-11-18 09:09:03 +01:00
Napalys Klicius
a23850940f Merge branch 'main' into napalys/ES2023-array-protype-with 2024-11-18 08:25:09 +01:00
Napalys Klicius
63bc1ef69f Merge pull request #17977 from Napalys/napalys/toSpliced-support
JS: Added support for Array.prototype.toSpliced() ES2023 feature
2024-11-18 08:24:49 +01:00
Napalys
1304ab7065 Added change notes 2024-11-18 08:05:51 +01:00
Mathias Vorreiter Pedersen
19d53fba8c C++: Exclude guards in static local or global initializers. 2024-11-17 19:51:35 +00:00
Owen Mansel-Chan
06b72e5782 Update models in test expectation files 2024-11-16 19:44:32 +00:00
Owen Mansel-Chan
5745969462 Set subtypes=false when it has no meaning 2024-11-16 19:34:23 +00:00
Mathias Vorreiter Pedersen
409f2c1251 C++: Make the formatting of conjunct when using 'getDualValue' consistent. 2024-11-15 15:20:04 +00:00
Mathias Vorreiter Pedersen
459bb6ed04 Update cpp/ql/lib/semmle/code/cpp/controlflow/IRGuards.qll
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-11-15 14:43:04 +00:00
Mathias Vorreiter Pedersen
5f9d3d7b09 C++: Rename 'ScrutineeValueNumber' to 'SwitchConditionValueNumber'. 2024-11-15 14:28:56 +00:00
Mathias Vorreiter Pedersen
feea29b8fe C++: Move classes. 2024-11-15 14:21:18 +00:00
Mathias Vorreiter Pedersen
c80bea33e5 C++: Stylistic fixes. 2024-11-15 14:20:12 +00:00
Napalys
a28fc8e772 JS: Add: Use of returnless function support for findLast and findLastIndex 2024-11-15 14:44:25 +01:00
Napalys
7250099f6c JS: Add: Test cases use of returnless function in findLast and findLastIndex 2024-11-15 14:42:11 +01:00
Tamás Vajk
e081b9a420 Merge pull request #17984 from tamasvajk/fix/tech-debt-01
Merge `Semmle.Extraction` into `Semmle.Extraction.CSharp`
2024-11-15 14:27:57 +01:00
Napalys
fcb65534a8 JS: Add: Array.protype.findLast as taint step 2024-11-15 14:10:01 +01:00
Napalys
ea90698fc1 JS: Add: Test case taint step for findLast 2024-11-15 13:35:28 +01:00
Rasmus Lerchedahl Petersen
15953bf569 java: inline range test 2024-11-15 12:31:18 +01:00
Simon Friis Vindum
7cb9d07f59 Rust: Fix default source and sink in inline flow test 2024-11-15 11:59:48 +01:00
Ian Lynagh
b1ac02795b Merge pull request #17991 from igfoo/igfoo/redundant
Go: Remove a redundant override
2024-11-15 10:55:56 +00:00
Napalys
bed1f25b3f JS: Fix: Now Array.prototype.with is properly flagged as taint step 2024-11-15 10:35:34 +01:00
Napalys
f04fd5cdcc JS: Add: Test case for Array.protype.with taint step 2024-11-15 10:27:44 +01:00
Tamas Vajk
e3b83bb4b4 Undo accidental comment removal 2024-11-15 10:19:33 +01:00
Simon Friis Vindum
9bf53f50fa Rust: Get CFG scope and update expected results 2024-11-15 10:00:43 +01:00
Napalys
631a3770ec JS: Add: change notes 2024-11-15 09:16:21 +01:00
Tamas Vajk
da5573203e C#: Consider the extraction of empty binlog files acceptable 2024-11-15 08:35:21 +01:00
Mathias Vorreiter Pedersen
42c1937776 Update IRGuards.qll
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-11-14 21:28:54 +00:00
Mathias Vorreiter Pedersen
229d40ad8b Update IRGuards.qll
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-11-14 21:28:43 +00:00
Mathias Vorreiter Pedersen
b10696c155 Update IRGuards.qll
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-11-14 21:28:33 +00:00
Ian Lynagh
50b9702afd Go: Remove a redundant override 2024-11-14 21:19:29 +00:00
Geoffrey White
8245e6c2b9 Swift: Fix unwanted flows. 2024-11-14 17:51:47 +00:00
Geoffrey White
e589b1fcd0 Swift: Fix query barriers. 2024-11-14 17:37:43 +00:00
Geoffrey White
6aa43e001d Swift: Effect on other tests. 2024-11-14 17:29:17 +00:00
Geoffrey White
c2c23c872b Swift: Address some modelling issues for Swift 6. 2024-11-14 17:22:15 +00:00
Geoffrey White
570393fe2b Swift: Additional test cases. 2024-11-14 17:17:00 +00:00
Mathias Vorreiter Pedersen
6e7256f9d4 C++: Delete unused predicates. 2024-11-14 16:46:19 +00:00
Geoffrey White
f0dc4f5ec3 Swift: Convert the dataflow-taint-core-conversions test to labelled sources. 2024-11-14 16:34:16 +00:00
Mathias Vorreiter Pedersen
bb85aa2fc9 C++: Accept test changes. 2024-11-14 16:29:51 +00:00
Mathias Vorreiter Pedersen
442968c3c2 C++: Properly restrict 'unary_simple_comparison_eq'. 2024-11-14 16:29:49 +00:00
Mathias Vorreiter Pedersen
db38069290 C++: Use value numbering in IRGuards. 2024-11-14 16:29:48 +00:00
Mathias Vorreiter Pedersen
a40c1d50b8 C++: Add FP tests. 2024-11-14 16:13:46 +00:00
Napalys Klicius
6fa3ff39a0 Merge branch 'main' into napalys/toSpliced-support 2024-11-14 16:56:32 +01:00
Owen Mansel-Chan
ba239a1be0 Add change note 2024-11-14 15:02:21 +00:00
Owen Mansel-Chan
bf0fba6c49 Refactor UnreachableBasicBlock to make it clearer 2024-11-14 14:53:12 +00:00
Owen Mansel-Chan
efb34aea45 Fix bug in UnreachableBlocks 2024-11-14 14:50:25 +00:00
Napalys Klicius
c8c15a0899 Merge pull request #17910 from Napalys/napalys/matchAll-support
JS: Support for matchAll
2024-11-14 15:36:20 +01:00
Napalys
b333f523df JS: Fix: now one can determine regex via Array.prototype.toSpliced function call. 2024-11-14 15:35:03 +01:00
Napalys
2b0def1ed3 JS: Add: Test case for checking if regex via using toSpliced 2024-11-14 15:31:38 +01:00
Napalys
52330e834c JS: Add: Test case for checking if regex via using splice 2024-11-14 15:29:05 +01:00
Jeroen Ketema
20685918bd C++: Silence ql-for-ql warning 2024-11-14 13:10:20 +01:00
Cornelius Riemenschneider
3fdd35cfdc Merge pull request #17976 from github/criemen/rust-3rdparty
Rust: Vendor build files for 3rdparty dependencies.
2024-11-14 12:58:00 +01:00
Jeroen Ketema
b581723a63 C++: Ignore complex guards and the comma operator 2024-11-14 12:53:54 +01:00
Jeroen Ketema
176acabd9d C++: Ignore free calls that are macro defined or #if/#ifdef guarded 2024-11-14 12:51:04 +01:00
Jeroen Ketema
a31e983e9e C++: Also allow single statement blocks in cpp/guarded-free 2024-11-14 12:47:29 +01:00
Jeroen Ketema
c86bbbb063 C++: Fix cpp/guarded-free FPs when there are other blocks depending on the guard 2024-11-14 11:48:17 +01:00
Owen Mansel-Chan
4ca6c80eb5 Merge pull request #17973 from github/workflow/coverage/update
Update CSV framework coverage reports
2024-11-14 10:19:41 +00:00
Tamas Vajk
0fa3ba6b4d Code quality improvements 2024-11-14 10:45:54 +01:00
Tamas Vajk
90579947cf Move all classes to the Semmle.Extraction.CSharp namespace 2024-11-14 09:13:03 +01:00
Napalys Klicius
97de35c689 Merge pull request #17965 from Napalys/napalys/immutable-array-operations
JS: Added support for toSorted and toReversed
2024-11-14 06:59:38 +01:00
github-actions[bot]
788a88aaca Add changed framework coverage reports 2024-11-14 00:20:18 +00:00
Dave Bartolomeo
df3b30489b Add --search-path in test workflow 2024-11-13 13:50:41 -05:00
Dave Bartolomeo
be8a49228f Delete dbscheme
Update after merge
2024-11-13 13:42:57 -05:00
Dave Bartolomeo
14119c7d84 Merge remote-tracking branch 'origin/master' into dbartol/move-to-codeql 2024-11-13 13:28:00 -05:00
Napalys
84234d59b9 JS: Fix: Ensure toSpliced with spread operator is flagged 2024-11-13 17:21:34 +01:00
Napalys
8512cb44ff JS: Add: Test cases for toSpliced with spread operator 2024-11-13 17:18:09 +01:00
Napalys
cf90430ec0 JS: Add: Missing test case for splice spread operator 2024-11-13 17:07:17 +01:00
Simon Friis Vindum
d3f5b479f6 Merge branch 'main' into rust-df-patterns 2024-11-13 16:22:07 +01:00
Napalys
2df3d1b251 JS: Fix: Ensure toSpliced is flagged by taint tracking in test suite (ed44358143) 2024-11-13 15:58:20 +01:00
Tamas Vajk
a0cac46b46 Merge the two CachedEntityFactory classes 2024-11-13 15:53:49 +01:00
Napalys
ed44358143 Added toSpliced test cases for mutation arrays 2024-11-13 15:51:00 +01:00
Tamas Vajk
02bd204111 Move more classes to the Semmle.Extraction.CSharp namespace 2024-11-13 15:27:48 +01:00
Tamas Vajk
46da5960ee Move extraction context classes to the Semmle.Extraction.CSharp namespace 2024-11-13 14:28:04 +01:00
Tamas Vajk
b7098b72a4 Move location-like entities to the Semmle.Extraction.CSharp namespace 2024-11-13 14:24:08 +01:00
Tom Hvitved
2bb5603b30 Merge pull request #17949 from paldepind/rust-async-blocks
Rust: Handle async blocks in CFG and SSA
2024-11-13 13:51:20 +01:00
Tamas Vajk
e7844e2855 C#: Remove Semmle.Extraction project and move content to Semmle.Extraction.CSharp 2024-11-13 13:47:40 +01:00
Napalys
df4b596180 Added toSpliced as part ArraySliceStep and ArraySpliceStep, fixed tests from 2d9bc43506 2024-11-13 13:47:34 +01:00
Cornelius Riemenschneider
a66f8209f9 Rust: Vendor 3rdparty dependencies.
We've been observing some performance issues using crate_universe on CI.
Therefore, we're moving to vendor the auto-generated BUILD files
in our repository. This should provide a nice speed boost, while
getting rid of the complexity of the "rust cache" job we've been using
when we had a lot of git dependencies.

This PR includes a vendor script, and I'll put up a CI job internally
that runs that vendor script on Cargo.toml and Cargo.lock changes, to check
that the vendored files are in sync.
2024-11-13 13:22:14 +01:00
Calum Grant
67684d1813 Merge pull request #17948 from github/revert-17694-multiple-entry-point
Revert "C++: Do not generate IR for functions with multiple entry points"
2024-11-13 12:11:02 +00:00
Napalys
2d9bc43506 Added tests for arrays toSpliced with pop 2024-11-13 12:58:24 +01:00
Napalys
b4c84d3d3c Added taint step for toSpliced, handles test from a65f80ef76 2024-11-13 12:41:41 +01:00
Napalys
a65f80ef76 Added basic taint tracking test for Array.prototype.toSpliced() 2024-11-13 12:28:14 +01:00
Napalys
37712d2e21 Added a new way to simulate CatastrophicError for integration-tests. In the future environmental variable, might be a more sustainable solution. 2024-11-13 08:58:54 +01:00
Napalys Klicius
ef18a6e562 Remove toReversed and toSorted func prototypes from extern.js. 2024-11-13 08:29:18 +01:00
Simon Friis Vindum
78edafc94c Rust: Include patterns as data flow nodes 2024-11-12 18:43:06 +01:00
Esben Sparre Andreasen
570260b4dc Merge pull request #17963 from github/esbena/actions/artifact-v4
chore(actions): bump to artifacts@v4
2024-11-12 15:51:14 +01:00
Taus
1ca2590146 Merge pull request #16764 from github/redsun82/python-match-fps
Python: tests with false positives around `match`
2024-11-12 15:43:32 +01:00
Napalys
c2c6b77b11 Added new test case for TS57 Creating Index Signatures from Non-Literal Method Names in Classes 2024-11-12 14:26:42 +01:00
Esben Sparre Andreasen
a70438b72c chore(action): ruby-dataset-measure w artifacts@v4 2024-11-12 13:58:02 +01:00
Arthur Baars
3b2262be3a Update ruby-dataset-measure.yml 2024-11-12 12:52:09 +00:00
Esben Sparre Andreasen
2f50d25aaa feat(actions/qhelp-preview): unique artifact names 2024-11-12 13:29:09 +01:00
Esben Sparre Andreasen
351daaac8b feat(actions/MAD): matrix-unique artifact names 2024-11-12 13:29:01 +01:00
Esben Sparre Andreasen
b3fff05e7d chore(actions): most workflows onto artifacts@v4
`ruby-dataset-measure.yml` is not updated yet as it requires aid from the language team.
We can presumably disable the workflow during the brownout periods, but a fix will have to be present before the full deprecation happens
2024-11-12 13:26:38 +01:00
Simon Friis Vindum
274d9421a7 Rust: Cache getEnclosingCfgScope 2024-11-12 13:15:20 +01:00
Anders Schack-Mulligen
d7fbf68a59 Merge pull request #17597 from aschackmull/java/chararraywriter-tostring
Java: Add model for CharArrayWriter.toString().
2024-11-12 12:55:44 +01:00
Calum Grant
1a688456f6 Merge pull request #17892 from github/calumgrant/telemetry
C++: Initial telemetry queries
2024-11-12 11:51:37 +00:00
Owen Mansel-Chan
44e865114a Add change note 2024-11-12 11:37:07 +00:00
Owen Mansel-Chan
d31700cf92 Accept changes in models in .expected files 2024-11-12 11:34:29 +00:00
Owen Mansel-Chan
dfd8e7d397 Set subtypes column to True in models
This is almost always what we want.
2024-11-12 11:21:52 +00:00
Napalys
5f8ff125e9 Added change notes 2024-11-12 12:21:39 +01:00
Owen Mansel-Chan
349518b0d7 Merge pull request #17618 from owen-mc/go/mad/subtypes-promoted-methods
Go: Make the models-as-data subtypes column do something more sensible for promoted methods
2024-11-12 11:21:17 +00:00
Napalys
7427a24ca1 Added test case for Array.prototype.toReversed, which is currently not flagged as a taint sink. 2024-11-12 12:02:37 +01:00
Napalys
3215967cbc Added toReserved test case 2024-11-12 12:02:20 +01:00
Napalys
3f0a54c2e8 Added support for Array.prototype.toSorted function 2024-11-12 12:02:04 +01:00
Napalys
def8d75cb8 Added test case for Array.prototype.toSorted, which is currently not flagged as a taint sink. 2024-11-12 12:01:51 +01:00
Calum Grant
91b1cb8a76 C++: Some renaming 2024-11-12 09:49:10 +00:00
Simon Friis Vindum
7517ad3e4b Merge pull request #17959 from paldepind/rust-inline-flow-test
Rust: Setup inline flow test library
2024-11-12 10:47:08 +01:00
Jeroen Ketema
77ae26fca7 Merge pull request #17960 from jketema/guarded-free
C++: Add tests for experimental `cpp/guarded-free` query
2024-11-12 10:43:39 +01:00
Jeroen Ketema
79a9e9c6c0 C++: Address review comments 2024-11-12 10:13:37 +01:00
Napalys Klicius
6266dab518 Merge pull request #17951 from Napalys/napalys/reverse-support
JS: Added support for reverse function
2024-11-12 10:09:18 +01:00
Simon Friis Vindum
d9d3027667 Rust: Make improvements to getArgString based on PR comments 2024-11-12 09:45:33 +01:00
Simon Friis Vindum
03292310b6 Merge branch 'main' into rust-async-blocks 2024-11-12 09:36:04 +01:00
Jeroen Ketema
a29b958f5f C++: Address review comments 2024-11-12 09:08:36 +01:00
Tamás Vajk
ba26281b02 Merge pull request #17955 from tamasvajk/binlog/multiple
C#: Change extractor to accept multiple `binlog` files
2024-11-12 08:58:47 +01:00
Simon Friis Vindum
63d84edfae Rust: Fix minor issues from PR feedback 2024-11-12 08:37:56 +01:00
Owen Mansel-Chan
fd4a6d4bb8 Change note 2024-11-11 23:55:57 +00:00
Owen Mansel-Chan
13fb92ad3e Rename getIntermediateEmbeddedType 2024-11-11 23:53:14 +00:00
Owen Mansel-Chan
d3a6452860 Add missing QLDoc 2024-11-11 23:50:09 +00:00
Owen Mansel-Chan
6af5b55d51 Refactor elementAppliesToQualifier
This is needed for performance when there are lots of embeddings.
2024-11-11 23:50:08 +00:00
Owen Mansel-Chan
3986dffc91 Keep methods and fields separate in SourceOrSinkElement
This improves performance.
2024-11-11 23:50:06 +00:00
Owen Mansel-Chan
b6a31b1def Restrict to Methods 2024-11-11 23:50:04 +00:00
Owen Mansel-Chan
57192e8154 Add even more tests 2024-11-11 23:49:58 +00:00
Owen Mansel-Chan
e813fa346b Fix case in some test-related file names 2024-11-11 23:48:34 +00:00
Owen Mansel-Chan
8abb0594c3 Combine two arms of newtype TSourceOrSinkElement 2024-11-11 23:48:32 +00:00
Owen Mansel-Chan
b2c2a94866 Accept review comment - doc clarification 2024-11-11 23:48:30 +00:00
Owen Mansel-Chan
39afb18ee4 Fix bad join order 2024-11-11 23:48:29 +00:00
Owen Mansel-Chan
80e8015e67 Inline late and remove manual magic 2024-11-11 23:48:27 +00:00
Owen Mansel-Chan
c2aee37210 getSyntacticQualifier -> getSyntacticQualifierBaseType
This improves performance.
2024-11-11 23:48:25 +00:00
Owen Mansel-Chan
ede3b9f033 Improve join order by making a separate predicate 2024-11-11 23:48:23 +00:00
Owen Mansel-Chan
e335737f38 Minor fixes to docs 2024-11-11 23:48:21 +00:00
Owen Mansel-Chan
adc946ec2b Revert simplification to make tests pass 2024-11-11 23:48:19 +00:00
Owen Mansel-Chan
4a1fce9168 Test non-promoted fields and methods 2024-11-11 23:46:10 +00:00
Chris Smowton
f61251cc24 Document elementAppliesToQualifier 2024-11-11 23:43:59 +00:00
Chris Smowton
7ffff43424 Improve comments 2024-11-11 23:43:57 +00:00
Chris Smowton
cd99bea9c1 Explain getSyntacticQual 2024-11-11 23:43:55 +00:00
Chris Smowton
ccc525abd3 Remove probably-unnecessary pragma 2024-11-11 23:43:53 +00:00
Chris Smowton
fd40662ad8 Rename getImplicitFieldReadInstruction 2024-11-11 23:43:51 +00:00
Chris Smowton
e290cecabd Rename ensureCorrectTypeInfo and getSyntacticRecv 2024-11-11 23:43:49 +00:00
Chris Smowton
17a3429f1e Correct hasTypeInfo doc comment 2024-11-11 23:43:47 +00:00
Chris Smowton
20e8d48869 Add comment noting that a Method or Field might have multiple SourceOrSinkElements 2024-11-11 23:43:45 +00:00
Chris Smowton
520acc4b1c Further simplify interpretElement to avoid 'm' only being used on one side of a disjunction 2024-11-11 23:43:44 +00:00
Chris Smowton
d9126d384f Simplify interpretElement 2024-11-11 23:43:42 +00:00
Chris Smowton
e90e313295 Simplify ensureCorrectTypeInfo 2024-11-11 23:43:40 +00:00
Owen Mansel-Chan
e46ec5a171 Fix MaD inheritance 2024-11-11 23:41:11 +00:00
Owen Mansel-Chan
91375d3a49 Update ExternalFlow.qll docs on subtypes column 2024-11-11 23:31:39 +00:00
Owen Mansel-Chan
a277bcbc3e Merge pull request #17941 from owen-mc/go/fix/missing-method-qualified-names
Go: fix missing qualified names for some promoted methods
2024-11-11 22:50:17 +00:00
Calum Grant
317f43d325 C++: Don't use PrintAST in a test 2024-11-11 17:16:47 +00:00
Calum Grant
2351328aa1 C++: Rename SourceFiles metric 2024-11-11 17:16:46 +00:00
Calum Grant
593dcb646b C++: Remove missing includes test 2024-11-11 17:16:44 +00:00
Calum Grant
fb82d435b5 C++: Various renamings 2024-11-11 17:16:43 +00:00
Calum Grant
34ee947d2f C++: Limit number of errors/includes to 50 2024-11-11 17:16:42 +00:00
Calum Grant
e6f3512056 C++: Remove unused class UndefinedIdentifier 2024-11-11 17:16:41 +00:00
Calum Grant
faeff396eb C++: Limit metrics to top 500 2024-11-11 17:16:39 +00:00
Calum Grant
067ecdeea0 C++: Match more tags 2024-11-11 17:16:38 +00:00
Calum Grant
9a81ce8bb4 C++: Separate int and float metrics 2024-11-11 17:16:37 +00:00
Calum Grant
8d2cef632e C++: Minor edits 2024-11-11 17:16:36 +00:00
Calum Grant
6c402adbcc C++: Minor edits 2024-11-11 17:16:35 +00:00
Calum Grant
a53e1dec20 C++: Minor edits 2024-11-11 17:16:34 +00:00
Calum Grant
f6776a4249 C++: Initial telemetry queries and tests 2024-11-11 17:16:32 +00:00
Jeroen Ketema
a5a6445b2e C++: Add tests for experimental cpp/guarded-free query 2024-11-11 17:29:28 +01:00
Simon Friis Vindum
cd2038a8f8 Rust: Setup inline flow test library 2024-11-11 16:41:59 +01:00
Cornelius Riemenschneider
fed240a2b2 Merge pull request #17956 from github/criemen/rust-upd-deps
Rust: Update cargo dependencies.
2024-11-11 16:06:09 +01:00
Napalys
00790bf3f4 Added change notes 2024-11-11 15:43:54 +01:00
Napalys Klicius
1eabb6cbdd Update javascript/ql/test/experimental/Security/CWE-918/check-regex.js
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2024-11-11 15:40:22 +01:00
Napalys Klicius
42f7f73ae1 Update ArrayInPlaceManipulationTaintStep documentation 2024-11-11 15:38:57 +01:00
Michael Nebel
425b1b17d1 Merge pull request #17952 from michaelnebel/java/movemodels
Java: Move non-experimental models out of the experimental folder.
2024-11-11 15:28:53 +01:00
Tamas Vajk
46f168823c Improve code quality 2024-11-11 14:10:13 +01:00
Calum Grant
2f032ec7b8 C++: Revert 17694 and keep tests 2024-11-11 13:06:50 +00:00
Paolo Tranquilli
5ef92a281b Rust: fix integration test on windows 2024-11-11 13:37:25 +01:00
Paolo Tranquilli
34361b81eb Rust: reorganize options integration tests 2024-11-11 13:11:10 +01:00
Tamas Vajk
fe62900a15 C#: Change extractor to accept multiple binlog files 2024-11-11 12:56:24 +01:00
Michael B. Gale
d6ef8c3f9a Merge pull request #17946 from github/dependabot/go_modules/go/extractor/extractor-dependencies-c113e28156
Bump golang.org/x/tools from 0.26.0 to 0.27.0 in /go/extractor in the extractor-dependencies group
2024-11-11 11:31:21 +00:00
Cornelius Riemenschneider
e8aa5db07a Rust: Update cargo dependencies.
There was a recent round of tree-sitter-* package releases,
so the latest code is now a) released and b) available on crates.io.

Therefore, move away from the (super slow on CI) git dependencies to released crates instead.
This also includes a run of `cargo update`, so there's a bunch of more changes to the lockfile.
2024-11-11 12:13:14 +01:00
Simon Friis Vindum
ad6bd88f0a Merge pull request #17954 from paldepind/rust-data-flow-fix-inconsistencies
Rust: Fix data flow fix inconsistencies
2024-11-11 11:56:10 +01:00
Chris Smowton
89a2f0dc00 Merge pull request #17890 from smowton/smowton/fix/kotlin-use-nulltype
Kotlin extractor: use special <nulltype> for null literals
2024-11-11 10:54:21 +00:00
Simon Friis Vindum
aebce746df Rust: Create data flow nodes for parameters in the CFG
Before data flow nodes where created for all parameters in the AST. But
some AST parameters does not lead to any data flow (for instance
parameters in function pointer types).
2024-11-11 11:46:10 +01:00
Simon Friis Vindum
6a3d417836 Rust: Implement enclosing callable for additional classes 2024-11-11 11:11:29 +01:00
Napalys
ae57c12b15 Added change notes 2024-11-11 10:38:14 +01:00
Napalys
82f09f1f8b Updated TS version to 5.7.1-release candidate 2024-11-11 10:19:32 +01:00
Michael Nebel
404ca27aec Java: Move non-experimental models out of the experimental folder. 2024-11-11 10:08:45 +01:00
Paolo Tranquilli
07c59f7562 Rust: fix integration tests 2024-11-11 09:55:46 +01:00
Simon Friis Vindum
bf07aa1cbd Merge pull request #17947 from paldepind/rust-ssa-node-printing
Rust: Mark SSA data flow nodes in output and hide them in paths
2024-11-11 09:55:26 +01:00
Paolo Tranquilli
0298743f2a Merge branch 'main' into redsun82/rust-cargo-options 2024-11-11 09:47:59 +01:00
Simon Friis Vindum
9f0fba16cd Rust: Fix grammar and add documentation comments 2024-11-11 09:46:47 +01:00
Simon Friis Vindum
db1b698689 Rust: Accept fixed spurious results 2024-11-11 08:59:34 +01:00
Simon Friis Vindum
54172774d5 Merge branch 'main' into rust-async-blocks 2024-11-11 08:50:51 +01:00
Simon Friis Vindum
55796badaf Rust: Mark SSA data flow nodes in output and hide them in paths 2024-11-11 08:48:48 +01:00
Simon Friis Vindum
e3662fa97f Merge pull request #17923 from geoffw0/unreachable4
Rust: More tests for rust/deadcode
2024-11-11 08:45:47 +01:00
Napalys
81bc7cd19f Refactored SortTaintStep to ArrayInPlaceManipulationTaintStep to support both sort and reverse functions. Fixed newly added test case. from 8026a99db7 2024-11-11 08:32:03 +01:00
Napalys
1c298f0231 Added test case for Array.prototype.reverse, which is currently not flagged as a potential sink. 2024-11-11 08:32:02 +01:00
Napalys
f1c6dc1d9b Moved SortTaintStep to more appropriate home TaintTracking->Arrays 2024-11-11 08:32:01 +01:00
dependabot[bot]
916184964b 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.26.0 to 0.27.0
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.26.0...v0.27.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-11-11 03:24:36 +00:00
Simon Friis Vindum
a5e13ee71b Rust: Handle async blocks in SSA analysis 2024-11-10 11:59:37 +01:00
Simon Friis Vindum
74a6d9812d Rust: Add SSA test for async blocks 2024-11-10 11:33:03 +01:00
Simon Friis Vindum
8e6844e4da Merge branch 'main' into rust-async-blocks 2024-11-10 09:28:14 +01:00
Alvaro Muñoz
064c983b47 Merge branch 'master' of https://github.com/github/codeql-actions 2024-11-09 10:40:14 +01:00
Alvaro Muñoz
44fd14caaf Bump qlpack versions 2024-11-09 10:40:04 +01:00
Owen Mansel-Chan
0b24235de4 Update test results 2024-11-09 07:56:44 +00:00
Owen Mansel-Chan
9afdee4697 Accept changed test results and improve test 2024-11-09 07:55:02 +00:00
Florin Coada
f3c7352727 Merge pull request #17935 from github/changedocs/2.19.3
Changedocs for 2.19.3
2024-11-08 17:58:54 +00:00
Geoffrey White
727a7d4957 Merge branch 'main' into unreachable4 2024-11-08 17:39:15 +00:00
Paolo Tranquilli
98b7d50e8a Rust: avoid test name with * 2024-11-08 18:20:09 +01:00
Paolo Tranquilli
d9d37dc341 Merge branch 'main' into redsun82/rust-cargo-options 2024-11-08 18:17:54 +01:00
Paolo Tranquilli
5490975a27 Merge pull request #17943 from github/redsun82/rust-accept-inconsistencies
Rust: accept some inconsitencies for now
2024-11-08 18:17:30 +01:00
Kylie Stradley
0110988b1c Merge pull request #105 from github/immutable-actions
Add CodeQL rule for Immutable actions, do not detect immutable actions in unpinned tag rule
2024-11-08 12:15:54 -05:00
Paolo Tranquilli
9684df8535 Rust: accept some inconsitencies for now
The modified result is just a change due to a semantic conflict after introducing some
`toString` implementations.

The new inconsistency should be looked at more in detail.
2024-11-08 18:05:19 +01:00
Paolo Tranquilli
94ba6473dd Merge branch 'main' into redsun82/rust-cargo-options 2024-11-08 17:54:59 +01:00
Kylie Stradley
d6e38d5e83 Do not detect immutable actions in UnpinnedActionsTag
* these should be handles by the UseOfUnversionedImmutableAction.qll query instead
* factor out immutableAction detection for reuse in both queries
* octokit should not longer ping in UnpinnedActionsTag
2024-11-08 11:51:25 -05:00
Paolo Tranquilli
f77f2b7ff0 Rust: turn off the test cfg by default 2024-11-08 17:07:03 +01:00
Paolo Tranquilli
a13c70bd11 Rust: add integration test for cargo options 2024-11-08 16:50:21 +01:00
Owen Mansel-Chan
c8f41206be Add a change note 2024-11-08 14:23:55 +00:00
Geoffrey White
c7112ef278 Rust: Accept consistency check changes. 2024-11-08 14:22:04 +00:00
Simon Friis Vindum
d52a2d67a2 Rust: Create CFG scope for async blocks 2024-11-08 15:00:02 +01:00
Geoffrey White
ede72b2680 Rust: Add unresolved macro calls count as well. 2024-11-08 13:59:05 +00:00
Owen Mansel-Chan
38ee2d418a Fix bug by extracting more pointer types 2024-11-08 13:57:36 +00:00
Owen Mansel-Chan
5094cb851b Add test showing bug (SEmbedP.PMethod not showing) 2024-11-08 13:57:34 +00:00
Simon Friis Vindum
e05b126215 Rust: Add CFG tests for async/await and const 2024-11-08 14:50:07 +01:00
Anders Schack-Mulligen
a311294080 Merge pull request #17932 from aschackmull/java/kotlin-notnull-typeflow
Kotlin: Support NotNullExpr in TypeFlow.
2024-11-08 13:48:15 +01:00
Michael B. Gale
71e4646489 Merge pull request #17934 from github/dependabot/go_modules/go/extractor/extractor-dependencies-ede2484c43
Bump golang.org/x/mod from 0.21.0 to 0.22.0 in /go/extractor in the extractor-dependencies group
2024-11-08 12:43:38 +00:00
Paolo Tranquilli
9cea631399 Merge pull request #17931 from github/redsun82/rust-target-dir
Rust: allow to specify the target directory
2024-11-08 13:34:03 +01:00
Paolo Tranquilli
26839f5e15 Merge pull request #17882 from github/redsun82/rust-resolve
Rust: extract some resolved paths
2024-11-08 13:33:41 +01:00
Geoffrey White
f827ad8157 Rust: Add missing @kind diagnostic query metadata. 2024-11-08 12:33:06 +00:00
Paolo Tranquilli
b9ea78fb32 Rust: fix vector options 2024-11-08 13:06:22 +01:00
Geoffrey White
3805d0f958 Merge branch 'main' into unreachable4 2024-11-08 11:46:34 +00:00
Geoffrey White
0610c265e2 Merge pull request #17913 from geoffw0/unusedvar8
Rust: Fix rust/unused-variable FPs
2024-11-08 11:41:45 +00:00
Paolo Tranquilli
be45e3deed Rust: allow to specify more cargo configuration options
This allows to tweak via extractor options some aspects of the cargo
configuration:
* the target architecture
* features (including `*` for all, which we must understand whether to
  set by default)
* cfg overrides

Integration tests will be added in a follow-up commit.
2024-11-08 12:23:16 +01:00
Geoffrey White
7c2c5ee1fa Rust: Fix expected consistency results. 2024-11-08 11:22:35 +00:00
Geoffrey White
fc444f1f9a Merge branch 'main' into unusedvar8 2024-11-08 11:20:12 +00:00
Florin Coada
bee51091d6 Changedocs for 2.19.3 2024-11-08 10:43:42 +00:00
Geoffrey White
04926df6ea Rust: Add rust/diagnostics/unresolved-macro-calls diagnostic query. 2024-11-08 10:19:43 +00:00
Geoffrey White
0d1bd8a9cd Rust: Add 'order by' to the summary stats query (doesn't seem to affect the test, but affects VSCode runs). 2024-11-08 10:19:42 +00:00
Geoffrey White
7b265b2df3 Rust: Add a deliberately unresolvable macro call to the test. 2024-11-08 09:53:32 +00:00
Erik Krogh Kristensen
9b6c96730d Merge pull request #17912 from mbarbero/patch-1
fix: add "actions" tag to ActionsArtifactLeak
2024-11-08 10:50:43 +01:00
Geoffrey White
7279cc42f8 Rust: Add resolved macros to rust/summary/summary-stats. 2024-11-08 09:49:47 +00:00
Simon Friis Vindum
f2569c45a9 Merge pull request #17921 from paldepind/rust-df-enclosing-callable
Rust: Implement enclosing callable
2024-11-08 10:36:59 +01:00
Paolo Tranquilli
083394073a Rust: rename target_dir to cargo_target_dir, add to extraction options
Also removed the now unused `extract_dependencies` one.
2024-11-08 09:53:50 +01:00
Napalys
70cf1a57bc Now catches usage of RegExp. after matchAll usage. 2024-11-08 08:59:31 +01:00
Napalys
c2baf0bd6d Added test where RegExp. is used after matchAll but it not flagged as potential issue 2024-11-08 08:56:12 +01:00
dependabot[bot]
ccb92357a2 Bump golang.org/x/mod
Bumps the extractor-dependencies group in /go/extractor with 1 update: [golang.org/x/mod](https://github.com/golang/mod).


Updates `golang.org/x/mod` from 0.21.0 to 0.22.0
- [Commits](https://github.com/golang/mod/compare/v0.21.0...v0.22.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-08 04:00:30 +00:00
Kylie Stradley
e8ee798ffa add temporary immutable actions doc page 2024-11-07 15:29:28 -05:00
Dave Bartolomeo
1f3bab2b65 Move data extensions to use codeql org 2024-11-07 11:15:52 -05:00
Dave Bartolomeo
b2100d00aa Add security-and-quality suite 2024-11-07 11:15:34 -05:00
Dave Bartolomeo
99a49fb27f Move packs to codeql org 2024-11-07 10:43:05 -05:00
Calum Grant
39b2d2c3d8 Merge pull request #17906 from github/calumgrant/bmn/wrong-number-format-args
C++: Fix FPs in cpp/wrong-number-format-arguments
2024-11-07 15:05:39 +00:00
Anders Schack-Mulligen
5602570e18 Kotlin: Support NotNullExpr in TypeFlow. 2024-11-07 15:25:23 +01:00
Simon Friis Vindum
22835c28ff Rust: Make a return node the last node before function exit 2024-11-07 15:21:11 +01:00
Tom Hvitved
a35a4b2d98 Merge pull request #17887 from hvitved/dataflow/provenance-order
Data flow: Order provenance output by textual representation
2024-11-07 14:19:18 +01:00
Napalys
dbd57e3870 Fixed issue where TaintTracking was not catching matchAll vulnerability 2024-11-07 13:40:10 +01:00
Napalys
a4fe728af2 Added matchAll test which is not marked as vulnurability by CodeQL 2024-11-07 13:35:09 +01:00
Simon Friis Vindum
1a000ecb46 Rust: Make minor data flow changes based on PR feedback 2024-11-07 13:04:54 +01:00
Napalys
514375dbf9 Fixes false positives from commit 42600c93ff 2024-11-07 13:00:54 +01:00
Paolo Tranquilli
4f6fda0100 Rust: allow to specify the target directory 2024-11-07 12:45:20 +01:00
Michael Nebel
b45b40ea4f C#: Add change note. 2024-11-07 11:55:55 +01:00
Napalys
42600c93ff Added tests which shows false positive SSRF via matchAll 2024-11-07 11:40:20 +01:00
Michael Nebel
71bf900c6c C#: Update FlowSummaries expected tests. 2024-11-07 11:14:02 +01:00
Michael Nebel
a60d9c2ca2 C#: Update .NET8 Runtime models to include generated models for higher order methods. 2024-11-07 11:14:01 +01:00
Michael Nebel
fc8d8bbbb1 Merge pull request #17742 from michaelnebel/csharp/higherordermodels
C#: Models for higher order methods.
2024-11-07 11:12:46 +01:00
Paolo Tranquilli
3488b9fbca Merge pull request #17920 from github/redsun82/rust-files
Rust: exclude uncompiled files from semantics and surface semantic-less reason
2024-11-07 11:04:12 +01:00
Geoffrey White
df7bcfd116 Rust: Accept dataflow consistency check changes. 2024-11-07 09:54:39 +00:00
Tom Hvitved
26b048a645 Address review comment 2024-11-07 10:40:03 +01:00
Napalys
449cee91c8 Fixes false positives from commit 445552d3b53ec9592e8e3892cb337d1004b6a432 2024-11-07 10:33:13 +01:00
Napalys
4106663d89 Added tests for regex sanitization to identify false positives matchAll 2024-11-07 10:27:58 +01:00
Paolo Tranquilli
147d66b587 Merge branch 'main' into redsun82/python-match-fps 2024-11-07 09:46:32 +01:00
Paolo Tranquilli
64d522e447 Rust: address review 2024-11-07 09:39:44 +01:00
Michael Nebel
8041f00bf5 C#: Address more review comments. 2024-11-07 09:24:26 +01:00
Jami
07bb60da92 Merge pull request #17925 from jcogs33/jcogs33/vscode-setting-matchOnWordStartOnly-false
VSCode setting: turn off `editor.suggest.matchOnWordStartOnly`
2024-11-06 18:05:26 -05:00
Jami Cogswell
8e4a312ac7 Turn off editor.suggest.matchOnWordStartOnly 2024-11-06 16:41:20 -05:00
Brandon Stewart
6a1e814cde Merge pull request #106 from github/advanced-config
Add rule to detect cases where CodeQL default setup could be used instead of advanced setup
2024-11-06 15:21:31 -05:00
Brandon Stewart
686e30a52a add qlhelp 2024-11-06 20:20:26 +00:00
Geoffrey White
b3f7a8a46f Merge pull request #17908 from geoffw0/dfcons
Rust: Expose counts of data flow inconsistencies
2024-11-06 19:11:04 +00:00
Geoffrey White
18ce8be302 Update rust/ql/lib/codeql/rust/elements/internal/VariableImpl.qll
Co-authored-by: Simon Friis Vindum <paldepind@github.com>
2024-11-06 19:00:10 +00:00
Geoffrey White
fbfdd57383 Rust: Additional test cases for rust/dead-code. 2024-11-06 17:43:04 +00:00
Geoffrey White
a8b1cb3243 Rust: Make it so that all of the test functions may return. 2024-11-06 17:23:01 +00:00
Paolo Tranquilli
200715773f Rust: fix no_semantics_reason 2024-11-06 17:19:06 +01:00
Michael Nebel
e9c9519d90 C#: Address review comments. 2024-11-06 16:29:20 +01:00
Michael Nebel
55cfbccd43 C#/Java: Exclude summaries using callbacks in fields, properties and synthetic fields. 2024-11-06 16:29:19 +01:00
Michael Nebel
5c389355d0 C#: Simplify delegate read and store steps (remove dependency on parameter). 2024-11-06 16:29:17 +01:00
Michael Nebel
a86cd181a6 Java: Make language specific modifications. 2024-11-06 16:29:16 +01:00
Michael Nebel
395cababb3 C#: Add some model generator examples for higher order methods. 2024-11-06 16:29:14 +01:00
Michael Nebel
fe854812ec C#: Add read and store steps for delegate calls. 2024-11-06 16:29:13 +01:00
Simon Friis Vindum
dadc6059a8 Rust: Implement enclosing callable 2024-11-06 16:23:24 +01:00
Paolo Tranquilli
2987743e44 Rust: exclude uncompiled files from semantics and surface semanticless reason 2024-11-06 15:22:28 +01:00
Geoffrey White
bf0e1008ce Rust: Move some test cases together. 2024-11-06 13:14:52 +00:00
Simon Friis Vindum
ff80b249ca Merge pull request #17917 from paldepind/rust-df-types
Rust: Fix unique type data flow inconsistency
2024-11-06 14:02:00 +01:00
Simon Friis Vindum
60986d8c9b Rust: Fix unique type data flow inconsistency 2024-11-06 13:48:10 +01:00
Anders Schack-Mulligen
4df4a1e6c6 Merge pull request #17863 from aschackmull/shared/universal-flow
Shared: Add a Universal Flow library and refactor TypeFlow to use it.
2024-11-06 13:46:13 +01:00
Tom Hvitved
f8058e40af Merge pull request #17915 from hvitved/rust/pat-literal-cfg
Rust: Include literals in the CFG for literal patterns
2024-11-06 13:09:49 +01:00
Geoffrey White
8a35e151d1 Rust: Move the function pointer parameter exclusion into VariableImpl.qll. 2024-11-06 10:51:41 +00:00
Tom Hvitved
9392bf796a Rust: Include literals in the CFG for literal patterns 2024-11-06 09:21:52 +01:00
Paolo Tranquilli
51f7129c79 Swift: accept integration test change 2024-11-06 08:40:29 +01:00
Paolo Tranquilli
02a0021a26 Swift: tweak mangling of extensions 2024-11-06 08:40:12 +01:00
Paolo Tranquilli
9e1e56f769 Swift: remove obsolete bazel definitions 2024-11-06 08:39:53 +01:00
Paolo Tranquilli
afd4585561 Merge branch 'main' into redsun82/swift-6 2024-11-06 08:05:52 +01:00
Paolo Tranquilli
c875667980 Swift: update to 6.0.2 2024-11-06 08:05:14 +01:00
Simon Friis Vindum
6054855edb Merge pull request #17888 from paldepind/rust-data-flow-consistency
Rust: Data flow additions
2024-11-05 21:29:18 +01:00
Geoffrey White
1a5d2e1f5d Rust: Correct a comment and autoformat. 2024-11-05 15:22:46 +00:00
Geoffrey White
93836a55e2 Rust: Clean up code / clarify responsibilities and fix the issue in rust/unused-value as well. 2024-11-05 15:16:59 +00:00
Geoffrey White
bb5ee525fc Merge pull request #17757 from geoffw0/unusedvar7
Rust: Remove the workaround in rust/unused-variable.
2024-11-05 15:06:48 +00:00
Mikaël Barbero
881fe0ba57 fix: add "actions" tag to ActionsArtifactLeak
Similar to javascript/ql/src/Security/CWE-094/ExpressionInjection.ql
2024-11-05 15:58:46 +01:00
Geoffrey White
278760c735 Rust: Add another exception to rust/unused-variable. 2024-11-05 14:46:32 +00:00
Simon Friis Vindum
262a9f0cfa Rust: Make fixes in data flow based on PR feedback 2024-11-05 15:37:44 +01:00
Geoffrey White
35ffd0cc9c Rust: Add more test cases for unused variables (inspired by real world FPs). 2024-11-05 14:07:10 +00:00
Geoffrey White
3091083705 Rust: Call all the test cases. 2024-11-05 11:02:38 +00:00
Geoffrey White
088dd50f1f Rust: Update tests. 2024-11-05 10:30:41 +00:00
Napalys Klicius
5e8b1b061f Update javascript/ql/src/Security/CWE-020/MissingRegExpAnchor.ql
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2024-11-05 10:29:22 +01:00
Napalys Klicius
7825a46085 Merge branch 'github:main' into napalys/matchAll-support 2024-11-05 09:31:30 +01:00
Napalys
b239bfabf1 Added tests forIncompleteHostnameRegExp and normalizedPaths using matchAll 2024-11-05 09:22:26 +01:00
Paolo Tranquilli
87a08fe5fa Merge pull request #17891 from geoffw0/swift6models
Swift: Update models for better Swift 6 compatibility.
2024-11-05 08:55:26 +01:00
Napalys
ccee34d6d3 Added support for matchAll in CWE-020 including new test cases 2024-11-05 08:51:24 +01:00
Geoffrey White
c8c747a110 Rust: Add total data flow inconsistencies to rust/summary/summary-statistics. 2024-11-04 19:10:44 +00:00
Geoffrey White
30cc55005d Rust: Add rust/diagnostics/data-flow-consistency-counts query for data flow inconsistency counts. 2024-11-04 19:09:30 +00:00
Simon Friis Vindum
c7b4e7c30a Rust: Small improvements to data flow
The predicate `ssaDefAssigns` was definitely broken before
2024-11-04 20:01:58 +01:00
Simon Friis Vindum
d9636b37b6 Rust: Add data flow test with assignment to mutable variable 2024-11-04 20:00:36 +01:00
Geoffrey White
91ebc0eb45 Rust: Add metadata to the DataFlowConsistency.ql query. 2024-11-04 18:53:34 +00:00
Geoffrey White
a645a9e829 Rust: Add getInconsistencyCounts predicate to the shared DataFlowImplConsistency.qll, so it's possibly to access inconsistency data as a whole. 2024-11-04 18:52:20 +00:00
Chuan-kai Lin
3cdf94e83a Merge pull request #17904 from github/post-release-prep/codeql-cli-2.19.3
Post-release preparation for codeql-cli-2.19.3
2024-11-04 10:14:12 -08:00
Calum Grant
397bf7c5e2 C++: Fix FPs caused by a syntax error 2024-11-04 17:38:16 +00:00
Calum Grant
496efeed7e C++: Add a test for cpp/wrong-number-format-arguments 2024-11-04 17:36:23 +00:00
github-actions[bot]
f107d16b4e Post-release preparation for codeql-cli-2.19.3 2024-11-04 17:20:08 +00:00
Kylie Stradley
0e94777b13 Merge branch 'master' into immutable-actions 2024-11-04 11:57:06 -05:00
Chuan-kai Lin
39a67b6e2e Merge pull request #17903 from github/release-prep/2.19.3
Release preparation for version 2.19.3
2024-11-04 08:42:12 -08:00
github-actions[bot]
cc7b724123 Release preparation for version 2.19.3 2024-11-04 16:37:28 +00:00
Kylie Stradley
5bf02e73ea Update ql/src/Security/CWE-829/UnpinnedActionsTag.ql
Co-authored-by: Alvaro Muñoz <pwntester@github.com>
2024-11-04 11:30:29 -05:00
Simon Friis Vindum
8d59b9289b Rust: Make improvements to data flow based on PR feedback 2024-11-04 16:42:05 +01:00
Geoffrey White
5a34c166b7 Rust: Remove the workaround in rust/unused-variable. 2024-11-04 15:31:43 +00:00
Simon Friis Vindum
2818893010 Rust: Refactor AstCfgNode to use a field
Co-authored-by: Tom Hvitved <hvitved@github.com>
2024-11-04 15:01:25 +01:00
Florin Coada
7418d8ed24 Merge pull request #17832 from github/changedocs/2.19.2
CodeQL 2.19.2 changedocs
2024-11-04 13:56:28 +00:00
Tom Hvitved
0aee809697 Merge pull request #17899 from hvitved/accept-changes-multi-jobs
Handle matrix jobs in accept changes script
2024-11-04 14:54:21 +01:00
Alvaro Muñoz
ae6856ab5a models: add new control check model 2024-11-04 14:44:13 +01:00
Rasmus Wriedt Larsen
5f20f1984c expected-changes: Use set constructor 2024-11-04 14:14:15 +01:00
Rasmus Wriedt Larsen
8f80c24270 Merge pull request #17256 from RasmusWL/js-threat-models
JS: Add support for threat models
2024-11-04 14:04:12 +01:00
Simon Friis Vindum
34e8ea17d8 Merge pull request #17898 from paldepind/rust-cfg-refactor
Rust: CFG classes are in expression module iff they correspond to exp…
2024-11-04 13:01:15 +01:00
Tom Hvitved
95e9d013cc Update expected test output 2024-11-04 12:07:06 +01:00
Tom Hvitved
a89c82bf74 Handle matrix jobs in accept changes script 2024-11-04 11:49:35 +01:00
Simon Friis Vindum
6b25bea2e5 Rust: Accept consistency results 2024-11-04 11:28:26 +01:00
Simon Friis Vindum
a3c7d5a469 Merge branch 'main' into rust-data-flow-consistency 2024-11-04 11:10:48 +01:00
Simon Friis Vindum
fb26f7861f Merge pull request #17895 from paldepind/rust-data-flow-consistency-query
Rust: Add data flow consistency queries
2024-11-04 11:07:46 +01:00
Simon Friis Vindum
714e2fc2c1 Merge branch 'main' into rust-data-flow-consistency-query 2024-11-04 10:42:53 +01:00
Simon Friis Vindum
2ae721bd54 Merge pull request #17897 from github/redsun82/rust-fix-compilation
Rust: fix semantic merge conflict about semantics
2024-11-04 10:35:47 +01:00
Simon Friis Vindum
633bac633c Rust: CFG classes are in expression module iff they correspond to expressions 2024-11-04 10:34:08 +01:00
Simon Friis Vindum
7f344fab78 Rust: Add data flow consistency queries 2024-11-04 10:17:50 +01:00
Alvaro Muñoz
4f62573d17 Bump qlpack versions 2024-11-04 10:11:52 +01:00
Alvaro Muñoz
55476af179 Merge pull request #107 from github/query_if
query: split if expression is always true query
2024-11-04 10:11:14 +01:00
Alvaro Muñoz
db6f174b79 query: split if expression is always true query
critical - if the if statement contains a known control check
high - otherwise
2024-11-04 10:10:47 +01:00
Paolo Tranquilli
6848a22c65 Rust: fix semantic merge conflict about semantics 2024-11-04 10:04:40 +01:00
Paolo Tranquilli
bde517fcb1 Merge pull request #17849 from github/aibaars/single-semantics
Rust: try to speed things up a bit
2024-11-04 09:24:26 +01:00
Tom Hvitved
8b8b721788 Data flow: Order provenance output by textual representation 2024-11-04 08:47:30 +01:00
Jami Cogswell
459d16824e Java: weak crypto: do not report weak hash algorithms 2024-11-03 18:22:06 -05:00
Alvaro Muñoz
80f2b24eeb Bump qlpack versions 2024-11-03 22:29:50 +01:00
Alvaro Muñoz
ea20e9b337 fix: Add versioned python binaries to poisonable steps 2024-11-03 22:29:20 +01:00
Simon Friis Vindum
82076ee0b8 Rust: Propagate data flow through a few expression types 2024-11-03 16:12:59 +01:00
Simon Friis Vindum
2bab29d31b Rust: Add local data flow step tests 2024-11-03 16:12:58 +01:00
Simon Friis Vindum
01141ccdc9 Rust: Integrate SSA into data flow 2024-11-03 16:12:56 +01:00
Tom Hvitved
662a824312 Merge pull request #17865 from hvitved/rust/unused-macro-expansion 2024-11-03 09:17:14 +01:00
Chris Smowton
81ff394533 Be explicit about Kotlin database type 2024-11-01 19:02:28 +00:00
Geoffrey White
24c4e87f44 Swift: Fix stray []. 2024-11-01 16:30:15 +00:00
Geoffrey White
f3ea75d27c Swift: Further modelling updates / gap filling that doesn't seem to affect tests. 2024-11-01 16:19:41 +00:00
Geoffrey White
954fbc44bf Swift: Update prefix / suffix models for Swift 6. 2024-11-01 16:19:39 +00:00
Geoffrey White
be12649838 Swift: Update joined models for Swift 6. 2024-11-01 16:19:36 +00:00
Geoffrey White
6f0f73974a Swift: Update dropFirst / dropLast / reversed models for Swift 6. 2024-11-01 16:19:34 +00:00
Chris Smowton
5d3f723df9 Kotlin extractor: use special <nulltype> for null literals
This matches the Java extractor's treatment of these literals, and so enables dataflow type-tracking to avoid special-casing Kotlin. Natively, Kotlin would regard this as kotlin.Nothing?, the type that can only contain null (kotlin.Nothing without a ? can take nothing at all), which gets Java-ified as java.lang.Void, and this will continue to be used when a null type has to be "boxed", as in representing substituted generic constraints with no possible type.
2024-11-01 16:14:10 +00:00
Tom Hvitved
c4adec3010 Address review comment 2024-11-01 15:28:17 +01:00
yoff
cec0544ca5 Merge pull request #17789 from aschackmull/python/resolvecall-refactor
Python: Refactor references to NormalCall.
2024-11-01 14:20:34 +01:00
Anders Schack-Mulligen
bae61875cd UniversalFlow: Fixup some qldoc. 2024-11-01 14:04:27 +01:00
Taus
0bb5b4b9dc Merge pull request #17875 from github/tausbn/python-improve-parser-logging-and-timing
Python: Improve parser logging/timing/customisability
2024-11-01 12:47:46 +01:00
Taus
2892f0ff48 Merge pull request #17873 from github/tausbn/python-fix-generator-expression-locations
Python: Even more parser fixes
2024-11-01 12:47:19 +01:00
Simon Friis Vindum
a36095d85b Rust: Add local data flow test with if expression 2024-11-01 11:28:10 +01:00
Rasmus Wriedt Larsen
c0ad9ba529 Merge branch 'main' into js-threat-models 2024-11-01 10:48:32 +01:00
Rasmus Wriedt Larsen
dc8e645594 JS: Convert remaining queries to use ActiveThreatModelSourceAsSource 2024-11-01 10:47:10 +01:00
Tom Hvitved
03ffaac87a Merge pull request #17880 from hvitved/ruby/symbol-string-key-indifference
Ruby: Do not distinguish between symbols and strings in hash keys
2024-11-01 10:43:56 +01:00
Rasmus Wriedt Larsen
19fae76a94 JS: Remove dummy comment
Co-authored-by: Asger F <asgerf@github.com>
2024-11-01 10:24:22 +01:00
Paolo Tranquilli
03aef50836 Merge pull request #17883 from github/redsun82/rust-analysis
Rust: use common config for analysis
2024-10-31 17:46:15 +01:00
Paolo Tranquilli
c6585b726a Rust: use common config for analysis
Now that the nightly bundle has the default query set, we don't need a special
inline config.
2024-10-31 16:44:07 +01:00
Brandon Stewart
0b7de6e86a add rule to detect if default setup would be more appropriate 2024-10-31 15:28:55 +00:00
Jeroen Ketema
03ced1795a Merge pull request #17694 from jketema/multiple-entry-point
C++: Do not generate IR for functions with multiple entry points
2024-10-31 16:16:03 +01:00
Paolo Tranquilli
e5a199b821 Rust: accept test changes due to toString implementations 2024-10-31 16:02:56 +01:00
Paolo Tranquilli
1f356078ff Swift: temporarily accept test changes 2024-10-31 15:57:31 +01:00
Rasmus Wriedt Larsen
61e60de969 JS: Model readline as a stdin threat-model source
Technically not always true, but my assumption is that +90% of the time
that's what it will be used for, so while we could be more precise by
adding a taint-step from the `input` part of the construction, I'm not
sure it's worth it in this case.

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

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

File copied from 7cef4322e7/javascript/externs/nodejs/fs.js
2024-10-31 13:51:22 +01:00
Alvaro Muñoz
45b7547016 chore: clean up partial.ql debug query 2024-10-31 13:38:38 +01:00
Alvaro Muñoz
0211902116 models: add models for zentered/issue-forms-parser 2024-10-31 13:38:17 +01:00
Alvaro Muñoz
d85ca10772 fix: account for tojson(expr) expressions 2024-10-31 13:36:59 +01:00
Rasmus Wriedt Larsen
b47fa77dc6 JS: Add tests for stdin threat-model sources 2024-10-31 12:59:21 +01:00
Tom Hvitved
d0f9a0b9ce Rust: Add another unused-value test 2024-10-31 11:43:33 +01:00
Tom Hvitved
55a6ed7e8a Rust: Include link to variable in unused value query 2024-10-31 11:42:44 +01:00
Tom Hvitved
2b340b18dd Rust: Exclude results inside macro expansions from unused entity queries 2024-10-31 11:42:43 +01:00
Tom Hvitved
fec31a6da4 Rust: Include variable name in Unused{Variable,Value}.ql 2024-10-31 11:42:41 +01:00
Tom Hvitved
6b60865d7e Ruby: Do not distinguish between symbols and strings in hash keys 2024-10-31 11:42:09 +01:00
Tom Hvitved
2b37c6cd32 Merge pull request #17548 from hvitved/shared/inline-test-post-process
Shared: Post-processing query for inline test expectations
2024-10-31 11:40:11 +01:00
Tom Hvitved
f04a55ecb5 Ruby: Update hash extension tests 2024-10-31 11:00:33 +01:00
Alvaro Muñoz
ebd45ace50 feat: add source model for peter-murra/issue-forms-body-parser 2024-10-31 10:59:05 +01:00
Jeroen Ketema
5e3748ac12 C++: Update expected test results 2024-10-31 10:57:12 +01:00
Jeroen Ketema
1a830cdf14 C++: Do not generate IR for functions with multiple entry points in different locations 2024-10-31 10:55:52 +01:00
Jeroen Ketema
8cfd19cf2f C++: Add multiple entry point test 2024-10-31 10:55:48 +01:00
Tom Hvitved
977eb05f31 Merge pull request #17879 from paldepind/rust-speculative-taint
Rust: Add predicate for speculative taint step
2024-10-31 10:17:48 +01:00
Paolo Tranquilli
5a045beff9 Swift: turn off SIL verifications 2024-10-31 10:03:08 +01:00
Paolo Tranquilli
ce4273d461 Revert "Swift: use -typecheck in QL tests"
This reverts commit 34b8b43843.
2024-10-31 09:52:08 +01:00
Paolo Tranquilli
3aa7123032 Swift: restrict UnresolvedAstNodes to known locations 2024-10-31 09:26:14 +01:00
Simon Friis Vindum
00b8a29da7 Rust: Add predicate for speculative taint step 2024-10-31 09:09:39 +01:00
Simon Friis Vindum
b96698aee3 Merge pull request #17871 from paldepind/rust-data-flow-skeleton
Rust: Add basic skeleton setup for data flow
2024-10-31 08:26:11 +01:00
Tom Hvitved
c936468b17 Merge pull request #17739 from hvitved/dataflow/big-step-quadratic 2024-10-31 08:16:16 +01:00
Anders Schack-Mulligen
b556590ef8 Merge pull request #17663 from aschackmull/dataflow/speculative-flow
Dataflow: Add support for speculative taint flow.
2024-10-31 08:12:43 +01:00
Paolo Tranquilli
34b8b43843 Swift: use -typecheck in QL tests 2024-10-31 06:41:46 +01:00
Paolo Tranquilli
7f3745cfcd Swift: fix @isolated(any) DB inconsistencies 2024-10-31 06:22:06 +01:00
Alvaro Muñoz
0157bf3297 fix: improve JS require/import poisonable step to account for cwd 2024-10-30 22:12:17 +01:00
Kevin Stubbings
ac411f1254 Second round feedback 2024-10-30 13:52:38 -07:00
Paolo Tranquilli
7e8a09aea1 Merge pull request #17825 from github/redsun82/rust-canonical-path
Rust: add `extended_canonical_path` and `crate_origin` to `Item`
2024-10-30 18:13:05 +01:00
Paolo Tranquilli
66e43c4006 Swift: use ubuntu 22.04 2024-10-30 17:16:35 +01:00
Paolo Tranquilli
3877eb8bc9 Swift: tentatively fix type mangling 2024-10-30 17:08:20 +01:00
Paolo Tranquilli
01417025f2 Swift: use ubuntu-latest 2024-10-30 16:20:27 +01:00
Paolo Tranquilli
5e6228cf7c Swift: fix 2024-10-30 16:11:08 +01:00
Simon Friis Vindum
efa59fd2b6 Rust: Make changes based on PR feedback 2024-10-30 16:01:26 +01:00
Paolo Tranquilli
df8184e0dc Swift: fix check-no-override job 2024-10-30 15:59:03 +01:00
Paolo Tranquilli
d325b8e678 Swift: update load.bzl and resources 2024-10-30 15:56:48 +01:00
Anders Schack-Mulligen
570b042645 Dataflow: Rename SpeculativeFlow to SpeculativeGlobal. 2024-10-30 15:23:15 +01:00
Anders Schack-Mulligen
9b493c1e1b Java: Fix bug related to null inference for pattern initializer. 2024-10-30 15:05:36 +01:00
Taus
2ef3ae9860 Python: Improve parser logging/timing/customisability
Does a bunch of things, unfortunately all in the same place, so my
apologies in advance for a slightly complicated commit.

As for the changes themselves, this commit

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

In the downgrade direction, we explicitly remove the relevant child (via
the `py_exprs` database relation) for `TypeVar`, `TypeVarTuple`, and
`ParamSpec` parameters.
2024-10-15 11:22:33 +00:00
Taus
819b3d77ab Python: Update test expectations
Note that this still includes the somewhat puzzling parsing of
`Spam[**P2]` as an exponentiation with an empty left hand side. When we
fix that bug, we should also update this test to contain actually valid
syntax.
2024-10-15 11:22:33 +00:00
Taus
182a192cc0 Python: Regenerate dbscheme/AST 2024-10-15 11:22:33 +00:00
Taus
36d89745f9 Python: Fix dbscheme/AST autogeneration
There was an errant `ql` in the relevant paths, a leftover from the move
from the internal repo. Also, we can no longer rely on an intree version
of the CodeQL CLI, so from now on we'll just assume it's present in the
path. (On Codespaces, `gh codeql` is a decent replacement, especially if
using the `install-stub` functionality.
2024-10-15 11:22:32 +00:00
Taus
2af0d78435 Python: Add default field to the relevant AST nodes 2024-10-15 11:22:32 +00:00
Taus
55ee3eb36b Python: Add TSG support for type defaults 2024-10-15 11:22:31 +00:00
Taus
6545bfffa7 Python: Regenerate parser files
Two new files -- alloc.h and array.h -- suddenly appeared. Presumably
they are used by the somewhat newer version of tree-sitter. To be safe,
I included them in this commit.
2024-10-15 11:22:31 +00:00
Taus
882249ef82 Python: Add grammar support for type defaults
Also fixes an oversight in the grammar: starred expressions should be
allowed inside the subscript of an `Index` expression.
2024-10-15 11:22:30 +00:00
Taus
1ced5b44d7 Python: Add test for type parameter defaults 2024-10-15 11:22:30 +00:00
Ian Lynagh
24d98eef83 Merge pull request #17741 from github/igfoo/logverb
Kotlin: Log our verbosity level
2024-10-15 11:42:15 +01:00
Geoffrey White
abc4981300 Rust: Address QL-for-QL complaint. 2024-10-15 11:30:03 +01:00
Geoffrey White
983179b84e Rust: Autoformat. 2024-10-15 11:23:16 +01:00
Paolo Tranquilli
248eb7f00c Merge branch 'main' into rust/callable-base 2024-10-15 11:03:11 +02:00
Alvaro Muñoz
e2e1dddb36 Move arg injection sinks to ShellScript class 2024-10-15 09:48:01 +02:00
Alvaro Muñoz
2e5379f289 Update expected tests 2024-10-14 15:10:31 +02:00
Alvaro Muñoz
ff17d1dcb1 Add CmdI test 2024-10-14 12:50:11 +02:00
Alvaro Muñoz
3b95ae0b53 Bump QLPacks versions 2024-10-14 12:15:58 +02:00
Alvaro Muñoz
7fa77e2728 Delete test script 2024-10-14 12:05:00 +02:00
Alvaro Muñoz
be87eccbe7 Refactor Script support 2024-10-14 12:04:20 +02:00
Alvaro Muñoz
a09acb5462 Better parsing of Bash script commands 2024-10-13 11:56:09 +02:00
Alvaro Muñoz
c7b57b5b77 Merge command and file store steps 2024-10-13 11:55:41 +02:00
Geoffrey White
ac9a8d602c Rust: Add metadata to the original CFG consistency query. 2024-10-11 17:01:47 +01:00
Geoffrey White
d4c3e3323f Rust: Add diagnostic query for CFG inconsistency counts. 2024-10-11 17:01:46 +01:00
Geoffrey White
7b712f3d65 Rust: Calculate a total of CFG inconsistencies. 2024-10-11 17:01:41 +01:00
Geoffrey White
4398c83a67 Rust: Add more QLDoc to the CFG consistency library. 2024-10-11 16:53:46 +01:00
Geoffrey White
85f2582afd Rust: Move CFG consistency logic into a library. 2024-10-11 16:53:45 +01:00
Ian Lynagh
9f340279cb Kotlin: Accept test changes 2024-10-11 15:10:19 +01:00
Ian Lynagh
156ddd3fae Kotlin: Log our verbosity level
This happens at `info` level, which is logged by default.
2024-10-11 14:24:25 +01:00
Tom Hvitved
0ec40afa4c Rust: Update expected test output 2024-10-11 12:44:35 +02:00
Owen Mansel-Chan
9381dda4a9 Use un-specialized field when extracting struct types 2024-10-11 11:30:02 +01:00
Owen Mansel-Chan
6bf6ed6f48 Add check for object for specialized named type 2024-10-11 11:30:00 +01:00
Owen Mansel-Chan
a810309160 Add check for specialized objects 2024-10-11 11:29:58 +01:00
Owen Mansel-Chan
45710e23c6 Always use generic method object 2024-10-11 11:29:57 +01:00
Alvaro Muñoz
48fa2967ed Bump qlpack versions 2024-10-11 12:22:40 +02:00
Alvaro Muñoz
ba5e1ed22f Merge pull request #102 from github/moar_poisonable_steps
Major refactor
2024-10-11 12:21:57 +02:00
Alvaro Muñoz
99e92af034 Update tests 2024-10-11 12:20:57 +02:00
Alvaro Muñoz
1e749ae6d5 Add new poisonable step 2024-10-11 12:20:39 +02:00
Alvaro Muñoz
ee25f35653 Refactor of Bash functions 2024-10-11 12:20:26 +02:00
Alvaro Muñoz
d558ff80c3 New Command sources for git and GITHUB_EVENT_PATH 2024-10-11 12:20:03 +02:00
Alvaro Muñoz
d4a24dfdd1 Refactor FlowSteps 2024-10-11 12:19:22 +02:00
Alvaro Muñoz
898507eb54 Update publish.yml 2024-10-11 12:17:35 +02:00
Tom Hvitved
8cc349e85f Rust: Run codegen 2024-10-11 12:01:16 +02:00
Tom Hvitved
b284a2a7c0 Rust: Add Callable as a base class of Function and ClosureExpr 2024-10-11 12:00:30 +02:00
Alvaro Muñoz
6a99845ecf Remove old code to handle redirections to GITHUB_ENV
Redirections to GITHUB_ENV are better handled now by the Bash module
----
2024-10-10 22:22:56 +02:00
Geoffrey White
b692b1b282 C++: Autoformat. 2024-10-10 17:26:38 +01:00
Geoffrey White
cedfeee6d7 Merge branch 'main' into aliasperf2 2024-10-10 17:25:45 +01:00
Owen Mansel-Chan
500992c499 Update qhelp to explain possible source of FPs 2024-10-09 15:08:48 +01:00
Paolo Tranquilli
524686ce37 Swift: make extractor compilable with Swift 6 2024-10-08 16:39:21 +02:00
Geoffrey White
7ff376b346 Merge branch 'main' into aliasperf2 2024-10-08 15:08:43 +01:00
Geoffrey White
4a131dd8f1 C++: Implement dbartol's suggestion. 2024-10-08 14:44:45 +01:00
Geoffrey White
f9fa52fe77 C++: Disabled the change again. 2024-10-08 14:43:56 +01:00
Alvaro Muñoz
b7aba1f081 Bump qlpack versions 2024-10-04 18:05:58 +02:00
Alvaro Muñoz
742602d794 Merge pull request #101 from github/control_checks/toctou_split
Improve control checks to better account for toctou issues
2024-10-04 18:04:33 +02:00
Alvaro Muñoz
860eda9c04 Improve control checks to better account for toctou issues 2024-10-04 18:04:13 +02:00
Alvaro Muñoz
a3cf8766ff Bump qlpack versions 2024-10-03 14:42:23 +02:00
Alvaro Muñoz
c90690d338 Merge pull request #100 from github/arginj_exp
Make Argument Injection queries experimental
2024-10-03 14:41:38 +02:00
Alvaro Muñoz
0c9b808fdf Make Argument Injection queries experimental 2024-10-03 14:41:18 +02:00
Alvaro Muñoz
350b354fb3 remmove leftover comments 2024-10-03 14:17:45 +02:00
Alvaro Muñoz
5494f7f099 Bump qlpack versions 2024-10-03 14:16:37 +02:00
Alvaro Muñoz
a6302913cd Merge pull request #99 from github/bash_parser
Improve Bash script parser
2024-10-03 14:13:53 +02:00
Alvaro Muñoz
7d2cbc1f50 Improve Bash script parser 2024-10-03 14:13:27 +02:00
Alvaro Muñoz
68da482352 Bump qlpack versions 2024-10-02 12:36:49 +02:00
Alvaro Muñoz
cd1827e3c9 Merge pull request #98 from github/improve_arginj
improve arginj
2024-10-02 12:36:06 +02:00
Alvaro Muñoz
531f3d40c0 Add tests for new bash parser 2024-10-02 12:35:09 +02:00
Alvaro Muñoz
6b98a5b5b1 Update tests 2024-10-02 12:34:27 +02:00
Alvaro Muñoz
8052696836 Add new Poisonable step for bun 2024-10-02 12:34:10 +02:00
Alvaro Muñoz
c58246363e Add new Argument Injection sinks 2024-10-02 12:34:01 +02:00
Alvaro Muñoz
a5075e5216 Change queries to use the new bash parser 2024-10-02 12:33:42 +02:00
Alvaro Muñoz
2727bf5e2f Add improved Bash script parser 2024-10-02 12:33:05 +02:00
Alvaro Muñoz
4b74adec4b Account for branches filter as a way to prevent workflow_run to trigger on PRs from forks 2024-10-02 12:31:59 +02:00
Alvaro Muñoz
ef37e3c594 Bump qlpack versions 2024-10-01 14:22:08 +02:00
Alvaro Muñoz
853fdf0d35 Merge pull request #97 from github/rasmuswl/avoid-duplicate-code-injection-alerts
Suppress `actions/cache-poisoning/code-injection` alerts covered by `actions/code-injection/critical`
2024-10-01 11:47:41 +02:00
Alvaro Muñoz
4274673628 Merge pull request #95 from github/rasmuswl/fix-qhelp-file 2024-10-01 10:10:27 +02:00
Rasmus Wriedt Larsen
726392c8b7 Suppress actions/cache-poisoning/code-injection alerts covered by actions/code-injection/critical 2024-10-01 09:48:16 +02:00
Alvaro Muñoz
c7fde2a40d Bump qlpack versions 2024-09-30 15:35:00 +02:00
Alvaro Muñoz
7e89c04e61 Merge pull request #96 from github/fix/repo_control_check
fix: Repository checks do not protect workflow_run triggered jobs
2024-09-30 15:28:07 +02:00
Alvaro Muñoz
e0a2eb93d6 fix: Repository checks do not protect workflow_run triggered jobs 2024-09-30 15:27:15 +02:00
Rasmus Wriedt Larsen
c10d5a113e Rename help-file to match .ql file
Reported by running

```
codeql generate query-help --format sarifv2.1.0 --output help.sairf ql/src/codeql-suites/actions-code-scanning.qls
```
2024-09-30 15:13:32 +02:00
Alvaro Muñoz
4edfdb4101 Bump qlpack versions 2024-09-28 23:59:23 +02:00
Alvaro Muñoz
fce300ee92 Merge pull request #94 from github/fix/sanitizer_scalar_value
Fix: ControlChecks protects/dominates only work with Steps. A sink can be in a sub-step node (eg: ScalarValue)
2024-09-28 23:58:47 +02:00
Alvaro Muñoz
f2c5a14883 Fix: ControlChecks protects/dominates only work with Steps. A sink can be in a sub-step node (eg: ScalarValue) 2024-09-28 23:57:32 +02:00
Alvaro Muñoz
1b3b47bb1e Bump qlpack versions 2024-09-27 21:39:51 +02:00
Alvaro Muñoz
05d4b3c9f4 Merge pull request #93 from github/ppe_from_rfs
Add remote flow sources as a mutable ref source for untrusted checkouts
2024-09-27 21:39:16 +02:00
Alvaro Muñoz
4fffde2fc5 Add remote flow sources as a mutable ref source for untrusted checkouts 2024-09-27 21:38:38 +02:00
Alvaro Muñoz
294ebe56c6 Merge branch 'master' of https://github.com/github/codeql-actions 2024-09-27 18:33:55 +02:00
Alvaro Muñoz
1a5a3044c2 Bump qlpack versions 2024-09-27 18:25:31 +02:00
Alvaro Muñoz
2e6f004bda Merge pull request #92 from github/fix/direct_cache_poison
Improve path checks for Artifact and Cache poisoning queries
2024-09-27 18:25:00 +02:00
Alvaro Muñoz
9d26a8da26 Improve path checks for Artifact and Cache poisoning queries 2024-09-27 18:22:35 +02:00
Alvaro Muñoz
65d09b3a4b Merge pull request #91 from github/fix/artpoison
Improve artifact poisoning query
2024-09-27 12:45:59 +02:00
Alvaro Muñoz
86c1d9c30f Improve artifact poisoning query
Better check of download path
Add downloading to /tmp as a sanitizer
2024-09-27 12:35:10 +02:00
Anders Schack-Mulligen
2d76752ca0 Java: Add model for CharArrayWriter.toString(). 2024-09-27 11:28:20 +02:00
Alvaro Muñoz
26f829eff4 Bump qlpack versions 2024-09-27 10:29:47 +02:00
Alvaro Muñoz
27752c7590 Merge pull request #90 from github/regexp_actions
Add new sources and summary steps
2024-09-27 10:29:06 +02:00
Alvaro Muñoz
010ad359d7 Add new sources and summary steps 2024-09-27 10:28:44 +02:00
Alvaro Muñoz
71960b3ddd Bump qlpack versions 2024-09-25 18:22:46 +02:00
Alvaro Muñoz
62162a5771 Merge pull request #89 from github/change_sources
Add new sources for github.event.changes
2024-09-25 18:22:14 +02:00
Alvaro Muñoz
16f1a53584 Add new sources for github.event.changes 2024-09-25 18:21:54 +02:00
Alvaro Muñoz
e147a0bc71 Bump qlpack versions 2024-09-25 15:26:31 +02:00
Alvaro Muñoz
b1ddbc9d13 Improve Control Checks 2024-09-25 15:25:56 +02:00
Alvaro Muñoz
153fb492f7 Update tests 2024-09-24 23:14:37 +02:00
Alvaro Muñoz
43b61eb072 Bump qlpack versions 2024-09-24 23:04:57 +02:00
Alvaro Muñoz
356c200158 Composite Action steps's getEnclosingJob should return the calling job 2024-09-24 23:03:55 +02:00
Alvaro Muñoz
0d55b4e784 Bump qlpack versions 2024-09-24 21:59:10 +02:00
Alvaro Muñoz
f26e41db3f Merge pull request #88 from github/DFG/composite_actions
DFG/composite actions
2024-09-24 21:58:07 +02:00
Alvaro Muñoz
f095622a9b Update expected test results 2024-09-24 21:50:59 +02:00
Alvaro Muñoz
e8a667fdc6 Add new tests 2024-09-24 21:43:31 +02:00
Alvaro Muñoz
4fc9e3f0f1 Add Composite action's outputs as a return node 2024-09-24 21:43:10 +02:00
Alvaro Muñoz
7c2386bbee Simplify callable/call matches 2024-09-24 21:42:52 +02:00
Alvaro Muñoz
ef549ef795 Add Outputs nodes as CFG/DFG nodes 2024-09-24 21:41:03 +02:00
Alvaro Muñoz
ffbddb1073 Simplify Callable/call match 2024-09-24 21:40:15 +02:00
Alvaro Muñoz
090d22fa7a Add GetRepoRoot helper function 2024-09-24 21:38:42 +02:00
Alvaro Muñoz
abd49d5b11 Improve privilege workflow detection 2024-09-24 12:12:29 +02:00
Alvaro Muñoz
fe06c9e5fa d /Users/pwntester/src/github.com/github/codeql-actions/ql 2024-09-24 12:12:09 +02:00
Kevin Stubbings
02a664319a formatting 2024-09-23 15:10:25 -07:00
Kevin Stubbings
e6b775422d Remove redundant imports 2024-09-23 15:08:24 -07:00
Kevin Stubbings
b1c0e28aff Extra test 2024-09-23 15:00:23 -07:00
Kevin Stubbings
05765c4284 Formatting 2024-09-23 14:51:50 -07:00
Kevin Stubbings
5d12f7bd30 Pre formatting Bottle tests 2024-09-23 14:37:22 -07:00
Alvaro Muñoz
2bfb156508 d /Users/pwntester/src/github.com/github/codeql-actions/ql 2024-09-23 23:08:58 +02:00
Alvaro Muñoz
610dcaf23d Bump qlpack versions 2024-09-23 12:31:19 +02:00
Alvaro Muñoz
53f82d3d6c Control Checks in Run/Uses steps also protect Jobs that depend on them 2024-09-23 12:29:35 +02:00
Alvaro Muñoz
269c1de902 Bump qlpack versions 2024-09-23 10:22:18 +02:00
Alvaro Muñoz
5e74f89255 Merge pull request #87 from github/reusable_workflow_priv_checks
Consider a Reusable Workflow privileged if a caller is
2024-09-23 10:19:00 +02:00
Alvaro Muñoz
df59e6f5d2 Consider a Reusable Workflow privileged if a caller is 2024-09-23 10:18:29 +02:00
Alvaro Muñoz
1dd7c3d2ef Bump qlpack versions 2024-09-22 22:06:35 +02:00
Alvaro Muñoz
b685a8df4d Merge pull request #86 from github/analyze_reusable_workflows
Cross remote Reusable Workflow analysis
2024-09-22 22:06:05 +02:00
Alvaro Muñoz
d44e7aee0a Cross remote Reusable Workflow analysis 2024-09-22 22:05:39 +02:00
Alvaro Muñoz
a1e44bc918 Bump qlpack versions 2024-09-20 15:42:19 +02:00
GitHub Security Lab
59592cc087 Merge pull request #85 from github/improve_reusable_workflow_calls
Improve reusable workflow calls
2024-09-20 15:41:42 +02:00
Alvaro Muñoz
116d83da5f Improve reusable workflow calls 2024-09-20 15:40:41 +02:00
Alvaro Muñoz
e9dfd9ccb4 Bump qlpack versions 2024-09-20 11:54:00 +02:00
GitHub Security Lab
d3c1db5948 Merge pull request #84 from github/report_unpin_node
Modify UnpinnedActionsTag report node
2024-09-20 11:53:26 +02:00
Alvaro Muñoz
c20e407c16 Modify UnpinnedActionsTag report node 2024-09-20 11:52:44 +02:00
Alvaro Muñoz
dac930de3a Merge branch 'master' of https://github.com/github/codeql-actions 2024-09-19 18:44:30 +02:00
Alvaro Muñoz
c3d7af8f59 Bump qlpack versions 2024-09-19 18:44:23 +02:00
Alvaro Muñoz
eca3205f3b Merge pull request #83 from github/fix_82
feat: Improve sanitizer checks
2024-09-19 18:40:38 +02:00
Alvaro Muñoz
db328f0b16 Improve Association check 2024-09-19 18:24:08 +02:00
Alvaro Muñoz
4f075f3f36 feat: Improve sanitizer checks 2024-09-19 13:38:08 +02:00
Alvaro Muñoz
92f3b1614c Bump qlpack versions 2024-09-17 17:07:35 +02:00
Alvaro Muñoz
69b9542a5f Add help file for SecretsInArtifacts query 2024-09-17 17:06:50 +02:00
Alvaro Muñoz
3a39058299 Bump qlpack versions 2024-09-12 10:42:12 +02:00
Alvaro Muñoz
69818c5bb5 Remove bindingset from DataFlow's compatibleTypes 2024-09-12 09:58:21 +02:00
Alvaro Muñoz
48a0fd500d Bump qlpack versions 2024-09-11 18:09:05 +02:00
Alvaro Muñoz
370d3adbb2 Merge pull request #80 from github/list_files
Add models for list-files actions
2024-09-11 18:08:15 +02:00
Alvaro Muñoz
5fe81ddb08 Update tests 2024-09-11 18:07:25 +02:00
Alvaro Muñoz
15bb4d851d Add new test for flow through matrix 2024-09-11 10:25:31 +02:00
Alvaro Muñoz
b199fdc3e2 Add new models for file listing actions 2024-09-11 10:25:10 +02:00
Alvaro Muñoz
321e5504bc Bump qlpack versions 2024-09-10 13:59:04 +02:00
Alvaro Muñoz
25a210734b Update tests 2024-09-10 13:58:36 +02:00
Alvaro Muñoz
ef41db3ce5 Extract simple reference expression from ORed disjuncts 2024-09-10 13:58:24 +02:00
Alvaro Muñoz
a9a297ab78 Update tests 2024-09-10 09:52:21 +02:00
Alvaro Muñoz
147da50cb9 Use Taint Tracking to track PR refs to checkout's ref argument 2024-09-10 09:52:09 +02:00
Alvaro Muñoz
bd0c762781 Refactor: Do not use PRHeadCheckoutStep on any dependency of TaintTracking
Problem is that there are StoreSteps that depend on PRHeadCheckout so
there is a non-monotic recursion error since PRHeadCheckout depends on
TaintTracking module, but this module depends on PRHeadCheckout
2024-09-10 09:51:32 +02:00
Alvaro Muñoz
42b487b348 Match callers and callees when root is not the repo root
When running codeql test run, the root of the database is not the root
of the original repo (the directory containing .github and .git)
therefore calls to reusable workflows are not correctly matched.
2024-09-10 09:49:43 +02:00
Alvaro Muñoz
f9d66d9b5e Bump qlpack versions 2024-09-06 23:37:00 +02:00
Alvaro Muñoz
2720aaf097 Add new test for secrets in artifact query 2024-09-06 23:36:29 +02:00
Alvaro Muñoz
279b0bb8f1 Change description for CWE-1395 query 2024-09-06 23:33:46 +02:00
Alvaro Muñoz
84b02febfe Bump qlpack versions 2024-09-06 22:53:53 +02:00
Alvaro Muñoz
72e0851e91 Update metadata for Secrets in Artifact query 2024-09-06 22:53:16 +02:00
Alvaro Muñoz
5e92026f14 Bump qlpack versions 2024-09-06 17:34:55 +02:00
Alvaro Muñoz
0e3097d604 Merge pull request #79 from github/secrets-in-artifacts
feat: New query to report GITHUB_TOKEN exposed in artifacts
2024-09-06 17:32:49 +02:00
Alvaro Muñoz
25eb417acc Remove public wording 2024-09-06 17:32:35 +02:00
Alvaro Muñoz
37fc6156d0 Removing experimental flag 2024-09-06 17:30:49 +02:00
Alvaro Muñoz
6eef51e415 fix: add path checks 2024-09-06 17:22:44 +02:00
Alvaro Muñoz
fefeae4469 feat: New query to report GITHUB_TOKEN exposed in artifacts 2024-09-06 17:00:15 +02:00
Alvaro Muñoz
b2f6ef246c Merge pull request #78 from github/rasmuswl/syntax-error-query 2024-09-06 15:48:35 +02:00
Rasmus Wriedt Larsen
2f68e6f26e Add missing test file 2024-09-06 14:53:46 +02:00
Rasmus Wriedt Larsen
4820626f29 Add SyntaxError query
This can be used by autofix, but might also be nice to help find YAML syntax errors 🤷
2024-09-06 14:04:46 +02:00
Alvaro Muñoz
ac7b7b7162 Bump qlpack versions 2024-09-06 10:50:58 +02:00
Alvaro Muñoz
4f57aade35 Improve accuracy of actions/download-artifact as a source
If upload is on the same workflow, it needs to be triggered by a priv
workflow
2024-09-06 10:49:27 +02:00
Kevin Stubbings
6efb3c69ef QLformatting 2024-09-03 15:54:06 -07:00
Kevin Stubbings
bd2564ee44 Formatting 2024-09-03 14:34:25 -07:00
Kevin Stubbings
581e7f5d3c Bottle 2024-09-03 14:00:27 -07:00
Geoffrey White
1ff6c4c090 C++: Restore change and see effect on test. 2024-09-03 11:55:06 +01:00
Geoffrey White
5bd58f044e C++: Add a direct test of getOverlap and a test case for it. 2024-09-03 11:52:20 +01:00
Porcupiney Hairs
e2dd126962 Python: Pycurl SSL Disabled 2024-09-03 03:41:23 +05:30
Kevin Stubbings
326eb6946e Added 2024-08-30 18:17:38 -07:00
Kevin Stubbings
5c8c99d31f Add header support for bottle and tornado 2024-08-30 18:16:01 -07:00
Alvaro Muñoz
0cabcf8ec7 Merge pull request #76 from github/pwntester-patch-1
Update ArgumentInjectionCritical.md
2024-08-23 17:40:48 +02:00
Alvaro Muñoz
293dd1a32b Update ArgumentInjectionCritical.md 2024-08-23 17:40:25 +02:00
Ed Minnix
bf11e2cd0f Fix code block 2024-08-22 08:57:54 -04:00
Edward Minnix III
9b43b4994e fixed-version: example
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2024-08-22 08:52:02 -04:00
Edward Minnix III
7e98d02d56 Wording
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2024-08-22 08:51:30 -04:00
Ed Minnix
2757b0ba6e Change example to net/http Request::FormValue 2024-08-21 18:35:19 -04:00
Edward Minnix III
1e1bbe92a3 Wording and typo
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2024-08-21 18:12:40 -04:00
Edward Minnix III
8b73d4af86 Fix typo
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2024-08-20 21:19:11 -04:00
Ed Minnix
1079486032 Mention Go in codeql-for-go toctree 2024-08-20 17:31:20 -04:00
Edward Minnix III
cc6b09da48 Fix name of section 2024-08-20 17:16:29 -04:00
Edward Minnix III
a99dd69d87 Remove function signature 2024-08-20 17:12:07 -04:00
Edward Minnix III
de2f8a1577 Make field consistent with existing model 2024-08-20 17:09:47 -04:00
Edward Minnix III
e142818fe5 Remove Select example.
Go does not currently have any equivalent with regards to lambda flow
2024-08-20 17:08:50 -04:00
Edward Minnix III
e8aac2be9a Remove neutral example
Go currently does not use `neutralModel`s and they are less relevant for Go than for Java/C#.
2024-08-20 17:06:58 -04:00
Edward Minnix III
27ad882f54 Usage range pattern instead of comma separation
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2024-08-20 17:05:33 -04:00
Edward Minnix III
2bfca21a2f Replace ss with elems 2024-08-20 17:04:42 -04:00
Edward Minnix III
9b92ff7e78 Typos and minor wording
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2024-08-20 17:02:24 -04:00
Edward Minnix III
211cda390d Method signatures and receiver/qualifier language
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2024-08-20 17:01:45 -04:00
Edward Minnix III
cfa1ad65c8 Consistently replace usage of namespace with package
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2024-08-20 17:00:32 -04:00
Ed Minnix
49a4318ab1 DRAFT: Go MaD docs first draft (still need to change Select example) 2024-08-20 00:30:16 -04:00
Geoffrey White
0e766aa99b C++: Remove redundant lines. 2024-08-16 15:56:30 +01:00
Geoffrey White
7430fde8c6 C++: Avoid outputting a cartesian product in AliasedSSA's getOverlap. 2024-08-14 10:53:25 +01:00
Alvaro Muñoz
1ca985b415 Update qlpack.yml 2024-08-12 13:09:06 +02:00
Alvaro Muñoz
0baf7e3cef Update qlpack.yml 2024-08-12 13:08:38 +02:00
Jaroslav Lobačevski
90b3c96a38 Merge pull request #74 from github/docs/help_files
docs/help files
2024-08-12 11:59:07 +02:00
Jaroslav Lobačevski
d6027267aa fix variable name 2024-08-12 09:31:58 +00:00
Jaroslav Lobačevski
e83841bba9 fixes 2024-08-12 09:29:26 +00:00
Jaroslav Lobačevski
a282818272 grammar 2024-08-10 10:52:06 +00:00
Jaroslav Lobačevski
77ecca9f5e grammar 2024-08-10 10:17:40 +00:00
Jaroslav Lobačevski
cc6badaea6 grammar 2024-08-10 09:54:23 +00:00
Alvaro Muñoz
23754b6d2f Update publish.yml 2024-08-09 17:38:57 +02:00
Alvaro Muñoz
2b8169b000 Update publish.yml 2024-08-09 17:37:52 +02:00
Alvaro Muñoz
d166b7c03a Create publish.yml 2024-08-09 17:34:42 +02:00
Alvaro Muñoz
569e80b678 Fix ImproperAccess query 2024-08-09 17:17:18 +02:00
Alvaro Muñoz
9411fac4d0 New Descriptions 2024-08-09 17:06:06 +02:00
Alvaro Muñoz
d8df3ff6b3 Use ControlCheck.dominates in the ImproperAccessControl query 2024-08-09 17:05:41 +02:00
Alvaro Muñoz
9977f25f0f Move some queries to experimental 2024-08-09 17:05:17 +02:00
Alvaro Muñoz
f4f18f38cc Move Argument injection queries to its own CWE 2024-08-09 17:04:32 +02:00
Alvaro Muñoz
8ebe76668c Bump qlpack versions 2024-08-07 17:24:59 +02:00
Alvaro Muñoz
88f6eff724 Merge pull request #73 from github/fix/control_checks_actor
fix(controlcheck): Improve checks for actors
2024-08-07 17:24:27 +02:00
Alvaro Muñoz
1750ebac18 fix(controlcheck): Improve checks for actors 2024-08-07 17:09:50 +02:00
Alvaro Muñoz
b251c661f8 Bump qlpack versions 2024-08-07 13:46:50 +02:00
Alvaro Muñoz
e4559e19d8 Move Output Clobbering to CWE-074 2024-08-07 13:46:27 +02:00
Alvaro Muñoz
ea9bb36ae0 Bump qlpack versions 2024-08-07 13:21:03 +02:00
Alvaro Muñoz
856077233d Merge pull request #72 from github/query/output_clobbering
feat(queries): Improve Output Clobbering query
2024-08-07 13:19:54 +02:00
Alvaro Muñoz
473251371b feat(queries): Improve Output Clobbering query
Add support for clobbering of `set-output` workflow command
2024-08-07 13:17:36 +02:00
Alvaro Muñoz
c442f1b96b Bump qlpack versions 2024-08-06 23:30:47 +02:00
Alvaro Muñoz
ff41cda8fc Merge pull request #71 from github/query/secret_handling
feat(query): New queries for incorrect secrets handling
2024-08-06 23:29:41 +02:00
Alvaro Muñoz
6842babd16 feat(query): New queries for incorrect secrets handling
ExcessiveSecretsExposure: Reports when all secrets are passed to the
workflow runner since that violates the principle of least privelege.
UnmaskedSecretExposure: Reports when secrets are derived from a JSON
secret since they wont get masked by the workflow runner
2024-08-06 23:08:52 +02:00
Alvaro Muñoz
9f79e51e89 Bump qlpack versions 2024-08-06 12:46:28 +02:00
Alvaro Muñoz
76210f53c8 Merge pull request #69 from github/improve_cache_poisoning
Improve Cache Poisoning Query
2024-08-06 12:45:51 +02:00
Alvaro Muñoz
d18179850d Split Cache Poisoning queries in 3
Split them into 3 queries depending of how the cache can be poisoned:
- control of cached files
- execution of controlled code
- code injection

Remove `setup-XXX` actions from CacheWriting class since the cached
files are not in the CWD
2024-08-06 12:04:34 +02:00
Alvaro Muñoz
fbc2e1e7e8 Remove caching actions that cache files outside of the CWD 2024-08-06 10:47:12 +02:00
Alvaro Muñoz
14f1672e74 Fix query message 2024-08-05 23:54:26 +02:00
Alvaro Muñoz
2273aadb4b Improve Cache Poisoning query
The untrusted files path is compared with the path written to the cache
to check if the cache can really be poisoned
2024-08-05 23:47:00 +02:00
Alvaro Muñoz
34b48d559b Add expected tests results 2024-08-05 23:45:51 +02:00
Alvaro Muñoz
c5314aeb6c Add new tests 2024-08-05 23:44:27 +02:00
Alvaro Muñoz
397eb2a762 Add getPath() to PRHeadCheckout and CacheWriting classes
Add getPath() methods to get the path where a checkout step writes the
code and where a Cache write reads the files from.
2024-08-05 23:44:20 +02:00
Alvaro Muñoz
0990774302 feat(poisonable_steps): Add python -m pip install 2024-08-05 18:53:53 +02:00
Alvaro Muñoz
ffe700c204 Merge pull request #68 from github/cat_env
feat(bash): Add support for `cat hazelcast/.github/java-config.env >> $GITHUB_ENV`
2024-08-02 15:49:19 +02:00
Alvaro Muñoz
8cf1a6afa7 feat(bash): Add support for cat hazelcast/.github/java-config.env >> $GITHUB_ENV 2024-08-02 15:48:57 +02:00
Alvaro Muñoz
90efdc7deb Bump qlpack versions 2024-08-02 12:47:16 +02:00
Alvaro Muñoz
4d7c985027 Merge pull request #67 from github/bash_script_parsing
feat(bash): Improve bash command parsing
2024-08-02 12:46:04 +02:00
Alvaro Muñoz
41fade5feb feat(bash): Improve bash command parsing 2024-08-02 12:44:43 +02:00
Alvaro Muñoz
c4d70e66e1 Bump qlpack versions 2024-08-01 17:49:13 +02:00
Alvaro Muñoz
822a326a4b Merge pull request #66 from github/tee_support
feat(bash): Add support for tee as a way to write to GITHUB special files
2024-08-01 17:47:55 +02:00
Alvaro Muñoz
f457537b34 feat(bash): Add support for tee as a way to write to GITHUB special files 2024-08-01 17:47:23 +02:00
Alvaro Muñoz
def170425a Bump qlpack versions 2024-08-01 11:43:48 +02:00
Alvaro Muñoz
e043cf3a54 Merge branch 'master' of https://github.com/github/codeql-actions 2024-08-01 11:38:55 +02:00
Alvaro Muñoz
c9b7340718 Bump qlpack versions 2024-08-01 11:38:46 +02:00
Alvaro Muñoz
5006b81565 Merge pull request #65 from github/query/vulnerable_versions
feat(queries): Improve Use Of Vulnerable Actions query
2024-08-01 11:37:24 +02:00
Alvaro Muñoz
6cfec0d245 feat(queries): Improve Use Of Vulnerable Actions query
Move all info to a MaD config file so its easier to mantain
Add other vulnerable actions
2024-08-01 11:37:00 +02:00
Alvaro Muñoz
a05dd49b74 Merge pull request #64 from github/query/path_traversal
query/path traversal
2024-07-31 23:14:48 +02:00
Alvaro Muñoz
5f1884aa32 feat(queries): Add new queries to report path traversal via artifact poisoning 2024-07-31 23:03:34 +02:00
Alvaro Muñoz
483f6229ff refactor: Create abstract class for known vulnerable actions 2024-07-31 23:02:52 +02:00
Alvaro Muñoz
4334524ac4 Merge pull request #63 from github/cwe_1395
feat(queries): Add query to report vulnerable 3rd party actions
2024-07-31 18:30:27 +02:00
Alvaro Muñoz
2b55d79c93 feat(queries): Add query to report vulnerable 3rd party actions 2024-07-31 18:29:17 +02:00
Alvaro Muñoz
a69fa5cb83 Merge pull request #62 from github/actions_download_artifact
feat(queries): Add actions/download-artifact as a source of Artifact Poisoning
2024-07-31 16:31:54 +02:00
Alvaro Muñoz
d548aef3e0 feat(queries): Add actions/download-artifact as a source of Artifact Poisoning 2024-07-31 16:31:15 +02:00
Alvaro Muñoz
80d2bbdc9b Merge pull request #61 from github/missing_permissions
fix(queries): Fix Missing Permissions query
2024-07-31 11:45:54 +02:00
Alvaro Muñoz
ab8dd599b7 fix(queries): Fix Missing Permissions query
If a job is only triggered by `workflow_call`, we dont report any issues
since they should be reported on the calling workflows
2024-07-31 11:45:30 +02:00
Alvaro Muñoz
8ffac2935e Bump qlpack versions 2024-07-30 18:22:20 +02:00
Alvaro Muñoz
65ad387543 fix: Add printf as an equivalent to echo 2024-07-30 18:18:22 +02:00
Alvaro Muñoz
bf10603b5f Bump qlpack versions 2024-07-30 10:28:15 +02:00
Alvaro Muñoz
f5261237a4 feat(suites): Add a bughalla-specific query suite 2024-07-30 10:27:28 +02:00
Alvaro Muñoz
da36924bb1 feat(queries): Add Output Clobbering query 2024-07-30 10:26:41 +02:00
Alvaro Muñoz
06ec94e731 Bump qlpack versions 2024-07-29 22:38:42 +02:00
Alvaro Muñoz
e3df12d77b Update Query suite 2024-07-29 22:37:47 +02:00
Alvaro Muñoz
eaf034e8cb feat(config): Add pipx as poisonable step 2024-07-25 11:09:02 +02:00
Alvaro Muñoz
28cc06e136 Bump qlpack versions 2024-07-24 18:28:09 +02:00
Alvaro Muñoz
ba6ab04dfc feat(suite): Remove severity:warning queries from CodeScanning suite 2024-07-24 18:27:39 +02:00
Alvaro Muñoz
bb78bb6f57 refactor(queries): update severity level for workflow permissions 2024-07-24 18:27:00 +02:00
Alvaro Muñoz
da28f7dc0a feat(config): add asv to poisonable steps list 2024-07-24 15:56:47 +02:00
Alvaro Muñoz
12e78ac4fe fix(regex): update pattern to match both gh and hub commands 2024-07-23 23:37:04 +02:00
Alvaro Muñoz
2dffb865d0 Bump qlpack versions 2024-07-22 12:45:34 +02:00
Alvaro Muñoz
15649afd5c feat(queries): Improve envvar injection queries
Consider those cases where the contents of a file are written to a var
and that var assigned to GITHUB_ENV
2024-07-22 12:44:27 +02:00
Alvaro Muñoz
270ca2ad7d feat(queries): Experimental Output clobbering query 2024-07-15 21:00:54 +02:00
Alvaro Muñoz
fc39249f92 feat(queries): Consider untrusted checkout as a source for code injections 2024-07-15 21:00:28 +02:00
Alvaro Muñoz
76ded33280 Bump qlpack versions 2024-07-13 23:29:36 +02:00
Alvaro Muñoz
cc64c95dbc feat(dataflow): Update edges predicate to only link to next step
Previously each step was linking to all possible following steps. This change makes a better flow path explanation flowing from the checkout to the poisonable step, step by step
2024-07-13 23:28:47 +02:00
Alvaro Muñoz
c1d8ca0976 Bump qlpack versions 2024-07-13 00:01:49 +02:00
Alvaro Muñoz
44911382af feat(tests): Update tests results 2024-07-12 23:49:05 +02:00
Alvaro Muñoz
9917c46f6f feat(core): Add StepsContainer class
A StepsContainer is an abstract class that includes all nodes with steps: Runs and LocalJobs
2024-07-12 23:48:52 +02:00
Alvaro Muñoz
69d173f13c fix(refactor): Remove unnecessary variables 2024-07-12 23:47:52 +02:00
Alvaro Muñoz
7f77e89bbf feat(tests): Add test for checkout in composite action 2024-07-12 23:31:12 +02:00
Alvaro Muñoz
417d5a403e Bump qlpack versions 2024-07-12 12:46:03 +02:00
Alvaro Muñoz
a1787596d2 feat(tests): Update tests 2024-07-12 12:45:19 +02:00
Alvaro Muñoz
e0a075da57 feat(dataflow): Flow through bash assigments on artifact to GH env/output 2024-07-12 12:45:06 +02:00
Alvaro Muñoz
5785a21d56 feat(queries): Env-var injection
Enable Uses sinks for envvar injection
2024-07-12 12:44:25 +02:00
Alvaro Muñoz
f623f73f16 feat(models): Add dotenv models
Envvar-injection sinks
2024-07-12 12:43:25 +02:00
Alvaro Muñoz
8289bf97b9 feat(models): Add support for artifact to step output 2024-07-12 11:10:01 +02:00
Alvaro Muñoz
29d2b287c9 tests: Organize tests 2024-07-12 10:14:39 +02:00
Alvaro Muñoz
c5d31ce08c fix(refactor): Add comments and rename predicates 2024-07-12 10:13:49 +02:00
Alvaro Muñoz
3f8a791b2e fix(queries): Improve Argument Injection query
Add GITHUB_HEAD_REF as a source
2024-07-11 22:59:20 +02:00
Alvaro Muñoz
89024ad604 fix(models): Reuse command delimiter regexps 2024-07-11 22:58:20 +02:00
Alvaro Muñoz
7a54170b31 feat(ext): Move regexp delimiters to Config.qll 2024-07-11 12:59:34 +02:00
Alvaro Muñoz
f4581d0aa5 Bump qlpack versions 2024-07-11 11:36:18 +02:00
Alvaro Muñoz
eb66114d8b feat(models): New ArgInj sink 2024-07-11 11:35:44 +02:00
Alvaro Muñoz
56af52a729 feat(tests): New tests for Command Injection
Injections on a workflow_run triggered protected by a allow branches list should not be reported as critical
2024-07-11 10:46:37 +02:00
Alvaro Muñoz
adbb236465 fix(query): Better identification of argument injection commands 2024-07-11 10:45:49 +02:00
Alvaro Muñoz
8d75250da7 Bump qlpack versions 2024-07-11 10:05:29 +02:00
Alvaro Muñoz
732f0dc29f feat(queries): Argument Injection
Make argument injection sinks congigurable with MaD
2024-07-11 10:04:43 +02:00
Alvaro Muñoz
73c77bc93b Initial implementation
Pending work: complete the regular expression
2024-07-11 10:04:43 +02:00
Alvaro Muñoz
4ad7c1fc95 Merge pull request #57 from github/workflow_run_branches
workflow run branches
2024-07-10 13:09:36 +02:00
Alvaro Muñoz
621ead2266 Fix branches logic 2024-07-10 13:09:23 +02:00
Alvaro Muñoz
090b3d41d1 Fix branches logic 2024-07-10 13:08:54 +02:00
Alvaro Muñoz
53b88627e5 feat(core): Exclude worflow_run#branches#default branch from externally triggerable events 2024-07-10 12:15:49 +02:00
Alvaro Muñoz
f1d1c1e55a Bump QL versions 2024-07-10 11:49:37 +02:00
Alvaro Muñoz
f4dd771d1c feat(models): Add models for ssh-action 2024-07-10 11:49:18 +02:00
Alvaro Muñoz
e23054292b feat(tests): Add new tests
Add new tests to verify that even if a job is privileged, if the vulnerability takes place in a different one, it should be considered as non-priveleged and reported as Cache Poisoning instead of Untrusted Checkout
2024-07-10 11:49:02 +02:00
Alvaro Muñoz
8231261ccf New poisonable steps 2024-07-09 17:28:04 +02:00
Alvaro Muñoz
59fd8530a3 Bump qlpack versions 2024-07-08 22:39:58 +02:00
Alvaro Muñoz
a368b797fd fix(checks): Add repository control checks 2024-07-08 22:39:22 +02:00
Alvaro Muñoz
ee265c4879 fix(models): Slash-command-action
Do not consider slash-command-action command-arguments as a remote flow source if it requires write or admin permissions
2024-07-08 22:38:53 +02:00
Alvaro Muñoz
a2af3c654b Account for all npm and pnpm subcommands
Exclude args such as `npm -v`
2024-07-08 20:46:29 +02:00
Alvaro Muñoz
1657af60df Model get-workflow-origin action 2024-07-08 12:59:36 +02:00
Alvaro Muñoz
20ce5d5344 Add JS local imports as Poisonable steps 2024-07-08 12:59:16 +02:00
Alvaro Muñoz
bc483fc380 Add poisonable step test 2024-07-06 22:44:57 +02:00
Alvaro Muñoz
56b70981ae Bump qlpack versions 2024-07-05 18:18:04 +02:00
Alvaro Muñoz
e5064f8090 Improve poisonable steps 2024-07-05 18:16:50 +02:00
Alvaro Muñoz
966a9b1652 Bump qlpack versions 2024-07-04 13:05:27 +02:00
Alvaro Muñoz
7d58beba67 Better control check support 2024-07-04 13:04:59 +02:00
Alvaro Muñoz
69db192378 Bump qlpack versions 2024-07-03 12:40:48 +02:00
Alvaro Muñoz
c70fb6e911 Consider toJson as a sanitizer for Code Injection in JS 2024-07-03 12:25:24 +02:00
Alvaro Muñoz
7e0146d634 Bump qlpack versions 2024-07-02 23:52:01 +02:00
Alvaro Muñoz
4b01cd5be4 Support flow through fromJson 2024-07-02 23:51:19 +02:00
Alvaro Muñoz
45d51a4d00 Add more poisonable steps 2024-07-02 23:29:53 +02:00
Alvaro Muñoz
1281ca8e81 Bump qlpack versions 2024-07-01 23:01:38 +02:00
Alvaro Muñoz
39bff38d70 Bump qlpack versions 2024-06-28 12:32:18 +02:00
Alvaro Muñoz
a485528ebe Refactor bash script parsing to improve coverage of env var injection 2024-06-28 12:31:43 +02:00
Alvaro Muñoz
40a6f3bbee Make EnvVar and Path injection equivalent 2024-06-27 22:53:55 +02:00
Alvaro Muñoz
a9ea9a1f8a Update expected test files 2024-06-27 22:53:32 +02:00
Alvaro Muñoz
effa1e1356 Move ControlChecks to its own file 2024-06-27 22:53:20 +02:00
Alvaro Muñoz
b64f53e03e Bump qlpack versions 2024-06-27 17:33:08 +02:00
Alvaro Muñoz
c57e4929cb New code injection sink 2024-06-27 17:32:21 +02:00
Alvaro Muñoz
31fe5952dc New poisonable steps 2024-06-27 17:32:03 +02:00
Alvaro Muñoz
04c4cedb41 New code injection sink 2024-06-27 17:26:04 +02:00
Alvaro Muñoz
682236e432 New poisonable steps 2024-06-27 17:25:55 +02:00
Alvaro Muñoz
d998373162 Move event sources to config files 2024-06-27 17:08:40 +02:00
Alvaro Muñoz
a99d293309 Bump to dataflow version 1.0.1 2024-06-27 16:33:45 +02:00
Alvaro Muñoz
fdedca394f Merge branch 'master' of https://github.com/github/codeql-actions 2024-06-27 16:10:08 +02:00
Alvaro Muñoz
4516d3df81 Bump qlpack versions 2024-06-27 16:09:49 +02:00
Alvaro Muñoz
c94b84685c Merge pull request #50 from github/fix_typo
fix typos
2024-06-27 11:56:03 +02:00
Alvaro Muñoz
eeba26a647 fix typos 2024-06-27 11:55:21 +02:00
Alvaro Muñoz
d11c15dc28 Bump qlpack versionsi 2024-06-27 11:07:55 +02:00
Alvaro Muñoz
5997038923 Exclude self-hosted query from CodeScanning suite 2024-06-27 11:07:02 +02:00
Alvaro Muñoz
4aba07074c Bump qlpack versionsi 2024-06-26 19:45:13 +02:00
Alvaro Muñoz
76b115deb0 Dedup Cache poisoning and Untrusted checkout 2024-06-26 19:44:44 +02:00
Alvaro Muñoz
878317ab6b Bump qlpack versions 2024-06-26 19:18:10 +02:00
Alvaro Muñoz
5cd292e23e Make Untrusted Checkout and CachePoisoning rules path-problems 2024-06-26 19:17:37 +02:00
Alvaro Muñoz
e6311966c8 Take explicit permission into account for privilege calculation 2024-06-26 16:17:07 +02:00
Alvaro Muñoz
1fd7c148a5 Bump qlpack versions 2024-06-25 13:58:25 +02:00
Alvaro Muñoz
61797e9180 Add pull_request-comment-branch head_ref as a source 2024-06-25 13:27:08 +02:00
GitHub Security Lab
795232e040 Merge pull request #47 from github/poisonable_config
Move configuration to MaD files
2024-06-25 09:48:06 +02:00
Alvaro Muñoz
fc8173239e Move configuration to MaD files 2024-06-25 09:47:43 +02:00
Alvaro Muñoz
24d69f2ee8 Bump qlpack versions 2024-06-24 12:45:35 +02:00
Alvaro Muñoz
b5dfda27fd Add cargo as poisonable step 2024-06-24 12:45:24 +02:00
Alvaro Muñoz
6df70d1a45 Do not consider priv events if runtime data is available 2024-06-23 21:34:30 +02:00
Alvaro Muñoz
4e94c4294c Merge pull request #46 from github/remove_scan_action 2024-06-21 15:26:21 +02:00
Alvaro Muñoz
06918b0492 Remove custom scan action 2024-06-21 09:19:37 +02:00
Alvaro Muñoz
1e4df62a39 Merge pull request #45 from github/change_packages
Move from githubsecuritylab packages to github
2024-06-20 09:51:17 +02:00
Alvaro Muñoz
4619128c11 Move from githubsecuritylab packages to github 2024-06-20 09:50:36 +02:00
Alvaro Muñoz
c764b39c18 Bump qlpack versions 2024-06-17 17:11:10 +02:00
Alvaro Muñoz
1fdf76ac41 Improve download artifact and untrusted checkout queries 2024-06-17 15:17:46 +02:00
Paolo Tranquilli
daea773fce Python: tests with false positives around match 2024-06-14 17:28:35 +02:00
Alvaro Muñoz
bdaab69d0b Do not uses globs for source-root 2024-06-13 15:09:37 +02:00
Alvaro Muñoz
6c73e3770f Merge branch 'master' of https://github.com/github/codeql-actions 2024-06-13 11:51:54 +02:00
Alvaro Muñoz
4b4901f99f Bump qlpack versions 2024-06-13 11:51:46 +02:00
Alvaro Muñoz
a84c1c4706 Minor improvemnts 2024-06-13 11:51:15 +02:00
Alvaro Muñoz
ceac1c6392 Do not scan JS files 2024-06-13 11:50:53 +02:00
Alvaro Muñoz
fbaf329428 Remove dependencies with javascript-all 2024-06-13 11:50:28 +02:00
Alvaro Muñoz
c61e71f22d Update build.yml 2024-06-12 11:19:06 +02:00
Alvaro Muñoz
f8dd493a68 Update build.yml 2024-06-12 11:15:17 +02:00
Alvaro Muñoz
f068504c4f Bump qlpack versions 2024-06-12 10:07:36 +02:00
Alvaro Muñoz
95b5eff5d0 Merge pull request #41 from github/js_extractor
Move from yaml to js extractor
2024-06-12 10:05:16 +02:00
Alvaro Muñoz
e5eb85695d Update action to use javascript extractor 2024-06-12 10:04:50 +02:00
Alvaro Muñoz
e2fb677abb Remove DS_Store 2024-06-12 09:48:27 +02:00
Alvaro Muñoz
63fd73020c Update lock files 2024-06-12 08:54:01 +02:00
Alvaro Muñoz
df3d6131a8 Update lock files 2024-06-12 08:50:49 +02:00
Alvaro Muñoz
ad1f35c86a Move from yaml to js extractor 2024-06-11 21:24:22 +02:00
Alvaro Muñoz
92cd50393b Bump qlpack versions 2024-06-07 10:06:46 +02:00
Alvaro Muñoz
3f0f75a7c5 Make CachePoisoning queries high severity 2024-06-07 10:05:39 +02:00
Alvaro Muñoz
c45d4d37aa Bump qlpack versions 2024-06-06 17:34:42 +02:00
Alvaro Muñoz
49a2fd82b1 Bump qlpack versions 2024-06-06 17:32:11 +02:00
Alvaro Muñoz
dea36402a6 Merge branch 'master' of https://github.com/github/codeql-actions 2024-06-06 17:30:49 +02:00
Alvaro Muñoz
d13a937a5d Update Cache Poisoning 2024-06-06 17:30:43 +02:00
Alvaro Muñoz
ba4dd2b0ed Update to latest dataflow shared library 2024-06-06 17:23:40 +02:00
Alvaro Muñoz
d344d9b97a Update to latest dataflow shared library 2024-06-06 17:23:10 +02:00
Alvaro Muñoz
2c96127425 Improve event context sources + test 2024-06-05 16:34:52 +02:00
Alvaro Muñoz
284c52f972 Bump qlpack versions 2024-06-05 10:54:37 +02:00
Alvaro Muñoz
28af21c556 Update ql suites 2024-06-05 08:57:43 +02:00
Alvaro Muñoz
fa05b684d7 Dont consider pull_request with write permissions as priv 2024-06-03 22:17:42 +02:00
Alvaro Muñoz
65b51996a6 new tests 2024-06-03 18:59:51 +02:00
Alvaro Muñoz
a5c6df3070 Move from yaml to js extractor 2024-06-03 18:13:01 +02:00
Alvaro Muñoz
88465bd0e3 Improve privleged detection 2024-06-03 11:26:51 +02:00
Alvaro Muñoz
844b6e014b Bump qlpack versions 2024-05-31 19:04:32 +02:00
Alvaro Muñoz
842b741611 Bump qlpack versions 2024-05-31 16:02:51 +02:00
Alvaro Muñoz
39e517ebd3 Merge pull request #40 from github/improve_regexps
Improve bash and source regexpps
2024-05-31 16:02:01 +02:00
Alvaro Muñoz
3e9c19044e Improve bash and source regexpps 2024-05-31 16:01:27 +02:00
Alvaro Muñoz
c6e3bafe00 Bump qlpack versions 2024-05-24 09:35:06 +02:00
Alvaro Muñoz
1fc45eb296 Improve ControlCheck for untrusted checkouts 2024-05-24 09:33:35 +02:00
Alvaro Muñoz
16a7522807 Improve Untrusted checkout queries 2024-05-22 23:24:17 +02:00
Alvaro Muñoz
33ae3b1625 minor updates 2024-05-22 18:53:39 +02:00
Alvaro Muñoz
367531a659 Bump qlpack versions 2024-05-22 11:08:22 +02:00
Alvaro Muñoz
4d28d6aa7c Improve toctou queries 2024-05-22 11:07:52 +02:00
Alvaro Muñoz
e86fa9744a Bump qlpack versions 2024-05-21 23:05:30 +02:00
Alvaro Muñoz
e5b5a0db04 Merge pull request #39 from github/externally_triggereable_jobs
externally triggereable jobs
2024-05-21 23:03:00 +02:00
Alvaro Muñoz
5d32071adc resolve conflicts 2024-05-21 23:02:34 +02:00
Alvaro Muñoz
313acfcac2 Add externally triggereable data model and predicates 2024-05-21 23:00:40 +02:00
Alvaro Muñoz
d3bff87f9a Add github to json contexts 2024-05-17 23:10:29 +02:00
Alvaro Muñoz
5f8bab0608 Bump qlpack versions 2024-05-17 22:36:26 +02:00
Alvaro Muñoz
66138df61d Merge pull request #37 from github/toctou_refinements
Reduce FP for actor/association checks that cannot be bypassed this way
2024-05-17 11:25:39 +02:00
Alvaro Muñoz
0456dcdc8f Merge pull request #38 from github/expr_trigger_mapping
Ensure event sources are available for triggering events
2024-05-17 11:25:14 +02:00
Alvaro Muñoz
47a66e1075 Add TODO 2024-05-16 21:43:00 +02:00
Alvaro Muñoz
dfeefe0caa Consider actor and association checks as bypassable checks ONLY for issueOps 2024-05-16 16:17:26 +02:00
Alvaro Muñoz
84d4c573f9 Merge branch 'toctou_refinements' of https://github.com/github/codeql-actions into toctou_refinements 2024-05-16 16:14:48 +02:00
Alvaro Muñoz
612be64ffc Consider actor and association checks as bypassable checks ONLY for issueOps 2024-05-16 16:10:26 +02:00
Jaroslav Lobačevski
558bea84d4 Create label_actor.yml 2024-05-16 15:57:13 +02:00
Alvaro Muñoz
e28ad1d644 Reduce FP for actor/association checks that cannot be bypassed this way 2024-05-16 15:57:13 +02:00
Alvaro Muñoz
f325d40a22 Ensure event sources are available for triggering events 2024-05-16 15:55:12 +02:00
Alvaro Muñoz
1b4246e7f1 Update tests for cache poisoning 2024-05-16 11:32:21 +02:00
Jaroslav Lobačevski
c47fdd123d Create label_actor.yml 2024-05-16 10:56:01 +02:00
Alvaro Muñoz
888b9fecca Reduce FP for actor/association checks that cannot be bypassed this way 2024-05-16 10:28:24 +02:00
Alvaro Muñoz
446765bcbb Update Cache Poisoning rule 2024-05-15 22:08:03 +02:00
Alvaro Muñoz
731889bf88 Bump qlpack versions 2024-05-15 21:29:51 +02:00
Alvaro Muñoz
d15dc68e43 Merge pull request #35 from github/default_branch_name 2024-05-15 17:57:25 +02:00
Alvaro Muñoz
d5e679a340 Merge pull request #36 from github/JarLob-patch-1 2024-05-15 17:52:00 +02:00
Jaroslav Lobačevski
6f87b75504 Update test.yml 2024-05-15 17:44:16 +02:00
Jaroslav Lobačevski
00052d1ea1 exists 2024-05-15 15:37:57 +00:00
Jaroslav Lobačevski
17a6d28e18 Fix OR 2024-05-15 15:37:17 +00:00
Jaroslav Lobačevski
11edff936b Fix tests 2024-05-15 15:27:59 +00:00
Jaroslav Lobačevski
1a4939a13b Apply suggestions from code review
Co-authored-by: Alvaro Muñoz <pwntester@github.com>
2024-05-15 16:19:58 +02:00
Alvaro Muñoz
f09e79a79b Merge pull request #33 from github/fix_32
Add context paths containing tainted fields
2024-05-15 16:00:22 +02:00
Jaroslav Lobačevski
a2503dd14b fix default_branch_name visibility 2024-05-15 10:22:40 +00:00
Jaroslav Lobačevski
cae29e0abe temporary fix 2024-05-15 10:03:17 +00:00
Jaroslav Lobačevski
f38af29f80 Fix array 2024-05-15 09:36:18 +00:00
Jaroslav Lobačevski
6e8fc89034 Add default branch name check 2024-05-15 09:29:24 +00:00
Alvaro Muñoz
7a66b12437 add tests 2024-05-14 22:33:50 +02:00
Alvaro Muñoz
30d0b9d133 Add context paths containing tainted fields 2024-05-14 22:07:49 +02:00
Alvaro Muñoz
3120d4b328 Merge branch 'master' of https://github.com/github/codeql-actions 2024-05-14 15:38:48 +02:00
Alvaro Muñoz
33b3fc67c7 Merge pull request #30 from github/peter_murray_issue-body-parser-action_model
Add missing source for peter-murray/issue-body-parser-action
2024-05-14 15:38:18 +02:00
Alvaro Muñoz
67c964808b Merge pull request #29 from github/toctou_queries
TOCTOU queries
2024-05-14 15:36:18 +02:00
Alvaro Muñoz
f96b9cc535 Update tests 2024-05-14 15:35:13 +02:00
Alvaro Muñoz
ca59423c8a Bump qlpack versions 2024-05-14 15:32:40 +02:00
Alvaro Muñoz
ff2cfa568d Merge pull request #31 from github/branch_deploy_head_source
Treat branch-deploy action as a source of HEAD ref for untrusted checkouts
2024-05-14 15:30:11 +02:00
Alvaro Muñoz
a0939bb0a3 Bump qlpack versions 2024-05-14 15:29:45 +02:00
Alvaro Muñoz
0473c3824f Treat branch-deploy action as a source of HEAD ref for untrusted checkouts 2024-05-14 11:38:39 +02:00
Alvaro Muñoz
00f77ca9ec Add missing source for peter-murray/issue-body-parser-action 2024-05-14 11:36:43 +02:00
Alvaro Muñoz
73fbd2311b Improper access check queries and tests 2024-05-14 10:20:04 +02:00
Alvaro Muñoz
7c295e011a TOCTOU queries and tests 2024-05-14 10:19:27 +02:00
Alvaro Muñoz
b4096e0201 Refactor control checks 2024-05-14 09:56:23 +02:00
Alvaro Muñoz
60769f1671 Bump qlpack versions 2024-05-13 16:26:53 +02:00
Alvaro Muñoz
54d103ffe4 Merge pull request #28 from github/feat/matrix_expressions
Resolve Matrix expression to their possible values
2024-05-13 16:25:52 +02:00
Alvaro Muñoz
cee0389d6e Update SelfHostedQuery.qll
Co-authored-by: Jaroslav Lobačevski <jarlob@github.com>
2024-05-13 15:33:28 +02:00
Alvaro Muñoz
a1efc78ac7 Refactor regexps 2024-05-13 13:47:01 +02:00
Alvaro Muñoz
9ee9314cb9 Resolve conflicts after rebasing 2024-05-13 10:37:42 +02:00
Alvaro Muñoz
9310150fb0 Resolve conflict 2024-05-13 09:20:45 +02:00
Alvaro Muñoz
b2d7c823b3 Merge pull request #25 from github/support_trigger_events
New `On` and `Event` classes
2024-05-13 09:18:53 +02:00
Alvaro Muñoz
510cefecbe Remove debug left-overs 2024-05-10 14:59:12 +02:00
Alvaro Muñoz
e0d147f39a Add On and Event AST nodes
Capture information about trigger events on the new On and Event classes
2024-05-10 14:13:44 +02:00
Alvaro Muñoz
8590a0ba8f Refactor runOnDefaultBranch 2024-05-10 14:12:54 +02:00
Alvaro Muñoz
4d61204404 New tests 2024-05-10 14:12:25 +02:00
Alvaro Muñoz
a30c2aa5de Update PoisonableSteps 2024-05-09 23:32:21 +02:00
Alvaro Muñoz
3b684d8c94 Merge pull request #19 from github/cache_poisoning_actions
Fix error in select
2024-05-08 22:44:57 +02:00
Alvaro Muñoz
eb4eb4e931 Merge branch 'master' into cache_poisoning_actions 2024-05-08 22:43:22 +02:00
Alvaro Muñoz
d6fb0ae84e Update tests 2024-05-08 22:41:05 +02:00
Alvaro Muñoz
ad45d319c5 Resolve conflict 2024-05-08 22:37:22 +02:00
Alvaro Muñoz
1ea0312f36 Bump qlpack versions 2024-05-08 22:35:25 +02:00
Alvaro Muñoz
d2e9411e12 Update and new tests 2024-05-08 22:35:17 +02:00
Alvaro Muñoz
44377acb08 Improve Cache Poisoning quer 2024-05-08 22:35:06 +02:00
Alvaro Muñoz
2d09d1e6d8 Fix alert text 2024-05-08 22:34:30 +02:00
Alvaro Muñoz
f95a3e5298 Refactor eventtrigger and privileged methods
Move them from Workflows to Jobs
2024-05-08 22:34:11 +02:00
Alvaro Muñoz
ddf72a2cf3 Add more poisonable steps 2024-05-08 22:32:24 +02:00
Alvaro Muñoz
e8f2bc3ef6 Remove debug method 2024-05-08 22:32:11 +02:00
Alvaro Muñoz
409a6aa137 Update ql/src/Security/CWE-349/CachePoisoning.ql
Co-authored-by: Jaroslav Lobačevski <jarlob@github.com>
2024-05-08 18:48:16 +02:00
Alvaro Muñoz
fafb44d4f6 Add CachePoisoning by Code Injection query 2024-05-08 15:20:48 +02:00
Alvaro Muñoz
b965a55339 Fix error in select
Casting to CachingWritingStep in the select clause was shadowing all the Poisonable result
2024-05-08 15:04:48 +02:00
Alvaro Muñoz
c39e802c17 Fix sources for tj-actions/verify-changed-files 2024-05-08 13:56:49 +02:00
Alvaro Muñoz
1df74e29c1 Merge branch 'master' of https://github.com/github/codeql-actions 2024-05-08 09:44:58 +02:00
Alvaro Muñoz
d3bb6668f6 Missing getMajorVersion predicate 2024-05-08 09:44:48 +02:00
Alvaro Muñoz
6a87192f64 Account for insecure action versions 2024-05-08 09:43:32 +02:00
Alvaro Muñoz
de74b88866 Update 2024-05-08 09:43:32 +02:00
Alvaro Muñoz
778c6ad923 Fix tj-actions/changed-files sources 2024-05-08 09:43:32 +02:00
Jorge
2a84b9cbfb Merge pull request #8 from github/jorgectf-patch-1
Copy master branch only
2024-05-07 09:49:56 +02:00
Jorge
5d6a3c4900 Copy master branch only 2024-05-07 09:45:12 +02:00
Alvaro Muñoz
b7960776cc Merge pull request #7 from github/fix_dorny_paths_filter_source
Fix incorrect source for dorny path filters
2024-05-07 09:45:04 +02:00
Alvaro Muñoz
b22e305699 Fix untrusted checkout tests 2024-05-06 23:32:42 +02:00
Alvaro Muñoz
ddf4bb194e Fix incorrect source for dorny path filters 2024-05-06 23:32:06 +02:00
Alvaro Muñoz
1ddfbb05f3 Update actions fragment 2024-05-06 22:19:02 +02:00
Alvaro Muñoz
0ea34dfb52 Update action.yml 2024-05-06 22:11:43 +02:00
Alvaro Muñoz
c3c6410a73 Update action.yml 2024-05-06 20:01:48 +02:00
Alvaro Muñoz
254664d274 Bump qlpack versions 2024-05-06 18:39:15 +02:00
Alvaro Muñoz
c14d069ad6 Merge pull request #5 from github/cache_poisoning
Add Cache Poisoning Query
2024-05-06 18:37:52 +02:00
Alvaro Muñoz
2980139283 Merge pull request #6 from github/untrusted_checkout_improvments
untrusted checkout improvments
2024-05-06 18:37:13 +02:00
Alvaro Muñoz
373e0a278a Rename untrusted checkout queries 2024-05-06 18:36:46 +02:00
Alvaro Muñoz
f6b1daa59c Improve query 2024-05-06 18:26:58 +02:00
Alvaro Muñoz
2359e2de90 Clean query 2024-05-06 17:24:43 +02:00
Alvaro Muñoz
9417e1d164 Classify checkout steps 2024-05-06 17:13:00 +02:00
Alvaro Muñoz
bb028e41d4 Add Cache Poisoning Query 2024-05-06 17:10:34 +02:00
Alvaro Muñoz
addedd0e2a Comment out unused source 2024-05-04 23:29:55 +02:00
Alvaro Muñoz
4be3011887 Merge pull request #4 from github/refactor_untrusted_checkout
Refactor untrusted checkout queries
2024-05-04 23:28:15 +02:00
Alvaro Muñoz
16c77cbe25 Refactor untrusted checkout queries 2024-05-04 23:27:26 +02:00
Alvaro Muñoz
9843f375ee ignore runtime info for pull_request triggered workflows 2024-04-30 12:20:53 +02:00
Alvaro Muñoz
186f9d018d Merge pull request #2 from github/separate_sources
Split sources by taint type
2024-04-28 12:04:02 +02:00
Alvaro Muñoz
831b8cfaa6 Bump qlpack versions 2024-04-28 12:03:40 +02:00
Alvaro Muñoz
0f3281c386 Support bash heredoc 2024-04-28 09:36:27 +02:00
Alvaro Muñoz
00f6ff8c01 Split sources by taint type 2024-04-27 11:02:33 +02:00
Alvaro Muñoz
27d0a3406d Improve Env path/var injection queries 2024-04-26 16:17:29 +02:00
Alvaro Muñoz
39308fd89f Fix typo 2024-04-24 22:09:03 +02:00
Alvaro Muñoz
0ff967b102 Fix typo 2024-04-24 22:07:18 +02:00
Alvaro Muñoz
fbf03fa8e2 New expression is always true tests 2024-04-24 21:51:27 +02:00
Alvaro Muñoz
c9b2dac128 Update action.yml 2024-04-24 15:07:05 +02:00
Alvaro Muñoz
944bd84a58 Add missing spaces 2024-04-23 15:15:16 +02:00
Alvaro Muñoz
16cf60af00 Add double quotes to env var 2024-04-23 15:05:40 +02:00
Alvaro Muñoz
6237a8e24c Update action.yml 2024-04-23 13:27:44 +02:00
Alvaro Muñoz
5cd8d70a9c Bump qlpack versions 2024-04-23 13:09:06 +02:00
Alvaro Muñoz
858df49012 Generate yaml file 2024-04-23 13:08:27 +02:00
Alvaro Muñoz
a2ed07ec35 Update scan action 2024-04-23 12:43:23 +02:00
Alvaro Muñoz
f73571a752 fix: fix shell comments 2024-04-23 11:20:52 +02:00
Alvaro Muñoz
4b03282be0 Merge pull request #1 from github/extensionpack
Support external workflow extpacks
2024-04-22 23:31:49 +02:00
Alvaro Muñoz
17933cbb54 Bump qlpack versions 2024-04-22 23:30:22 +02:00
Alvaro Muñoz
61976c684e Lower privilege checks to Jobs 2024-04-22 23:28:58 +02:00
Alvaro Muñoz
ef9583a921 Bump qlpack versions 2024-04-22 16:20:36 +02:00
Alvaro Muñoz
c31e9dde5e Add EnvPathInjection query 2024-04-22 16:19:56 +02:00
Alvaro Muñoz
ab7196ac52 Fix FPs in EnvVarInjection 2024-04-22 09:53:30 +02:00
Alvaro Muñoz
9183fb0d80 Fix expression always true query 2024-04-20 23:31:08 +02:00
Alvaro Muñoz
46d2bb24e5 Fix expression always true query 2024-04-20 22:57:22 +02:00
Alvaro Muñoz
1a44d83ddb Bump qlpack versions 2024-04-19 17:58:40 +02:00
Alvaro Muñoz
d504cd9b4d Better detection of poisonable steps 2024-04-19 16:20:09 +02:00
Alvaro Muñoz
7a8af5e8ea Additional sources 2024-04-19 16:19:35 +02:00
Alvaro Muñoz
cb1e19a317 New ExpressionIdAlwaysTrue query 2024-04-19 16:19:10 +02:00
Alvaro Muñoz
e084cef23d Merge branch 'master' of https://github.com/github/codeql-actions 2024-04-19 12:23:05 +02:00
Alvaro Muñoz
19a87a13db Update lock files 2024-04-19 12:22:58 +02:00
Alvaro Muñoz
febba3d6d3 Update gitignore 2024-04-19 12:22:20 +02:00
Alvaro Muñoz
a222bfc33d Update test.yml 2024-04-19 12:07:00 +02:00
Alvaro Muñoz
843d9e24c4 Update test.yml 2024-04-19 12:05:09 +02:00
Alvaro Muñoz
ecf8198984 Update test.yml 2024-04-19 12:00:02 +02:00
Alvaro Muñoz
417830020d Update test.yml 2024-04-19 11:55:08 +02:00
Alvaro Muñoz
0713294006 Update test.yml 2024-04-19 11:52:56 +02:00
Alvaro Muñoz
96abb193c7 Update test.yml 2024-04-19 11:39:03 +02:00
Alvaro Muñoz
d2e675f68c Merge branch 'master' of https://github.com/github/codeql-actions 2024-04-19 11:31:31 +02:00
Alvaro Muñoz
e200746678 remove qlpack locks from repo 2024-04-19 11:31:22 +02:00
Alvaro Muñoz
5190e0865c Update test.yml 2024-04-19 10:29:12 +02:00
Jorge
8c8a9b8a18 Update test.yml 2024-04-19 10:01:55 +02:00
Alvaro Muñoz
6bc0d6dc32 Update test.yml 2024-04-19 09:59:15 +02:00
Jorge
c681b13046 Update copy-to-bughalla.yml 2024-04-19 09:55:12 +02:00
Alvaro Muñoz
d69c10c4f6 Update test.yml 2024-04-19 09:40:44 +02:00
Alvaro Muñoz
5d5a02ccc3 Update test.yml 2024-04-18 22:02:04 +02:00
Alvaro Muñoz
591dfe07fe Update copy-to-bughalla.yml 2024-04-18 21:55:09 +02:00
Alvaro Muñoz
bd4f158b22 Update test.yml 2024-04-18 21:48:40 +02:00
Alvaro Muñoz
a4cf78b9ed Update test.yml 2024-04-18 21:43:20 +02:00
Alvaro Muñoz
a29e0c438d Update test.yml 2024-04-18 21:38:27 +02:00
Alvaro Muñoz
86cc50971b Update test.yml 2024-04-18 21:30:15 +02:00
Alvaro Muñoz
d4d3957392 Create test.yml 2024-04-18 21:29:14 +02:00
Alvaro Muñoz
1cdcb3271b Merge pull request #48 from GitHubSecurityLab/new_untrusted_checkout_step
new untrusted checkout step
2024-04-17 11:56:10 +02:00
Alvaro Muñoz
afaab8b644 add tests 2024-04-17 11:26:21 +02:00
Alvaro Muñoz
bd9cd3eb86 new untrusted checkout step 2024-04-17 11:23:00 +02:00
Alvaro Muñoz
d18c575cd4 fix broken models 2024-04-17 11:22:45 +02:00
Alvaro Muñoz
a5d8a4568e Merge pull request #47 from GitHubSecurityLab/ca-rw-summaries-sources
CA RW summaries and sources
2024-04-17 10:18:01 +02:00
jorgectf
764f6fbc0d Fix "inputs" models typo 2024-04-16 21:35:30 +02:00
jorgectf
463a7a6062 Add resuable workflow summaries and sources 2024-04-16 21:33:59 +02:00
jorgectf
d1a4d18fca Add composite actions summaries and sources 2024-04-16 21:33:50 +02:00
Alvaro Muñoz
9ecda65e32 Update Priv workflow definition 2024-04-16 11:41:53 +02:00
Alvaro Muñoz
25eace71bf Bump qlpack versions 2024-04-12 13:08:41 +02:00
Alvaro Muñoz
e45010ec5b Add Secret exfiltration query 2024-04-12 13:07:54 +02:00
Alvaro Muñoz
db86c40c50 Enable dataflow through GITHUB_ENV vars 2024-04-12 13:07:40 +02:00
Alvaro Muñoz
2925380e72 Remove dummy models 2024-04-11 16:27:40 +02:00
Alvaro Muñoz
29cef4fd73 Bump qlpack versions 2024-04-11 16:24:51 +02:00
Alvaro Muñoz
841499eeb0 Improve privleged workflow detection 2024-04-11 16:23:51 +02:00
Alvaro Muñoz
ed70ef0307 Make Artifact poisoning query a path problem 2024-04-11 15:46:49 +02:00
Alvaro Muñoz
b761565dcf Merge branch 'master' of https://github.com/GitHubSecurityLab/codeql-actions 2024-04-11 15:18:19 +02:00
Alvaro Muñoz
1b2e02df64 Add support for multiline assigments 2024-04-11 15:18:09 +02:00
Alvaro Muñoz
4f0ec73307 Merge pull request #46 from GitHubSecurityLab/ca-rw-sinks
Add models for composite actions and reusable workflows sinks
2024-04-11 12:02:01 +02:00
jorgectf
6c245605a7 Discard already-modeled sinks 2024-04-11 11:26:45 +02:00
jorgectf
83f9527cc4 Add models for reusable workflows sinks 2024-04-11 11:25:54 +02:00
jorgectf
ae84303fac Add models for composite actions sinks 2024-04-11 11:25:23 +02:00
jorgectf
5a12a2213b Add provenance to existing models 2024-04-11 11:24:42 +02:00
jorgectf
c373238fa6 Add subfolders to dataExtensions 2024-04-11 11:23:53 +02:00
jorgectf
c56f220b13 Add provenance field 2024-04-11 11:23:28 +02:00
jorgectf
a817a22cc7 Remove redundant import 2024-04-11 11:22:36 +02:00
jorgectf
0051914245 Add .cache to gitignore 2024-04-11 11:21:59 +02:00
Alvaro Muñoz
8d2b8be133 Add github.event as a source 2024-04-10 22:32:49 +02:00
Alvaro Muñoz
5968da87bb Bump qlpack versions 2024-04-08 18:53:39 +02:00
Alvaro Muñoz
58b21d4684 Improve assignments to GITHUB ENVARS detection 2024-04-08 18:52:13 +02:00
Alvaro Muñoz
ae5b8bc0ac Bump qlpack versions 2024-04-08 17:12:45 +02:00
Alvaro Muñoz
31a1ea9593 Improve envvar injection 2024-04-08 17:12:00 +02:00
Alvaro Muñoz
45a51a9f74 Bump qlpack versions 2024-04-08 12:55:24 +02:00
Alvaro Muñoz
56d2d8ec10 Update test results 2024-04-08 12:54:30 +02:00
Alvaro Muñoz
5d81c4d69e Merge pull request #45 from GitHubSecurityLab/artifact_posining
Improve Artifact Poisoning query
2024-04-08 12:53:35 +02:00
Alvaro Muñoz
2651e5a673 Improve Artifact poisoning related queries 2024-04-08 12:52:10 +02:00
Alvaro Muñoz
3209378f45 Remove TODO 2024-04-05 14:25:25 +02:00
Alvaro Muñoz
28ccf4fa68 Improve Artifact Poisoning query 2024-04-05 09:18:01 +02:00
Alvaro Muñoz
ce5928c6ba Bump qlpack versions 2024-04-03 15:43:43 +02:00
Alvaro Muñoz
73878ed3cd Merge pull request #42 from GitHubSecurityLab/priv_workflows
priv workflows
2024-04-03 15:41:04 +02:00
Alvaro Muñoz
f7ddd8b769 Include problem queries in actions-all suite 2024-04-03 15:39:50 +02:00
Alvaro Muñoz
2988bc8885 Centralize isPrivileged decisions 2024-04-03 15:39:00 +02:00
Alvaro Muñoz
119c7b8158 Bump qlpack versions 2024-04-03 11:41:42 +02:00
Alvaro Muñoz
9c90db3f83 Merge pull request #41 from GitHubSecurityLab/env_injection
New Artifact Poisoning and EnvVar Injection queries
2024-04-03 11:39:56 +02:00
Alvaro Muñoz
a2bbf704ee fix: triggering events for artifact poisoning 2024-04-03 11:39:35 +02:00
Alvaro Muñoz
2a1226c37a Add workflow_dispatch to the triggers for artifact poisoning 2024-04-02 12:54:42 +02:00
Alvaro Muñoz
152d29da38 Add Artifact poisoning and Env Injection queries 2024-04-01 18:53:37 +02:00
Alvaro Muñoz
c7b3148af6 Merge pull request #39 from GitHubSecurityLab/new_sources
feat(sources): New sources
2024-04-01 10:56:45 +02:00
Alvaro Muñoz
cc16318a90 Make new trilom source compliant with new sources 2024-04-01 10:56:03 +02:00
Alvaro Muñoz
ee81a87428 resolve conflicts 2024-04-01 10:54:02 +02:00
Alvaro Muñoz
9807cf87d5 resolve conflicts 2024-04-01 10:52:46 +02:00
Alvaro Muñoz
bdfd46111f Only triggered on non-pull_request events 2024-04-01 10:51:26 +02:00
Alvaro Muñoz
822e9bcaab env var injection query 2024-03-23 21:55:54 +01:00
Alvaro Muñoz
ff3759eca8 Merge pull request #40 from GitHubSecurityLab/refactor_source_checks
feat(sources): Do not take triggers into consideration
2024-03-23 21:42:19 +01:00
Alvaro Muñoz
2ed3aceddf feat(sources): Do not take triggers into consideration 2024-03-22 13:32:29 +01:00
Alvaro Muñoz
9d5b026fde Merge branch 'master' of https://github.com/GitHubSecurityLab/codeql-actions 2024-03-21 14:21:30 +01:00
Alvaro Muñoz
06747cd98b Add tests for untrusted checkouts in workflow_run triggered workflows 2024-03-21 14:19:46 +01:00
Alvaro Muñoz
b6a097caa4 Merge pull request #38 from GitHubSecurityLab/improve_untrusted_co 2024-03-18 14:36:42 +01:00
Alvaro Muñoz
874e45e3e5 feat(sources): New sources
This PR also adds the ability to not limit a source to a trigger event
2024-03-18 13:22:53 +01:00
Alvaro Muñoz
9683ae35bc Add tests 2024-03-18 13:04:57 +01:00
Alvaro Muñoz
8023a527a4 fix(untrusted_co): Do not report Reusable workflows called from pull_request 2024-03-18 13:02:11 +01:00
Alvaro Muñoz
0a2be55507 Merge branch 'master' of https://github.com/GitHubSecurityLab/codeql-actions 2024-03-18 11:00:30 +01:00
Alvaro Muñoz
8906bd9635 Bump versions 2024-03-18 11:00:22 +01:00
Jorge
cbfd53a17c Merge pull request #37 from GitHubSecurityLab/fix-inputs
Fix inputs with composite action
2024-03-15 23:03:27 +01:00
Jorge
e60c0b875f Fix inputs for composite action 2024-03-15 22:01:06 +00:00
Jorge
09c2ba4280 Make action download actions-all 2024-03-15 16:39:18 +01:00
Jorge
e0bbb66be4 Try to fix actions-all suite 2024-03-15 15:11:21 +01:00
Alvaro Muñoz
0da8f8d299 Merge pull request #36 from GitHubSecurityLab/fix_source_regexps
fix(fn): Apply json wrappers to source regexps
2024-03-15 14:05:29 +01:00
Alvaro Muñoz
d9e589c6e7 Remove unnecessary boundary anchors 2024-03-15 13:58:46 +01:00
Alvaro Muñoz
6cb15f06bc fix(fn): Apply json wrappers to source regexps 2024-03-15 13:54:21 +01:00
Alvaro Muñoz
27a9bc8564 Merge branch 'master' of https://github.com/GitHubSecurityLab/codeql-actions 2024-03-15 13:34:21 +01:00
Alvaro Muñoz
01d8d79e6d Bump versions 2024-03-15 13:34:12 +01:00
Alvaro Muñoz
ea135a60de Merge pull request #35 from GitHubSecurityLab/jorgectf-patch-2
Fix tokens
2024-03-15 11:25:08 +01:00
Jorge
5908d6c567 Fix tokens 2024-03-15 11:23:37 +01:00
Jorge
465700b2cd Merge pull request #33 from GitHubSecurityLab/jorgectf-patch-1
Add `GITHUB_TOKEN`
2024-03-15 11:19:41 +01:00
Alvaro Muñoz
188f9d5adc Merge pull request #34 from GitHubSecurityLab/refactor_queries
Refactor queries
2024-03-15 11:17:31 +01:00
Alvaro Muñoz
169e57e874 Refactor queries 2024-03-15 11:10:41 +01:00
Jorge
a36ae6a7e2 Add GITHUB_TOKEN 2024-03-15 11:07:01 +01:00
Alvaro Muñoz
92dbceb507 boost pack versions 2024-03-15 10:19:08 +01:00
Alvaro Muñoz
12af3bdf08 resolve conflicts 2024-03-14 22:42:57 +01:00
Alvaro Muñoz
46afa9c1f3 Add new tests 2024-03-14 22:41:01 +01:00
Alvaro Muñoz
f251783c26 Apply suggestions from code review
Co-authored-by: Jorge <46056498+jorgectf@users.noreply.github.com>
2024-03-14 21:52:22 +01:00
Alvaro Muñoz
d21d453d1c Split queries 2024-03-14 21:52:22 +01:00
jorgectf
d26ead7c3b Add security sinks 2024-03-14 21:52:22 +01:00
Jorge
4fcd68ba5a Merge pull request #31 from GitHubSecurityLab/new_sinks
Add security sinks
2024-03-14 19:11:27 +01:00
Jorge
1e64b18212 Add suite that runs all queries 2024-03-14 19:09:22 +01:00
Alvaro Muñoz
70dd7fe18f Apply suggestions from code review
Co-authored-by: Jorge <46056498+jorgectf@users.noreply.github.com>
2024-03-14 17:47:20 +01:00
Alvaro Muñoz
d011269bf8 Merge pull request #32 from GitHubSecurityLab/choose-suite 2024-03-14 17:42:55 +01:00
Jorge
53209a26b1 build 2024-03-14 16:22:34 +00:00
Jorge
a9aba88bc5 Add alternate value 2024-03-14 17:21:26 +01:00
Jorge
678f99b6be build 2024-03-14 16:14:33 +00:00
Jorge
a9057a7386 Add suite input 2024-03-14 17:10:35 +01:00
Alvaro Muñoz
cfed2d4ce0 Split queries 2024-03-14 16:30:23 +01:00
Alvaro Muñoz
8e5eeb2ea3 Merge branch 'untrusted_co' 2024-03-14 16:15:53 +01:00
Alvaro Muñoz
5130135df0 fix(stepsExpression): allow steps from a composite action to communicate 2024-03-14 16:14:55 +01:00
Alvaro Muñoz
a3ccc2eba3 Merge pull request #30 from GitHubSecurityLab/untrusted_co
Improve UntrustedCheckout query
2024-03-14 14:52:39 +01:00
Alvaro Muñoz
778d8978b0 DF support for untrusted checkout query 2024-03-14 13:55:10 +01:00
Alvaro Muñoz
22d0600da8 Support more PR head checkouts 2024-03-14 13:28:39 +01:00
Alvaro Muñoz
d12b24886f Merge branch 'untrusted_co' of https://github.com/GitHubSecurityLab/codeql-actions into untrusted_co 2024-03-14 12:58:56 +01:00
Alvaro Muñoz
35df9519e1 Support more untrusted checkout cases 2024-03-14 12:58:47 +01:00
Alvaro Muñoz
9ca1ac5bb9 Fix expression regexp 2024-03-14 12:58:02 +01:00
Alvaro Muñoz
3150f24d3f Update tests and fix regexp 2024-03-14 12:21:16 +01:00
Alvaro Muñoz
7160f08222 Update ql/test/query-tests/Security/CWE-829/.github/workflows/auto_ci.yml
Co-authored-by: Jaroslav Lobačevski <jarlob@github.com>
2024-03-14 12:03:40 +01:00
Alvaro Muñoz
03277cc24b Add test for self-referencing jobs 2024-03-14 11:58:44 +01:00
Alvaro Muñoz
8e2c1a4f4e Expose predicates to check local flow 2024-03-14 11:58:07 +01:00
Alvaro Muñoz
3e2dffce8b Rename ContextExpression to SimpleReferenceExpression 2024-03-14 11:57:43 +01:00
Alvaro Muñoz
e726f9fff1 Apply suggestions from code review
Co-authored-by: Jaroslav Lobačevski <jarlob@github.com>
2024-03-14 09:24:32 +01:00
Alvaro Muñoz
aa37339deb Apply suggestions from code review 2024-03-14 09:22:40 +01:00
Alvaro Muñoz
fe1bf58ae5 Apply suggestions from code review
Co-authored-by: Jaroslav Lobačevski <jarlob@github.com>
2024-03-14 09:22:05 +01:00
jorgectf
446a2dc267 Add security sinks 2024-03-13 23:22:13 +01:00
Alvaro Muñoz
872b1f88f0 More regexp improvements 2024-03-13 22:47:19 +01:00
Alvaro Muñoz
0e50204672 More regexp improvements 2024-03-13 22:19:55 +01:00
Alvaro Muñoz
87b284e5e6 update 2024-03-13 19:14:57 +01:00
Alvaro Muñoz
839d16cde5 Treat If's values as expression no matter the delimiters 2024-03-13 18:41:17 +01:00
Alvaro Muñoz
1bf2431c99 Improve UntrustedCheckout query
Account for more events, more triggers and heuristics to detect git checkouts
2024-03-13 15:41:57 +01:00
Alvaro Muñoz
aa62603899 Merge pull request #29 from GitHubSecurityLab/clean
fix: clean debug lefovers
2024-03-13 13:50:11 +01:00
Alvaro Muñoz
0b71d02407 fix: clean debug lefovers 2024-03-13 13:49:50 +01:00
Alvaro Muñoz
37331c3d43 Merge pull request #28 from GitHubSecurityLab/new_ast_refactor
Refactor ast nodes
2024-03-12 10:17:34 +01:00
Alvaro Muñoz
9b97dbd870 Refactor ast nodes 2024-03-12 10:16:43 +01:00
Alvaro Muñoz
86075c95bd Improve ExpressionNode Location handling 2024-03-07 22:28:54 +01:00
Alvaro Muñoz
4f7cce9c11 Merge pull request #27 from GitHubSecurityLab/refactor_astnode
Add Expression nodes and locations
2024-03-07 15:36:54 +01:00
Alvaro Muñoz
96246f4b74 Add Expression nodes and their corresponding locations 2024-03-07 15:35:47 +01:00
Alvaro Muñoz
e5527d7a18 Refactor ast nodes 2024-03-05 19:59:43 +01:00
Alvaro Muñoz
b3cecfc7e8 Merge pull request #26 from GitHubSecurityLab/refactor_ast
Refactor AST layer
2024-03-04 17:39:56 +01:00
Alvaro Muñoz
c8e89797eb remove test db 2024-03-04 15:43:38 +01:00
Alvaro Muñoz
6875640c64 Refactor getXXXExpr methods 2024-03-04 10:33:26 +01:00
Alvaro Muñoz
1c2f19f4e1 Merge Actions.qll and Ast.qll 2024-03-01 16:06:06 +01:00
Alvaro Muñoz
bcf3081259 Refactor Input/Outpts 2024-03-01 11:17:23 +01:00
Alvaro Muñoz
0eabdd9507 Rename classes 2024-03-01 09:44:33 +01:00
Alvaro Muñoz
e979f51956 Merge pull request #25 from GitHubSecurityLab/add_tests
test: Add tests
2024-02-29 13:47:57 +01:00
Alvaro Muñoz
6b11506abb test: Add tests 2024-02-29 13:23:59 +01:00
Alvaro Muñoz
cbe43bf72b Merge pull request #24 from GitHubSecurityLab/matrix_ctx
matrix ctx
2024-02-29 12:08:20 +01:00
Alvaro Muñoz
5b40d98849 Update test db build script 2024-02-28 14:36:21 +01:00
Alvaro Muñoz
8a9ec88b36 feat(matrix): Add support for flow through matrix vars 2024-02-28 13:21:29 +01:00
Alvaro Muñoz
447b65e7a9 Add script to build full DBs (testproj ones remove source code origin) 2024-02-28 12:37:41 +01:00
Alvaro Muñoz
8e7e5d03a5 fix(test): Add expected files 2024-02-28 11:15:38 +01:00
Mathew Payne
409d35ba1f Merge pull request #23 from GitHubSecurityLab/IAC_queries
feat(queries): Migrate queries from AdvancedSecurity repo
2024-02-27 20:11:12 +00:00
Alvaro Muñoz
fe976faf6a feat(queries): Migrate queries from AdvancedSecurity repo 2024-02-27 15:20:35 +01:00
Alvaro Muñoz
c29f3a7779 Merge pull request #21 from GitHubSecurityLab/refactor_env_access
refactor env access
2024-02-26 13:02:33 +01:00
Alvaro Muñoz
98f3a1e7bf fix(env): Improve env access support 2024-02-26 10:43:55 +01:00
Alvaro Muñoz
645177cc80 Account for github.event.label check as a sanitizer for untrusted checkout 2024-02-26 09:39:42 +01:00
Alvaro Muñoz
1458434504 Merge branch 'master' of https://github.com/GitHubSecurityLab/codeql-actions 2024-02-23 11:54:41 +01:00
Alvaro Muñoz
f513a19c24 fix: restrict EnvCtxAccessExpr to Env decarlations on the same file 2024-02-23 11:53:47 +01:00
Alvaro Muñoz
f5355e722d Merge pull request #20 from GitHubSecurityLab/untrusted_checkout 2024-02-22 15:52:08 +01:00
Alvaro Muñoz
68f15f2b85 rename query id 2024-02-22 13:14:53 +01:00
Alvaro Muñoz
ecefb7ffb5 feat(untrusted checkout query): Add new query and tests 2024-02-22 13:12:37 +01:00
Alvaro Muñoz
d0b904a590 Fix QLpack names 2024-02-21 21:57:45 +01:00
Alvaro Muñoz
7a1369d9d0 Merge pull request #19 from GitHubSecurityLab/steps 2024-02-21 18:38:44 +01:00
Jorge
9e2be7d674 Apply suggestions from code review
Co-authored-by: Alvaro Muñoz <pwntester@github.com>
2024-02-21 17:27:39 +01:00
Alvaro Muñoz
d6f6e1fc0b Merge pull request #18 from GitHubSecurityLab/triggers
feat(triggers): New query and support for trigger-based severity decisions
2024-02-21 16:51:16 +01:00
Alvaro Muñoz
3d5567d698 Update ql/lib/codeql/actions/Ast.qll
Co-authored-by: Jorge <46056498+jorgectf@users.noreply.github.com>
2024-02-21 16:50:44 +01:00
Alvaro Muñoz
a28f8e90f0 Update ql/lib/ext/tj-actions_branch-names.model.yml 2024-02-21 16:50:33 +01:00
Jorge
3ca7adab4f Merge branch 'master' into steps 2024-02-21 15:31:42 +01:00
jorgectf
e1d6c7dac4 Add some steps 2024-02-21 15:29:27 +01:00
Alvaro Muñoz
a2b0a01298 fix: fix merge conflict 2024-02-21 10:57:51 +01:00
Alvaro Muñoz
ea29a09fd7 feat(triggers): New query for critical issues
Adds a new query and the required changes to be able to account for the trigger events so that we dont report issues if they are not likely exploitable.
2024-02-21 10:56:17 +01:00
Alvaro Muñoz
3aa4f7f1af feat(triggers): Add getEnclosingWorkflowStmt to Statement class 2024-02-21 10:56:17 +01:00
Alvaro Muñoz
3814462266 feat(triggers): New query for critical issues
Adds a new query and the required changes to be able to account for the trigger events so that we dont report issues if they are not likely exploitable.
2024-02-21 10:23:37 +01:00
Alvaro Muñoz
4b9cec79dc Merge pull request #17 from GitHubSecurityLab/reusable_workflow_models
feat(reusable-workflow-models): Reusable workflow MaD
2024-02-21 10:20:40 +01:00
Alvaro Muñoz
a2210dca79 feat(triggers): Add getEnclosingWorkflowStmt to Statement class 2024-02-20 21:48:29 +01:00
Alvaro Muñoz
c84e64e76c Merge pull request #16 from GitHubSecurityLab/model-gen-queries
feat(model-generation): Add more model generation queries
2024-02-20 12:05:12 +01:00
Alvaro Muñoz
010d7df71d feat(reusable-workflow-models): Reusable workflow MaD
Add support to define sources/sinks/summaries for Reusable Workflows as
MaD entries.
2024-02-20 11:58:54 +01:00
Alvaro Muñoz
1d582a4c4d feat(model-generation): Add more model generation queries
Add new queries for finding reusable workflows that behave as summaries, sources or sinks.
Add new query for finding composite actions that behave as sinks.
Add `github.event.inputs` context to the regular expression matching input var accesses.
2024-02-20 10:50:02 +01:00
jorgectf
334fda18ba Fix copy workflow 2024-02-16 16:39:40 +01:00
Jorge
5cb9c21e05 Fetch before push 2024-02-16 16:06:05 +01:00
Alvaro Muñoz
55ff6ff8ee Merge pull request #15 from GitHubSecurityLab/copy-workflow
Add copy workflow
2024-02-16 16:05:08 +01:00
Alvaro Muñoz
7c3503e6c7 fix: remove debug leftovers 2024-02-16 16:03:38 +01:00
Jorge
4e44444d5a Add copy workflow 2024-02-16 16:03:01 +01:00
Alvaro Muñoz
43a55e80a9 feat(model-generator): New qls for modelling composite actions 2024-02-16 16:02:10 +01:00
Alvaro Muñoz
8ae1e26d5d fix(action): qls reference 2024-02-16 15:49:29 +01:00
Alvaro Muñoz
76f245b337 feat(actions): use published actions packs 2024-02-16 15:34:20 +01:00
Alvaro Muñoz
8e59fb7558 fix(actions): ql pack installation 2024-02-16 14:47:34 +01:00
Alvaro Muñoz
003b8cc8c0 fix(actions): ql pack installation 2024-02-16 14:44:47 +01:00
Alvaro Muñoz
13c5ec07b4 fix(actions): ql pack installation 2024-02-16 14:41:47 +01:00
Alvaro Muñoz
b3bab160d2 fix(actions): ql pack installation 2024-02-16 14:41:21 +01:00
Alvaro Muñoz
41639dd0e2 fix(actions): ql pack installation 2024-02-16 14:37:43 +01:00
Alvaro Muñoz
b11d8dad49 fix(actions): ql pack installation 2024-02-16 14:31:07 +01:00
Alvaro Muñoz
04a2ae9ad3 fix(actions): ql pack installation 2024-02-16 14:29:03 +01:00
Alvaro Muñoz
a94793fc09 fix(actions): pass the qlpack dirs 2024-02-16 14:14:53 +01:00
Alvaro Muñoz
e9f3006204 fix(actions): pass the qlpack dirs 2024-02-16 14:10:52 +01:00
Alvaro Muñoz
c58c4e0d54 feat(actions): refactor as composite action to be able to pass env vars 2024-02-16 14:06:46 +01:00
Alvaro Muñoz
e2699c31f8 feat(action): clone and install local packs 2024-02-16 13:56:58 +01:00
Alvaro Muñoz
959a974c8b feat(action): clone pack (not use the registry) 2024-02-16 13:32:05 +01:00
Alvaro Muñoz
5d1264d3a4 feat(action): update references to qlpacks 2024-02-16 12:56:06 +01:00
Alvaro Muñoz
cf4ab41df2 feat(action): rename qlpacks to use githubsecuritylab prefix 2024-02-16 12:32:48 +01:00
Alvaro Muñoz
0105d63a44 Add Action to scan repos 2024-02-16 12:25:23 +01:00
Alvaro Muñoz
f5c6905a50 Merge pull request #13 from GitHubSecurityLab/github_ctx
Improve regexs
2024-02-15 12:03:33 +01:00
Alvaro Muñoz
499c3e7ac3 Improve regexs 2024-02-15 12:03:06 +01:00
Alvaro Muñoz
65b226d36e Merge pull request #12 from GitHubSecurityLab/ctx_expressions
feat(bash-step): Improve bash step accuracy
2024-02-15 11:52:18 +01:00
Alvaro Muñoz
1cd32195a7 feat(bash-step): Improve bash step accuracy
Only pass the taint when the env var is directlty set as the step output
2024-02-15 11:51:28 +01:00
Alvaro Muñoz
0f73080a7b Merge pull request #11 from GitHubSecurityLab/fix_composite_actions
feat(composite-actions): Fix summary and source queries for composite actions analysis
2024-02-14 18:11:12 +01:00
Alvaro Muñoz
3c12e43d3f feat(composite-actions): Fix summary and source queries for composite actions analysis 2024-02-14 18:09:12 +01:00
Alvaro Muñoz
700882730c Merge pull request #10 from GitHubSecurityLab/job_outputs
feat(field-flow): Refactor flow through job outputs
2024-02-14 17:14:09 +01:00
Alvaro Muñoz
f65587e5cf feat(fieldflow): Refactor flow through Job outputs
Job output should flow to the “key” (YamlString) and be read from there
from the JobOutputAccessExpr.

- NeedsCtxAccessExpr.getRefExpr should point to the UsesExpr(RW calling Job)
  or to the OutputsStmt(Regular Job).
- JobsCtxAccessExpr.getRefExpr should point to the OutputsStmt(Regular Job).
- Create storeStep from OutputExpr to OutputStmt using output var name
  as the field name.
- Create a readStep for CtxAccessExpr to read the referenced fields from
  the job outputs.
2024-02-14 17:08:13 +01:00
Alvaro Muñoz
90d1ae4a05 fix: simplify Ast 2024-02-14 14:06:28 +01:00
Alvaro Muñoz
494fb2470e fix: refactor local, read and store steps 2024-02-14 14:05:13 +01:00
Alvaro Muñoz
ebaac5f5cb fix: enforce input,output,env prefixes in MaD 2024-02-14 14:03:11 +01:00
Alvaro Muñoz
7139d3b6d2 Merge pull request #8 from GitHubSecurityLab/changed-files-sources
Add some changed-files sources
2024-02-14 10:56:20 +01:00
Alvaro Muñoz
2b3b3732b9 resolve conflicts 2024-02-14 10:55:31 +01:00
Alvaro Muñoz
6b83afebaa Merge pull request #9 from GitHubSecurityLab/content_set
feat(field-flow): enhance dataflow tracking
2024-02-14 10:49:11 +01:00
Alvaro Muñoz
e6b4676f90 feat(field-flow): enhance dataflow tracking
implement field flow to reduce false positives
2024-02-14 10:47:00 +01:00
jorgectf
29b3d6c9ef Prefix sources with output. 2024-02-13 15:00:53 +01:00
jorgectf
6627a858e3 Suffix with .model 2024-02-13 13:24:25 +01:00
jorgectf
fa91837f63 Trim yaml 2024-02-13 13:22:18 +01:00
jorgectf
68901e252c Add some changed-files sources 2024-02-13 13:18:52 +01:00
Alvaro Muñoz
32b1d77b4a Merge pull request #7 from GitHubSecurityLab/input_output_nodes
Better handling of input and output expressions
2024-02-13 11:52:10 +01:00
Alvaro Muñoz
271c512f4d better identification of Composite Actions input and output nodes 2024-02-13 11:40:22 +01:00
Alvaro Muñoz
cc3f2eed68 add characteristic predicates to InputExpr and OutputExpr 2024-02-13 11:24:16 +01:00
Alvaro Muñoz
3c5358c381 Merge pull request #6 from GitHubSecurityLab/composite_actions
feat: support for composite action's analysis
2024-02-12 22:57:31 +01:00
Alvaro Muñoz
e9707af38d feat: support for composite action's analysis 2024-02-12 22:55:58 +01:00
Alvaro Muñoz
9030cb3df4 Merge pull request #5 from GitHubSecurityLab/env_context
Implement support for env context
2024-02-12 15:48:37 +01:00
Alvaro Muñoz
99358c62e2 Extend CFG to reach env expressions 2024-02-12 15:47:27 +01:00
Alvaro Muñoz
70d1741177 Merge pull request #4 from GitHubSecurityLab/improve_mad
Refactor MaD semantics
2024-02-12 15:46:50 +01:00
Alvaro Muñoz
4b57cee300 Initial implementaion of env context support 2024-02-12 15:14:47 +01:00
Alvaro Muñoz
4f0b66ea03 Refactor MaD semantics 2024-02-12 13:47:44 +01:00
Alvaro Muñoz
f2fc411d6b Merge pull request #3 from GitHubSecurityLab/extensible_predicates
Add support for external definitions
2024-02-09 22:59:23 +01:00
Alvaro Muñoz
2eaca7e826 Add support for external definitions 2024-02-09 22:55:10 +01:00
Alvaro Muñoz
e9c1114f98 Merge pull request #2 from GitHubSecurityLab/refactor_cfgscope
Refactor CfgScopes and Ast predicate names
2024-02-09 13:48:29 +01:00
Alvaro Muñoz
b54316fc9a Refactor CfgScopes and Ast predicate names 2024-02-09 13:35:47 +01:00
Alvaro Muñoz
9c6fd20e5e Move reusable tests to src pack 2024-02-09 12:29:48 +01:00
Alvaro Muñoz
96e41bb043 Merge pull request #1 from GitHubSecurityLab/reusable_workflows
Add support for Reusable workflows
2024-02-09 12:28:17 +01:00
Alvaro Muñoz
3152ed71ba dataflow through reusable workflows 2024-02-09 11:57:47 +01:00
Alvaro Muñoz
9659098ab6 Support for Reusable workflows 2024-02-08 15:40:06 +01:00
Alvaro Muñoz
db413361f7 Add Reusable Workflow test 2024-02-08 15:11:39 +01:00
Alvaro Muñoz
5006ffe203 Use the LibYaml default AST hierarchy 2024-02-08 12:01:41 +01:00
Alvaro Muñoz
83ca36bc76 Support RunExpr's env vars 2024-02-08 11:56:55 +01:00
Alvaro Muñoz
1708e0f19d Move tests files to .github/workflows 2024-02-08 11:55:21 +01:00
Alvaro Muñoz
da2ac2af03 Process only .github/workflows yaml files 2024-02-08 11:52:14 +01:00
Alvaro Muñoz
0398fbd0d7 Refactor AST layer 2024-02-05 18:04:37 +01:00
Alvaro Muñoz
b3eae71f95 fix test 2024-02-05 13:30:46 +01:00
Alvaro Muñoz
3902a55fbb Update build test db script 2024-02-05 10:52:17 +01:00
Alvaro Muñoz
b57e6b41a3 Add testproj to gitignore 2024-02-05 10:48:53 +01:00
Alvaro Muñoz
093b1a2211 Remove test dbs 2024-02-05 10:45:52 +01:00
Alvaro Muñoz
355ccf42ee Do not compress local flow steps
Use `neverSkipPathGrap` to `any()` so no local flow steps get pruned
and thrown away in order to compress the presented dataflow path.
2024-02-05 10:44:37 +01:00
Alvaro Muñoz
45d959d13f Initial implementation 2024-02-05 09:26:11 +01:00
Alvaro Muñoz
70a7bb1f75 Add .gitignore 2024-02-05 09:25:33 +01:00
6821 changed files with 333575 additions and 154737 deletions

View File

@@ -1,5 +1,4 @@
common --enable_platform_specific_config
common --enable_bzlmod
# because we use --override_module with `%workspace%`, the lock file is not stable
common --lockfile_mode=off
@@ -24,7 +23,13 @@ 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
common --incompatible_use_plus_in_repo_names
# Reduce this eventually to empty, once we've fixed all our usages of java, and https://github.com/bazel-contrib/rules_go/issues/4193 is fixed
common --incompatible_autoload_externally="+@rules_java,+@rules_shell"
build --java_language_version=17
build --tool_java_language_version=17
build --tool_java_runtime_version=remotejdk_17
build --java_runtime_version=remotejdk_17
try-import %workspace%/local.bazelrc

View File

@@ -8,4 +8,3 @@ 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 @@
5f5d70b6c4d2fb1a889479569107f1692239e8a7
8.0.0

View File

@@ -1,4 +1,5 @@
{
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
"extensions": [
"rust-lang.rust-analyzer",
"bungcip.better-toml",

3
.gitattributes vendored
View File

@@ -86,4 +86,5 @@
/misc/ripunzip/ripunzip-* filter=lfs diff=lfs merge=lfs -text
# swift prebuilt resources
/swift/third_party/resource-dir/*.zip filter=lfs diff=lfs merge=lfs -text
/swift/third_party/resources/*.zip filter=lfs diff=lfs merge=lfs -text
/swift/third_party/resources/*.tar.zst filter=lfs diff=lfs merge=lfs -text

View File

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

4
.github/labeler.yml vendored
View File

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

View File

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

View File

@@ -30,7 +30,8 @@ jobs:
run: |
EXIT_CODE=0
# TODO: remove the shared exception from the regex when coverage of qlpacks without dbschemes is supported
changed_lib_packs="$(git diff --name-only --diff-filter=ACMRT HEAD^ HEAD | { grep -Po '^(?!(shared))[a-z]*/ql/lib' || true; } | sort -u)"
# TODO: remove the actions exception once https://github.com/github/codeql-team/issues/3656 is fixed
changed_lib_packs="$(git diff --name-only --diff-filter=ACMRT HEAD^ HEAD | { grep -Po '^(?!(shared|actions))[a-z]*/ql/lib' || true; } | sort -u)"
for pack_dir in ${changed_lib_packs}; do
lang="${pack_dir%/ql/lib}"
codeql generate library-doc-coverage --output="${RUNNER_TEMP}/${lang}-current.txt" --dir="${pack_dir}"

View File

@@ -30,7 +30,7 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.101
dotnet-version: 9.0.100
- name: Checkout repository
uses: actions/checkout@v4

View File

@@ -7,6 +7,11 @@ on:
- "rc/*"
- "codeql-cli-*"
pull_request:
paths:
- '**.ql'
- '**.qll'
- '**/qlpack.yml'
- '**.dbscheme'
permissions:
contents: read
@@ -33,9 +38,9 @@ jobs:
# run with --check-only if running in a PR (github.sha != main)
if : ${{ github.event_name == 'pull_request' }}
shell: bash
run: codeql query compile -q -j0 */ql/{src,examples} --keep-going --warnings=error --check-only --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" --compilation-cache-size=500
run: codeql query compile -q -j0 */ql/{src,examples} --keep-going --warnings=error --check-only --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" --compilation-cache-size=500 --ram=56000
- name: compile queries - full
# do full compile if running on main - this populates the cache
if : ${{ github.event_name != 'pull_request' }}
shell: bash
run: codeql query compile -q -j0 */ql/{src,examples} --keep-going --warnings=error --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" --compilation-cache-size=500
run: codeql query compile -q -j0 */ql/{src,examples} --keep-going --warnings=error --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" --compilation-cache-size=500 --ram=56000

View File

@@ -19,7 +19,7 @@ on:
jobs:
CodeQL-Build:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
contents: read
@@ -38,17 +38,15 @@ jobs:
languages: cpp
config-file: ./.github/codeql/codeql-config.yml
- name: "[Ubuntu] Remove GCC 13 from runner image"
shell: bash
- name: Install dependencies
run: |
sudo rm -f /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-jammy.list
sudo apt-get update
sudo apt-get install -y --allow-downgrades libc6=2.35-* libc6-dev=2.35-* libstdc++6=12.3.0-* libgcc-s1=12.3.0-*
sudo apt-get install -y uuid-dev
- name: "Build Swift extractor using Bazel"
run: |
bazel clean --expunge
bazel run //swift:create-extractor-pack --nouse_action_cache --noremote_accept_cached --noremote_upload_local_results --spawn_strategy=local
bazel run //swift:install --nouse_action_cache --noremote_accept_cached --noremote_upload_local_results --spawn_strategy=local
bazel shutdown
- name: Perform CodeQL Analysis

View File

@@ -5,8 +5,10 @@ on:
paths:
- "csharp/**"
- "shared/**"
- "misc/bazel/**"
- .github/actions/fetch-codeql/action.yml
- codeql-workspace.yml
- "MODULE.bazel"
branches:
- main
- "rc/*"
@@ -14,9 +16,11 @@ on:
paths:
- "csharp/**"
- "shared/**"
- "misc/bazel/**"
- .github/workflows/csharp-qltest.yml
- .github/actions/fetch-codeql/action.yml
- codeql-workspace.yml
- "MODULE.bazel"
branches:
- main
- "rc/*"
@@ -39,14 +43,14 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.101
dotnet-version: 9.0.100
- name: Extractor unit tests
run: |
dotnet tool restore
dotnet test -p:RuntimeFrameworkVersion=8.0.1 extractor/Semmle.Util.Tests
dotnet test -p:RuntimeFrameworkVersion=8.0.1 extractor/Semmle.Extraction.Tests
dotnet test -p:RuntimeFrameworkVersion=8.0.1 autobuilder/Semmle.Autobuild.CSharp.Tests
dotnet test -p:RuntimeFrameworkVersion=8.0.1 autobuilder/Semmle.Autobuild.Cpp.Tests
dotnet test -p:RuntimeFrameworkVersion=9.0.0 extractor/Semmle.Util.Tests
dotnet test -p:RuntimeFrameworkVersion=9.0.0 extractor/Semmle.Extraction.Tests
dotnet test -p:RuntimeFrameworkVersion=9.0.0 autobuilder/Semmle.Autobuild.CSharp.Tests
dotnet test -p:RuntimeFrameworkVersion=9.0.0 autobuilder/Semmle.Autobuild.Cpp.Tests
shell: bash
stubgentest:
runs-on: ubuntu-latest

View File

@@ -37,7 +37,7 @@ jobs:
run: |
DATABASE="${{ runner.temp }}/java-database"
codeql database analyze --format=sarif-latest --output=metrics-java.sarif -- "$DATABASE" ./java/ql/src/Metrics/Summaries/FrameworkCoverage.ql
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: metrics-java.sarif
path: metrics-java.sarif
@@ -64,7 +64,7 @@ jobs:
run: |
DATABASE="${{ runner.temp }}/csharp-database"
codeql database analyze --format=sarif-latest --output=metrics-csharp.sarif -- "$DATABASE" ./csharp/ql/src/Metrics/Summaries/FrameworkCoverage.ql
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: metrics-csharp.sarif
path: metrics-csharp.sarif

View File

@@ -71,21 +71,21 @@ jobs:
run: |
python base/misc/scripts/library-coverage/compare-folders.py out_base out_merge comparison.md
- name: Upload CSV package list
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: csv-framework-coverage-merge
path: |
out_merge/framework-coverage-*.csv
out_merge/framework-coverage-*.rst
- name: Upload CSV package list
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: csv-framework-coverage-base
path: |
out_base/framework-coverage-*.csv
out_base/framework-coverage-*.rst
- name: Upload comparison results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: comparison
path: |
@@ -97,7 +97,7 @@ jobs:
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
- name: Upload PR number
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pr
path: pr/
@@ -117,7 +117,7 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
- name: Upload comment ID (if it exists)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: comment
path: comment/

View File

@@ -30,7 +30,7 @@ jobs:
run: |
python script/misc/scripts/library-coverage/generate-timeseries.py codeqlModels
- name: Upload timeseries CSV
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: framework-coverage-timeseries
path: framework-coverage-timeseries-*.csv

View File

@@ -34,12 +34,12 @@ jobs:
run: |
python script/misc/scripts/library-coverage/generate-report.py ci codeqlModels script
- name: Upload CSV package list
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: framework-coverage-csv
path: framework-coverage-*.csv
- name: Upload RST package list
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: framework-coverage-rst
path: framework-coverage-*.rst

View File

@@ -38,14 +38,20 @@ jobs:
path: codeql-main
ref: main
- uses: ./codeql-main/.github/actions/fetch-codeql
# compute the shortname of the project that does not contain any special (disk) characters
- run: |
echo "SHORTNAME=${SLUG//[^a-zA-Z0-9_]/}" >> $GITHUB_OUTPUT
env:
SLUG: ${{ matrix.slug }}
id: shortname
- name: Download database
env:
SLUG: ${{ matrix.slug }}
GH_TOKEN: ${{ github.token }}
SHORTNAME: ${{ steps.shortname.outputs.SHORTNAME }}
run: |
set -x
mkdir lib-dbs
SHORTNAME=${SLUG//[^a-zA-Z0-9_]/}
gh api -H "Accept: application/zip" "/repos/${SLUG}/code-scanning/codeql/databases/java" > "$SHORTNAME.zip"
unzip -q -d "${SHORTNAME}-db" "${SHORTNAME}.zip"
mkdir "lib-dbs/$SHORTNAME/"
@@ -93,14 +99,14 @@ jobs:
name="diff_${basename/.model.yml/""}"
(diff -w -u $m $t | diff2html -i stdin -F $MODELS/$name.html) || true
done
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: models
name: models-${{ steps.shortname.outputs.SHORTNAME }}
path: tmp-models/**/**/*.model.yml
retention-days: 20
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: diffs
name: diffs-${{ steps.shortname.outputs.SHORTNAME }}
path: tmp-models/*.html
# An html file is only produced if the generated models differ.
if-no-files-found: ignore

View File

@@ -59,7 +59,7 @@ jobs:
find java -name "*.model.yml" -print0 | xargs -0 git add
git status
git diff --cached > models.patch
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: patch
path: models.patch

View File

@@ -17,8 +17,11 @@ jobs:
post_comment:
runs-on: ubuntu-latest
steps:
- name: Download artifact
run: gh run download "${WORKFLOW_RUN_ID}" --repo "${GITHUB_REPOSITORY}" --name "comment"
- name: Download artifacts
run: |
gh run download "${WORKFLOW_RUN_ID}" --repo "${GITHUB_REPOSITORY}" --name "comment-pr-number"
gh run download "${WORKFLOW_RUN_ID}" --repo "${GITHUB_REPOSITORY}" --name "comment-body"
gh run download "${WORKFLOW_RUN_ID}" --repo "${GITHUB_REPOSITORY}" --name "comment-id"
env:
GITHUB_TOKEN: ${{ github.token }}
WORKFLOW_RUN_ID: ${{ github.event.workflow_run.id }}

View File

@@ -36,9 +36,9 @@ jobs:
- run: echo "${PR_NUMBER}" > pr_number.txt
env:
PR_NUMBER: ${{ github.event.number }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: comment
name: comment-pr-number
path: pr_number.txt
if-no-files-found: error
retention-days: 1
@@ -78,9 +78,9 @@ jobs:
exit "${EXIT_CODE}"
- if: ${{ !cancelled() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: comment
name: comment-body
path: comment_body.txt
if-no-files-found: error
retention-days: 1
@@ -94,9 +94,9 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.number }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: comment
name: comment-id
path: comment_id.txt
if-no-files-found: error
retention-days: 1

View File

@@ -75,7 +75,7 @@ jobs:
sarif_file: ql-for-ql.sarif
category: ql-for-ql
- name: Sarif as artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ql-for-ql.sarif
path: ql-for-ql.sarif
@@ -84,7 +84,7 @@ jobs:
mkdir split-sarif
node ./ql/scripts/split-sarif.js ql-for-ql.sarif split-sarif
- name: Upload langs as artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ql-for-ql-langs
path: split-sarif

View File

@@ -65,7 +65,7 @@ jobs:
"${CODEQL}" dataset measure --threads 4 --output "stats/${{ matrix.repo }}/stats.xml" "${{ runner.temp }}/database/db-ql"
env:
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: measurements
path: stats
@@ -76,14 +76,14 @@ jobs:
needs: measure
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: measurements
path: stats
- run: |
python -m pip install --user lxml
find stats -name 'stats.xml' -print0 | sort -z | xargs -0 python ruby/scripts/merge_stats.py --output ql/ql/src/ql.dbscheme.stats --normalise ql_tokeninfo
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ql.dbscheme.stats
path: ql/ql/src/ql.dbscheme.stats

View File

@@ -40,7 +40,7 @@ jobs:
ql/target
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/rust-toolchain.toml', 'ql/**/Cargo.lock') }}
- name: Check formatting
run: cd ql; cargo fmt --all -- --check
run: cd ql; cargo fmt -- --check
- name: Build extractor
run: |
cd ql;

View File

@@ -37,7 +37,7 @@ jobs:
run: |
python codeql/misc/scripts/generate-code-scanning-query-list.py > code-scanning-query-list.csv
- name: Upload code scanning query list
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: code-scanning-query-list
path: code-scanning-query-list.csv

View File

@@ -79,7 +79,7 @@ jobs:
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-rust-cargo-${{ hashFiles('ruby/extractor/rust-toolchain.toml', 'ruby/extractor/**/Cargo.lock') }}
- name: Check formatting
if: steps.cache-extractor.outputs.cache-hit != 'true'
run: cd extractor && cargo fmt --all -- --check
run: cd extractor && cargo fmt -- --check
- name: Build
if: steps.cache-extractor.outputs.cache-hit != 'true'
run: cd extractor && cargo build --verbose
@@ -92,17 +92,17 @@ jobs:
- name: Generate dbscheme
if: ${{ matrix.os == 'ubuntu-latest' && steps.cache-extractor.outputs.cache-hit != 'true'}}
run: ../target/release/codeql-extractor-ruby generate --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
name: ruby.dbscheme
path: ruby/ql/lib/ruby.dbscheme
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
name: TreeSitter.qll
path: ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: extractor-${{ matrix.os }}
path: |
@@ -134,7 +134,7 @@ jobs:
PACK_FOLDER=$(readlink -f "$PACKS"/codeql/ruby-queries/*)
codeql generate query-help --format=sarifv2.1.0 --output="${PACK_FOLDER}/rules.sarif" ql/src
(cd ql/src; find queries \( -name '*.qhelp' -o -name '*.rb' -o -name '*.erb' \) -exec bash -c 'mkdir -p "'"${PACK_FOLDER}"'/$(dirname "{}")"' \; -exec cp "{}" "${PACK_FOLDER}/{}" \;)
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: codeql-ruby-queries
path: |
@@ -147,19 +147,19 @@ jobs:
needs: [build, compile-queries]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: ruby.dbscheme
path: ruby/ruby
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: extractor-ubuntu-latest
path: ruby/linux64
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: extractor-windows-latest
path: ruby/win64
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: extractor-macos-latest
path: ruby/osx64
@@ -172,13 +172,13 @@ jobs:
cp win64/codeql-extractor-ruby.exe ruby/tools/win64/extractor.exe
chmod +x ruby/tools/{linux64,osx64}/extractor
zip -rq codeql-ruby.zip ruby
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: codeql-ruby-pack
path: ruby/codeql-ruby.zip
retention-days: 1
include-hidden-files: true
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: codeql-ruby-queries
path: ruby/qlpacks
@@ -190,7 +190,7 @@ jobs:
]
}' > .codeqlmanifest.json
zip -rq codeql-ruby-bundle.zip .codeqlmanifest.json ruby qlpacks
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: codeql-ruby-bundle
path: ruby/codeql-ruby-bundle.zip
@@ -214,7 +214,7 @@ jobs:
uses: ./.github/actions/fetch-codeql
- name: Download Ruby bundle
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: codeql-ruby-bundle
path: ${{ runner.temp }}

View File

@@ -52,9 +52,9 @@ jobs:
run: |
mkdir -p "stats/${{ matrix.repo }}"
codeql dataset measure --threads 4 --output "stats/${{ matrix.repo }}/stats.xml" "${{ runner.temp }}/database/db-ruby"
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: measurements
name: measurements-${{ hashFiles('stats/**') }}
path: stats
retention-days: 1
@@ -63,14 +63,13 @@ jobs:
needs: measure
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: measurements
path: stats
- run: |
python -m pip install --user lxml
find stats -name 'stats.xml' | sort | xargs python ruby/scripts/merge_stats.py --output ruby/ql/lib/ruby.dbscheme.stats --normalise ruby_tokeninfo
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ruby.dbscheme.stats
path: ruby/ql/lib/ruby.dbscheme.stats

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

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

View File

@@ -23,26 +23,48 @@ permissions:
contents: read
jobs:
rust-code:
rust-ast-generator:
runs-on: ubuntu-latest
defaults:
run:
working-directory: rust/ast-generator
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Inject sources
shell: bash
run: |
bazel run //rust/ast-generator:inject-sources
- name: Format
working-directory: rust/extractor
shell: bash
run: |
cargo fmt --check
- name: Compilation
working-directory: rust/extractor
shell: bash
run: cargo check
- name: Clippy
working-directory: rust/extractor
shell: bash
run: |
cargo clippy --fix
git diff --exit-code
cargo clippy --no-deps -- -D warnings
rust-code:
runs-on: ubuntu-latest
defaults:
run:
working-directory: rust/extractor
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Format
shell: bash
run: |
cargo fmt --check
- name: Compilation
shell: bash
run: cargo check
- name: Clippy
shell: bash
run: |
cargo clippy --no-deps -- -D warnings
rust-codegen:
runs-on: ubuntu-latest
steps:

View File

@@ -44,27 +44,20 @@ jobs:
# without waiting for the macOS build
build-and-test-macos:
if: github.repository_owner == 'github'
runs-on: macos-12-xl
runs-on: macos-13-xlarge
steps:
- uses: actions/checkout@v4
- uses: ./swift/actions/build-and-test
build-and-test-linux:
if: github.repository_owner == 'github'
runs-on: ubuntu-latest-xl
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./swift/actions/build-and-test
qltests-linux:
if: github.repository_owner == 'github'
needs: build-and-test-linux
runs-on: ubuntu-latest-xl
steps:
- uses: actions/checkout@v4
- uses: ./swift/actions/run-ql-tests
qltests-macos:
if: ${{ github.repository_owner == 'github' && github.event_name == 'pull_request' }}
needs: build-and-test-macos
runs-on: macos-12-xl
runs-on: macos-13-xlarge
steps:
- uses: actions/checkout@v4
- uses: ./swift/actions/run-ql-tests
@@ -98,7 +91,7 @@ jobs:
- name: Generate C++ files
run: |
bazel run //swift/codegen:codegen -- --generate=trap,cpp --cpp-output=$PWD/generated-cpp-files
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: swift-generated-cpp-files
path: generated-cpp-files/**
@@ -109,3 +102,10 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/fetch-codeql
- uses: ./swift/actions/database-upgrade-scripts
check-no-override:
if : github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- shell: bash
run: bazel test //swift/... --test_tag_filters=override --test_output=errors

View File

@@ -32,17 +32,17 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Check formatting
run: cargo fmt --all -- --check
run: cargo fmt -- --check
- name: Run tests
run: cargo test --verbose
fmt:
runs-on: ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check formatting
run: cargo fmt --check
clippy:
runs-on: ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run clippy

2
.gitignore vendored
View File

@@ -8,7 +8,7 @@
# qltest projects and artifacts
*.actual
*/ql/test/**/*.testproj
*/ql/test*/**/*.testproj
*/ql/test/**/go.sum
# Visual studio temporaries, except a file used by QL4VS

View File

@@ -72,7 +72,7 @@ repos:
- id: rust-codegen
name: Run Rust checked in code generation
files: ^misc/codegen/|^rust/(schema.py$|codegen/|.*/generated/|ql/lib/(rust\.dbscheme$|codeql/rust/elements)|\.generated.list)
files: ^misc/codegen/|^rust/(prefix\.dbscheme|schema/|codegen/|.*/generated/|ql/lib/(rust\.dbscheme$|codeql/rust/elements)|\.generated.list)
language: system
entry: bazel run //rust/codegen -- --quiet
pass_filenames: false

View File

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

88
.vscode/tasks.json vendored
View File

@@ -38,6 +38,94 @@
"command": "${config:python.pythonPath}",
},
"problemMatcher": []
},
{
"label": "Create query change note",
"type": "process",
"command": "python3",
"args": [
"misc/scripts/create-change-note.py",
"${input:language}",
"src",
"${input:name}",
"${input:categoryQuery}"
],
"presentation": {
"reveal": "never",
"close": true
},
"problemMatcher": []
},
{
"label": "Create library change note",
"type": "process",
"command": "python3",
"args": [
"misc/scripts/create-change-note.py",
"${input:language}",
"lib",
"${input:name}",
"${input:categoryLibrary}"
],
"presentation": {
"reveal": "never",
"close": true
},
"problemMatcher": []
}
],
"inputs": [
{
"type": "pickString",
"id": "language",
"description": "Language",
"options":
[
"actions",
"go",
"java",
"javascript",
"cpp",
"csharp",
"python",
"ruby",
"rust",
"swift",
]
},
{
"type": "promptString",
"id": "name",
"description": "Short name (kebab-case)"
},
{
"type": "pickString",
"id": "categoryQuery",
"description": "Category (query change)",
"options":
[
"breaking",
"deprecated",
"newQuery",
"queryMetadata",
"majorAnalysis",
"minorAnalysis",
"fix",
]
},
{
"type": "pickString",
"id": "categoryLibrary",
"description": "Category (library change)",
"options":
[
"breaking",
"deprecated",
"feature",
"majorAnalysis",
"minorAnalysis",
"fix",
]
}
]
}

4
2024-11-25-ts57.md Normal file
View File

@@ -0,0 +1,4 @@
---
category: majorAnalysis
---
* Added support for TypeScript 5.7.

View File

@@ -1 +1,5 @@
exports_files(["LICENSE"])
exports_files([
"LICENSE",
"Cargo.lock",
"Cargo.toml",
])

View File

@@ -1,3 +1,4 @@
/actions/ @github/codeql-dynamic
/cpp/ @github/codeql-c-analysis
/csharp/ @github/codeql-csharp
/csharp/autobuilder/Semmle.Autobuild.Cpp @github/codeql-c-extractor
@@ -23,7 +24,6 @@
/ql/ @github/codeql-ql-for-ql-reviewers
# Bazel (excluding BUILD.bazel files)
WORKSPACE.bazel @github/codeql-ci-reviewers
MODULE.bazel @github/codeql-ci-reviewers
.bazelversion @github/codeql-ci-reviewers
.bazelrc @github/codeql-ci-reviewers
@@ -43,3 +43,6 @@ MODULE.bazel @github/codeql-ci-reviewers
# Misc
/misc/scripts/accept-expected-changes-from-ci.py @RasmusWL
/misc/scripts/generate-code-scanning-query-list.py @RasmusWL
# .devcontainer
/.devcontainer/ @github/codeql-ci-reviewers

594
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -8,6 +8,7 @@ members = [
"rust/extractor",
"rust/extractor/macros",
"rust/ast-generator",
"rust/autobuild",
]
[patch.crates-io]

View File

@@ -15,60 +15,80 @@ local_path_override(
# see https://registry.bazel.build/ for a list of available packages
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_go", version = "0.50.0")
bazel_dep(name = "rules_go", version = "0.50.1")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_nodejs", version = "6.2.0-codeql.1")
bazel_dep(name = "rules_python", version = "0.35.0")
bazel_dep(name = "bazel_skylib", version = "1.6.1")
bazel_dep(name = "abseil-cpp", version = "20240116.0", repo_name = "absl")
bazel_dep(name = "rules_python", version = "0.40.0")
bazel_dep(name = "rules_shell", version = "0.3.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "abseil-cpp", version = "20240116.1", repo_name = "absl")
bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "json")
bazel_dep(name = "fmt", version = "10.0.0")
bazel_dep(name = "rules_kotlin", version = "2.0.0-codeql.1")
bazel_dep(name = "gazelle", version = "0.38.0")
bazel_dep(name = "rules_dotnet", version = "0.15.1")
bazel_dep(name = "gazelle", version = "0.40.0")
bazel_dep(name = "rules_dotnet", version = "0.17.4")
bazel_dep(name = "googletest", version = "1.14.0.bcr.1")
bazel_dep(name = "rules_rust", version = "0.52.2")
bazel_dep(name = "zstd", version = "1.5.5.bcr.1")
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
# crate_py but shortened due to Windows file path considerations
cp = use_extension(
"@rules_rust//crate_universe:extension.bzl",
"crate",
isolate = True,
)
cp.from_cargo(
name = "py_deps",
cargo_lockfile = "//python/extractor/tsg-python:Cargo.lock",
manifests = [
"//python/extractor/tsg-python:Cargo.toml",
"//python/extractor/tsg-python/tsp:Cargo.toml",
],
)
use_repo(cp, "py_deps")
# Keep edition and version approximately in sync with internal repo.
# the versions there are canonical, the versions here are used for CI in github/codeql, as well as for the vendoring of dependencies.
RUST_EDITION = "2021"
# deps for ruby+rust, but shortened due to windows file paths
r = use_extension(
"@rules_rust//crate_universe:extension.bzl",
"crate",
isolate = True,
)
r.from_cargo(
name = "r",
cargo_lockfile = "//:Cargo.lock",
manifests = [
"//:Cargo.toml",
"//ruby/extractor:Cargo.toml",
"//rust/extractor:Cargo.toml",
"//rust/extractor/macros:Cargo.toml",
"//rust/ast-generator:Cargo.toml",
"//shared/tree-sitter-extractor:Cargo.toml",
RUST_VERSION = "1.82.0"
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
edition = RUST_EDITION,
# We need those extra target triples so that we can build universal binaries on macos
extra_target_triples = [
"x86_64-apple-darwin",
"aarch64-apple-darwin",
],
versions = [RUST_VERSION],
)
use_repo(rust, "rust_toolchains")
register_toolchains("@rust_toolchains//:all")
rust_host_tools = use_extension("@rules_rust//rust:extensions.bzl", "rust_host_tools")
# Don't download a second toolchain as host toolchain, make sure this is the same version as above
# The host toolchain is used for vendoring dependencies.
rust_host_tools.host_tools(
edition = RUST_EDITION,
version = RUST_VERSION,
)
# deps for python extractor
# keep in sync by running `misc/bazel/3rdparty/update_cargo_deps.sh`
py_deps = use_extension("//misc/bazel/3rdparty:py_deps_extension.bzl", "p")
use_repo(py_deps, "vendor__anyhow-1.0.44", "vendor__cc-1.0.70", "vendor__clap-2.33.3", "vendor__regex-1.5.5", "vendor__smallvec-1.6.1", "vendor__string-interner-0.12.2", "vendor__thiserror-1.0.29", "vendor__tree-sitter-0.20.4", "vendor__tree-sitter-graph-0.7.0")
# deps for ruby+rust
# keep in sync by running `misc/bazel/3rdparty/update_cargo_deps.sh`
tree_sitter_extractors_deps = use_extension("//misc/bazel/3rdparty:tree_sitter_extractors_extension.bzl", "r")
use_repo(tree_sitter_extractors_deps, "vendor__anyhow-1.0.94", "vendor__argfile-0.2.1", "vendor__chrono-0.4.39", "vendor__clap-4.5.23", "vendor__dunce-1.0.5", "vendor__either-1.13.0", "vendor__encoding-0.2.33", "vendor__figment-0.10.19", "vendor__flate2-1.0.35", "vendor__glob-0.3.1", "vendor__globset-0.4.15", "vendor__itertools-0.12.1", "vendor__itertools-0.13.0", "vendor__lazy_static-1.5.0", "vendor__log-0.4.22", "vendor__num-traits-0.2.19", "vendor__num_cpus-1.16.0", "vendor__proc-macro2-1.0.92", "vendor__quote-1.0.37", "vendor__ra_ap_base_db-0.0.248", "vendor__ra_ap_cfg-0.0.248", "vendor__ra_ap_hir-0.0.248", "vendor__ra_ap_hir_def-0.0.248", "vendor__ra_ap_hir_expand-0.0.248", "vendor__ra_ap_ide_db-0.0.248", "vendor__ra_ap_intern-0.0.248", "vendor__ra_ap_load-cargo-0.0.248", "vendor__ra_ap_parser-0.0.248", "vendor__ra_ap_paths-0.0.248", "vendor__ra_ap_project_model-0.0.248", "vendor__ra_ap_span-0.0.248", "vendor__ra_ap_stdx-0.0.248", "vendor__ra_ap_syntax-0.0.248", "vendor__ra_ap_vfs-0.0.248", "vendor__rand-0.8.5", "vendor__rayon-1.10.0", "vendor__regex-1.11.1", "vendor__serde-1.0.216", "vendor__serde_json-1.0.133", "vendor__serde_with-3.11.0", "vendor__stderrlog-0.6.0", "vendor__syn-2.0.90", "vendor__tracing-0.1.41", "vendor__tracing-subscriber-0.3.19", "vendor__tree-sitter-0.24.5", "vendor__tree-sitter-embedded-template-0.23.2", "vendor__tree-sitter-json-0.24.8", "vendor__tree-sitter-ql-0.23.1", "vendor__tree-sitter-ruby-0.23.1", "vendor__triomphe-0.1.14", "vendor__ungrammar-1.16.1")
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# rust-analyzer sources needed by the rust ast-generator (see `rust/ast-generator/README.md`)
http_archive(
name = "rust-analyzer-src",
build_file = "//rust/ast-generator:BUILD.rust-analyzer-src.bazel",
integrity = "sha256-jl4KJmZku+ilMLnuX2NU+qa1v10IauSiDiz23sZo360=",
patch_args = ["-p1"],
patches = [
"//rust/ast-generator:patches/rust-analyzer.patch",
],
strip_prefix = "rust-analyzer-2024-12-16",
url = "https://github.com/rust-lang/rust-analyzer/archive/refs/tags/2024-12-16.tar.gz",
)
use_repo(r, tree_sitter_extractors_deps = "r")
dotnet = use_extension("@rules_dotnet//dotnet:extensions.bzl", "dotnet")
dotnet.toolchain(dotnet_version = "8.0.101")
dotnet.toolchain(dotnet_version = "9.0.100")
use_repo(dotnet, "dotnet_toolchains")
register_toolchains("@dotnet_toolchains//:all")
@@ -91,10 +111,12 @@ use_repo(
swift_deps,
"binlog",
"picosha2",
"swift_prebuilt_darwin_x86_64",
"swift_prebuilt_linux",
"swift_toolchain_linux",
"swift_toolchain_macos",
"swift-prebuilt-linux",
"swift-prebuilt-linux-download-only",
"swift-prebuilt-macos",
"swift-prebuilt-macos-download-only",
"swift-resource-dir-linux",
"swift-resource-dir-macos",
)
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
@@ -186,16 +208,6 @@ lfs_files(
executable = True,
)
lfs_files(
name = "swift-resource-dir-linux",
srcs = ["//swift/third_party/resource-dir:resource-dir-linux.zip"],
)
lfs_files(
name = "swift-resource-dir-macos",
srcs = ["//swift/third_party/resource-dir:resource-dir-macos.zip"],
)
register_toolchains(
"@nodejs_toolchains//:all",
)

View File

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

9
actions/BUILD.bazel Normal file
View File

@@ -0,0 +1,9 @@
load("//misc/bazel:pkg.bzl", "codeql_pack")
package(default_visibility = ["//visibility:public"])
codeql_pack(
name = "actions",
srcs = ["//actions/extractor"],
experimental = True,
)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,5 @@
## 0.4.0
### New Features
* Initial public preview release

View File

@@ -0,0 +1 @@
import codeql.actions.Ast

View File

@@ -0,0 +1,5 @@
## 0.4.0
### New Features
* Initial public preview release

View File

@@ -0,0 +1,4 @@
---
lockVersion: 1.0.0
dependencies: {}
compiled: false

View File

@@ -0,0 +1,2 @@
---
lastReleaseVersion: 0.4.0

View File

@@ -0,0 +1,98 @@
/** Provides classes for working with locations. */
import files.FileSystem
import codeql.actions.ast.internal.Ast
bindingset[loc]
pragma[inline_late]
private string locationToString(Location loc) {
exists(string filepath, int startline, int startcolumn, int endline, int endcolumn |
loc.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) and
result = filepath + "@" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn
)
}
newtype TLocation =
TBaseLocation(string filepath, int startline, int startcolumn, int endline, int endcolumn) {
exists(File file |
file.getAbsolutePath() = filepath and
locations_default(_, file, startline, startcolumn, endline, endcolumn)
)
or
exists(ExpressionImpl e |
e.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
)
or
filepath = "" and startline = 0 and startcolumn = 0 and endline = 0 and endcolumn = 0
}
/**
* A location as given by a file, a start line, a start column,
* an end line, and an end column.
*
* For more information about locations see [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
*/
class Location extends TLocation, TBaseLocation {
string filepath;
int startline;
int startcolumn;
int endline;
int endcolumn;
Location() { this = TBaseLocation(filepath, startline, startcolumn, endline, endcolumn) }
/** Gets the file for this location. */
File getFile() {
exists(File file |
file.getAbsolutePath() = filepath and
result = file
)
}
/** Gets the 1-based line number (inclusive) where this location starts. */
int getStartLine() { result = startline }
/** Gets the 1-based column number (inclusive) where this location starts. */
int getStartColumn() { result = startcolumn }
/** Gets the 1-based line number (inclusive) where this.getLocationDefault() location ends. */
int getEndLine() { result = endline }
/** Gets the 1-based column number (inclusive) where this.getLocationDefault() location ends. */
int getEndColumn() { result = endcolumn }
/** Gets the number of lines covered by this location. */
int getNumLines() { result = endline - startline + 1 }
/** Gets a textual representation of this element. */
pragma[inline]
string toString() { result = locationToString(this) }
/**
* Holds if this element is at the specified location.
* The location spans column `startcolumn` of line `startline` to
* column `endcolumn` of line `endline` in file `filepath`.
* For more information, see
* [Providing locations in CodeQL queries](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
*/
predicate hasLocationInfo(string p, int sl, int sc, int el, int ec) {
p = filepath and
sl = startline and
sc = startcolumn and
el = endline and
ec = endcolumn
}
/** Holds if this location starts strictly before the specified location. */
pragma[inline]
predicate strictlyBefore(Location other) {
this.getStartLine() < other.getStartLine()
or
this.getStartLine() = other.getStartLine() and this.getStartColumn() < other.getStartColumn()
}
}
/** An entity representing an empty location. */
class EmptyLocation extends Location {
EmptyLocation() { this.hasLocationInfo("", 0, 0, 0, 0) }
}

View File

@@ -0,0 +1,400 @@
private import codeql.actions.ast.internal.Ast
private import codeql.Locations
import codeql.actions.Helper
class AstNode instanceof AstNodeImpl {
AstNode getAChildNode() { result = super.getAChildNode() }
AstNode getParentNode() { result = super.getParentNode() }
string getAPrimaryQlClass() { result = super.getAPrimaryQlClass() }
Location getLocation() { result = super.getLocation() }
string toString() { result = super.toString() }
Step getEnclosingStep() { result = super.getEnclosingStep() }
Job getEnclosingJob() { result = super.getEnclosingJob() }
Event getATriggerEvent() { result = super.getATriggerEvent() }
Workflow getEnclosingWorkflow() { result = super.getEnclosingWorkflow() }
CompositeAction getEnclosingCompositeAction() { result = super.getEnclosingCompositeAction() }
Expression getInScopeEnvVarExpr(string name) { result = super.getInScopeEnvVarExpr(name) }
ScalarValue getInScopeDefaultValue(string name, string prop) {
result = super.getInScopeDefaultValue(name, prop)
}
}
class ScalarValue extends AstNode instanceof ScalarValueImpl {
string getValue() { result = super.getValue() }
}
class Expression extends AstNode instanceof ExpressionImpl {
string expression;
string rawExpression;
Expression() {
expression = this.getExpression() and
rawExpression = this.getRawExpression()
}
string getExpression() { result = expression }
string getRawExpression() { result = rawExpression }
string getNormalizedExpression() { result = normalizeExpr(expression) }
}
/** A common class for `env` in workflow, job or step. */
abstract class Env extends AstNode instanceof EnvImpl {
/** Gets an environment variable value given its name. */
ScalarValueImpl getEnvVarValue(string name) { result = super.getEnvVarValue(name) }
/** Gets an environment variable value. */
ScalarValueImpl getAnEnvVarValue() { result = super.getAnEnvVarValue() }
/** Gets an environment variable expressin given its name. */
ExpressionImpl getEnvVarExpr(string name) { result = super.getEnvVarExpr(name) }
/** Gets an environment variable expression. */
ExpressionImpl getAnEnvVarExpr() { result = super.getAnEnvVarExpr() }
}
/**
* A custom composite action. This is a mapping at the top level of an Actions YAML action file.
* See https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions.
*/
class CompositeAction extends AstNode instanceof CompositeActionImpl {
Runs getRuns() { result = super.getRuns() }
Outputs getOutputs() { result = super.getOutputs() }
Expression getAnOutputExpr() { result = super.getAnOutputExpr() }
Expression getOutputExpr(string outputName) { result = super.getOutputExpr(outputName) }
Input getAnInput() { result = super.getAnInput() }
Input getInput(string inputName) { result = super.getInput(inputName) }
LocalJob getACallerJob() { result = super.getACallerJob() }
UsesStep getACallerStep() { result = super.getACallerStep() }
predicate isPrivileged() { super.isPrivileged() }
}
/**
* An Actions workflow. This is a mapping at the top level of an Actions YAML workflow file.
* See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions.
*/
class Workflow extends AstNode instanceof WorkflowImpl {
Env getEnv() { result = super.getEnv() }
string getName() { result = super.getName() }
Job getAJob() { result = super.getAJob() }
Job getJob(string jobId) { result = super.getJob(jobId) }
Permissions getPermissions() { result = super.getPermissions() }
Strategy getStrategy() { result = super.getStrategy() }
On getOn() { result = super.getOn() }
}
class ReusableWorkflow extends Workflow instanceof ReusableWorkflowImpl {
Outputs getOutputs() { result = super.getOutputs() }
Expression getAnOutputExpr() { result = super.getAnOutputExpr() }
Expression getOutputExpr(string outputName) { result = super.getOutputExpr(outputName) }
Input getAnInput() { result = super.getAnInput() }
Input getInput(string inputName) { result = super.getInput(inputName) }
ExternalJob getACaller() { result = super.getACaller() }
}
class Input extends AstNode instanceof InputImpl { }
class Default extends AstNode instanceof DefaultsImpl {
ScalarValue getValue(string name, string prop) { result = super.getValue(name, prop) }
}
class Outputs extends AstNode instanceof OutputsImpl {
Expression getAnOutputExpr() { result = super.getAnOutputExpr() }
Expression getOutputExpr(string outputName) { result = super.getOutputExpr(outputName) }
override string toString() { result = "Job outputs node" }
}
class Permissions extends AstNode instanceof PermissionsImpl {
bindingset[perm]
string getPermission(string perm) { result = super.getPermission(perm) }
string getAPermission() { result = super.getAPermission() }
}
class Strategy extends AstNode instanceof StrategyImpl {
Expression getMatrixVarExpr(string varName) { result = super.getMatrixVarExpr(varName) }
Expression getAMatrixVarExpr() { result = super.getAMatrixVarExpr() }
}
/**
* https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idneeds
*/
class Needs extends AstNode instanceof NeedsImpl {
Job getANeededJob() { result = super.getANeededJob() }
}
class On extends AstNode instanceof OnImpl {
Event getAnEvent() { result = super.getAnEvent() }
}
class Event extends AstNode instanceof EventImpl {
string getName() { result = super.getName() }
string getAnActivityType() { result = super.getAnActivityType() }
string getAPropertyValue(string prop) { result = super.getAPropertyValue(prop) }
predicate hasProperty(string prop) { super.hasProperty(prop) }
predicate isExternallyTriggerable() { super.isExternallyTriggerable() }
predicate isPrivileged() { super.isPrivileged() }
}
/**
* An Actions job within a workflow.
* See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobs.
*/
abstract class Job extends AstNode instanceof JobImpl {
string getId() { result = super.getId() }
Workflow getWorkflow() { result = super.getWorkflow() }
Job getANeededJob() { result = super.getANeededJob() }
Outputs getOutputs() { result = super.getOutputs() }
Expression getAnOutputExpr() { result = super.getAnOutputExpr() }
Expression getOutputExpr(string outputName) { result = super.getOutputExpr(outputName) }
Env getEnv() { result = super.getEnv() }
If getIf() { result = super.getIf() }
Environment getEnvironment() { result = super.getEnvironment() }
Permissions getPermissions() { result = super.getPermissions() }
Strategy getStrategy() { result = super.getStrategy() }
string getARunsOnLabel() { result = super.getARunsOnLabel() }
predicate isPrivileged() { super.isPrivileged() }
predicate isPrivilegedExternallyTriggerable(Event event) {
super.isPrivilegedExternallyTriggerable(event)
}
}
abstract class StepsContainer extends AstNode instanceof StepsContainerImpl {
Step getAStep() { result = super.getAStep() }
Step getStep(int i) { result = super.getStep(i) }
}
/**
* An `runs` mapping in a custom composite action YAML.
* See https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs
*/
class Runs extends StepsContainer instanceof RunsImpl {
CompositeAction getAction() { result = super.getAction() }
}
/**
* An Actions job within a workflow which is composed of steps.
* See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobs.
*/
class LocalJob extends Job, StepsContainer instanceof LocalJobImpl { }
/**
* A step within an Actions job.
* See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idsteps.
*/
class Step extends AstNode instanceof StepImpl {
string getId() { result = super.getId() }
Env getEnv() { result = super.getEnv() }
If getIf() { result = super.getIf() }
StepsContainer getContainer() { result = super.getContainer() }
Step getNextStep() { result = super.getNextStep() }
Step getAFollowingStep() { result = super.getAFollowingStep() }
}
/**
* An If node representing a conditional statement.
*/
class If extends AstNode instanceof IfImpl {
string getCondition() { result = super.getCondition() }
Expression getConditionExpr() { result = super.getConditionExpr() }
string getConditionStyle() { result = super.getConditionStyle() }
}
/**
* An Environemnt node representing a deployment environment.
*/
class Environment extends AstNode instanceof EnvironmentImpl {
string getName() { result = super.getName() }
Expression getNameExpr() { result = super.getNameExpr() }
}
abstract class Uses extends AstNode instanceof UsesImpl {
string getCallee() { result = super.getCallee() }
ScalarValue getCalleeNode() { result = super.getCalleeNode() }
string getVersion() { result = super.getVersion() }
int getMajorVersion() { result = super.getMajorVersion() }
string getArgument(string argName) { result = super.getArgument(argName) }
Expression getArgumentExpr(string argName) { result = super.getArgumentExpr(argName) }
}
class UsesStep extends Step, Uses instanceof UsesStepImpl { }
class ExternalJob extends Job, Uses instanceof ExternalJobImpl { }
/**
* A `run` field within an Actions job step, which runs command-line programs using an operating system shell.
* See https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsrun.
*/
class Run extends Step instanceof RunImpl {
ShellScript getScript() { result = super.getScript() }
Expression getAnScriptExpr() { result = super.getAnScriptExpr() }
string getWorkingDirectory() { result = super.getWorkingDirectory() }
string getShell() { result = super.getShell() }
}
class ShellScript extends ScalarValueImpl instanceof ShellScriptImpl {
string getRawScript() { result = super.getRawScript() }
string getStmt(int i) { result = super.getStmt(i) }
string getAStmt() { result = super.getAStmt() }
string getCommand(int i) { result = super.getCommand(i) }
string getACommand() { result = super.getACommand() }
string getFileReadCommand(int i) { result = super.getFileReadCommand(i) }
string getAFileReadCommand() { result = super.getAFileReadCommand() }
predicate getAssignment(int i, string name, string data) { super.getAssignment(i, name, data) }
predicate getAnAssignment(string name, string data) { super.getAnAssignment(name, data) }
predicate getAWriteToGitHubEnv(string name, string data) {
super.getAWriteToGitHubEnv(name, data)
}
predicate getAWriteToGitHubOutput(string name, string data) {
super.getAWriteToGitHubOutput(name, data)
}
predicate getAWriteToGitHubPath(string data) { super.getAWriteToGitHubPath(data) }
predicate getAnEnvReachingGitHubOutputWrite(string var, string output_field) {
super.getAnEnvReachingGitHubOutputWrite(var, output_field)
}
predicate getACmdReachingGitHubOutputWrite(string cmd, string output_field) {
super.getACmdReachingGitHubOutputWrite(cmd, output_field)
}
predicate getAnEnvReachingGitHubEnvWrite(string var, string output_field) {
super.getAnEnvReachingGitHubEnvWrite(var, output_field)
}
predicate getACmdReachingGitHubEnvWrite(string cmd, string output_field) {
super.getACmdReachingGitHubEnvWrite(cmd, output_field)
}
predicate getAnEnvReachingGitHubPathWrite(string var) {
super.getAnEnvReachingGitHubPathWrite(var)
}
predicate getACmdReachingGitHubPathWrite(string cmd) { super.getACmdReachingGitHubPathWrite(cmd) }
predicate getAnEnvReachingArgumentInjectionSink(string var, string command, string argument) {
super.getAnEnvReachingArgumentInjectionSink(var, command, argument)
}
predicate getACmdReachingArgumentInjectionSink(string cmd, string command, string argument) {
super.getACmdReachingArgumentInjectionSink(cmd, command, argument)
}
predicate fileToGitHubEnv(string path) { super.fileToGitHubEnv(path) }
predicate fileToGitHubOutput(string path) { super.fileToGitHubOutput(path) }
predicate fileToGitHubPath(string path) { super.fileToGitHubPath(path) }
}
abstract class SimpleReferenceExpression extends AstNode instanceof SimpleReferenceExpressionImpl {
string getFieldName() { result = super.getFieldName() }
AstNode getTarget() { result = super.getTarget() }
}
class JsonReferenceExpression extends AstNode instanceof JsonReferenceExpressionImpl {
string getAccessPath() { result = super.getAccessPath() }
string getInnerExpression() { result = super.getInnerExpression() }
}
class GitHubExpression extends SimpleReferenceExpression instanceof GitHubExpressionImpl { }
class SecretsExpression extends SimpleReferenceExpression instanceof SecretsExpressionImpl { }
class StepsExpression extends SimpleReferenceExpression instanceof StepsExpressionImpl {
string getStepId() { result = super.getStepId() }
}
class NeedsExpression extends SimpleReferenceExpression instanceof NeedsExpressionImpl {
string getNeededJobId() { result = super.getNeededJobId() }
}
class JobsExpression extends SimpleReferenceExpression instanceof JobsExpressionImpl { }
class InputsExpression extends SimpleReferenceExpression instanceof InputsExpressionImpl { }
class EnvExpression extends SimpleReferenceExpression instanceof EnvExpressionImpl { }
class MatrixExpression extends SimpleReferenceExpression instanceof MatrixExpressionImpl { }

View File

@@ -0,0 +1,722 @@
private import codeql.actions.Ast
class BashShellScript extends ShellScript {
BashShellScript() {
exists(Run run |
this = run.getScript() and
run.getShell().matches(["bash%", "sh"])
)
}
private string lineProducer(int i) {
result = this.getRawScript().regexpReplaceAll("\\\\\\s*\n", "").splitAt("\n", i)
}
private predicate cmdSubstitutionReplacement(string cmdSubs, string id, int k) {
exists(string line | line = this.lineProducer(k) |
exists(int i, int j |
cmdSubs =
// $() cmd substitution
line.regexpFind("\\$\\((?:[^()]+|\\((?:[^()]+|\\([^()]*\\))*\\))*\\)", i, j)
.regexpReplaceAll("^\\$\\(", "")
.regexpReplaceAll("\\)$", "") and
id = "cmdsubs:" + k + ":" + i + ":" + j
)
or
exists(int i, int j |
// `...` cmd substitution
cmdSubs =
line.regexpFind("\\`[^\\`]+\\`", i, j)
.regexpReplaceAll("^\\`", "")
.regexpReplaceAll("\\`$", "") and
id = "cmd:" + k + ":" + i + ":" + j
)
)
}
private predicate rankedCmdSubstitutionReplacements(int i, string old, string new) {
old = rank[i](string old2 | this.cmdSubstitutionReplacement(old2, _, _) | old2) and
this.cmdSubstitutionReplacement(old, new, _)
}
private predicate doReplaceCmdSubstitutions(int line, int round, string old, string new) {
round = 0 and
old = this.lineProducer(line) and
new = old
or
round > 0 and
exists(string middle, string target, string replacement |
this.doReplaceCmdSubstitutions(line, round - 1, old, middle) and
this.rankedCmdSubstitutionReplacements(round, target, replacement) and
new = middle.replaceAll(target, replacement)
)
}
private string cmdSubstitutedLineProducer(int i) {
// script lines where any command substitution has been replaced with a unique placeholder
result =
max(int round, string new |
this.doReplaceCmdSubstitutions(i, round, _, new)
|
new order by round
)
or
this.cmdSubstitutionReplacement(result, _, i)
}
private predicate quotedStringReplacement(string quotedStr, string id) {
exists(string line, int k | line = this.cmdSubstitutedLineProducer(k) |
exists(int i, int j |
// double quoted string
quotedStr = line.regexpFind("\"((?:[^\"\\\\]|\\\\.)*)\"", i, j) and
id =
"qstr:" + k + ":" + i + ":" + j + ":" + quotedStr.length() + ":" +
quotedStr.regexpReplaceAll("[^a-zA-Z0-9]", "")
)
or
exists(int i, int j |
// single quoted string
quotedStr = line.regexpFind("'((?:\\\\.|[^'\\\\])*)'", i, j) and
id =
"qstr:" + k + ":" + i + ":" + j + ":" + quotedStr.length() + ":" +
quotedStr.regexpReplaceAll("[^a-zA-Z0-9]", "")
)
)
}
private predicate rankedQuotedStringReplacements(int i, string old, string new) {
old = rank[i](string old2 | this.quotedStringReplacement(old2, _) | old2) and
this.quotedStringReplacement(old, new)
}
private predicate doReplaceQuotedStrings(int line, int round, string old, string new) {
round = 0 and
old = this.cmdSubstitutedLineProducer(line) and
new = old
or
round > 0 and
exists(string middle, string target, string replacement |
this.doReplaceQuotedStrings(line, round - 1, old, middle) and
this.rankedQuotedStringReplacements(round, target, replacement) and
new = middle.replaceAll(target, replacement)
)
}
private string quotedStringLineProducer(int i) {
result =
max(int round, string new | this.doReplaceQuotedStrings(i, round, _, new) | new order by round)
}
private string stmtProducer(int i) {
result = this.quotedStringLineProducer(i).splitAt(Bash::splitSeparator()).trim() and
// when splitting the line with a separator that is not present, the result is the original line which may contain other separators
// we only one the split parts that do not contain any of the separators
not result.indexOf(Bash::splitSeparator()) > -1
}
private predicate doStmtRestoreQuotedStrings(int line, int round, string old, string new) {
round = 0 and
old = this.stmtProducer(line) and
new = old
or
round > 0 and
exists(string middle, string target, string replacement |
this.doStmtRestoreQuotedStrings(line, round - 1, old, middle) and
this.rankedQuotedStringReplacements(round, target, replacement) and
new = middle.replaceAll(replacement, target)
)
}
private string restoredStmtQuotedStringLineProducer(int i) {
result =
max(int round, string new |
this.doStmtRestoreQuotedStrings(i, round, _, new)
|
new order by round
) and
not result.indexOf("qstr:") > -1
}
private predicate doStmtRestoreCmdSubstitutions(int line, int round, string old, string new) {
round = 0 and
old = this.restoredStmtQuotedStringLineProducer(line) and
new = old
or
round > 0 and
exists(string middle, string target, string replacement |
this.doStmtRestoreCmdSubstitutions(line, round - 1, old, middle) and
this.rankedCmdSubstitutionReplacements(round, target, replacement) and
new = middle.replaceAll(replacement, target)
)
}
override string getStmt(int i) {
result =
max(int round, string new |
this.doStmtRestoreCmdSubstitutions(i, round, _, new)
|
new order by round
) and
not result.indexOf("cmdsubs:") > -1
}
override string getAStmt() { result = this.getStmt(_) }
private string cmdProducer(int i) {
result = this.quotedStringLineProducer(i).splitAt(Bash::separator()).trim() and
// when splitting the line with a separator that is not present, the result is the original line which may contain other separators
// we only one the split parts that do not contain any of the separators
not result.indexOf(Bash::separator()) > -1
}
private predicate doCmdRestoreQuotedStrings(int line, int round, string old, string new) {
round = 0 and
old = this.cmdProducer(line) and
new = old
or
round > 0 and
exists(string middle, string target, string replacement |
this.doCmdRestoreQuotedStrings(line, round - 1, old, middle) and
this.rankedQuotedStringReplacements(round, target, replacement) and
new = middle.replaceAll(replacement, target)
)
}
private string restoredCmdQuotedStringLineProducer(int i) {
result =
max(int round, string new |
this.doCmdRestoreQuotedStrings(i, round, _, new)
|
new order by round
) and
not result.indexOf("qstr:") > -1
}
private predicate doCmdRestoreCmdSubstitutions(int line, int round, string old, string new) {
round = 0 and
old = this.restoredCmdQuotedStringLineProducer(line) and
new = old
or
round > 0 and
exists(string middle, string target, string replacement |
this.doCmdRestoreCmdSubstitutions(line, round - 1, old, middle) and
this.rankedCmdSubstitutionReplacements(round, target, replacement) and
new = middle.replaceAll(replacement, target)
)
}
string getCmd(int i) {
result =
max(int round, string new |
this.doCmdRestoreCmdSubstitutions(i, round, _, new)
|
new order by round
) and
not result.indexOf("cmdsubs:") > -1
}
string getACmd() { result = this.getCmd(_) }
override string getCommand(int i) {
// remove redirection
result =
this.getCmd(i)
.regexpReplaceAll("(>|>>|2>|2>>|<|<<<)\\s*[\\{\\}\\$\"'_\\-0-9a-zA-Z]+$", "")
.trim() and
// exclude variable declarations
not result.regexpMatch("^[a-zA-Z0-9\\-_]+=") and
// exclude comments
not result.trim().indexOf("#") = 0 and
// exclude the following keywords
not result =
[
"", "for", "in", "do", "done", "if", "then", "else", "elif", "fi", "while", "until", "case",
"esac", "{", "}"
]
}
override string getACommand() { result = this.getCommand(_) }
override string getFileReadCommand(int i) {
result = this.getStmt(i) and
result.matches(Bash::fileReadCommand() + "%")
}
override string getAFileReadCommand() { result = this.getFileReadCommand(_) }
override predicate getAssignment(int i, string name, string data) {
exists(string stmt |
stmt = this.getStmt(i) and
name = stmt.regexpCapture("^([a-zA-Z0-9\\-_]+)=.*", 1) and
data = stmt.regexpCapture("^[a-zA-Z0-9\\-_]+=(.*)", 1)
)
}
override predicate getAnAssignment(string name, string data) { this.getAssignment(_, name, data) }
override predicate getAWriteToGitHubEnv(string name, string data) {
exists(string raw |
Bash::extractFileWrite(this, "GITHUB_ENV", raw) and
Bash::extractVariableAndValue(raw, name, data)
)
}
override predicate getAWriteToGitHubOutput(string name, string data) {
exists(string raw |
Bash::extractFileWrite(this, "GITHUB_OUTPUT", raw) and
Bash::extractVariableAndValue(raw, name, data)
)
}
override predicate getAWriteToGitHubPath(string data) {
Bash::extractFileWrite(this, "GITHUB_PATH", data)
}
override predicate getAnEnvReachingGitHubOutputWrite(string var, string output_field) {
Bash::envReachingGitHubFileWrite(this, var, "GITHUB_OUTPUT", output_field)
}
override predicate getACmdReachingGitHubOutputWrite(string cmd, string output_field) {
Bash::cmdReachingGitHubFileWrite(this, cmd, "GITHUB_OUTPUT", output_field)
}
override predicate getAnEnvReachingGitHubEnvWrite(string var, string output_field) {
Bash::envReachingGitHubFileWrite(this, var, "GITHUB_ENV", output_field)
}
override predicate getACmdReachingGitHubEnvWrite(string cmd, string output_field) {
Bash::cmdReachingGitHubFileWrite(this, cmd, "GITHUB_ENV", output_field)
}
override predicate getAnEnvReachingGitHubPathWrite(string var) {
Bash::envReachingGitHubFileWrite(this, var, "GITHUB_PATH", _)
}
override predicate getACmdReachingGitHubPathWrite(string cmd) {
Bash::cmdReachingGitHubFileWrite(this, cmd, "GITHUB_PATH", _)
}
override predicate getAnEnvReachingArgumentInjectionSink(
string var, string command, string argument
) {
Bash::envReachingArgumentInjectionSink(this, var, command, argument)
}
override predicate getACmdReachingArgumentInjectionSink(
string cmd, string command, string argument
) {
Bash::cmdReachingArgumentInjectionSink(this, cmd, command, argument)
}
override predicate fileToGitHubEnv(string path) {
Bash::fileToFileWrite(this, "GITHUB_ENV", path)
}
override predicate fileToGitHubOutput(string path) {
Bash::fileToFileWrite(this, "GITHUB_OUTPUT", path)
}
override predicate fileToGitHubPath(string path) {
Bash::fileToFileWrite(this, "GITHUB_PATH", path)
}
}
module Bash {
string stmtSeparator() { result = ";" }
string commandSeparator() { result = ["&&", "||"] }
string splitSeparator() {
result = stmtSeparator() or
result = commandSeparator()
}
string redirectionSeparator() { result = [">", ">>", "2>", "2>>", ">&", "2>&", "<", "<<<"] }
string pipeSeparator() { result = "|" }
string separator() {
result = stmtSeparator() or
result = commandSeparator() or
result = pipeSeparator()
}
string fileReadCommand() { result = ["<", "cat", "jq", "yq", "tail", "head"] }
/** Checks if expr is a bash command substitution */
bindingset[expr]
predicate isCmdSubstitution(string expr, string cmd) {
exists(string regexp |
// $(cmd)
regexp = "\\$\\(([^)]+)\\)" and
cmd = expr.regexpCapture(regexp, 1)
or
// `cmd`
regexp = "`([^`]+)`" and
cmd = expr.regexpCapture(regexp, 1)
)
}
/** Checks if expr is a bash command substitution */
bindingset[expr]
predicate containsCmdSubstitution(string expr, string cmd) {
exists(string regexp |
// $(cmd)
regexp = ".*\\$\\(([^)]+)\\).*" and
cmd = expr.regexpCapture(regexp, 1).trim()
or
// `cmd`
regexp = ".*`([^`]+)`.*" and
cmd = expr.regexpCapture(regexp, 1).trim()
)
}
/** Checks if expr is a bash parameter expansion */
bindingset[expr]
predicate isParameterExpansion(string expr, string parameter, string operator, string params) {
exists(string regexp |
// $VAR
regexp = "\\$([a-zA-Z_][a-zA-Z0-9_]+)\\b" and
parameter = expr.regexpCapture(regexp, 1) and
operator = "" and
params = ""
or
// ${VAR}
regexp = "\\$\\{([a-zA-Z_][a-zA-Z0-9_]*)\\}" and
parameter = expr.regexpCapture(regexp, 1) and
operator = "" and
params = ""
or
// ${!VAR}
regexp = "\\$\\{([!#])([a-zA-Z_][a-zA-Z0-9_]*)\\}" and
parameter = expr.regexpCapture(regexp, 2) and
operator = expr.regexpCapture(regexp, 1) and
params = ""
or
// ${VAR<OP><PARAMS>}, ...
regexp = "\\$\\{([a-zA-Z_][a-zA-Z0-9_]*)([#%/:^,\\-+]{1,2})?(.*?)\\}" and
parameter = expr.regexpCapture(regexp, 1) and
operator = expr.regexpCapture(regexp, 2) and
params = expr.regexpCapture(regexp, 3)
)
}
bindingset[expr]
predicate containsParameterExpansion(string expr, string parameter, string operator, string params) {
exists(string regexp |
// $VAR
regexp = ".*\\$([a-zA-Z_][a-zA-Z0-9_]+)\\b.*" and
parameter = expr.regexpCapture(regexp, 1) and
operator = "" and
params = ""
or
// ${VAR}
regexp = ".*\\$\\{([a-zA-Z_][a-zA-Z0-9_]*)\\}.*" and
parameter = expr.regexpCapture(regexp, 1) and
operator = "" and
params = ""
or
// ${!VAR}
regexp = ".*\\$\\{([!#])([a-zA-Z_][a-zA-Z0-9_]*)\\}.*" and
parameter = expr.regexpCapture(regexp, 2) and
operator = expr.regexpCapture(regexp, 1) and
params = ""
or
// ${VAR<OP><PARAMS>}, ...
regexp = ".*\\$\\{([a-zA-Z_][a-zA-Z0-9_]*)([#%/:^,\\-+]{1,2})?(.*?)\\}.*" and
parameter = expr.regexpCapture(regexp, 1) and
operator = expr.regexpCapture(regexp, 2) and
params = expr.regexpCapture(regexp, 3)
)
}
bindingset[raw_content]
predicate extractVariableAndValue(string raw_content, string key, string value) {
exists(string regexp, string content | content = trimQuotes(raw_content) |
regexp = "(?msi).*^([a-zA-Z_][a-zA-Z0-9_]*)\\s*<<\\s*['\"]?(\\S+)['\"]?\\s*\n(.*?)\n\\2\\s*$" and
key = trimQuotes(content.regexpCapture(regexp, 1)) and
value = trimQuotes(content.regexpCapture(regexp, 3))
or
exists(string line |
line = content.splitAt("\n") and
regexp = "(?i)^([a-zA-Z_][a-zA-Z0-9_\\-]*)\\s*=\\s*(.*)$" and
key = trimQuotes(line.regexpCapture(regexp, 1)) and
value = trimQuotes(line.regexpCapture(regexp, 2))
)
)
}
bindingset[script]
predicate singleLineFileWrite(
string script, string cmd, string file, string content, string filters
) {
exists(string regexp |
regexp = "(?i)(echo|printf)\\s*(.*?)\\s*(>>|>|\\s*\\|\\s*tee\\s*(-a|--append)?)\\s*(\\S+)" and
cmd = script.regexpCapture(regexp, 1) and
file = trimQuotes(script.regexpCapture(regexp, 5)) and
filters = "" and
content = script.regexpCapture(regexp, 2)
)
}
bindingset[script]
predicate singleLineWorkflowCmd(string script, string cmd, string key, string value) {
exists(string regexp |
regexp = "(?i)(echo|printf)\\s*(['|\"])?::(set-[a-z]+)\\s*name\\s*=\\s*(.*?)::(.*)" and
cmd = script.regexpCapture(regexp, 3) and
key = script.regexpCapture(regexp, 4) and
value = trimQuotes(script.regexpCapture(regexp, 5))
or
regexp = "(?i)(echo|printf)\\s*(['|\"])?::(add-[a-z]+)\\s*::(.*)" and
cmd = script.regexpCapture(regexp, 3) and
key = "" and
value = trimQuotes(script.regexpCapture(regexp, 4))
)
}
bindingset[script]
predicate heredocFileWrite(string script, string cmd, string file, string content, string filters) {
exists(string regexp |
regexp =
"(?msi).*^(cat)\\s*(>>|>|\\s*\\|\\s*tee\\s*(-a|--append)?)\\s*(\\S+)\\s*<<\\s*['\"]?(\\S+)['\"]?\\s*\n(.*?)\n\\4\\s*$.*" and
cmd = script.regexpCapture(regexp, 1) and
file = trimQuotes(script.regexpCapture(regexp, 4)) and
content = script.regexpCapture(regexp, 6) and
filters = ""
or
regexp =
"(?msi).*^(cat)\\s*(<<|<)\\s*[-]?['\"]?(\\S+)['\"]?\\s*([^>]*)(>>|>|\\s*\\|\\s*tee\\s*(-a|--append)?)\\s*(\\S+)\\s*\n(.*?)\n\\3\\s*$.*" and
cmd = script.regexpCapture(regexp, 1) and
file = trimQuotes(script.regexpCapture(regexp, 7)) and
filters = script.regexpCapture(regexp, 4) and
content = script.regexpCapture(regexp, 8)
)
}
bindingset[script]
predicate linesFileWrite(string script, string cmd, string file, string content, string filters) {
exists(string regexp, string var_name |
regexp =
"(?msi).*((echo|printf)\\s+['|\"]?(.*?<<(\\S+))['|\"]?\\s*>>\\s*(\\S+)\\s*[\r\n]+)" +
"(((.*?)\\s*>>\\s*\\S+\\s*[\r\n]+)+)" +
"((echo|printf)\\s+['|\"]?(EOF)['|\"]?\\s*>>\\s*\\S+\\s*[\r\n]*).*" and
var_name = trimQuotes(script.regexpCapture(regexp, 3)).regexpReplaceAll("<<\\s*(\\S+)", "") and
content =
var_name + "=$(" +
trimQuotes(script.regexpCapture(regexp, 6))
.regexpReplaceAll(">>.*GITHUB_(ENV|OUTPUT)(})?", "")
.trim() + ")" and
cmd = "echo" and
file = trimQuotes(script.regexpCapture(regexp, 5)) and
filters = ""
)
}
bindingset[script]
predicate blockFileWrite(string script, string cmd, string file, string content, string filters) {
exists(string regexp, string first_line, string var_name |
regexp =
"(?msi).*^\\s*\\{\\s*[\r\n]" +
//
"(.*?)" +
//
"(\\s*\\}\\s*(>>|>|\\s*\\|\\s*tee\\s*(-a|--append)?)\\s*(\\S+))\\s*$.*" and
first_line = script.regexpCapture(regexp, 1).splitAt("\n", 0).trim() and
var_name = first_line.regexpCapture("echo\\s+('|\\\")?(.*)<<.*", 2) and
content = var_name + "=$(" + script.regexpCapture(regexp, 1).splitAt("\n").trim() + ")" and
not content.indexOf("EOF") > 0 and
file = trimQuotes(script.regexpCapture(regexp, 5)) and
cmd = "echo" and
filters = ""
)
}
bindingset[script]
predicate multiLineFileWrite(
string script, string cmd, string file, string content, string filters
) {
heredocFileWrite(script, cmd, file, content, filters)
or
linesFileWrite(script, cmd, file, content, filters)
or
blockFileWrite(script, cmd, file, content, filters)
}
bindingset[file_var]
predicate extractFileWrite(BashShellScript script, string file_var, string content) {
// single line assignment
exists(string file_expr, string raw_content |
isParameterExpansion(file_expr, file_var, _, _) and
singleLineFileWrite(script.getAStmt(), _, file_expr, raw_content, _) and
content = trimQuotes(raw_content)
)
or
// workflow command assignment
exists(string key, string value, string cmd |
(
file_var = "GITHUB_ENV" and
cmd = "set-env" and
content = key + "=" + value
or
file_var = "GITHUB_OUTPUT" and
cmd = "set-output" and
content = key + "=" + value
or
file_var = "GITHUB_PATH" and
cmd = "add-path" and
content = value
) and
singleLineWorkflowCmd(script.getAStmt(), cmd, key, value)
)
or
// multiline assignment
exists(string file_expr, string raw_content |
multiLineFileWrite(script.getRawScript(), _, file_expr, raw_content, _) and
isParameterExpansion(file_expr, file_var, _, _) and
content = trimQuotes(raw_content)
)
}
/** Writes the content of the file specified by `path` into a file pointed to by `file_var` */
predicate fileToFileWrite(BashShellScript script, string file_var, string path) {
exists(string regexp, string stmt, string file_expr |
regexp =
"(?i)(cat)\\s*" + "((?:(?!<<|<<-)[^>\n])+)\\s*" +
"(>>|>|\\s*\\|\\s*tee\\s*(-a|--append)?)\\s*" + "(\\S+)" and
stmt = script.getAStmt() and
file_expr = trimQuotes(stmt.regexpCapture(regexp, 5)) and
path = stmt.regexpCapture(regexp, 2) and
containsParameterExpansion(file_expr, file_var, _, _)
)
}
/**
* Holds if the Run scripts contains an access to an environment variable called `var`
* which value may get appended to the GITHUB_XXX special file
*/
predicate envReachingGitHubFileWrite(
BashShellScript script, string var, string file_var, string field
) {
exists(string file_write_value |
(
file_var = "GITHUB_ENV" and
script.getAWriteToGitHubEnv(field, file_write_value)
or
file_var = "GITHUB_OUTPUT" and
script.getAWriteToGitHubOutput(field, file_write_value)
or
file_var = "GITHUB_PATH" and
field = "PATH" and
script.getAWriteToGitHubPath(file_write_value)
) and
envReachingRunExpr(script, var, file_write_value)
)
}
/**
* Holds if and environment variable is used, directly or indirectly, in a Run's step expression.
* Where the expression is a string captured from the Run's script.
*/
bindingset[expr]
predicate envReachingRunExpr(BashShellScript script, string var, string expr) {
exists(string var2, string value2 |
// VAR2=${VAR:-default} (var2=value2)
// echo "FIELD=${VAR2:-default}" >> $GITHUB_ENV (field, file_write_value)
script.getAnAssignment(var2, value2) and
containsParameterExpansion(value2, var, _, _) and
containsParameterExpansion(expr, var2, _, _)
)
or
// var reaches the file write directly
// echo "FIELD=${VAR:-default}" >> $GITHUB_ENV (field, file_write_value)
containsParameterExpansion(expr, var, _, _)
}
/**
* Holds if the Run scripts contains a command substitution (`cmd`)
* which output may get appended to the GITHUB_XXX special file
*/
predicate cmdReachingGitHubFileWrite(
BashShellScript script, string cmd, string file_var, string field
) {
exists(string file_write_value |
(
file_var = "GITHUB_ENV" and
script.getAWriteToGitHubEnv(field, file_write_value)
or
file_var = "GITHUB_OUTPUT" and
script.getAWriteToGitHubOutput(field, file_write_value)
or
file_var = "GITHUB_PATH" and
field = "PATH" and
script.getAWriteToGitHubPath(file_write_value)
) and
cmdReachingRunExpr(script, cmd, file_write_value)
)
}
predicate envReachingArgumentInjectionSink(
BashShellScript script, string source, string command, string argument
) {
exists(string cmd, string regex, int command_group, int argument_group |
cmd = script.getACommand() and
argumentInjectionSinksDataModel(regex, command_group, argument_group) and
argument = cmd.regexpCapture(regex, argument_group).trim() and
command = cmd.regexpCapture(regex, command_group).trim() and
envReachingRunExpr(script, source, argument)
)
}
predicate cmdReachingArgumentInjectionSink(
BashShellScript script, string source, string command, string argument
) {
exists(string cmd, string regex, int command_group, int argument_group |
cmd = script.getACommand() and
argumentInjectionSinksDataModel(regex, command_group, argument_group) and
argument = cmd.regexpCapture(regex, argument_group).trim() and
command = cmd.regexpCapture(regex, command_group).trim() and
cmdReachingRunExpr(script, source, argument)
)
}
/**
* Holds if a command output is used, directly or indirectly, in a Run's step expression.
* Where the expression is a string captured from the Run's script.
*/
bindingset[expr]
predicate cmdReachingRunExpr(BashShellScript script, string cmd, string expr) {
// cmd output is assigned to a second variable (var2) and var2 reaches the file write
exists(string var2, string value2 |
// VAR2=$(cmd)
// echo "FIELD=${VAR2:-default}" >> $GITHUB_ENV (field, file_write_value)
script.getAnAssignment(var2, value2) and
containsCmdSubstitution(value2, cmd) and
containsParameterExpansion(expr, var2, _, _) and
not varMatchesRegexTest(script, var2, alphaNumericRegex())
)
or
// var reaches the file write directly
// echo "FIELD=$(cmd)" >> $GITHUB_ENV (field, file_write_value)
containsCmdSubstitution(expr, cmd)
}
/**
* Holds if there test command that checks a variable against a regex
* eg: `[[ $VAR =~ ^[a-zA-Z0-9_]+$ ]]`
*/
bindingset[var, regex]
predicate varMatchesRegexTest(BashShellScript script, string var, string regex) {
exists(string lhs, string rhs |
lhs = script.getACommand().regexpCapture(".*\\[\\[\\s*(.*?)\\s*=~\\s*(.*?)\\s*\\]\\].*", 1) and
containsParameterExpansion(lhs, var, _, _) and
rhs = script.getACommand().regexpCapture(".*\\[\\[\\s*(.*?)\\s*=~\\s*(.*?)\\s*\\]\\].*", 2) and
trimQuotes(rhs).regexpMatch(regex)
)
}
/**
* Holds if the given regex is used to match an alphanumeric string
* eg: `^[0-9a-zA-Z]{40}$`, `^[0-9]+$` or `^[a-zA-Z0-9_]+$`
*/
string alphaNumericRegex() { result = "^\\^\\[([09azAZ_-]+)\\](\\+|\\{\\d+\\})\\$$" }
}

View File

@@ -0,0 +1,6 @@
/** Provides classes representing the control flow graph. */
private import codeql.actions.controlflow.internal.Cfg as CfgInternal
import CfgInternal::Completion
import CfgInternal::CfgScope
import CfgInternal::CfgImpl

View File

@@ -0,0 +1 @@
import DataFlow::DataFlow::Consistency

View File

@@ -0,0 +1,22 @@
/**
* Provides classes for performing local (intra-procedural) and
* global (inter-procedural) data flow analyses.
*/
import codeql.Locations
module DataFlow {
private import codeql.dataflow.DataFlow
private import codeql.actions.dataflow.internal.DataFlowImplSpecific
import DataFlowMake<Location, ActionsDataFlow>
import codeql.actions.dataflow.internal.DataFlowPublic
// debug
private import codeql.actions.dataflow.internal.TaintTrackingImplSpecific
import codeql.dataflow.internal.DataFlowImplConsistency as DFIC
module ActionsConsistency implements DFIC::InputSig<Location, ActionsDataFlow> { }
module Consistency {
import DFIC::MakeConsistency<Location, ActionsDataFlow, ActionsTaintTracking, ActionsConsistency>
}
}

View File

@@ -0,0 +1,88 @@
private import codeql.actions.Ast
private import codeql.Locations
private import codeql.actions.security.ControlChecks
import codeql.actions.config.Config
import codeql.actions.Bash
import codeql.actions.PowerShell
bindingset[expr]
string normalizeExpr(string expr) {
result =
expr.regexpReplaceAll("\\['([a-zA-Z0-9_\\*\\-]+)'\\]", ".$1")
.regexpReplaceAll("\\[\"([a-zA-Z0-9_\\*\\-]+)\"\\]", ".$1")
.regexpReplaceAll("\\s*\\.\\s*", ".")
}
bindingset[regex]
string wrapRegexp(string regex) { result = "\\b" + regex + "\\b" }
bindingset[regex]
string wrapJsonRegexp(string regex) {
result = ["fromJSON\\(\\s*" + regex + "\\s*\\)", "toJSON\\(\\s*" + regex + "\\s*\\)"]
}
bindingset[str]
string trimQuotes(string str) {
result = str.trim().regexpReplaceAll("^(\"|')", "").regexpReplaceAll("(\"|')$", "")
}
predicate inPrivilegedContext(AstNode node, Event event) {
node.getEnclosingJob().isPrivilegedExternallyTriggerable(event)
}
predicate inNonPrivilegedContext(AstNode node) {
not node.getEnclosingJob().isPrivilegedExternallyTriggerable(_)
}
string defaultBranchNames() {
repositoryDataModel(_, result)
or
not exists(string default_branch_name | repositoryDataModel(_, default_branch_name)) and
result = ["main", "master"]
}
string getRepoRoot() {
exists(Workflow w |
w.getLocation().getFile().getRelativePath().indexOf("/.github/workflows") > 0 and
result =
w.getLocation()
.getFile()
.getRelativePath()
.prefix(w.getLocation().getFile().getRelativePath().indexOf("/.github/workflows") + 1) and
// exclude workflow_enum reusable workflows directory root
not result.indexOf(".github/workflows/external/") > -1 and
not result.indexOf(".github/actions/external/") > -1
or
not w.getLocation().getFile().getRelativePath().indexOf("/.github/workflows") > 0 and
not w.getLocation().getFile().getRelativePath().indexOf(".github/workflows/external/") > -1 and
not w.getLocation().getFile().getRelativePath().indexOf(".github/actions/external/") > -1 and
result = ""
)
}
bindingset[path]
string normalizePath(string path) {
exists(string trimmed_path | trimmed_path = trimQuotes(path) |
// ./foo -> GITHUB_WORKSPACE/foo
if path.indexOf("./") = 0
then result = path.replaceAll("./", "GITHUB_WORKSPACE/")
else
// GITHUB_WORKSPACE/foo -> GITHUB_WORKSPACE/foo
if path.indexOf("GITHUB_WORKSPACE/") = 0
then result = path
else
// foo -> GITHUB_WORKSPACE/foo
if path.regexpMatch("^[^/~].*")
then result = "GITHUB_WORKSPACE/" + path.regexpReplaceAll("/$", "")
else
// ~/foo -> ~/foo
// /foo -> /foo
result = path
)
}
/**
* Holds if the path cache_path is a subpath of the path untrusted_path.
*/
bindingset[subpath, path]
predicate isSubpath(string subpath, string path) { subpath.substring(0, path.length()) = path }

View File

@@ -0,0 +1,62 @@
private import codeql.actions.Ast
class PowerShellScript extends ShellScript {
PowerShellScript() {
exists(Run run |
this = run.getScript() and
run.getShell().matches("pwsh%")
)
}
override string getStmt(int i) { none() }
override string getAStmt() { none() }
override string getCommand(int i) { none() }
override string getACommand() { none() }
override string getFileReadCommand(int i) { none() }
override string getAFileReadCommand() { none() }
override predicate getAssignment(int i, string name, string data) { none() }
override predicate getAnAssignment(string name, string data) { none() }
override predicate getAWriteToGitHubEnv(string name, string data) { none() }
override predicate getAWriteToGitHubOutput(string name, string data) { none() }
override predicate getAWriteToGitHubPath(string data) { none() }
override predicate getAnEnvReachingGitHubOutputWrite(string var, string output_field) { none() }
override predicate getACmdReachingGitHubOutputWrite(string cmd, string output_field) { none() }
override predicate getAnEnvReachingGitHubEnvWrite(string var, string output_field) { none() }
override predicate getACmdReachingGitHubEnvWrite(string cmd, string output_field) { none() }
override predicate getAnEnvReachingGitHubPathWrite(string var) { none() }
override predicate getACmdReachingGitHubPathWrite(string cmd) { none() }
override predicate getAnEnvReachingArgumentInjectionSink(
string var, string command, string argument
) {
none()
}
override predicate getACmdReachingArgumentInjectionSink(
string cmd, string command, string argument
) {
none()
}
override predicate fileToGitHubEnv(string path) { none() }
override predicate fileToGitHubOutput(string path) { none() }
override predicate fileToGitHubPath(string path) { none() }
}

View File

@@ -0,0 +1,13 @@
/**
* Provides classes for performing local (intra-procedural) and
* global (inter-procedural) taint-tracking analyses.
*/
import codeql.Locations
module TaintTracking {
private import codeql.actions.dataflow.internal.DataFlowImplSpecific
private import codeql.actions.dataflow.internal.TaintTrackingImplSpecific
private import codeql.dataflow.TaintTracking
import TaintFlowMake<Location, ActionsDataFlow, ActionsTaintTracking>
}

View File

@@ -0,0 +1,32 @@
private import actions
/**
* Holds if workflow step uses the github/codeql-action/init action with no customizations.
* e.g.
* - name: Initialize
* uses: github/codeql-action/init@v2
* with:
* languages: ruby, javascript
*/
class DefaultableCodeQLInitiatlizeActionQuery extends UsesStep {
DefaultableCodeQLInitiatlizeActionQuery() {
this.getCallee() = "github/codeql-action/init" and
not customizedWorkflowStep(this)
}
}
/**
* Holds if the with: part of the workflow step contains any arguments for with: other than "languages".
* e.g.
* - name: Initialize CodeQL
* uses: github/codeql-action/init@v3
* with:
* languages: ${{ matrix.language }}
* config-file: ./.github/codeql/${{ matrix.language }}/codeql-config.yml
*/
predicate customizedWorkflowStep(UsesStep codeQLInitStep) {
exists(string arg |
exists(codeQLInitStep.getArgument(arg)) and
arg != "languages"
)
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,57 @@
/**
* Provides classes for working with YAML data.
*
* YAML documents are represented as abstract syntax trees whose nodes
* are either YAML values or alias nodes referring to another YAML value.
*/
private import codeql.yaml.Yaml as LibYaml
private module YamlSig implements LibYaml::InputSig {
import codeql.Locations
class LocatableBase extends @yaml_locatable {
Location getLocation() {
exists(@location_default loc, File f, string p, int sl, int sc, int el, int ec |
f.getAbsolutePath() = p and
locations_default(loc, f, sl, sc, el, ec) and
yaml_locations(this, loc) and
result = TBaseLocation(p, sl, sc, el, ec)
)
}
string toString() { none() }
}
class NodeBase extends LocatableBase, @yaml_node {
NodeBase getChildNode(int i) { yaml(result, _, this, i, _, _) }
string getTag() { yaml(this, _, _, _, result, _) }
string getAnchor() { yaml_anchors(this, result) }
override string toString() { yaml(this, _, _, _, _, result) }
}
class ScalarNodeBase extends NodeBase, @yaml_scalar_node {
int getStyle() { yaml_scalars(this, result, _) }
string getValue() { yaml_scalars(this, _, result) }
}
class CollectionNodeBase extends NodeBase, @yaml_collection_node { }
class MappingNodeBase extends CollectionNodeBase, @yaml_mapping_node { }
class SequenceNodeBase extends CollectionNodeBase, @yaml_sequence_node { }
class AliasNodeBase extends NodeBase, @yaml_alias_node {
string getTarget() { yaml_aliases(this, result) }
}
class ParseErrorBase extends LocatableBase, @yaml_error {
string getMessage() { yaml_errors(this, result) }
}
}
import LibYaml::Make<YamlSig>

View File

@@ -0,0 +1,147 @@
import ConfigExtensions as Extensions
/**
* MaD models for workflow details
* Fields:
* - path: Path to the workflow file
* - trigger: Trigger for the workflow
* - job: Job name
* - secrets_source: Source of secrets
* - permissions: Permissions for the workflow
* - runner: Runner info for the workflow
*/
predicate workflowDataModel(
string path, string trigger, string job, string secrets_source, string permissions, string runner
) {
Extensions::workflowDataModel(path, trigger, job, secrets_source, permissions, runner)
}
/**
* MaD models for repository details
* Fields:
* - visibility: Visibility of the repository
* - default_branch_name: Default branch name
*/
predicate repositoryDataModel(string visibility, string default_branch_name) {
Extensions::repositoryDataModel(visibility, default_branch_name)
}
/**
* MaD models for context/trigger mapping
* Fields:
* - trigger: Trigger for the workflow
* - context_prefix: Prefix for the context
*/
predicate contextTriggerDataModel(string trigger, string context_prefix) {
Extensions::contextTriggerDataModel(trigger, context_prefix)
}
/**
* MaD models for externally triggerable events
* Fields:
* - event: Event name
*/
predicate externallyTriggerableEventsDataModel(string event) {
Extensions::externallyTriggerableEventsDataModel(event)
}
private string commandLauncher() { result = ["", "sudo\\s+", "su\\s+", "xvfb-run\\s+"] }
/**
* MaD models for poisonable commands
* Fields:
* - regexp: Regular expression for matching poisonable commands
*/
predicate poisonableCommandsDataModel(string regexp) {
exists(string sub_regexp |
Extensions::poisonableCommandsDataModel(sub_regexp) and
regexp = commandLauncher() + sub_regexp + ".*"
)
}
/**
* MaD models for poisonable local scripts
* Fields:
* - regexp: Regular expression for matching poisonable local scripts
* - group: Script capture group number for the regular expression
*/
predicate poisonableLocalScriptsDataModel(string regexp, int command_group) {
exists(string sub_regexp |
Extensions::poisonableLocalScriptsDataModel(sub_regexp, command_group) and
regexp = commandLauncher() + sub_regexp + ".*"
)
}
/**
* MaD models for arguments to commands that execute the given argument.
* Fields:
* - regexp: Regular expression for matching argument injections.
* - command_group: capture group for the command.
* - argument_group: capture group for the argument.
*/
predicate argumentInjectionSinksDataModel(string regexp, int command_group, int argument_group) {
exists(string sub_regexp |
Extensions::argumentInjectionSinksDataModel(sub_regexp, command_group, argument_group) and
regexp = commandLauncher() + sub_regexp
)
}
/**
* MaD models for poisonable actions
* Fields:
* - action: action name
*/
predicate poisonableActionsDataModel(string action) {
Extensions::poisonableActionsDataModel(action)
}
/**
* MaD models for event properties that can be user-controlled.
* Fields:
* - property: event property
* - kind: property kind
*/
predicate untrustedEventPropertiesDataModel(string property, string kind) {
Extensions::untrustedEventPropertiesDataModel(property, kind)
}
/**
* MaD models for vulnerable actions
* Fields:
* - action: action name
* - vulnerable_version: vulnerable version
* - vulnerable_sha: vulnerable sha
* - fixed_version: fixed version
*/
predicate vulnerableActionsDataModel(
string action, string vulnerable_version, string vulnerable_sha, string fixed_version
) {
Extensions::vulnerableActionsDataModel(action, vulnerable_version, vulnerable_sha, fixed_version)
}
/**
* MaD models for immutable actions
* Fields:
* - action: action name
*/
predicate immutableActionsDataModel(string action) { Extensions::immutableActionsDataModel(action) }
/**
* MaD models for untrusted git commands
* Fields:
* - cmd_regex: Regular expression for matching untrusted git commands
* - flag: Flag for the command
*/
predicate untrustedGitCommandDataModel(string cmd_regex, string flag) {
Extensions::untrustedGitCommandDataModel(cmd_regex, flag)
}
/**
* MaD models for untrusted gh commands
* Fields:
* - cmd_regex: Regular expression for matching untrusted gh commands
* - flag: Flag for the command
*/
predicate untrustedGhCommandDataModel(string cmd_regex, string flag) {
Extensions::untrustedGhCommandDataModel(cmd_regex, flag)
}

View File

@@ -0,0 +1,74 @@
/**
* This module provides extensible predicates for defining MaD models.
*/
/**
* Holds if workflow data model exists for the given parameters.
*/
extensible predicate workflowDataModel(
string path, string trigger, string job, string secrets_source, string permissions, string runner
);
/**
* Holds if repository data model exists for the given parameters.
*/
extensible predicate repositoryDataModel(string visibility, string default_branch_name);
/**
* Holds if a context expression starting with context_prefix is available for a given trigger.
*/
extensible predicate contextTriggerDataModel(string trigger, string context_prefix);
/**
* Holds if a given trigger event can be fired by an external actor.
*/
extensible predicate externallyTriggerableEventsDataModel(string event);
/**
* Holds for strings that match poisonable commands.
*/
extensible predicate poisonableCommandsDataModel(string regexp);
/**
* Holds for strings that match poisonable local scripts.
*/
extensible predicate poisonableLocalScriptsDataModel(string regexp, int group);
/**
* Holds for actions that can be poisoned through local files.
*/
extensible predicate poisonableActionsDataModel(string action);
/**
* Holds for event properties that can be user-controlled.
*/
extensible predicate untrustedEventPropertiesDataModel(string property, string kind);
/**
* Holds for arguments to commands that execute the given argument
*/
extensible predicate argumentInjectionSinksDataModel(
string regexp, int command_group, int argument_group
);
/**
* Holds for actions that are known to be vulnerable.
*/
extensible predicate vulnerableActionsDataModel(
string action, string vulnerable_version, string vulnerable_sha, string fixed_version
);
/**
* Holds for actions that are known to be immutable.
*/
extensible predicate immutableActionsDataModel(string action);
/**
* Holds for git commands that may introduce untrusted data when called on an attacker controlled branch.
*/
extensible predicate untrustedGitCommandDataModel(string cmd_regex, string flag);
/**
* Holds for gh commands that may introduce untrusted data
*/
extensible predicate untrustedGhCommandDataModel(string cmd_regex, string flag);

View File

@@ -0,0 +1,444 @@
/** Provides classes representing basic blocks. */
private import codeql.actions.Cfg
private import codeql.actions.Ast
private import codeql.Locations
/**
* A basic block, that is, a maximal straight-line sequence of control flow nodes
* without branches or joins.
*/
class BasicBlock extends TBasicBlockStart {
/** Gets the scope of this basic block. */
final CfgScope getScope() { result = this.getFirstNode().getScope() }
/** Gets an immediate successor of this basic block, if any. */
BasicBlock getASuccessor() { result = this.getASuccessor(_) }
/** Gets an immediate successor of this basic block of a given type, if any. */
BasicBlock getASuccessor(SuccessorType t) {
result.getFirstNode() = this.getLastNode().getASuccessor(t)
}
/** Gets an immediate predecessor of this basic block, if any. */
BasicBlock getAPredecessor() { result.getASuccessor() = this }
/** Gets an immediate predecessor of this basic block of a given type, if any. */
BasicBlock getAPredecessor(SuccessorType t) { result.getASuccessor(t) = this }
/** Gets the control flow node at a specific (zero-indexed) position in this basic block. */
Node getNode(int pos) { bbIndex(this.getFirstNode(), result, pos) }
/** Gets a control flow node in this basic block. */
Node getANode() { result = this.getNode(_) }
/** Gets the first control flow node in this basic block. */
Node getFirstNode() { this = TBasicBlockStart(result) }
/** Gets the last control flow node in this basic block. */
Node getLastNode() { result = this.getNode(this.length() - 1) }
/** Gets the length of this basic block. */
int length() { result = strictcount(this.getANode()) }
/**
* Holds if this basic block immediately dominates basic block `bb`.
*
* That is, all paths reaching basic block `bb` from some entry point
* basic block must go through this basic block (which is an immediate
* predecessor of `bb`).
*
* Example:
*
* ```rb
* def m b
* if b
* return 0
* end
* return 1
* end
* ```
*
* The basic block starting on line 2 immediately dominates the
* basic block on line 5 (all paths from the entry point of `m`
* to `return 1` must go through the `if` block).
*/
predicate immediatelyDominates(BasicBlock bb) { bbIDominates(this, bb) }
/**
* Holds if this basic block strictly dominates basic block `bb`.
*
* That is, all paths reaching basic block `bb` from some entry point
* basic block must go through this basic block (which must be different
* from `bb`).
*
* Example:
*
* ```rb
* def m b
* if b
* return 0
* end
* return 1
* end
* ```
*
* The basic block starting on line 2 strictly dominates the
* basic block on line 5 (all paths from the entry point of `m`
* to `return 1` must go through the `if` block).
*/
predicate strictlyDominates(BasicBlock bb) { bbIDominates+(this, bb) }
/**
* Holds if this basic block dominates basic block `bb`.
*
* That is, all paths reaching basic block `bb` from some entry point
* basic block must go through this basic block.
*
* Example:
*
* ```rb
* def m b
* if b
* return 0
* end
* return 1
* end
* ```
*
* The basic block starting on line 2 dominates the basic
* basic block on line 5 (all paths from the entry point of `m`
* to `return 1` must go through the `if` block).
*/
predicate dominates(BasicBlock bb) {
bb = this or
this.strictlyDominates(bb)
}
/**
* Holds if `df` is in the dominance frontier of this basic block.
* That is, this basic block dominates a predecessor of `df`, but
* does not dominate `df` itself.
*
* Example:
*
* ```rb
* def m x
* if x < 0
* x = -x
* if x > 10
* x = x - 1
* end
* end
* puts x
* end
* ```
*
* The basic block on line 8 is in the dominance frontier
* of the basic block starting on line 3 because that block
* dominates the basic block on line 4, which is a predecessor of
* `puts x`. Also, the basic block starting on line 3 does not
* dominate the basic block on line 8.
*/
predicate inDominanceFrontier(BasicBlock df) {
this.dominatesPredecessor(df) and
not this.strictlyDominates(df)
}
/**
* Holds if this basic block dominates a predecessor of `df`.
*/
private predicate dominatesPredecessor(BasicBlock df) { this.dominates(df.getAPredecessor()) }
/**
* Gets the basic block that immediately dominates this basic block, if any.
*
* That is, all paths reaching this basic block from some entry point
* basic block must go through the result, which is an immediate basic block
* predecessor of this basic block.
*
* Example:
*
* ```rb
* def m b
* if b
* return 0
* end
* return 1
* end
* ```
*
* The basic block starting on line 2 is an immediate dominator of
* the basic block on line 5 (all paths from the entry point of `m`
* to `return 1` must go through the `if` block, and the `if` block
* is an immediate predecessor of `return 1`).
*/
BasicBlock getImmediateDominator() { bbIDominates(result, this) }
/**
* Holds if this basic block strictly post-dominates basic block `bb`.
*
* That is, all paths reaching a normal exit point basic block from basic
* block `bb` must go through this basic block (which must be different
* from `bb`).
*
* Example:
*
* ```rb
* def m b
* if b
* puts "b"
* end
* puts "m"
* end
* ```
*
* The basic block on line 5 strictly post-dominates the basic block on
* line 3 (all paths to the exit point of `m` from `puts "b"` must go
* through `puts "m"`).
*/
predicate strictlyPostDominates(BasicBlock bb) { bbIPostDominates+(this, bb) }
/**
* Holds if this basic block post-dominates basic block `bb`.
*
* That is, all paths reaching a normal exit point basic block from basic
* block `bb` must go through this basic block.
*
* Example:
*
* ```rb
* def m b
* if b
* puts "b"
* end
* puts "m"
* end
* ```
*
* The basic block on line 5 post-dominates the basic block on line 3
* (all paths to the exit point of `m` from `puts "b"` must go through
* `puts "m"`).
*/
predicate postDominates(BasicBlock bb) {
this.strictlyPostDominates(bb) or
this = bb
}
/** Holds if this basic block is in a loop in the control flow graph. */
predicate inLoop() { this.getASuccessor+() = this }
/** Gets a textual representation of this basic block. */
string toString() { result = this.getFirstNode().toString() }
/** Gets the location of this basic block. */
Location getLocation() { result = this.getFirstNode().getLocation() }
}
cached
private module Cached {
/** Internal representation of basic blocks. */
cached
newtype TBasicBlock = TBasicBlockStart(Node cfn) { startsBB(cfn) }
/** Holds if `cfn` starts a new basic block. */
private predicate startsBB(Node cfn) {
not exists(cfn.getAPredecessor()) and exists(cfn.getASuccessor())
or
cfn.isJoin()
or
cfn.getAPredecessor().isBranch()
or
/*
* In cases such as
*
* ```rb
* if x or y
* foo
* else
* bar
* ```
*
* we have a CFG that looks like
*
* x --false--> [false] x or y --false--> bar
* \ |
* --true--> y --false--
* \
* --true--> [true] x or y --true--> foo
*
* and we want to ensure that both `foo` and `bar` start a new basic block,
* in order to get a `ConditionalBlock` out of the disjunction.
*/
exists(cfn.getAPredecessor(any(BooleanSuccessor s)))
}
/**
* Holds if `succ` is a control flow successor of `pred` within
* the same basic block.
*/
private predicate intraBBSucc(Node pred, Node succ) {
succ = pred.getASuccessor() and
not startsBB(succ)
}
/**
* Holds if `cfn` is the `i`th node in basic block `bb`.
*
* In other words, `i` is the shortest distance from a node `bb`
* that starts a basic block to `cfn` along the `intraBBSucc` relation.
*/
cached
predicate bbIndex(Node bbStart, Node cfn, int i) =
shortestDistances(startsBB/1, intraBBSucc/2)(bbStart, cfn, i)
/**
* Holds if the first node of basic block `succ` is a control flow
* successor of the last node of basic block `pred`.
*/
private predicate succBB(BasicBlock pred, BasicBlock succ) { succ = pred.getASuccessor() }
/** Holds if `dom` is an immediate dominator of `bb`. */
cached
predicate bbIDominates(BasicBlock dom, BasicBlock bb) =
idominance(entryBB/1, succBB/2)(_, dom, bb)
/** Holds if `pred` is a basic block predecessor of `succ`. */
private predicate predBB(BasicBlock succ, BasicBlock pred) { succBB(pred, succ) }
/** Holds if `bb` is an exit basic block that represents normal exit. */
private predicate normalExitBB(BasicBlock bb) { bb.getANode().(AnnotatedExitNode).isNormal() }
/** Holds if `dom` is an immediate post-dominator of `bb`. */
cached
predicate bbIPostDominates(BasicBlock dom, BasicBlock bb) =
idominance(normalExitBB/1, predBB/2)(_, dom, bb)
/**
* Gets the `i`th predecessor of join block `jb`, with respect to some
* arbitrary order.
*/
cached
JoinBlockPredecessor getJoinBlockPredecessor(JoinBlock jb, int i) {
none()
/*
* result =
* rank[i + 1](JoinBlockPredecessor jbp |
* jbp = jb.getAPredecessor()
* |
* jbp order by JoinBlockPredecessors::getId(jbp), JoinBlockPredecessors::getSplitString(jbp)
* )
*/
}
cached
predicate immediatelyControls(ConditionBlock cb, BasicBlock succ, BooleanSuccessor s) {
succ = cb.getASuccessor(s) and
forall(BasicBlock pred | pred = succ.getAPredecessor() and pred != cb | succ.dominates(pred))
}
cached
predicate controls(ConditionBlock cb, BasicBlock controlled, BooleanSuccessor s) {
exists(BasicBlock succ | cb.immediatelyControls(succ, s) | succ.dominates(controlled))
}
}
private import Cached
/** Holds if `bb` is an entry basic block. */
private predicate entryBB(BasicBlock bb) { bb.getFirstNode() instanceof EntryNode }
/**
* An entry basic block, that is, a basic block whose first node is
* an entry node.
*/
class EntryBasicBlock extends BasicBlock {
EntryBasicBlock() { entryBB(this) }
}
/**
* An annotated exit basic block, that is, a basic block whose last node is
* an annotated exit node.
*/
class AnnotatedExitBasicBlock extends BasicBlock {
private boolean normal;
AnnotatedExitBasicBlock() {
exists(AnnotatedExitNode n |
n = this.getANode() and
if n.isNormal() then normal = true else normal = false
)
}
/** Holds if this block represent a normal exit. */
final predicate isNormal() { normal = true }
}
/**
* An exit basic block, that is, a basic block whose last node is
* an exit node.
*/
class ExitBasicBlock extends BasicBlock {
ExitBasicBlock() { this.getLastNode() instanceof ExitNode }
}
/*
* private module JoinBlockPredecessors {
* private predicate id(AstNode x, AstNode y) { x = y }
*
* private predicate idOf(AstNode x, int y) = equivalenceRelation(id/2)(x, y)
*
* int getId(JoinBlockPredecessor jbp) {
* idOf(Ast::toTreeSitter(jbp.getFirstNode().(AstCfgNode).getAstNode()), result)
* or
* idOf(Ast::toTreeSitter(jbp.(EntryBasicBlock).getScope()), result)
* }
*
* string getSplitString(JoinBlockPredecessor jbp) {
* result = jbp.getFirstNode().(AstCfgNode).getSplitsString()
* or
* not exists(jbp.getFirstNode().(AstCfgNode).getSplitsString()) and
* result = ""
* }
* }
*/
/** A basic block with more than one predecessor. */
class JoinBlock extends BasicBlock {
JoinBlock() { this.getFirstNode().isJoin() }
/**
* Gets the `i`th predecessor of this join block, with respect to some
* arbitrary order.
*/
JoinBlockPredecessor getJoinBlockPredecessor(int i) { result = getJoinBlockPredecessor(this, i) }
}
/** A basic block that is an immediate predecessor of a join block. */
class JoinBlockPredecessor extends BasicBlock {
JoinBlockPredecessor() { this.getASuccessor() instanceof JoinBlock }
}
/** A basic block that terminates in a condition, splitting the subsequent control flow. */
class ConditionBlock extends BasicBlock {
ConditionBlock() { this.getLastNode().isCondition() }
/**
* Holds if basic block `succ` is immediately controlled by this basic
* block with conditional value `s`. That is, `succ` is an immediate
* successor of this block, and `succ` can only be reached from
* the callable entry point by going via the `s` edge out of this basic block.
*/
predicate immediatelyControls(BasicBlock succ, BooleanSuccessor s) {
immediatelyControls(this, succ, s)
}
/**
* Holds if basic block `controlled` is controlled by this basic block with
* conditional value `s`. That is, `controlled` can only be reached from
* the callable entry point by going via the `s` edge out of this basic block.
*/
predicate controls(BasicBlock controlled, BooleanSuccessor s) { controls(this, controlled, s) }
}

View File

@@ -0,0 +1,316 @@
private import codeql.actions.Ast
private import codeql.controlflow.Cfg as CfgShared
private import codeql.Locations
module Completion {
private newtype TCompletion =
TSimpleCompletion() or
TBooleanCompletion(boolean b) { b in [false, true] } or
TReturnCompletion()
abstract class Completion extends TCompletion {
abstract string toString();
predicate isValidForSpecific(AstNode e) { none() }
predicate isValidFor(AstNode e) { this.isValidForSpecific(e) }
abstract SuccessorType getAMatchingSuccessorType();
}
abstract class NormalCompletion extends Completion { }
class SimpleCompletion extends NormalCompletion, TSimpleCompletion {
override string toString() { result = "SimpleCompletion" }
override predicate isValidFor(AstNode e) { not any(Completion c).isValidForSpecific(e) }
override NormalSuccessor getAMatchingSuccessorType() { any() }
}
class BooleanCompletion extends NormalCompletion, TBooleanCompletion {
boolean value;
BooleanCompletion() { this = TBooleanCompletion(value) }
override string toString() { result = "BooleanCompletion(" + value + ")" }
override predicate isValidForSpecific(AstNode e) { none() }
override BooleanSuccessor getAMatchingSuccessorType() { result.getValue() = value }
final boolean getValue() { result = value }
}
class ReturnCompletion extends Completion, TReturnCompletion {
override string toString() { result = "ReturnCompletion" }
override predicate isValidForSpecific(AstNode e) { none() }
override ReturnSuccessor getAMatchingSuccessorType() { any() }
}
cached
private newtype TSuccessorType =
TNormalSuccessor() or
TBooleanSuccessor(boolean b) { b in [false, true] } or
TReturnSuccessor()
class SuccessorType extends TSuccessorType {
string toString() { none() }
}
class NormalSuccessor extends SuccessorType, TNormalSuccessor {
override string toString() { result = "successor" }
}
class BooleanSuccessor extends SuccessorType, TBooleanSuccessor {
boolean value;
BooleanSuccessor() { this = TBooleanSuccessor(value) }
override string toString() { result = value.toString() }
boolean getValue() { result = value }
}
class ReturnSuccessor extends SuccessorType, TReturnSuccessor {
override string toString() { result = "return" }
}
}
module CfgScope {
abstract class CfgScope extends AstNode { }
class WorkflowScope extends CfgScope instanceof Workflow { }
class CompositeActionScope extends CfgScope instanceof CompositeAction { }
}
private module Implementation implements CfgShared::InputSig<Location> {
import codeql.actions.Ast
import Completion
import CfgScope
predicate completionIsNormal(Completion c) { not c instanceof ReturnCompletion }
// Not using CFG splitting, so the following are just dummy types.
private newtype TUnit = Unit()
additional class SplitKindBase = TUnit;
additional class Split extends TUnit {
abstract string toString();
}
predicate completionIsSimple(Completion c) { c instanceof SimpleCompletion }
predicate completionIsValidFor(Completion c, AstNode e) { c.isValidFor(e) }
CfgScope getCfgScope(AstNode e) {
exists(AstNode p | p = e.getParentNode() |
result = p
or
not p instanceof CfgScope and result = getCfgScope(p)
)
}
additional int maxSplits() { result = 0 }
predicate scopeFirst(CfgScope scope, AstNode e) {
first(scope.(Workflow), e) or
first(scope.(CompositeAction), e)
}
predicate scopeLast(CfgScope scope, AstNode e, Completion c) {
last(scope.(Workflow), e, c) or
last(scope.(CompositeAction), e, c)
}
predicate successorTypeIsSimple(SuccessorType t) { t instanceof NormalSuccessor }
predicate successorTypeIsCondition(SuccessorType t) { t instanceof BooleanSuccessor }
SuccessorType getAMatchingSuccessorType(Completion c) { result = c.getAMatchingSuccessorType() }
predicate isAbnormalExitType(SuccessorType t) { none() }
}
module CfgImpl = CfgShared::Make<Location, Implementation>;
private import CfgImpl
private import Completion
private import CfgScope
private class CompositeActionTree extends StandardPreOrderTree instanceof CompositeAction {
override ControlFlowTree getChildNode(int i) {
result =
rank[i](AstNode child, Location l |
(
child = this.(CompositeAction).getAnInput() or
child = this.(CompositeAction).getOutputs() or
child = this.(CompositeAction).getRuns()
) and
l = child.getLocation()
|
child
order by
l.getStartLine(), l.getStartColumn(), l.getEndColumn(), l.getEndLine(), child.toString()
)
}
}
private class RunsTree extends StandardPreOrderTree instanceof Runs {
override ControlFlowTree getChildNode(int i) { result = super.getStep(i) }
}
private class WorkflowTree extends StandardPreOrderTree instanceof Workflow {
override ControlFlowTree getChildNode(int i) {
if this instanceof ReusableWorkflow
then
result =
rank[i](AstNode child, Location l |
(
child = this.(ReusableWorkflow).getAnInput() or
child = this.(ReusableWorkflow).getOutputs() or
child = this.(ReusableWorkflow).getStrategy() or
child = this.(ReusableWorkflow).getAJob()
) and
l = child.getLocation()
|
child
order by
l.getStartLine(), l.getStartColumn(), l.getEndColumn(), l.getEndLine(), child.toString()
)
else
result =
rank[i](AstNode child, Location l |
(
child = super.getStrategy() or
child = super.getAJob()
) and
l = child.getLocation()
|
child
order by
l.getStartLine(), l.getStartColumn(), l.getEndColumn(), l.getEndLine(), child.toString()
)
}
}
private class OutputsTree extends StandardPreOrderTree instanceof Outputs {
override ControlFlowTree getChildNode(int i) {
result =
rank[i](AstNode child, Location l |
child = super.getAnOutputExpr() and l = child.getLocation()
|
child
order by
l.getStartLine(), l.getStartColumn(), l.getEndColumn(), l.getEndLine(), child.toString()
)
}
}
private class StrategyTree extends StandardPreOrderTree instanceof Strategy {
override ControlFlowTree getChildNode(int i) {
result =
rank[i](AstNode child, Location l |
child = super.getAMatrixVarExpr() and l = child.getLocation()
|
child
order by
l.getStartLine(), l.getStartColumn(), l.getEndColumn(), l.getEndLine(), child.toString()
)
}
}
private class JobTree extends StandardPreOrderTree instanceof LocalJob {
override ControlFlowTree getChildNode(int i) {
result =
rank[i](AstNode child, Location l |
(
child = super.getAStep() or
child = super.getOutputs() or
child = super.getStrategy()
) and
l = child.getLocation()
|
child
order by
l.getStartLine(), l.getStartColumn(), l.getEndColumn(), l.getEndLine(), child.toString()
)
}
}
private class ExternalJobTree extends StandardPreOrderTree instanceof ExternalJob {
override ControlFlowTree getChildNode(int i) {
result =
rank[i](AstNode child, Location l |
(
child = super.getArgumentExpr(_) or
child = super.getInScopeEnvVarExpr(_) or
child = super.getOutputs() or
child = super.getStrategy()
) and
l = child.getLocation()
|
child
order by
l.getStartLine(), l.getStartColumn(), l.getEndColumn(), l.getEndLine(), child.toString()
)
}
}
private class UsesTree extends StandardPreOrderTree instanceof UsesStep {
override ControlFlowTree getChildNode(int i) {
result =
rank[i](AstNode child, Location l |
(child = super.getArgumentExpr(_) or child = super.getInScopeEnvVarExpr(_)) and
l = child.getLocation()
|
child
order by
l.getStartLine(), l.getStartColumn(), l.getEndColumn(), l.getEndLine(), child.toString()
)
}
}
private class RunTree extends StandardPreOrderTree instanceof Run {
override ControlFlowTree getChildNode(int i) {
result =
rank[i](AstNode child, Location l |
(
child = super.getInScopeEnvVarExpr(_) or
child = super.getAnScriptExpr() or
child = super.getScript()
) and
l = child.getLocation()
|
child
order by
l.getStartLine(), l.getStartColumn(), l.getEndColumn(), l.getEndLine(), child.toString()
)
}
}
private class ScalarValueTree extends StandardPreOrderTree instanceof ScalarValue {
override ControlFlowTree getChildNode(int i) {
result =
rank[i](Expression child, Location l |
child = super.getAChildNode() and
l = child.getLocation()
|
child
order by
l.getStartLine(), l.getStartColumn(), l.getEndColumn(), l.getEndLine(), child.toString()
)
}
}
private class UsesLeaf extends LeafTree instanceof Uses { }
private class InputTree extends LeafTree instanceof Input { }
private class ScalarValueLeaf extends LeafTree instanceof ScalarValue { }
private class ExpressionLeaf extends LeafTree instanceof Expression { }

View File

@@ -0,0 +1,131 @@
private import actions
private import internal.ExternalFlowExtensions as Extensions
private import codeql.actions.DataFlow
private import codeql.actions.security.ArtifactPoisoningQuery
/**
* MaD sources
* Fields:
* - action: Fully-qualified action name (NWO)
* - version: Either '*' or a specific SHA/Tag
* - output arg: To node (prefixed with either `env.` or `output.`)
* - provenance: verification of the model
*/
predicate actionsSourceModel(
string action, string version, string output, string kind, string provenance
) {
Extensions::actionsSourceModel(action, version, output, kind, provenance)
}
/**
* MaD summaries
* Fields:
* - action: Fully-qualified action name (NWO)
* - version: Either '*' or a specific SHA/Tag
* - input arg: From node (prefixed with either `env.` or `input.`)
* - output arg: To node (prefixed with either `env.` or `output.`)
* - kind: Either 'Taint' or 'Value'
* - provenance: verification of the model
*/
predicate actionsSummaryModel(
string action, string version, string input, string output, string kind, string provenance
) {
Extensions::actionsSummaryModel(action, version, input, output, kind, provenance)
}
/**
* MaD sinks
* Fields:
* - action: Fully-qualified action name (NWO)
* - version: Either '*' or a specific SHA/Tag
* - input: sink node (prefixed with either `env.` or `input.`)
* - kind: sink kind
* - provenance: verification of the model
*/
predicate actionsSinkModel(
string action, string version, string input, string kind, string provenance
) {
Extensions::actionsSinkModel(action, version, input, kind, provenance)
}
/**
* Holds if source.fieldName is a MaD-defined source of a given taint kind.
*/
predicate madSource(DataFlow::Node source, string kind, string fieldName) {
exists(Uses uses, string action, string version |
actionsSourceModel(action, version, fieldName, kind, _) and
uses.getCallee() = action.toLowerCase() and
(
if version.trim() = "*"
then uses.getVersion() = any(string v)
else uses.getVersion() = version.trim()
) and
(
if fieldName.trim().matches("env.%")
then source.asExpr() = uses.getInScopeEnvVarExpr(fieldName.trim().replaceAll("env.", ""))
else
if fieldName.trim().matches("output.%")
then source.asExpr() = uses
else none()
)
)
}
/**
* Holds if the data flow from `pred` to `succ` is a MaD store step.
*/
predicate madStoreStep(DataFlow::Node pred, DataFlow::Node succ, DataFlow::ContentSet c) {
exists(Uses uses, string action, string version, string input, string output |
actionsSummaryModel(action, version, input, output, "taint", _) and
c = any(DataFlow::FieldContent ct | ct.getName() = output.replaceAll("output.", "")) and
uses.getCallee() = action.toLowerCase() and
// version check
(
if version.trim() = "*"
then uses.getVersion() = any(string v)
else uses.getVersion() = version.trim()
) and
// pred provenance
(
input.trim().matches("env.%") and
pred.asExpr() = uses.getInScopeEnvVarExpr(input.trim().replaceAll("env.", ""))
or
input.trim().matches("input.%") and
pred.asExpr() = uses.getArgumentExpr(input.trim().replaceAll("input.", ""))
or
input.trim() = "artifact" and
exists(UntrustedArtifactDownloadStep download |
pred.asExpr() = download and
download.getAFollowingStep() = uses
)
) and
succ.asExpr() = uses
)
}
/**
* Holds if sink is a MaD-defined sink for a given taint kind.
*/
predicate madSink(DataFlow::Node sink, string kind) {
exists(Uses uses, string action, string version, string input |
actionsSinkModel(action, version, input, kind, _) and
uses.getCallee() = action.toLowerCase() and
// version check
(
if version.trim() = "*"
then uses.getVersion() = any(string v)
else uses.getVersion() = version.trim()
) and
// pred provenance
(
input.trim().matches("env.%") and
sink.asExpr() = uses.getInScopeEnvVarExpr(input.trim().replaceAll("env.", ""))
or
input.trim().matches("input.%") and
sink.asExpr() = uses.getArgumentExpr(input.trim().replaceAll("input.", ""))
or
input.trim() = "artifact" and
sink.asExpr() = uses
)
)
}

View File

@@ -0,0 +1,366 @@
private import codeql.actions.security.ArtifactPoisoningQuery
private import codeql.actions.security.UntrustedCheckoutQuery
private import codeql.actions.config.Config
private import codeql.actions.dataflow.ExternalFlow
/**
* A data flow source.
*/
abstract class SourceNode extends DataFlow::Node {
/**
* Gets a string that represents the source kind with respect to threat modeling.
*/
abstract string getThreatModel();
}
/** A data flow source of remote user input. */
abstract class RemoteFlowSource extends SourceNode {
/** Gets a string that describes the type of this remote flow source. */
abstract string getSourceType();
/** Gets the event that triggered the source. */
abstract string getEventName();
override string getThreatModel() { result = "remote" }
}
/**
* A data flow source of user input from github context.
* eg: github.head_ref
*/
class GitHubCtxSource extends RemoteFlowSource {
string flag;
string event;
GitHubExpression e;
GitHubCtxSource() {
this.asExpr() = e and
// github.head_ref
e.getFieldName() = "head_ref" and
flag = "branch" and
(
event = e.getATriggerEvent().getName() and
event = "pull_request_target"
or
not exists(e.getATriggerEvent()) and
event = "unknown"
)
}
override string getSourceType() { result = flag }
override string getEventName() { result = event }
}
class GitHubEventCtxSource extends RemoteFlowSource {
string flag;
string context;
string event;
GitHubEventCtxSource() {
exists(Expression e, string regexp |
this.asExpr() = e and
context = e.getExpression() and
(
// the context is available for the job trigger events
event = e.getATriggerEvent().getName() and
exists(string context_prefix |
contextTriggerDataModel(event, context_prefix) and
normalizeExpr(context).matches("%" + context_prefix + "%")
)
or
not exists(e.getATriggerEvent()) and
event = "unknown"
) and
untrustedEventPropertiesDataModel(regexp, flag) and
not flag = "json" and
normalizeExpr(context).regexpMatch("(?i)\\s*" + wrapRegexp(regexp) + ".*")
)
}
override string getSourceType() { result = flag }
string getContext() { result = context }
override string getEventName() { result = event }
}
abstract class CommandSource extends RemoteFlowSource {
abstract string getCommand();
abstract Run getEnclosingRun();
override string getEventName() { result = this.getEnclosingRun().getATriggerEvent().getName() }
}
class GitCommandSource extends RemoteFlowSource, CommandSource {
Run run;
string cmd;
string flag;
GitCommandSource() {
exists(Step checkout, string cmd_regex |
checkout instanceof SimplePRHeadCheckoutStep and
this.asExpr() = run.getScript() and
checkout.getAFollowingStep() = run and
run.getScript().getAStmt() = cmd and
cmd.indexOf("git") = 0 and
untrustedGitCommandDataModel(cmd_regex, flag) and
cmd.regexpMatch(cmd_regex + ".*")
)
}
override string getSourceType() { result = flag }
override string getCommand() { result = cmd }
override Run getEnclosingRun() { result = run }
}
class GhCLICommandSource extends RemoteFlowSource, CommandSource {
Run run;
string cmd;
string flag;
GhCLICommandSource() {
exists(string cmd_regex |
this.asExpr() = run.getScript() and
run.getScript().getAStmt() = cmd and
cmd.indexOf("gh ") = 0 and
untrustedGhCommandDataModel(cmd_regex, flag) and
cmd.regexpMatch(cmd_regex + ".*") and
(
cmd.regexpMatch(".*\\b(pr|pulls)\\b.*") and
run.getATriggerEvent().getName() = checkoutTriggers()
or
not cmd.regexpMatch(".*\\b(pr|pulls)\\b.*")
)
)
}
override string getSourceType() { result = flag }
override Run getEnclosingRun() { result = run }
override string getCommand() { result = cmd }
}
class GitHubEventPathSource extends RemoteFlowSource, CommandSource {
string cmd;
string flag;
string access_path;
Run run;
// Examples
// COMMENT_AUTHOR=$(jq -r .comment.user.login "$GITHUB_EVENT_PATH")
// CURRENT_COMMENT=$(jq -r .comment.body "$GITHUB_EVENT_PATH")
// PR_HEAD=$(jq --raw-output .pull_request.head.ref ${GITHUB_EVENT_PATH})
// PR_NUMBER=$(jq --raw-output .pull_request.number ${GITHUB_EVENT_PATH})
// PR_TITLE=$(jq --raw-output .pull_request.title ${GITHUB_EVENT_PATH})
// BODY=$(jq -r '.issue.body' "$GITHUB_EVENT_PATH" | sed -n '3p')
GitHubEventPathSource() {
this.asExpr() = run.getScript() and
run.getScript().getACommand() = cmd and
cmd.matches("jq%") and
cmd.matches("%GITHUB_EVENT_PATH%") and
exists(string regexp |
untrustedEventPropertiesDataModel(regexp, flag) and
not flag = "json" and
access_path = "github.event" + cmd.regexpCapture(".*\\s+([^\\s]+)\\s+.*", 1) and
normalizeExpr(access_path).regexpMatch("(?i)\\s*" + wrapRegexp(regexp) + ".*")
)
}
override string getSourceType() { result = flag }
override string getCommand() { result = cmd }
override Run getEnclosingRun() { result = run }
}
class GitHubEventJsonSource extends RemoteFlowSource {
string flag;
string event;
GitHubEventJsonSource() {
exists(Expression e, string context, string regexp |
this.asExpr() = e and
context = e.getExpression() and
untrustedEventPropertiesDataModel(regexp, _) and
(
// only contexts for the triggering events are considered tainted.
// eg: for `pull_request`, we only consider `github.event.pull_request`
event = e.getEnclosingWorkflow().getATriggerEvent().getName() and
exists(string context_prefix |
contextTriggerDataModel(event, context_prefix) and
normalizeExpr(context).matches("%" + context_prefix + "%")
) and
normalizeExpr(context).regexpMatch("(?i).*" + wrapJsonRegexp(regexp) + ".*")
or
// github.event is tainted for all triggers
event = e.getEnclosingWorkflow().getATriggerEvent().getName() and
contextTriggerDataModel(e.getEnclosingWorkflow().getATriggerEvent().getName(), _) and
normalizeExpr(context).regexpMatch("(?i).*" + wrapJsonRegexp("\\bgithub.event\\b") + ".*")
or
not exists(e.getATriggerEvent()) and
event = "unknown"
) and
flag = "json"
)
}
override string getSourceType() { result = flag }
override string getEventName() { result = event }
}
/**
* A Source of untrusted data defined in a MaD specification
*/
class MaDSource extends RemoteFlowSource {
string sourceType;
MaDSource() { madSource(this, sourceType, _) }
override string getSourceType() { result = sourceType }
override string getEventName() { result = this.asExpr().getATriggerEvent().getName() }
}
abstract class FileSource extends RemoteFlowSource { }
/**
* A downloaded artifact.
*/
class ArtifactSource extends RemoteFlowSource, FileSource {
ArtifactSource() { this.asExpr() instanceof UntrustedArtifactDownloadStep }
override string getSourceType() { result = "artifact" }
override string getEventName() { result = this.asExpr().getATriggerEvent().getName() }
}
/**
* A file from an untrusted checkout.
*/
private class CheckoutSource extends RemoteFlowSource, FileSource {
CheckoutSource() { this.asExpr() instanceof SimplePRHeadCheckoutStep }
override string getSourceType() { result = "artifact" }
override string getEventName() { result = this.asExpr().getATriggerEvent().getName() }
}
/**
* A list of file names returned by dorny/paths-filter.
*/
class DornyPathsFilterSource extends RemoteFlowSource {
DornyPathsFilterSource() {
exists(UsesStep u |
u.getCallee() = "dorny/paths-filter" and
u.getArgument("list-files") = ["csv", "json"] and
this.asExpr() = u
)
}
override string getSourceType() { result = "filename" }
override string getEventName() { result = this.asExpr().getATriggerEvent().getName() }
}
/**
* A list of file names returned by tj-actions/changed-files.
*/
class TJActionsChangedFilesSource extends RemoteFlowSource {
TJActionsChangedFilesSource() {
exists(UsesStep u, string vulnerable_action, string vulnerable_version, string vulnerable_sha |
vulnerableActionsDataModel(vulnerable_action, vulnerable_version, vulnerable_sha, _) and
u.getCallee() = "tj-actions/changed-files" and
u.getCallee() = vulnerable_action and
(
u.getArgument("safe_output") = "false"
or
(u.getVersion() = vulnerable_version or u.getVersion() = vulnerable_sha)
) and
this.asExpr() = u
)
}
override string getSourceType() { result = "filename" }
override string getEventName() { result = this.asExpr().getATriggerEvent().getName() }
}
/**
* A list of file names returned by tj-actions/verify-changed-files.
*/
class TJActionsVerifyChangedFilesSource extends RemoteFlowSource {
TJActionsVerifyChangedFilesSource() {
exists(UsesStep u, string vulnerable_action, string vulnerable_version, string vulnerable_sha |
vulnerableActionsDataModel(vulnerable_action, vulnerable_version, vulnerable_sha, _) and
u.getCallee() = "tj-actions/verify-changed-files" and
u.getCallee() = vulnerable_action and
(
u.getArgument("safe_output") = "false"
or
(u.getVersion() = vulnerable_version or u.getVersion() = vulnerable_sha)
) and
this.asExpr() = u
)
}
override string getSourceType() { result = "filename" }
override string getEventName() { result = this.asExpr().getATriggerEvent().getName() }
}
class Xt0rtedSlashCommandSource extends RemoteFlowSource {
Xt0rtedSlashCommandSource() {
exists(UsesStep u |
u.getCallee() = "xt0rted/slash-command-action" and
u.getArgument("permission-level").toLowerCase() = ["read", "none"] and
this.asExpr() = u
)
}
override string getSourceType() { result = "text" }
override string getEventName() { result = this.asExpr().getATriggerEvent().getName() }
}
class ZenteredIssueFormBodyParserSource extends RemoteFlowSource {
ZenteredIssueFormBodyParserSource() {
exists(UsesStep u |
u.getCallee() = "zentered/issue-forms-body-parser" and
not exists(u.getArgument("body")) and
this.asExpr() = u
)
}
override string getSourceType() { result = "text" }
override string getEventName() { result = this.asExpr().getATriggerEvent().getName() }
}
class OctokitRequestActionSource extends RemoteFlowSource {
OctokitRequestActionSource() {
exists(UsesStep u, string route |
u.getCallee() = "octokit/request-action" and
route = u.getArgument("route").trim() and
route.indexOf("GET") = 0 and
(
route.matches("%/commits%") or
route.matches("%/comments%") or
route.matches("%/pulls%") or
route.matches("%/issues%") or
route.matches("%/users%") or
route.matches("%github.event.issue.pull_request.url%")
) and
this.asExpr() = u
)
}
override string getSourceType() { result = "text" }
override string getEventName() { result = this.asExpr().getATriggerEvent().getName() }
}

View File

@@ -0,0 +1,92 @@
/**
* Provides classes representing various flow steps for taint tracking.
*/
private import actions
private import codeql.actions.DataFlow
private import codeql.actions.dataflow.FlowSources
/**
* Holds if a Run step declares an environment variable, uses it in its script and sets an output in its script.
* e.g.
* - name: Extract and Clean Initial URL
* id: extract-url
* env:
* BODY: ${{ github.event.comment.body }}
* run: |
* echo "::set-output name=foo::$BODY"
* echo "foo=$(echo $BODY)" >> $GITHUB_OUTPUT
* echo "foo=$(echo $BODY)" >> "$GITHUB_OUTPUT"
* echo "::set-output name=step-output::$BODY"
*/
predicate envToOutputStoreStep(DataFlow::Node pred, DataFlow::Node succ, DataFlow::ContentSet c) {
exists(Run run, string var, string field |
run.getInScopeEnvVarExpr(var) = pred.asExpr() and
succ.asExpr() = run and
run.getScript().getAnEnvReachingGitHubOutputWrite(var, field) and
c = any(DataFlow::FieldContent ct | ct.getName() = field)
)
}
predicate envToEnvStoreStep(DataFlow::Node pred, DataFlow::Node succ, DataFlow::ContentSet c) {
exists(
Run run, string var, string field //string key, string value |
|
run.getInScopeEnvVarExpr(var) = pred.asExpr() and
// we store the taint on the enclosing job since the may not exist an implicit env attribute
succ.asExpr() = run.getEnclosingJob() and
run.getScript().getAnEnvReachingGitHubEnvWrite(var, field) and
c = any(DataFlow::FieldContent ct | ct.getName() = field)
)
}
/**
* A command whose output gets assigned to an environment variable or step output.
* - run: |
* echo "foo=$(cmd)" >> "$GITHUB_OUTPUT"
* - run: |
* foo=$(<cmd)"
* echo "bar=${foo}" >> "$GITHUB_OUTPUT"
*/
predicate commandToOutputStoreStep(DataFlow::Node pred, DataFlow::Node succ, DataFlow::ContentSet c) {
exists(Run run, string key, string cmd |
(
exists(CommandSource source | source.getCommand() = cmd)
or
exists(FileSource source |
source.asExpr().(Step).getAFollowingStep() = run and
run.getScript().getAFileReadCommand() = cmd
)
) and
run.getScript().getACmdReachingGitHubOutputWrite(cmd, key) and
c = any(DataFlow::FieldContent ct | ct.getName() = key) and
pred.asExpr() = run.getScript() and
succ.asExpr() = run
)
}
/**
* A command whose output gets assigned to an environment variable or step output.
* - run: |
* echo "foo=$(cmd)" >> "$GITHUB_ENV"
* - run: |
* foo=$(<cmd)"
* echo "bar=${foo}" >> "$GITHUB_ENV"
*/
predicate commandToEnvStoreStep(DataFlow::Node pred, DataFlow::Node succ, DataFlow::ContentSet c) {
exists(Run run, string key, string cmd |
(
exists(CommandSource source | source.getCommand() = cmd)
or
exists(FileSource source |
source.asExpr().(Step).getAFollowingStep() = run and
run.getScript().getAFileReadCommand() = cmd
)
) and
run.getScript().getACmdReachingGitHubEnvWrite(cmd, key) and
c = any(DataFlow::FieldContent ct | ct.getName() = key) and
pred.asExpr() = run.getScript() and
// we store the taint on the enclosing job since there may not be an implicit env attribute
succ.asExpr() = run.getEnclosingJob()
)
}

View File

@@ -0,0 +1,156 @@
/**
* Provides classes representing various flow steps for taint tracking.
*/
private import actions
private import codeql.util.Unit
private import codeql.actions.DataFlow
private import codeql.actions.dataflow.FlowSources
/**
* A unit class for adding additional taint steps.
*
* Extend this class to add additional taint steps that should apply to all
* taint configurations.
*/
class AdditionalTaintStep extends Unit {
/**
* Holds if the step from `node1` to `node2` should be considered a taint
* step for all configurations.
*/
abstract predicate step(DataFlow::Node node1, DataFlow::Node node2);
}
/**
* A file source step followed by a Run step may read the file.
*/
predicate fileDownloadToRunStep(DataFlow::Node pred, DataFlow::Node succ) {
exists(FileSource source, Run run |
pred = source and
source.asExpr().(Step).getAFollowingStep() = run and
succ.asExpr() = run.getScript() and
exists(run.getScript().getAFileReadCommand())
)
}
/**
* A read of the _files field of the dorny/paths-filter action.
*/
predicate dornyPathsFilterTaintStep(DataFlow::Node pred, DataFlow::Node succ) {
exists(StepsExpression o |
pred instanceof DornyPathsFilterSource and
o.getStepId() = pred.asExpr().(UsesStep).getId() and
o.getFieldName().matches("%_files") and
succ.asExpr() = o
)
}
/**
* A read of user-controlled field of the tj-actions/changed-files action.
*/
predicate tjActionsChangedFilesTaintStep(DataFlow::Node pred, DataFlow::Node succ) {
exists(StepsExpression o |
pred instanceof TJActionsChangedFilesSource and
o.getTarget() = pred.asExpr() and
o.getStepId() = pred.asExpr().(UsesStep).getId() and
o.getFieldName() =
[
"added_files", "copied_files", "deleted_files", "modified_files", "renamed_files",
"all_old_new_renamed_files", "type_changed_files", "unmerged_files", "unknown_files",
"all_changed_and_modified_files", "all_changed_files", "other_changed_files",
"all_modified_files", "other_modified_files", "other_deleted_files", "modified_keys",
"changed_keys"
] and
succ.asExpr() = o
)
}
/**
* A read of user-controlled field of the tj-actions/verify-changed-files action.
*/
predicate tjActionsVerifyChangedFilesTaintStep(DataFlow::Node pred, DataFlow::Node succ) {
exists(StepsExpression o |
pred instanceof TJActionsVerifyChangedFilesSource and
o.getTarget() = pred.asExpr() and
o.getStepId() = pred.asExpr().(UsesStep).getId() and
o.getFieldName() = "changed_files" and
succ.asExpr() = o
)
}
/**
* A read of user-controlled field of the xt0rted/slash-command-action action.
*/
predicate xt0rtedSlashCommandActionTaintStep(DataFlow::Node pred, DataFlow::Node succ) {
exists(StepsExpression o |
pred instanceof Xt0rtedSlashCommandSource and
o.getTarget() = pred.asExpr() and
o.getStepId() = pred.asExpr().(UsesStep).getId() and
o.getFieldName() = "command-arguments" and
succ.asExpr() = o
)
}
/**
* A read of user-controlled field of the zentered/issue-forms-body-parser action.
*/
predicate zenteredIssueFormBodyParserSource(DataFlow::Node pred, DataFlow::Node succ) {
exists(StepsExpression o |
pred instanceof ZenteredIssueFormBodyParserSource and
o.getTarget() = pred.asExpr() and
o.getStepId() = pred.asExpr().(UsesStep).getId() and
(
not o instanceof JsonReferenceExpression and
o.getFieldName() = "data"
or
o instanceof JsonReferenceExpression and
o.(JsonReferenceExpression).getInnerExpression().matches("%.data")
) and
succ.asExpr() = o
)
}
/**
* A read of user-controlled field of the octokit/request-action action.
*/
predicate octokitRequestActionTaintStep(DataFlow::Node pred, DataFlow::Node succ) {
exists(StepsExpression o |
pred instanceof OctokitRequestActionSource and
o.getTarget() = pred.asExpr() and
o.getStepId() = pred.asExpr().(UsesStep).getId() and
succ.asExpr() = o and
(
not o instanceof JsonReferenceExpression and
o.getFieldName() = "data"
or
o instanceof JsonReferenceExpression and
o.(JsonReferenceExpression).getInnerExpression().matches("%.data") and
o.(JsonReferenceExpression)
.getAccessPath()
.matches([
"%.title",
"%.user.login",
"%.body",
"%.head.ref",
"%.head.repo.full_name",
"%.commit.author.email",
"%.commit.commiter.email",
"%.commit.message",
"%.email",
"%.name",
])
)
)
}
class TaintSteps extends AdditionalTaintStep {
override predicate step(DataFlow::Node node1, DataFlow::Node node2) {
dornyPathsFilterTaintStep(node1, node2) or
tjActionsChangedFilesTaintStep(node1, node2) or
tjActionsVerifyChangedFilesTaintStep(node1, node2) or
xt0rtedSlashCommandActionTaintStep(node1, node2) or
xt0rtedSlashCommandActionTaintStep(node1, node2) or
zenteredIssueFormBodyParserSource(node1, node2) or
octokitRequestActionTaintStep(node1, node2)
}
}

View File

@@ -0,0 +1,15 @@
/**
* Provides Actions-specific definitions for use in the data flow library.
* Implementation of https://github.com/github/codeql/blob/main/shared/dataflow/codeql/dataflow/DataFlow.qll
*/
private import codeql.dataflow.DataFlow
private import codeql.Locations
module ActionsDataFlow implements InputSig<Location> {
import DataFlowPrivate as Private
import DataFlowPublic
import Private
predicate neverSkipInPathGraph = Private::neverSkipInPathGraph/1;
}

View File

@@ -0,0 +1,403 @@
private import codeql.util.Unit
private import codeql.dataflow.DataFlow
private import codeql.actions.Ast
private import codeql.actions.Cfg as Cfg
private import codeql.Locations
private import codeql.actions.controlflow.BasicBlocks
private import DataFlowPublic
private import codeql.actions.dataflow.ExternalFlow
private import codeql.actions.dataflow.FlowSteps
private import codeql.actions.dataflow.FlowSources
class DataFlowSecondLevelScope = Unit;
cached
newtype TNode = TExprNode(DataFlowExpr e)
class OutNode extends ExprNode {
private DataFlowCall call;
OutNode() { call = this.getCfgNode() }
DataFlowCall getCall(ReturnKind kind) {
result = call and
kind instanceof NormalReturn
}
}
/**
* Not implemented
*/
class CastNode extends Node {
CastNode() { none() }
}
/**
* Not implemented
*/
class PostUpdateNode extends Node {
PostUpdateNode() { none() }
Node getPreUpdateNode() { none() }
}
predicate isParameterNode(ParameterNode p, DataFlowCallable c, ParameterPosition pos) {
p.isParameterOf(c, pos)
}
predicate isArgumentNode(ArgumentNode arg, DataFlowCall call, ArgumentPosition pos) {
arg.argumentOf(call, pos)
}
DataFlowCallable nodeGetEnclosingCallable(Node node) {
node = TExprNode(any(DataFlowExpr e | result = e.getScope()))
}
DataFlowType getNodeType(Node node) { any() }
predicate nodeIsHidden(Node node) { none() }
class DataFlowExpr extends Cfg::Node {
DataFlowExpr() {
this.getAstNode() instanceof Job or
this.getAstNode() instanceof Expression or
this.getAstNode() instanceof Uses or
this.getAstNode() instanceof Run or
this.getAstNode() instanceof Outputs or
this.getAstNode() instanceof Input or
this.getAstNode() instanceof ScalarValue
}
}
/**
* A call corresponds to a Uses steps where a composite action or a reusable workflow get called
*/
class DataFlowCall instanceof Cfg::Node {
DataFlowCall() { super.getAstNode() instanceof Uses }
/** Gets a textual representation of this element. */
string toString() { result = super.toString() }
string getName() { result = super.getAstNode().(Uses).getCallee() }
DataFlowCallable getEnclosingCallable() { result = super.getScope() }
/** Gets a best-effort total ordering. */
int totalorder() { none() }
/** Gets the location of this call. */
Location getLocation() { result = this.(Cfg::Node).getLocation() }
}
/**
* A Cfg scope that can be called
*/
class DataFlowCallable instanceof Cfg::CfgScope {
string toString() { result = super.toString() }
string getName() {
result = this.(ReusableWorkflowImpl).getResolvedPath() or
result = this.(CompositeActionImpl).getResolvedPath()
}
/** Gets a best-effort total ordering. */
int totalorder() { none() }
/** Gets the location of this callable. */
Location getLocation() { result = this.(Cfg::CfgScope).getLocation() }
}
newtype TReturnKind = TNormalReturn()
abstract class ReturnKind extends TReturnKind {
/** Gets a textual representation of this element. */
abstract string toString();
}
class NormalReturn extends ReturnKind, TNormalReturn {
override string toString() { result = "return" }
}
/** Gets a viable implementation of the target of the given `Call`. */
DataFlowCallable viableCallable(DataFlowCall c) { c.getName() = result.getName() }
/**
* Gets a node that can read the value returned from `call` with return kind
* `kind`.
*/
OutNode getAnOutNode(DataFlowCall call, ReturnKind kind) { call = result.getCall(kind) }
private newtype TDataFlowType = TUnknownDataFlowType()
/**
* A type for a data flow node.
*
* This may or may not coincide with any type system existing for the source
* language, but should minimally include unique types for individual closure
* expressions (typically lambdas).
*/
class DataFlowType extends TDataFlowType {
string toString() { result = "" }
}
string ppReprType(DataFlowType t) { none() }
predicate compatibleTypes(DataFlowType t1, DataFlowType t2) { any() }
predicate typeStrongerThan(DataFlowType t1, DataFlowType t2) { none() }
newtype TContent =
TFieldContent(string name) {
// We only use field flow for env, steps and jobs outputs
// not for accessing other context fields such as matrix or inputs
name = any(StepsExpression a).getFieldName() or
name = any(NeedsExpression a).getFieldName() or
name = any(JobsExpression a).getFieldName() or
name = any(EnvExpression a).getFieldName()
}
predicate forceHighPrecision(Content c) { c instanceof FieldContent }
class NodeRegion instanceof Unit {
string toString() { result = "NodeRegion" }
predicate contains(Node n) { none() }
int totalOrder() { result = 1 }
}
/**
* Holds if the nodes in `nr` are unreachable when the call context is `call`.
*/
predicate isUnreachableInCall(NodeRegion nr, DataFlowCall call) { none() }
class ContentApprox = ContentSet;
ContentApprox getContentApprox(Content c) { result = c }
/**
* Made a string to match the ArgumentPosition type.
*/
class ParameterPosition extends string {
ParameterPosition() {
exists(any(ReusableWorkflow w).getInput(this)) or
exists(any(CompositeAction a).getInput(this))
}
}
/**
* Made a string to match `With:` keys in the AST
*/
class ArgumentPosition extends string {
ArgumentPosition() { exists(any(Uses e).getArgumentExpr(this)) }
}
/**
*/
predicate parameterMatch(ParameterPosition ppos, ArgumentPosition apos) { ppos = apos }
/**
* Holds if there is a local flow step between a ${{ steps.xxx.outputs.yyy }} expression accesing a step output field
* and the step output itself. But only for those cases where the step output is defined externally in a MaD Source
* specification. The reason for this is that we don't currently have a way to specify that a source starts with a
* non-empty access path so we cannot write a Source that stores the taint in a Content, we can only do that for steps
* (storeStep). The easiest thing is to add this local flow step that simulates a read step from the source node for a specific
* field name.
*/
predicate stepsCtxLocalStep(Node nodeFrom, Node nodeTo) {
exists(Uses astFrom, StepsExpression astTo |
madSource(nodeFrom, _, "output." + ["*", astTo.getFieldName()]) and
astFrom = nodeFrom.asExpr() and
astTo = nodeTo.asExpr() and
astTo.getTarget() = astFrom
)
}
/**
* Holds if there is a local flow step between a ${{ needs.xxx.outputs.yyy }} expression accesing a job output field
* and the step output itself. But only for those cases where the job (needs) output is defined externally in a MaD Source
* specification. The reason for this is that we don't currently have a way to specify that a source starts with a
* non-empty access path so we cannot write a Source that stores the taint in a Content, we can only do that for steps
* (storeStep). The easiest thing is to add this local flow step that simulates a read step from the source node for a specific
* field name.
*/
predicate needsCtxLocalStep(Node nodeFrom, Node nodeTo) {
exists(Uses astFrom, NeedsExpression astTo |
madSource(nodeFrom, _, "output." + astTo.getFieldName()) and
astFrom = nodeFrom.asExpr() and
astTo = nodeTo.asExpr() and
astTo.getTarget() = astFrom
)
}
/**
* Holds if there is a local flow step between a ${{}} expression accesing an input variable and the input itself
* e.g. ${{ inputs.foo }}
*/
predicate inputsCtxLocalStep(Node nodeFrom, Node nodeTo) {
exists(AstNode astFrom, InputsExpression astTo |
astFrom = nodeFrom.asExpr() and
astTo = nodeTo.asExpr() and
astTo.getTarget() = astFrom
)
}
/**
* Holds if there is a local flow step between a ${{}} expression accesing a matrix variable and the matrix itself
* e.g. ${{ matrix.foo }}
*/
predicate matrixCtxLocalStep(Node nodeFrom, Node nodeTo) {
exists(AstNode astFrom, MatrixExpression astTo |
astFrom = nodeFrom.asExpr() and
astTo = nodeTo.asExpr() and
astTo.getTarget() = astFrom
)
}
/**
* Holds if there is a local flow step between a ${{}} expression accesing an env var and the var definition itself
* e.g. ${{ env.foo }}
*/
predicate envCtxLocalStep(Node nodeFrom, Node nodeTo) {
exists(AstNode astFrom, EnvExpression astTo |
astFrom = nodeFrom.asExpr() and
astTo = nodeTo.asExpr() and
(
madSource(nodeFrom, _, "env." + astTo.getFieldName())
or
astTo.getTarget() = astFrom
)
)
}
/**
* Holds if there is a local flow step from `nodeFrom` to `nodeTo`.
* For Actions, we dont need SSA nodes since it should be already in SSA form
* Local flow steps are always between two nodes in the same Cfg scope.
*/
pragma[nomagic]
predicate localFlowStep(Node nodeFrom, Node nodeTo) {
stepsCtxLocalStep(nodeFrom, nodeTo) or
needsCtxLocalStep(nodeFrom, nodeTo) or
inputsCtxLocalStep(nodeFrom, nodeTo) or
matrixCtxLocalStep(nodeFrom, nodeTo) or
envCtxLocalStep(nodeFrom, nodeTo)
}
/**
* This is the local flow predicate that is used as a building block in global
* data flow.
*/
cached
predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo, string model) {
localFlowStep(nodeFrom, nodeTo) and model = ""
}
/**
* Holds if data can flow from `node1` to `node2` through a non-local step
* that does not follow a call edge. For example, a step through a global
* variable.
* We throw away the call context and let us jump to any location
* AKA teleport steps
* local steps are preferible since they are more predictable and easier to control
*/
predicate jumpStep(Node nodeFrom, Node nodeTo) { none() }
/**
* Holds if a Expression reads a field from a job (needs/jobs), step (steps) output via a read of `c` (fieldname)
*/
predicate ctxFieldReadStep(Node node1, Node node2, ContentSet c) {
exists(SimpleReferenceExpression access |
(
access instanceof NeedsExpression or
access instanceof StepsExpression or
access instanceof JobsExpression or
access instanceof EnvExpression
) and
c = any(FieldContent ct | ct.getName() = access.getFieldName()) and
node1.asExpr() = access.getTarget() and
node2.asExpr() = access
)
}
/**
* Holds if data can flow from `node1` to `node2` via a read of `c`. Thus,
* `node1` references an object with a content `c.getAReadContent()` whose
* value ends up in `node2`.
* Store steps without corresponding reads are pruned aggressively very early, since they can never contribute to a complete path.
*/
predicate readStep(Node node1, ContentSet c, Node node2) { ctxFieldReadStep(node1, node2, c) }
/**
* Stores an output expression (node1) into its OutputsStm node (node2)
* using the output variable name as the access path
*/
predicate fieldStoreStep(Node node1, Node node2, ContentSet c) {
exists(Outputs out, string fieldName |
node1.asExpr() = out.getOutputExpr(fieldName) and
node2.asExpr() = out and
c = any(FieldContent ct | ct.getName() = fieldName)
)
}
/**
* Holds if data can flow from `node1` to `node2` via a store into `c`. Thus,
* `node2` references an object with a content `c.getAStoreContent()` that
* contains the value of `node1`.
* Store steps without corresponding reads are pruned aggressively very early, since they can never contribute to a complete path.
*/
predicate storeStep(Node node1, ContentSet c, Node node2) {
fieldStoreStep(node1, node2, c) or
madStoreStep(node1, node2, c) or
envToOutputStoreStep(node1, node2, c) or
envToEnvStoreStep(node1, node2, c) or
commandToOutputStoreStep(node1, node2, c) or
commandToEnvStoreStep(node1, node2, c)
}
/**
* Holds if values stored inside content `c` are cleared at node `n`. For example,
* any value stored inside `f` is cleared at the pre-update node associated with `x`
* in `x.f = newValue`.
*/
predicate clearsContent(Node n, ContentSet c) { none() }
/**
* Holds if the value that is being tracked is expected to be stored inside content `c`
* at node `n`.
*/
predicate expectsContent(Node n, ContentSet c) { none() }
/**
* Holds if flow is allowed to pass from parameter `p` and back to itself as a
* side-effect, resulting in a summary from `p` to itself.
*
* One example would be to allow flow like `p.foo = p.bar;`, which is disallowed
* by default as a heuristic.
*/
predicate allowParameterReturnInSelf(ParameterNode p) { none() }
predicate localMustFlowStep(Node nodeFrom, Node nodeTo) { localFlowStep(nodeFrom, nodeTo) }
private newtype TLambdaCallKind = TNone()
class LambdaCallKind = TLambdaCallKind;
/** Holds if `creation` is an expression that creates a lambda of kind `kind` for `c`. */
predicate lambdaCreation(Node creation, LambdaCallKind kind, DataFlowCallable c) { none() }
/** Holds if `call` is a lambda call of kind `kind` where `receiver` is the lambda expression. */
predicate lambdaCall(DataFlowCall call, LambdaCallKind kind, Node receiver) { none() }
/** Extra data-flow steps needed for lambda flow analysis. */
predicate additionalLambdaFlowStep(Node nodeFrom, Node nodeTo, boolean preservesValue) { none() }
/**
* Since our model is so simple, we dont want to compress the local flow steps.
* This compression is normally done to not show SSA steps, casts, etc.
*/
predicate neverSkipInPathGraph(Node node) { any() }
predicate knownSourceModel(Node source, string model) { none() }
predicate knownSinkModel(Node sink, string model) { none() }

View File

@@ -0,0 +1,194 @@
private import codeql.dataflow.DataFlow
private import codeql.actions.Ast
private import codeql.actions.Cfg as Cfg
private import codeql.Locations
private import DataFlowPrivate
class Node extends TNode {
/** Gets a textual representation of this element. */
string toString() { none() }
Location getLocation() { none() }
/**
* Holds if this element is at the specified location.
* The location spans column `startcolumn` of line `startline` to
* column `endcolumn` of line `endline` in file `filepath`.
* For more information, see
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
*/
predicate hasLocationInfo(
string filepath, int startline, int startcolumn, int endline, int endcolumn
) {
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
}
AstNode asExpr() { none() }
}
/**
* Any Ast Expression.
* UsesExpr, RunExpr, ArgumentExpr, VarAccessExpr, ...
*/
class ExprNode extends Node, TExprNode {
private DataFlowExpr expr;
ExprNode() { this = TExprNode(expr) }
Cfg::Node getCfgNode() { result = expr }
override string toString() { result = expr.toString() }
override Location getLocation() { result = expr.getLocation() }
override AstNode asExpr() { result = expr.getAstNode() }
}
/**
* Reusable workflow input nodes
*/
class ParameterNode extends ExprNode {
private Input input;
ParameterNode() { this.asExpr() = input }
predicate isParameterOf(DataFlowCallable c, ParameterPosition pos) {
input = c.(ReusableWorkflow).getInput(pos) or
input = c.(CompositeAction).getInput(pos)
}
override string toString() { result = "input " + input.toString() }
override Location getLocation() { result = input.getLocation() }
Input getInput() { result = input }
}
/**
* A call to a data flow callable (Uses).
*/
class CallNode extends ExprNode {
private DataFlowCall call;
CallNode() { this.getCfgNode() instanceof DataFlowCall }
DataFlowCallable getCalleeNode() { result = viableCallable(this.getCfgNode()) }
}
/**
* An argument to a Uses step (call).
*/
class ArgumentNode extends ExprNode {
ArgumentNode() { this.getCfgNode().getAstNode() = any(Uses e).getArgumentExpr(_) }
predicate argumentOf(DataFlowCall call, ArgumentPosition pos) {
this.getCfgNode() = call.(Cfg::Node).getASuccessor+() and
call.(Cfg::Node).getAstNode() =
any(Uses e | e.getArgumentExpr(pos) = this.getCfgNode().getAstNode())
}
}
/**
* Reusable workflow output nodes
*/
class ReturnNode extends ExprNode {
private Outputs outputs;
ReturnNode() {
this.asExpr() = outputs and
(
exists(ReusableWorkflow w | w.getOutputs() = outputs) or
exists(CompositeAction a | a.getOutputs() = outputs)
)
}
ReturnKind getKind() { result = TNormalReturn() }
override string toString() { result = "output " + outputs.toString() }
override Location getLocation() { result = outputs.getLocation() }
}
/** Gets the node corresponding to `e`. */
Node exprNode(DataFlowExpr e) { result = TExprNode(e) }
/**
* An entity that represents a set of `Content`s.
*
* The set may be interpreted differently depending on whether it is
* stored into (`getAStoreContent`) or read from (`getAReadContent`).
*/
class ContentSet instanceof Content {
/** Gets a content that may be stored into when storing into this set. */
Content getAStoreContent() { result = this }
/** Gets a content that may be read from when reading from this set. */
Content getAReadContent() { result = this }
/** Gets a textual representation of this content set. */
string toString() { result = super.toString() }
/**
* Holds if this element is at the specified location.
* The location spans column `startcolumn` of line `startline` to
* column `endcolumn` of line `endline` in file `filepath`.
* For more information, see
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
*/
predicate hasLocationInfo(
string filepath, int startline, int startcolumn, int endline, int endcolumn
) {
super.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
}
}
/**
* A reference contained in an object. Examples include instance fields, the
* contents of a collection object, the contents of an array or pointer.
*/
class Content extends TContent {
/** Gets the type of the contained data for the purpose of type pruning. */
DataFlowType getType() { any() }
/** Gets a textual representation of this element. */
abstract string toString();
/**
* Holds if this element is at the specified location.
* The location spans column `startcolumn` of line `startline` to
* column `endcolumn` of line `endline` in file `filepath`.
* For more information, see
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
*/
predicate hasLocationInfo(
string filepath, int startline, int startcolumn, int endline, int endcolumn
) {
filepath = "" and startline = 0 and startcolumn = 0 and endline = 0 and endcolumn = 0
}
}
/** A field of an object, for example an instance variable. */
class FieldContent extends Content, TFieldContent {
private string name;
FieldContent() { this = TFieldContent(name) }
/** Gets the name of the field. */
string getName() { result = name }
override string toString() { result = name }
}
predicate hasLocalFlow(Node n1, Node n2) {
n1 = n2 or
simpleLocalFlowStep(n1, n2, _) or
exists(ContentSet c | ctxFieldReadStep(n1, n2, c))
}
predicate hasLocalFlowExpr(AstNode n1, AstNode n2) {
exists(Node dn1, Node dn2 |
dn1.asExpr() = n1 and
dn2.asExpr() = n2 and
hasLocalFlow(dn1, dn2)
)
}

View File

@@ -0,0 +1,24 @@
/**
* This module provides extensible predicates for defining MaD models.
*/
/**
* Holds if a source model exists for the given parameters.
*/
extensible predicate actionsSourceModel(
string action, string version, string output, string kind, string provenance
);
/**
* Holds if a summary model exists for the given parameters.
*/
extensible predicate actionsSummaryModel(
string action, string version, string input, string output, string kind, string provenance
);
/**
* Holds if a sink model exists for the given parameters.
*/
extensible predicate actionsSinkModel(
string action, string version, string input, string kind, string provenance
);

View File

@@ -0,0 +1,12 @@
/**
* Provides Actions-specific definitions for use in the taint tracking library.
* Implementation of https://github.com/github/codeql/blob/main/shared/dataflow/codeql/dataflow/TaintTracking.qll
*/
private import codeql.Locations
private import codeql.dataflow.TaintTracking
private import DataFlowImplSpecific
module ActionsTaintTracking implements InputSig<Location, ActionsDataFlow> {
import TaintTrackingPrivate
}

View File

@@ -0,0 +1,40 @@
/**
* Provides modules for performing local (intra-procedural) and
* global (inter-procedural) taint-tracking analyses.
*/
private import DataFlowPrivate
private import codeql.actions.DataFlow
private import codeql.actions.dataflow.TaintSteps
private import codeql.actions.Ast
/**
* Holds if `node` should be a sanitizer in all global taint flow configurations
* but not in local taint.
*/
predicate defaultTaintSanitizer(DataFlow::Node node) { none() }
// predicate defaultAdditionalTaintStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
// any(AdditionalTaintStep s).step(nodeFrom, nodeTo)
// }
/**
* Holds if the additional step from `nodeFrom` to `nodeTo` should be included
* in all global taint flow configurations.
*/
cached
predicate defaultAdditionalTaintStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo, string model) {
any(AdditionalTaintStep s).step(nodeFrom, nodeTo) and model = ""
}
/**
* Holds if taint flow configurations should allow implicit reads of `c` at sinks
* and inputs to additional taint steps.
*/
bindingset[node]
predicate defaultImplicitTaintRead(DataFlow::Node node, DataFlow::ContentSet c) { none() }
/**
* Holds if the additional step from `src` to `sink` should be considered in
* speculative taint flow exploration.
*/
predicate speculativeTaintStep(DataFlow::Node src, DataFlow::Node sink) { none() }

View File

@@ -0,0 +1,19 @@
private import codeql.files.FileSystem
/**
* Returns an appropriately encoded version of a filename `name`
* passed by the VS Code extension in order to coincide with the
* output of `.getFile()` on locatable entities.
*/
cached
File getFileBySourceArchiveName(string name) {
// The name provided for a file in the source archive by the VS Code extension
// has some differences from the absolute path in the database:
// 1. colons are replaced by underscores
// 2. there's a leading slash, even for Windows paths: "C:/foo/bar" ->
// "/C_/foo/bar"
// 3. double slashes in UNC prefixes are replaced with a single slash
// We can handle 2 and 3 together by unconditionally adding a leading slash
// before replacing double slashes.
name = ("/" + result.getAbsolutePath().replaceAll(":", "_")).replaceAll("//", "/")
}

View File

@@ -0,0 +1,137 @@
/**
* Provides queries to pretty-print an Kaleidoscope abstract syntax tree as a graph.
*
* By default, this will print the AST for all nodes in the database. To change
* this behavior, extend `PrintASTConfiguration` and override `shouldPrintNode`
* to hold for only the AST nodes you wish to view.
*/
private import codeql.actions.Ast
private import codeql.Locations
/**
* The query can extend this class to control which nodes are printed.
*/
class PrintAstConfiguration extends string {
PrintAstConfiguration() { this = "PrintAstConfiguration" }
/**
* Holds if the given node should be printed.
*/
predicate shouldPrintNode(PrintAstNode n) { any() }
}
newtype TPrintNode = TPrintRegularAstNode(AstNode n) { any() }
private predicate shouldPrintNode(PrintAstNode n) {
any(PrintAstConfiguration config).shouldPrintNode(n)
}
/**
* A node in the output tree.
*/
class PrintAstNode extends TPrintNode {
/** Gets a textual representation of this node in the PrintAst output tree. */
string toString() { none() }
/**
* Gets the child node with name `edgeName`. Typically this is the name of the
* predicate used to access the child.
*/
PrintAstNode getChild(string edgeName) { none() }
/** Get the Location of this AST node */
Location getLocation() { none() }
/** Gets a child of this node. */
final PrintAstNode getAChild() { result = this.getChild(_) }
/** Gets the parent of this node, if any. */
final PrintAstNode getParent() { result.getAChild() = this }
/** Gets a value used to order this node amongst its siblings. */
int getOrder() {
this =
rank[result](PrintRegularAstNode p, Location l, File f |
l = p.getLocation() and
f = l.getFile()
|
p
order by
f.getBaseName(), f.getAbsolutePath(), l.getStartLine(), l.getStartColumn(),
l.getEndLine(), l.getEndColumn()
)
}
/**
* Gets the value of the property of this node, where the name of the property
* is `key`.
*/
final string getProperty(string key) {
key = "semmle.label" and
result = this.toString()
or
key = "semmle.order" and result = this.getOrder().toString()
}
}
/** An `AstNode` in the output tree. */
class PrintRegularAstNode extends PrintAstNode, TPrintRegularAstNode {
AstNode astNode;
PrintRegularAstNode() { this = TPrintRegularAstNode(astNode) }
override string toString() {
result = "[" + concat(astNode.getAPrimaryQlClass(), ", ") + "] " + astNode.toString()
}
override Location getLocation() { result = astNode.getLocation() }
override PrintAstNode getChild(string name) {
exists(int i |
name = i.toString() and
result =
TPrintRegularAstNode(rank[i](AstNode child, Location l |
child.getParentNode() = astNode and
child.getLocation() = l
|
child
order by
l.getStartLine(), l.getStartColumn(), l.getEndColumn(), l.getEndLine(),
child.toString()
))
)
}
}
/**
* Holds if `node` belongs to the output tree, and its property `key` has the
* given `value`.
*/
query predicate nodes(PrintAstNode node, string key, string value) {
value = node.getProperty(key) and shouldPrintNode(node)
}
/**
* Holds if `target` is a child of `source` in the AST, and property `key` of
* the edge has the given `value`.
*/
query predicate edges(PrintAstNode source, PrintAstNode target, string key, string value) {
shouldPrintNode(source) and
shouldPrintNode(target) and
target = source.getChild(_) and
(
key = "semmle.label" and
value = strictconcat(string name | source.getChild(name) = target | name, "/")
or
key = "semmle.order" and
value = target.getProperty("semmle.order")
)
}
/**
* Holds if property `key` of the graph has the given `value`.
*/
query predicate graphProperties(string key, string value) {
key = "semmle.graphKind" and value = "tree"
}

View File

@@ -0,0 +1,94 @@
private import actions
private import codeql.actions.TaintTracking
private import codeql.actions.dataflow.ExternalFlow
import codeql.actions.dataflow.FlowSources
import codeql.actions.DataFlow
abstract class ArgumentInjectionSink extends DataFlow::Node {
abstract string getCommand();
}
/**
* Holds if a Run step declares an environment variable, uses it as the argument to a command vulnerable to argument injection.
* e.g.
* env:
* BODY: ${{ github.event.comment.body }}
* run: |
* sed "s/FOO/$BODY/g" > /tmp/foo
*/
class ArgumentInjectionFromEnvVarSink extends ArgumentInjectionSink {
string command;
string argument;
ArgumentInjectionFromEnvVarSink() {
exists(Run run, string var |
run.getScript() = this.asExpr() and
(
exists(run.getInScopeEnvVarExpr(var)) or
var = "GITHUB_HEAD_REF"
) and
run.getScript().getAnEnvReachingArgumentInjectionSink(var, command, argument)
)
}
override string getCommand() { result = command }
}
/**
* Holds if a Run step executes a command that returns untrusted data which flows to an unsafe argument
* e.g.
* run: |
* BODY=$(git log --format=%s)
* sed "s/FOO/$BODY/g" > /tmp/foo
*/
class ArgumentInjectionFromCommandSink extends ArgumentInjectionSink {
string command;
string argument;
ArgumentInjectionFromCommandSink() {
exists(CommandSource source, Run run |
run = source.getEnclosingRun() and
this.asExpr() = run.getScript() and
run.getScript().getACmdReachingArgumentInjectionSink(source.getCommand(), command, argument)
)
}
override string getCommand() { result = command }
}
/**
* Holds if a Run step declares an environment variable, uses it as the argument to a command vulnerable to argument injection.
*/
class ArgumentInjectionFromMaDSink extends ArgumentInjectionSink {
ArgumentInjectionFromMaDSink() { madSink(this, "argument-injection") }
override string getCommand() { result = "unknown" }
}
/**
* A taint-tracking configuration for unsafe user input
* that is used to construct and evaluate a code script.
*/
private module ArgumentInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
source instanceof RemoteFlowSource
or
exists(Run run |
run.getScript() = source.asExpr() and
run.getScript().getAnEnvReachingArgumentInjectionSink("GITHUB_HEAD_REF", _, _)
)
}
predicate isSink(DataFlow::Node sink) { sink instanceof ArgumentInjectionSink }
predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {
exists(Run run, string var |
run.getInScopeEnvVarExpr(var) = pred.asExpr() and
succ.asExpr() = run.getScript() and
run.getScript().getAnEnvReachingArgumentInjectionSink(var, _, _)
)
}
}
/** Tracks flow of unsafe user input that is used to construct and evaluate a code script. */
module ArgumentInjectionFlow = TaintTracking::Global<ArgumentInjectionConfig>;

View File

@@ -0,0 +1,322 @@
import actions
private import codeql.actions.TaintTracking
import codeql.actions.DataFlow
import codeql.actions.dataflow.FlowSources
import codeql.actions.security.PoisonableSteps
import codeql.actions.security.UntrustedCheckoutQuery
string unzipRegexp() { result = "(unzip|tar)\\s+.*" }
string unzipDirArgRegexp() { result = "(-d|-C)\\s+([^ ]+).*" }
abstract class UntrustedArtifactDownloadStep extends Step {
abstract string getPath();
}
class GitHubDownloadArtifactActionStep extends UntrustedArtifactDownloadStep, UsesStep {
GitHubDownloadArtifactActionStep() {
this.getCallee() = "actions/download-artifact" and
(
// By default, the permissions are scoped so they can only download Artifacts within the current workflow run.
// To elevate permissions for this scenario, you can specify a github-token along with other repository and run identifiers
this.getArgument("run-id").matches("%github.event.workflow_run.id%") and
exists(this.getArgument("github-token"))
or
// There is an artifact upload step in the same workflow which can be influenced by an attacker on a checkout step
exists(LocalJob job, SimplePRHeadCheckoutStep checkout, UsesStep upload |
this.getEnclosingWorkflow().getAJob() = job and
job.getAStep() = checkout and
checkout.getATriggerEvent().getName() = "pull_request_target" and
checkout.getAFollowingStep() = upload and
upload.getCallee() = "actions/upload-artifact"
)
)
}
override string getPath() {
if exists(this.getArgument("path"))
then result = normalizePath(this.getArgument("path"))
else result = "GITHUB_WORKSPACE/"
}
}
class DownloadArtifactActionStep extends UntrustedArtifactDownloadStep, UsesStep {
DownloadArtifactActionStep() {
this.getCallee() =
[
"dawidd6/action-download-artifact", "marcofaggian/action-download-multiple-artifacts",
"benday-inc/download-latest-artifact", "blablacar/action-download-last-artifact",
"levonet/action-download-last-artifact", "bettermarks/action-artifact-download",
"aochmann/actions-download-artifact", "cytopia/download-artifact-retry-action",
"alextompkins/download-prior-artifact", "nmerget/download-gzip-artifact",
"benday-inc/download-artifact", "synergy-au/download-workflow-artifacts-action",
"ishworkh/docker-image-artifact-download", "ishworkh/container-image-artifact-download",
"sidx1024/action-download-artifact", "hyperskill/azblob-download-artifact",
"ma-ve/action-download-artifact-with-retry"
] and
(
not exists(this.getArgument(["branch", "branch_name"]))
or
exists(this.getArgument(["branch", "branch_name"])) and
this.getArgument("allow_forks") = "true"
) and
(
not exists(this.getArgument(["commit", "commitHash", "commit_sha"])) or
not this.getArgument(["commit", "commitHash", "commit_sha"])
.matches("%github.event.pull_request.head.sha%")
) and
(
not exists(this.getArgument("event")) or
not this.getArgument("event") = "pull_request"
) and
(
not exists(this.getArgument(["run-id", "run_id", "workflow-run-id", "workflow_run_id"])) or
this.getArgument(["run-id", "run_id", "workflow-run-id", "workflow_run_id"])
.matches("%github.event.workflow_run.id%")
) and
(
not exists(this.getArgument("pr")) or
not this.getArgument("pr")
.matches(["%github.event.pull_request.number%", "%github.event.number%"])
)
}
override string getPath() {
if exists(this.getArgument(["path", "download_path"]))
then result = normalizePath(this.getArgument(["path", "download_path"]))
else
if exists(this.getArgument("paths"))
then result = normalizePath(this.getArgument("paths").splitAt(" "))
else result = "GITHUB_WORKSPACE/"
}
}
class LegitLabsDownloadArtifactActionStep extends UntrustedArtifactDownloadStep, UsesStep {
LegitLabsDownloadArtifactActionStep() {
this.getCallee() = "Legit-Labs/action-download-artifact" and
(
not exists(this.getArgument("branch")) or
not this.getArgument("branch") = ["main", "master"]
) and
(
not exists(this.getArgument("commit")) or
not this.getArgument("commit").matches("%github.event.pull_request.head.sha%")
) and
(
not exists(this.getArgument("event")) or
not this.getArgument("event") = "pull_request"
) and
(
not exists(this.getArgument("run_id")) or
not this.getArgument("run_id").matches("%github.event.workflow_run.id%")
) and
(
not exists(this.getArgument("pr")) or
not this.getArgument("pr").matches("%github.event.pull_request.number%")
)
}
override string getPath() {
if exists(this.getArgument("path"))
then result = normalizePath(this.getArgument("path"))
else result = "GITHUB_WORKSPACE/artifacts"
}
}
class ActionsGitHubScriptDownloadStep extends UntrustedArtifactDownloadStep, UsesStep {
string script;
ActionsGitHubScriptDownloadStep() {
// eg:
// - uses: actions/github-script@v6
// with:
// script: |
// let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
// owner: context.repo.owner,
// repo: context.repo.repo,
// run_id: context.payload.workflow_run.id,
// });
// let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
// return artifact.name == "<ARTEFACT_NAME>"
// })[0];
// let download = await github.rest.actions.downloadArtifact({
// owner: context.repo.owner,
// repo: context.repo.repo,
// artifact_id: matchArtifact.id,
// archive_format: 'zip',
// });
// var fs = require('fs');
// fs.writeFileSync('${{github.workspace}}/test-results.zip', Buffer.from(download.data));
this.getCallee() = "actions/github-script" and
this.getArgument("script") = script and
script.matches("%listWorkflowRunArtifacts(%") and
script.matches("%downloadArtifact(%") and
script.matches("%writeFileSync(%") and
// Filter out artifacts that were created by pull-request.
not script.matches("%exclude_pull_requests: true%")
}
override string getPath() {
if
this.getAFollowingStep()
.(Run)
.getScript()
.getACommand()
.regexpMatch(unzipRegexp() + unzipDirArgRegexp())
then
result =
normalizePath(trimQuotes(this.getAFollowingStep()
.(Run)
.getScript()
.getACommand()
.regexpCapture(unzipRegexp() + unzipDirArgRegexp(), 3)))
else
if this.getAFollowingStep().(Run).getScript().getACommand().regexpMatch(unzipRegexp())
then result = "GITHUB_WORKSPACE/"
else none()
}
}
class GHRunArtifactDownloadStep extends UntrustedArtifactDownloadStep, Run {
GHRunArtifactDownloadStep() {
// eg: - run: gh run download ${{ github.event.workflow_run.id }} --repo "${GITHUB_REPOSITORY}" --name "artifact_name"
this.getScript().getACommand().regexpMatch(".*gh\\s+run\\s+download.*") and
(
this.getScript().getACommand().regexpMatch(unzipRegexp()) or
this.getAFollowingStep().(Run).getScript().getACommand().regexpMatch(unzipRegexp())
)
}
override string getPath() {
if
this.getAFollowingStep()
.(Run)
.getScript()
.getACommand()
.regexpMatch(unzipRegexp() + unzipDirArgRegexp()) or
this.getScript().getACommand().regexpMatch(unzipRegexp() + unzipDirArgRegexp())
then
result =
normalizePath(trimQuotes(this.getScript()
.getACommand()
.regexpCapture(unzipRegexp() + unzipDirArgRegexp(), 3))) or
result =
normalizePath(trimQuotes(this.getAFollowingStep()
.(Run)
.getScript()
.getACommand()
.regexpCapture(unzipRegexp() + unzipDirArgRegexp(), 3)))
else
if
this.getAFollowingStep().(Run).getScript().getACommand().regexpMatch(unzipRegexp()) or
this.getScript().getACommand().regexpMatch(unzipRegexp())
then result = "GITHUB_WORKSPACE/"
else none()
}
}
class DirectArtifactDownloadStep extends UntrustedArtifactDownloadStep, Run {
DirectArtifactDownloadStep() {
// eg:
// run: |
// artifacts_url=${{ github.event.workflow_run.artifacts_url }}
// gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
// do
// IFS=$'\t' read name url <<< "$artifact"
// gh api $url > "$name.zip"
// unzip -d "$name" "$name.zip"
// done
this.getScript().getACommand().matches("%github.event.workflow_run.artifacts_url%") and
(
this.getScript().getACommand().regexpMatch(unzipRegexp()) or
this.getAFollowingStep().(Run).getScript().getACommand().regexpMatch(unzipRegexp())
)
}
override string getPath() {
if
this.getScript().getACommand().regexpMatch(unzipRegexp() + unzipDirArgRegexp()) or
this.getAFollowingStep()
.(Run)
.getScript()
.getACommand()
.regexpMatch(unzipRegexp() + unzipDirArgRegexp())
then
result =
normalizePath(trimQuotes(this.getScript()
.getACommand()
.regexpCapture(unzipRegexp() + unzipDirArgRegexp(), 3))) or
result =
normalizePath(trimQuotes(this.getAFollowingStep()
.(Run)
.getScript()
.getACommand()
.regexpCapture(unzipRegexp() + unzipDirArgRegexp(), 3)))
else result = "GITHUB_WORKSPACE/"
}
}
class ArtifactPoisoningSink extends DataFlow::Node {
UntrustedArtifactDownloadStep download;
PoisonableStep poisonable;
ArtifactPoisoningSink() {
download.getAFollowingStep() = poisonable and
// excluding artifacts downloaded to /tmp
not download.getPath().regexpMatch("^/tmp.*") and
(
poisonable.(Run).getScript() = this.asExpr() and
(
// Check if the poisonable step is a local script execution step
// and the path of the command or script matches the path of the downloaded artifact
isSubpath(poisonable.(LocalScriptExecutionRunStep).getPath(), download.getPath())
or
// Checking the path for non local script execution steps is very difficult
not poisonable instanceof LocalScriptExecutionRunStep
// Its not easy to extract the path from a non-local script execution step so skipping this check for now
// and isSubpath(poisonable.(Run).getWorkingDirectory(), download.getPath())
)
or
poisonable.(UsesStep) = this.asExpr() and
(
not poisonable instanceof LocalActionUsesStep and
download.getPath() = "GITHUB_WORKSPACE/"
or
isSubpath(poisonable.(LocalActionUsesStep).getPath(), download.getPath())
)
)
}
string getPath() { result = download.getPath() }
}
/**
* A taint-tracking configuration for unsafe artifacts
* that is used may lead to artifact poisoning
*/
private module ArtifactPoisoningConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof ArtifactSource }
predicate isSink(DataFlow::Node sink) { sink instanceof ArtifactPoisoningSink }
predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {
exists(PoisonableStep step |
pred instanceof ArtifactSource and
pred.asExpr().(Step).getAFollowingStep() = step and
(
succ.asExpr() = step.(Run).getScript() or
succ.asExpr() = step.(UsesStep)
)
)
or
exists(Run run |
pred instanceof ArtifactSource and
pred.asExpr().(Step).getAFollowingStep() = run and
succ.asExpr() = run.getScript() and
exists(run.getScript().getAFileReadCommand())
)
}
}
/** Tracks flow of unsafe artifacts that is used in an insecure way. */
module ArtifactPoisoningFlow = TaintTracking::Global<ArtifactPoisoningConfig>;

View File

@@ -0,0 +1,72 @@
import actions
string defaultBranchTriggerEvent() {
result =
[
"check_run", "check_suite", "delete", "discussion", "discussion_comment", "fork", "gollum",
"issue_comment", "issues", "label", "milestone", "project", "project_card", "project_column",
"public", "pull_request_comment", "pull_request_target", "repository_dispatch", "schedule",
"watch", "workflow_run"
]
}
predicate runsOnDefaultBranch(Event e) {
(
e.getName() = defaultBranchTriggerEvent() and
not e.getName() = "pull_request_target"
or
e.getName() = "push" and
e.getAPropertyValue("branches") = defaultBranchNames()
or
e.getName() = "pull_request_target" and
(
// no filtering
not e.hasProperty("branches") and not e.hasProperty("branches-ignore")
or
// only branches-ignore filter
e.hasProperty("branches-ignore") and
not e.hasProperty("branches") and
not e.getAPropertyValue("branches-ignore") = defaultBranchNames()
or
// only branches filter
e.hasProperty("branches") and
not e.hasProperty("branches-ignore") and
e.getAPropertyValue("branches") = defaultBranchNames()
or
// branches and branches-ignore filters
e.hasProperty("branches") and
e.hasProperty("branches-ignore") and
e.getAPropertyValue("branches") = defaultBranchNames() and
not e.getAPropertyValue("branches-ignore") = defaultBranchNames()
)
)
}
abstract class CacheWritingStep extends Step {
abstract string getPath();
}
class CacheActionUsesStep extends CacheWritingStep, UsesStep {
CacheActionUsesStep() { this.getCallee() = "actions/cache" }
override string getPath() {
result = normalizePath(this.(UsesStep).getArgument("path").splitAt("\n"))
}
}
class CacheActionSaveUsesStep extends CacheWritingStep, UsesStep {
CacheActionSaveUsesStep() { this.getCallee() = "actions/cache/save" }
override string getPath() {
result = normalizePath(this.(UsesStep).getArgument("path").splitAt("\n"))
}
}
class SetupRubyUsesStep extends CacheWritingStep, UsesStep {
SetupRubyUsesStep() {
this.getCallee() = ["actions/setup-ruby", "ruby/setup-ruby"] and
this.getArgument("bundler-cache") = "true"
}
override string getPath() { result = normalizePath("vendor/bundle") }
}

View File

@@ -0,0 +1,41 @@
private import actions
private import codeql.actions.TaintTracking
private import codeql.actions.dataflow.ExternalFlow
import codeql.actions.dataflow.FlowSources
import codeql.actions.DataFlow
class CodeInjectionSink extends DataFlow::Node {
CodeInjectionSink() {
exists(Run e | e.getAnScriptExpr() = this.asExpr()) or
madSink(this, "code-injection")
}
}
/**
* A taint-tracking configuration for unsafe user input
* that is used to construct and evaluate a code script.
*/
private module CodeInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof CodeInjectionSink }
predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {
exists(Uses step |
pred instanceof FileSource and
pred.asExpr().(Step).getAFollowingStep() = step and
succ.asExpr() = step and
madSink(succ, "code-injection")
)
or
exists(Run run |
pred instanceof FileSource and
pred.asExpr().(Step).getAFollowingStep() = run and
succ.asExpr() = run.getScript() and
exists(run.getScript().getAFileReadCommand())
)
}
}
/** Tracks flow of unsafe user input that is used to construct and evaluate a code script. */
module CodeInjectionFlow = TaintTracking::Global<CodeInjectionConfig>;

View File

@@ -0,0 +1,22 @@
private import actions
private import codeql.actions.TaintTracking
private import codeql.actions.dataflow.ExternalFlow
import codeql.actions.dataflow.FlowSources
import codeql.actions.DataFlow
private class CommandInjectionSink extends DataFlow::Node {
CommandInjectionSink() { madSink(this, "command-injection") }
}
/**
* A taint-tracking configuration for unsafe user input
* that is used to construct and evaluate a system command.
*/
private module CommandInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof CommandInjectionSink }
}
/** Tracks flow of unsafe user input that is used to construct and evaluate a system command. */
module CommandInjectionFlow = TaintTracking::Global<CommandInjectionConfig>;

View File

@@ -0,0 +1,312 @@
import actions
string any_category() {
result =
[
"untrusted-checkout", "output-clobbering", "envpath-injection", "envvar-injection",
"command-injection", "argument-injection", "code-injection", "cache-poisoning",
"untrusted-checkout-toctou", "artifact-poisoning", "artifact-poisoning-toctou"
]
}
string non_toctou_category() {
result = any_category() and not result = "untrusted-checkout-toctou"
}
string toctou_category() { result = ["untrusted-checkout-toctou", "artifact-poisoning-toctou"] }
string any_event() { result = actor_not_attacker_event() or result = actor_is_attacker_event() }
string actor_is_attacker_event() {
result =
[
// actor and attacker have to be the same
"pull_request_target",
"workflow_run",
"discussion_comment",
"discussion",
"issues",
"fork",
"watch"
]
}
string actor_not_attacker_event() {
result =
[
// actor and attacker can be different
// actor may be a collaborator, but the attacker is may be the author of the PR that gets commented
// therefore it may be vulnerable to TOCTOU races where the actor reviews one thing and the attacker changes it
"issue_comment",
"pull_request_comment",
]
}
/** An If node that contains an actor, user or label check */
abstract class ControlCheck extends AstNode {
ControlCheck() {
this instanceof If or
this instanceof Environment or
this instanceof UsesStep or
this instanceof Run
}
predicate protects(AstNode node, Event event, string category) {
// The check dominates the step it should protect
this.dominates(node) and
// The check is effective against the event and category
this.protectsCategoryAndEvent(category, event.getName()) and
// The check can be triggered by the event
this.getATriggerEvent() = event
}
predicate dominates(AstNode node) {
this instanceof If and
(
node.getEnclosingStep().getIf() = this or
node.getEnclosingJob().getIf() = this or
node.getEnclosingJob().getANeededJob().(LocalJob).getAStep().getIf() = this or
node.getEnclosingJob().getANeededJob().(LocalJob).getIf() = this
)
or
this instanceof Environment and
(
node.getEnclosingJob().getEnvironment() = this
or
node.getEnclosingJob().getANeededJob().getEnvironment() = this
)
or
(
this instanceof Run or
this instanceof UsesStep
) and
(
this.(Step).getAFollowingStep() = node.getEnclosingStep()
or
node.getEnclosingJob().getANeededJob().(LocalJob).getAStep() = this.(Step)
)
}
abstract predicate protectsCategoryAndEvent(string category, string event);
}
abstract class AssociationCheck extends ControlCheck {
// Checks if the actor is a MEMBER/OWNER the repo
// - they are effective against pull requests and workflow_run (since these are triggered by pull_requests) since they can control who is making the PR
// - they are not effective against issue_comment since the author of the comment may not be the same as the author of the PR
override predicate protectsCategoryAndEvent(string category, string event) {
event = actor_is_attacker_event() and category = any_category()
or
event = actor_not_attacker_event() and category = non_toctou_category()
}
}
abstract class ActorCheck extends ControlCheck {
// checks for a specific actor
// - they are effective against pull requests and workflow_run (since these are triggered by pull_requests) since they can control who is making the PR
// - they are not effective against issue_comment since the author of the comment may not be the same as the author of the PR
override predicate protectsCategoryAndEvent(string category, string event) {
event = actor_is_attacker_event() and category = any_category()
or
event = actor_not_attacker_event() and category = non_toctou_category()
}
}
abstract class RepositoryCheck extends ControlCheck {
// checks that the origin of the code is the same as the repository.
// for pull_requests, that means that it triggers only on local branches or repos from the same org
// - they are effective against pull requests/workflow_run since they can control where the code is coming from
// - they are not effective against issue_comment since the repository will always be the same
}
abstract class PermissionCheck extends ControlCheck {
// checks that the actor has a specific permission level
// - they are effective against pull requests/workflow_run since they can control who can make changes
// - they are not effective against issue_comment since the author of the comment may not be the same as the author of the PR
override predicate protectsCategoryAndEvent(string category, string event) {
event = actor_is_attacker_event() and category = any_category()
or
event = actor_not_attacker_event() and category = non_toctou_category()
}
}
abstract class LabelCheck extends ControlCheck {
// checks if the issue/pull_request is labeled, which implies that it could have been approved
// - they dont protect against mutation attacks
override predicate protectsCategoryAndEvent(string category, string event) {
event = actor_is_attacker_event() and category = any_category()
or
event = actor_not_attacker_event() and category = non_toctou_category()
}
}
class EnvironmentCheck extends ControlCheck instanceof Environment {
// Environment checks are not effective against any mutable attacks
// they do actually protect against untrusted code execution (sha)
override predicate protectsCategoryAndEvent(string category, string event) {
event = actor_is_attacker_event() and category = any_category()
or
event = actor_not_attacker_event() and category = non_toctou_category()
}
}
abstract class CommentVsHeadDateCheck extends ControlCheck {
override predicate protectsCategoryAndEvent(string category, string event) {
// by itself, this check is not effective against any attacks
event = actor_not_attacker_event() and category = toctou_category()
}
}
/* Specific implementations of control checks */
class LabelIfCheck extends LabelCheck instanceof If {
string condition;
LabelIfCheck() {
condition = normalizeExpr(this.getCondition()) and
(
// eg: contains(github.event.pull_request.labels.*.name, 'safe to test')
condition.regexpMatch(".*(^|[^!])contains\\(\\s*github\\.event\\.pull_request\\.labels\\b.*")
or
// eg: github.event.label.name == 'safe to test'
condition.regexpMatch(".*\\bgithub\\.event\\.label\\.name\\s*==.*")
)
}
}
class ActorIfCheck extends ActorCheck instanceof If {
ActorIfCheck() {
// eg: github.event.pull_request.user.login == 'admin'
exists(
normalizeExpr(this.getCondition())
.regexpFind([
"\\bgithub\\.event\\.pull_request\\.user\\.login\\b",
"\\bgithub\\.event\\.head_commit\\.author\\.name\\b",
"\\bgithub\\.event\\.commits.*\\.author\\.name\\b",
"\\bgithub\\.event\\.sender\\.login\\b"
], _, _)
)
or
// eg: github.actor == 'admin'
// eg: github.triggering_actor == 'admin'
exists(
normalizeExpr(this.getCondition())
.regexpFind(["\\bgithub\\.actor\\b", "\\bgithub\\.triggering_actor\\b",], _, _)
) and
not normalizeExpr(this.getCondition()).matches("%[bot]%")
}
}
class PullRequestTargetRepositoryIfCheck extends RepositoryCheck instanceof If {
PullRequestTargetRepositoryIfCheck() {
// eg: github.event.pull_request.head.repo.full_name == github.repository
exists(
normalizeExpr(this.getCondition())
// github.repository in a workflow_run event triggered by a pull request is the base repository
.regexpFind([
"\\bgithub\\.repository\\b", "\\bgithub\\.repository_owner\\b",
"\\bgithub\\.event\\.pull_request\\.head\\.repo\\.full_name\\b",
"\\bgithub\\.event\\.pull_request\\.head\\.repo\\.owner\\.name\\b",
"\\bgithub\\.event\\.workflow_run\\.head_repository\\.full_name\\b",
"\\bgithub\\.event\\.workflow_run\\.head_repository\\.owner\\.name\\b"
], _, _)
)
}
override predicate protectsCategoryAndEvent(string category, string event) {
event = "pull_request_target" and category = any_category()
}
}
class WorkflowRunRepositoryIfCheck extends RepositoryCheck instanceof If {
WorkflowRunRepositoryIfCheck() {
// eg: github.event.workflow_run.head_repository.full_name == github.repository
exists(
normalizeExpr(this.getCondition())
// github.repository in a workflow_run event triggered by a pull request is the base repository
.regexpFind([
"\\bgithub\\.event\\.workflow_run\\.head_repository\\.full_name\\b",
"\\bgithub\\.event\\.workflow_run\\.head_repository\\.owner\\.name\\b"
], _, _)
)
}
override predicate protectsCategoryAndEvent(string category, string event) {
event = "workflow_run" and category = any_category()
}
}
class AssociationIfCheck extends AssociationCheck instanceof If {
AssociationIfCheck() {
// eg: contains(fromJson('["MEMBER", "OWNER"]'), github.event.comment.author_association)
normalizeExpr(this.getCondition())
.splitAt("\n")
.regexpMatch([
".*\\bgithub\\.event\\.comment\\.author_association\\b.*",
".*\\bgithub\\.event\\.issue\\.author_association\\b.*",
".*\\bgithub\\.event\\.pull_request\\.author_association\\b.*",
])
}
}
class AssociationActionCheck extends AssociationCheck instanceof UsesStep {
AssociationActionCheck() {
this.getCallee() = "TheModdingInquisition/actions-team-membership" and
(
not exists(this.getArgument("exit"))
or
this.getArgument("exit") = "true"
)
or
this.getCallee() = "actions/github-script" and
this.getArgument("script").splitAt("\n").matches("%getMembershipForUserInOrg%")
or
this.getCallee() = "octokit/request-action" and
this.getArgument("route").regexpMatch("GET.*(memberships).*")
}
}
class PermissionActionCheck extends PermissionCheck instanceof UsesStep {
PermissionActionCheck() {
this.getCallee() = "actions-cool/check-user-permission" and
(
// default permission level is write
not exists(this.getArgument("permission-level")) or
this.getArgument("require") = ["write", "admin"]
)
or
this.getCallee() = "sushichop/action-repository-permission" and
this.getArgument("required-permission") = ["write", "admin"]
or
this.getCallee() = "prince-chrismc/check-actor-permissions-action" and
this.getArgument("permission") = ["write", "admin"]
or
this.getCallee() = "lannonbr/repo-permission-check-action" and
this.getArgument("permission") = ["write", "admin"]
or
this.getCallee() = "xt0rted/slash-command-action" and
(
// default permission level is write
not exists(this.getArgument("permission-level")) or
this.getArgument("permission-level") = ["write", "admin"]
)
or
this.getCallee() = "actions/github-script" and
this.getArgument("script").splitAt("\n").matches("%getCollaboratorPermissionLevel%")
or
this.getCallee() = "octokit/request-action" and
this.getArgument("route").regexpMatch("GET.*(collaborators|permission).*")
}
}
class BashCommentVsHeadDateCheck extends CommentVsHeadDateCheck, Run {
BashCommentVsHeadDateCheck() {
// eg: if [[ $(date -d "$pushed_at" +%s) -gt $(date -d "$COMMENT_AT" +%s) ]]; then
exists(string cmd1, string cmd2 |
cmd1 = this.getScript().getACommand() and
cmd2 = this.getScript().getACommand() and
not cmd1 = cmd2 and
cmd1.toLowerCase().regexpMatch("date\\s+-d.*(commit|pushed|comment|commented)_at.*") and
cmd2.toLowerCase().regexpMatch("date\\s+-d.*(commit|pushed|comment|commented)_at.*")
)
}
}

View File

@@ -0,0 +1,114 @@
private import actions
private import codeql.actions.TaintTracking
private import codeql.actions.dataflow.ExternalFlow
private import codeql.actions.security.ArtifactPoisoningQuery
private import codeql.actions.security.UntrustedCheckoutQuery
abstract class EnvPathInjectionSink extends DataFlow::Node { }
/**
* Holds if a Run step declares a PATH environment variable with contents from a local file.
*/
class EnvPathInjectionFromFileReadSink extends EnvPathInjectionSink {
EnvPathInjectionFromFileReadSink() {
exists(Run run, Step step |
(
step instanceof UntrustedArtifactDownloadStep or
step instanceof PRHeadCheckoutStep
) and
this.asExpr() = run.getScript() and
step.getAFollowingStep() = run and
(
// echo "$(cat foo.txt)" >> $GITHUB_PATH
// FOO=$(cat foo.txt)
// echo "$FOO" >> $GITHUB_PATH
exists(string cmd |
run.getScript().getAFileReadCommand() = cmd and
run.getScript().getACmdReachingGitHubPathWrite(cmd)
)
or
// cat foo.txt >> $GITHUB_PATH
run.getScript().fileToGitHubPath(_)
)
)
}
}
/**
* Holds if a Run step executes a command that returns untrusted data which flows to GITHUB_ENV
* e.g.
* run: |
* COMMIT_MESSAGE=$(git log --format=%s)
* echo "${COMMIT_MESSAGE}" >> $GITHUB_PATH
*/
class EnvPathInjectionFromCommandSink extends EnvPathInjectionSink {
EnvPathInjectionFromCommandSink() {
exists(CommandSource source |
this.asExpr() = source.getEnclosingRun().getScript() and
source.getEnclosingRun().getScript().getACmdReachingGitHubPathWrite(source.getCommand())
)
}
}
/**
* Holds if a Run step declares an environment variable, uses it to declare a PATH env var.
* e.g.
* env:
* BODY: ${{ github.event.comment.body }}
* run: |
* echo "$BODY" >> $GITHUB_PATH
*/
class EnvPathInjectionFromEnvVarSink extends EnvPathInjectionSink {
EnvPathInjectionFromEnvVarSink() {
exists(Run run, string var_name |
run.getScript().getAnEnvReachingGitHubPathWrite(var_name) and
exists(run.getInScopeEnvVarExpr(var_name)) and
run.getScript() = this.asExpr()
)
}
}
class EnvPathInjectionFromMaDSink extends EnvPathInjectionSink {
EnvPathInjectionFromMaDSink() { madSink(this, "envpath-injection") }
}
/**
* A taint-tracking configuration for unsafe user input
* that is used to construct and evaluate an environment variable.
*/
private module EnvPathInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof EnvPathInjectionSink }
predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {
exists(Run run, string var |
run.getInScopeEnvVarExpr(var) = pred.asExpr() and
succ.asExpr() = run.getScript() and
(
run.getScript().getAnEnvReachingGitHubEnvWrite(var, _)
or
run.getScript().getAnEnvReachingGitHubOutputWrite(var, _)
or
run.getScript().getAnEnvReachingGitHubPathWrite(var)
)
)
or
exists(Uses step |
pred instanceof FileSource and
pred.asExpr().(Step).getAFollowingStep() = step and
succ.asExpr() = step and
madSink(succ, "envpath-injection")
)
or
exists(Run run |
pred instanceof FileSource and
pred.asExpr().(Step).getAFollowingStep() = run and
succ.asExpr() = run.getScript() and
exists(run.getScript().getAFileReadCommand())
)
}
}
/** Tracks flow of unsafe user input that is used to construct and evaluate the PATH environment variable. */
module EnvPathInjectionFlow = TaintTracking::Global<EnvPathInjectionConfig>;

View File

@@ -0,0 +1,169 @@
private import actions
private import codeql.actions.TaintTracking
private import codeql.actions.dataflow.ExternalFlow
private import codeql.actions.security.ArtifactPoisoningQuery
private import codeql.actions.security.UntrustedCheckoutQuery
abstract class EnvVarInjectionSink extends DataFlow::Node { }
string sanitizerCommand() {
result =
[
"tr\\s+(-d\\s*)?('|\")?.n('|\")?", // tr -d '\n' ' ', tr '\n' ' '
"tr\\s+-cd\\s+.*:al(pha|num):", // tr -cd '[:alpha:_]'
"(head|tail)\\s+-n\\s+1" // head -n 1, tail -n 1
]
}
/**
* Holds if a Run step declares an environment variable with contents from a local file.
*/
class EnvVarInjectionFromFileReadSink extends EnvVarInjectionSink {
EnvVarInjectionFromFileReadSink() {
exists(Run run, Step step |
(
step instanceof UntrustedArtifactDownloadStep or
step instanceof PRHeadCheckoutStep
) and
this.asExpr() = run.getScript() and
step.getAFollowingStep() = run and
(
// eg:
// echo "SHA=$(cat test-results/sha-number)" >> $GITHUB_ENV
// echo "SHA=$(<test-results/sha-number)" >> $GITHUB_ENV
// FOO=$(cat test-results/sha-number)
// echo "FOO=$FOO" >> $GITHUB_ENV
exists(string cmd, string var, string sanitizer |
run.getScript().getAFileReadCommand() = cmd and
run.getScript().getACmdReachingGitHubEnvWrite(cmd, var) and
run.getScript().getACmdReachingGitHubEnvWrite(sanitizer, var) and
not exists(sanitizer.regexpFind(sanitizerCommand(), _, _))
)
or
// eg: cat test-results/.env >> $GITHUB_ENV
run.getScript().fileToGitHubEnv(_)
)
)
}
}
/**
* Holds if a Run step executes a command that returns untrusted data which flows to GITHUB_ENV
* e.g.
* run: |
* COMMIT_MESSAGE=$(git log --format=%s)
* echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV
*/
class EnvVarInjectionFromCommandSink extends EnvVarInjectionSink {
CommandSource inCommand;
string injectedVar;
string command;
EnvVarInjectionFromCommandSink() {
exists(Run run |
this.asExpr() = inCommand.getEnclosingRun().getScript() and
run = inCommand.getEnclosingRun() and
run.getScript().getACmdReachingGitHubEnvWrite(inCommand.getCommand(), injectedVar) and
(
// the source flows to the injected variable without any command in between
not run.getScript().getACmdReachingGitHubEnvWrite(_, injectedVar) and
command = ""
or
// the source flows to the injected variable with a command in between
run.getScript().getACmdReachingGitHubEnvWrite(command, injectedVar) and
not command.regexpMatch(".*" + sanitizerCommand() + ".*")
)
)
}
}
/**
* Holds if a Run step declares an environment variable, uses it to declare env var.
* e.g.
* env:
* BODY: ${{ github.event.comment.body }}
* run: |
* echo "FOO=$BODY" >> $GITHUB_ENV
*/
class EnvVarInjectionFromEnvVarSink extends EnvVarInjectionSink {
string inVar;
string injectedVar;
string command;
EnvVarInjectionFromEnvVarSink() {
exists(Run run |
run.getScript() = this.asExpr() and
exists(run.getInScopeEnvVarExpr(inVar)) and
run.getScript().getAnEnvReachingGitHubEnvWrite(inVar, injectedVar) and
(
// the source flows to the injected variable without any command in between
not run.getScript().getACmdReachingGitHubEnvWrite(_, injectedVar) and
command = ""
or
// the source flows to the injected variable with a command in between
run.getScript().getACmdReachingGitHubEnvWrite(_, injectedVar) and
run.getScript().getACmdReachingGitHubEnvWrite(command, injectedVar) and
not command.regexpMatch(".*" + sanitizerCommand() + ".*")
)
)
}
}
/**
* Holds if a 3rd party action declares an environment variable with contents from an untrusted file.
* e.g.
*- name: Load .env file
* uses: aarcangeli/load-dotenv@v1.0.0
* with:
* path: 'backend/new'
* filenames: |
* .env
* .env.test
* quiet: false
* if-file-not-found: error
*/
class EnvVarInjectionFromMaDSink extends EnvVarInjectionSink {
EnvVarInjectionFromMaDSink() { madSink(this, "envvar-injection") }
}
/**
* A taint-tracking configuration for unsafe user input
* that is used to construct and evaluate an environment variable.
*/
private module EnvVarInjectionConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
source instanceof RemoteFlowSource and
not source.(RemoteFlowSource).getSourceType() = ["branch", "username"]
}
predicate isSink(DataFlow::Node sink) { sink instanceof EnvVarInjectionSink }
predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {
exists(Run run, string var |
run.getInScopeEnvVarExpr(var) = pred.asExpr() and
succ.asExpr() = run.getScript() and
(
run.getScript().getAnEnvReachingGitHubEnvWrite(var, _)
or
run.getScript().getAnEnvReachingGitHubOutputWrite(var, _)
)
)
or
exists(Uses step |
pred instanceof FileSource and
pred.asExpr().(Step).getAFollowingStep() = step and
succ.asExpr() = step and
madSink(succ, "envvar-injection")
)
or
exists(Run run |
pred instanceof FileSource and
pred.asExpr().(Step).getAFollowingStep() = run and
succ.asExpr() = run.getScript() and
exists(run.getScript().getAFileReadCommand())
)
}
}
/** Tracks flow of unsafe user input that is used to construct and evaluate an environment variable. */
module EnvVarInjectionFlow = TaintTracking::Global<EnvVarInjectionConfig>;

View File

@@ -0,0 +1,220 @@
private import actions
private import codeql.actions.TaintTracking
private import codeql.actions.dataflow.ExternalFlow
private import codeql.actions.security.ArtifactPoisoningQuery
private import codeql.actions.security.UntrustedCheckoutQuery
abstract class OutputClobberingSink extends DataFlow::Node { }
/**
* Holds if a Run step declares a step output variable with contents from a local file.
* e.g.
* run: |
* cat test-results/.vars >> $GITHUB_OUTPUT
* echo "sha=$(cat test-results/sha-number)" >> $GITHUB_OUTPUT
* echo "sha=$(<test-results/sha-number)" >> $GITHUB_OUTPUT
*/
class OutputClobberingFromFileReadSink extends OutputClobberingSink {
OutputClobberingFromFileReadSink() {
exists(Run run, Step step, string field1, string field2 |
(
step instanceof UntrustedArtifactDownloadStep
or
step instanceof SimplePRHeadCheckoutStep
) and
step.getAFollowingStep() = run and
this.asExpr() = run.getScript() and
// A write to GITHUB_OUTPUT that is not attacker-controlled
exists(string str |
// The output of a command that is not a file read command
run.getScript().getACmdReachingGitHubOutputWrite(str, field1) and
not str = run.getScript().getAFileReadCommand()
or
// A hard-coded string
run.getScript().getAWriteToGitHubOutput(field1, str) and
str.regexpMatch("[\"'0-9a-zA-Z_\\-]+")
) and
// A write to GITHUB_OUTPUT that is attacker-controlled
(
// echo "sha=$(<test-results/sha-number)" >> $GITHUB_OUTPUT
exists(string cmd |
run.getScript().getACmdReachingGitHubOutputWrite(cmd, field2) and
run.getScript().getAFileReadCommand() = cmd
)
or
// cat test-results/.vars >> $GITHUB_OUTPUT
run.getScript().fileToGitHubOutput(_) and
field2 = "UNKNOWN"
)
)
}
}
/**
* Holds if a Run step declares an environment variable, uses it in a step variable output.
* e.g.
* env:
* BODY: ${{ github.event.comment.body }}
* run: |
* echo "FOO=$BODY" >> $GITHUB_OUTPUT
*/
class OutputClobberingFromEnvVarSink extends OutputClobberingSink {
OutputClobberingFromEnvVarSink() {
exists(Run run, string field1, string field2 |
// A write to GITHUB_OUTPUT that is attacker-controlled
exists(string var |
run.getScript().getAnEnvReachingGitHubOutputWrite(var, field1) and
exists(run.getInScopeEnvVarExpr(var)) and
run.getScript() = this.asExpr()
) and
// A write to GITHUB_OUTPUT that is not attacker-controlled
exists(string str |
// The output of a command that is not a file read command
run.getScript().getACmdReachingGitHubOutputWrite(str, field2) and
not str = run.getScript().getAFileReadCommand()
or
// A hard-coded string
run.getScript().getAWriteToGitHubOutput(field2, str) and
str.regexpMatch("[\"'0-9a-zA-Z_\\-]+")
) and
not field2 = field1
)
}
}
/**
* - id: clob1
* env:
* BODY: ${{ github.event.comment.body }}
* run: |
* # VULNERABLE
* echo $BODY
* echo "::set-output name=OUTPUT::SAFE"
* - id: clob2
* env:
* BODY: ${{ github.event.comment.body }}
* run: |
* # VULNERABLE
* echo "::set-output name=OUTPUT::SAFE"
* echo $BODY
*/
class WorkflowCommandClobberingFromEnvVarSink extends OutputClobberingSink {
string clobbering_var;
string clobbered_value;
WorkflowCommandClobberingFromEnvVarSink() {
exists(Run run, string workflow_cmd_stmt, string clobbering_stmt |
run.getScript() = this.asExpr() and
run.getScript().getAStmt() = clobbering_stmt and
clobbering_stmt.regexpMatch("echo\\s+(-e\\s+)?(\"|')?\\$(\\{)?" + clobbering_var + ".*") and
exists(run.getInScopeEnvVarExpr(clobbering_var)) and
run.getScript().getAStmt() = workflow_cmd_stmt and
clobbered_value =
trimQuotes(workflow_cmd_stmt.regexpCapture(".*::set-output\\s+name=.*::(.*)", 1))
)
}
}
/**
* - id: clob1
* run: |
* # VULNERABLE
* PR="$(<pr-number)"
* echo "$PR"
* echo "::set-output name=OUTPUT::SAFE"
* - id: clob2
* run: |
* # VULNERABLE
* cat pr-number
* echo "::set-output name=OUTPUT::SAFE"
* - id: clob3
* run: |
* # VULNERABLE
* echo "::set-output name=OUTPUT::SAFE"
* ls *.txt
* - id: clob4
* run: |
* # VULNERABLE
* CURRENT_VERSION=$(cat gradle.properties | sed -n '/^version=/ { s/^version=//;p }')
* echo "$CURRENT_VERSION"
* echo "::set-output name=OUTPUT::SAFE"
*/
class WorkflowCommandClobberingFromFileReadSink extends OutputClobberingSink {
string clobbering_cmd;
WorkflowCommandClobberingFromFileReadSink() {
exists(Run run, string clobbering_stmt |
run.getScript() = this.asExpr() and
run.getScript().getAStmt() = clobbering_stmt and
(
// A file's content is assigned to an env var that gets printed to stdout
// - run: |
// foo=$(<pr-id.txt)"
// echo "${foo}"
exists(string var, string value |
run.getScript().getAnAssignment(var, value) and
clobbering_cmd = run.getScript().getAFileReadCommand() and
trimQuotes(value) = ["$(" + clobbering_cmd + ")", "`" + clobbering_cmd + "`"] and
clobbering_stmt.regexpMatch("echo.*\\$(\\{)?" + var + ".*")
)
or
// A file is read and its content is printed to stdout
clobbering_cmd = run.getScript().getACommand() and
clobbering_cmd.regexpMatch(["ls", Bash::fileReadCommand()] + "\\s.*") and
(
// - run: echo "foo=$(<pr-id.txt)"
clobbering_stmt.regexpMatch("echo.*" + clobbering_cmd + ".*")
or
// A file content is printed to stdout
// - run: cat pr-id.txt
clobbering_stmt.indexOf(clobbering_cmd) = 0
)
)
)
}
}
class OutputClobberingFromMaDSink extends OutputClobberingSink {
OutputClobberingFromMaDSink() { madSink(this, "output-clobbering") }
}
/**
* A taint-tracking configuration for unsafe user input
* that is used to construct and evaluate an environment variable.
*/
private module OutputClobberingConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
source instanceof RemoteFlowSource and
not source.(RemoteFlowSource).getSourceType() = "branch"
}
predicate isSink(DataFlow::Node sink) { sink instanceof OutputClobberingSink }
predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {
exists(Run run, string var |
run.getInScopeEnvVarExpr(var) = pred.asExpr() and
succ.asExpr() = run.getScript() and
run.getScript().getAWriteToGitHubOutput(_, _)
)
or
exists(Uses step |
pred instanceof FileSource and
pred.asExpr().(Step).getAFollowingStep() = step and
succ.asExpr() = step and
madSink(succ, "output-clobbering")
)
or
exists(Run run |
pred instanceof FileSource and
pred.asExpr().(Step).getAFollowingStep() = run and
succ.asExpr() = run.getScript() and
(
exists(run.getScript().getAFileReadCommand()) or
run.getScript().getAStmt().matches("%::set-output %")
)
)
}
}
/** Tracks flow of unsafe user input that is used to construct and evaluate an environment variable. */
module OutputClobberingFlow = TaintTracking::Global<OutputClobberingConfig>;

View File

@@ -0,0 +1,56 @@
import actions
abstract class PoisonableStep extends Step { }
class DangerousActionUsesStep extends PoisonableStep, UsesStep {
DangerousActionUsesStep() { poisonableActionsDataModel(this.getCallee()) }
}
class PoisonableCommandStep extends PoisonableStep, Run {
PoisonableCommandStep() {
exists(string regexp |
poisonableCommandsDataModel(regexp) and
this.getScript().getACommand().regexpMatch(regexp)
)
}
}
class JavascriptImportUsesStep extends PoisonableStep, UsesStep {
JavascriptImportUsesStep() {
exists(string script, string line |
this.getCallee() = "actions/github-script" and
script = this.getArgument("script") and
line = script.splitAt("\n").trim() and
// const { default: foo } = await import('${{ github.workspace }}/scripts/foo.mjs')
// const script = require('${{ github.workspace }}/scripts/test.js');
// const script = require('./scripts');
line.regexpMatch(".*(import|require)\\(('|\")(\\./|.*github.workspace).*")
)
}
}
class SetupNodeUsesStep extends PoisonableStep, UsesStep {
SetupNodeUsesStep() {
this.getCallee() = "actions/setup-node" and
this.getArgument("cache") = "yarn"
}
}
class LocalScriptExecutionRunStep extends PoisonableStep, Run {
string path;
LocalScriptExecutionRunStep() {
exists(string cmd, string regexp, int path_group | cmd = this.getScript().getACommand() |
poisonableLocalScriptsDataModel(regexp, path_group) and
path = cmd.regexpCapture(regexp, path_group)
)
}
string getPath() { result = normalizePath(path.splitAt(" ")) }
}
class LocalActionUsesStep extends PoisonableStep, UsesStep {
LocalActionUsesStep() { this.getCallee().matches("./%") }
string getPath() { result = normalizePath(this.getCallee()) }
}

View File

@@ -0,0 +1,22 @@
private import actions
private import codeql.actions.TaintTracking
private import codeql.actions.dataflow.ExternalFlow
import codeql.actions.dataflow.FlowSources
import codeql.actions.DataFlow
private class RequestForgerySink extends DataFlow::Node {
RequestForgerySink() { madSink(this, "request-forgery") }
}
/**
* A taint-tracking configuration for unsafe user input
* that is used to construct and evaluate a system command.
*/
private module RequestForgeryConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof RequestForgerySink }
}
/** Tracks flow of unsafe user input that is used to construct and evaluate a system command. */
module RequestForgeryFlow = TaintTracking::Global<RequestForgeryConfig>;

View File

@@ -0,0 +1,21 @@
private import actions
private import codeql.actions.TaintTracking
private import codeql.actions.dataflow.ExternalFlow
import codeql.actions.dataflow.FlowSources
import codeql.actions.DataFlow
private class SecretExfiltrationSink extends DataFlow::Node {
SecretExfiltrationSink() { madSink(this, "secret-exfiltration") }
}
/**
* A taint-tracking configuration for untrusted data that reaches a sink where it may lead to secret exfiltration
*/
private module SecretExfiltrationConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
predicate isSink(DataFlow::Node sink) { sink instanceof SecretExfiltrationSink }
}
/** Tracks flow of unsafe user input that is used in a context where it may lead to a secret exfiltration. */
module SecretExfiltrationFlow = TaintTracking::Global<SecretExfiltrationConfig>;

View File

@@ -0,0 +1,45 @@
import actions
bindingset[runner]
predicate isGithubHostedRunner(string runner) {
// list of github hosted repos: https://github.com/actions/runner-images/blob/main/README.md#available-images
runner
.toLowerCase()
.regexpMatch("^(ubuntu-([0-9.]+|latest)|macos-([0-9]+|latest)(-x?large)?|windows-([0-9.]+|latest))$")
}
bindingset[runner]
predicate is3rdPartyHostedRunner(string runner) {
runner.toLowerCase().regexpMatch("^(buildjet|warp)-[a-z0-9-]+$")
}
/**
* This predicate uses data available in the workflow file to identify self-hosted runners.
* It does not know if the repository is public or private.
* It is a best-effort approach to identify self-hosted runners.
*/
predicate staticallyIdentifiedSelfHostedRunner(Job job) {
exists(string label |
job.getATriggerEvent().getName() =
[
"issue_comment", "pull_request", "pull_request_review", "pull_request_review_comment",
"pull_request_target", "workflow_run"
] and
label = job.getARunsOnLabel() and
not isGithubHostedRunner(label) and
not is3rdPartyHostedRunner(label)
)
}
/**
* This predicate uses data available in the job log files to identify self-hosted runners.
* It is a best-effort approach to identify self-hosted runners.
*/
predicate dynamicallyIdentifiedSelfHostedRunner(Job job) {
exists(string runner_info |
repositoryDataModel("public", _) and
workflowDataModel(job.getEnclosingWorkflow().getLocation().getFile().getRelativePath(), _,
job.getId(), _, _, runner_info) and
runner_info.indexOf("self-hosted:true") > 0
)
}

View File

@@ -0,0 +1,384 @@
import actions
private import codeql.actions.DataFlow
private import codeql.actions.dataflow.FlowSources
private import codeql.actions.TaintTracking
string checkoutTriggers() {
result = ["pull_request_target", "workflow_run", "workflow_call", "issue_comment"]
}
/**
* A taint-tracking configuration for PR HEAD references flowing
* into actions/checkout's ref argument.
*/
private module ActionsMutableRefCheckoutConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
(
// remote flow sources
source instanceof GitHubCtxSource
or
source instanceof GitHubEventCtxSource
or
source instanceof GitHubEventJsonSource
or
source instanceof MaDSource
or
// `ref` argument contains the PR id/number or head ref
exists(Expression e |
source.asExpr() = e and
(
containsHeadRef(e.getExpression()) or
containsPullRequestNumber(e.getExpression())
)
)
or
// 3rd party actions returning the PR head ref
exists(StepsExpression e, UsesStep step |
source.asExpr() = e and
e.getStepId() = step.getId() and
(
step.getCallee() = "eficode/resolve-pr-refs" and e.getFieldName() = "head_ref"
or
step.getCallee() = "xt0rted/pull-request-comment-branch" and e.getFieldName() = "head_ref"
or
step.getCallee() = "alessbell/pull-request-comment-branch" and
e.getFieldName() = "head_ref"
or
step.getCallee() = "gotson/pull-request-comment-branch" and e.getFieldName() = "head_ref"
or
step.getCallee() = "potiuk/get-workflow-origin" and
e.getFieldName() = ["sourceHeadBranch", "pullRequestNumber"]
or
step.getCallee() = "github/branch-deploy" and e.getFieldName() = ["ref", "fork_ref"]
)
)
)
}
predicate isSink(DataFlow::Node sink) {
exists(Uses uses |
uses.getCallee() = "actions/checkout" and
uses.getArgumentExpr(["ref", "repository"]) = sink.asExpr()
)
}
predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {
exists(Run run |
pred instanceof FileSource and
pred.asExpr().(Step).getAFollowingStep() = run and
succ.asExpr() = run.getScript() and
exists(run.getScript().getAFileReadCommand())
)
}
}
module ActionsMutableRefCheckoutFlow = TaintTracking::Global<ActionsMutableRefCheckoutConfig>;
private module ActionsSHACheckoutConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
source.asExpr().getATriggerEvent().getName() =
["pull_request_target", "workflow_run", "workflow_call", "issue_comment"] and
(
// `ref` argument contains the PR head/merge commit sha
exists(Expression e |
source.asExpr() = e and
containsHeadSHA(e.getExpression())
)
or
// 3rd party actions returning the PR head sha
exists(StepsExpression e, UsesStep step |
source.asExpr() = e and
e.getStepId() = step.getId() and
(
step.getCallee() = "eficode/resolve-pr-refs" and e.getFieldName() = "head_sha"
or
step.getCallee() = "xt0rted/pull-request-comment-branch" and e.getFieldName() = "head_sha"
or
step.getCallee() = "alessbell/pull-request-comment-branch" and
e.getFieldName() = "head_sha"
or
step.getCallee() = "gotson/pull-request-comment-branch" and e.getFieldName() = "head_sha"
or
step.getCallee() = "potiuk/get-workflow-origin" and
e.getFieldName() = ["sourceHeadSha", "mergeCommitSha"]
)
)
)
}
predicate isSink(DataFlow::Node sink) {
exists(Uses uses |
uses.getCallee() = "actions/checkout" and
uses.getArgumentExpr(["ref", "repository"]) = sink.asExpr()
)
}
predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {
exists(Run run |
pred instanceof FileSource and
pred.asExpr().(Step).getAFollowingStep() = run and
succ.asExpr() = run.getScript() and
exists(run.getScript().getAFileReadCommand())
)
}
}
module ActionsSHACheckoutFlow = TaintTracking::Global<ActionsSHACheckoutConfig>;
bindingset[s]
predicate containsPullRequestNumber(string s) {
exists(
normalizeExpr(s)
.regexpFind([
"\\bgithub\\.event\\.number\\b", "\\bgithub\\.event\\.issue\\.number\\b",
"\\bgithub\\.event\\.pull_request\\.id\\b",
"\\bgithub\\.event\\.pull_request\\.number\\b",
"\\bgithub\\.event\\.check_suite\\.pull_requests\\[\\d+\\]\\.id\\b",
"\\bgithub\\.event\\.check_suite\\.pull_requests\\[\\d+\\]\\.number\\b",
"\\bgithub\\.event\\.check_run\\.check_suite\\.pull_requests\\[\\d+\\]\\.id\\b",
"\\bgithub\\.event\\.check_run\\.check_suite\\.pull_requests\\[\\d+\\]\\.number\\b",
"\\bgithub\\.event\\.check_run\\.pull_requests\\[\\d+\\]\\.id\\b",
"\\bgithub\\.event\\.check_run\\.pull_requests\\[\\d+\\]\\.number\\b",
// heuristics
"\\bpr_number\\b", "\\bpr_id\\b"
], _, _)
)
}
bindingset[s]
predicate containsHeadSHA(string s) {
exists(
normalizeExpr(s)
.regexpFind([
"\\bgithub\\.event\\.pull_request\\.head\\.sha\\b",
"\\bgithub\\.event\\.pull_request\\.merge_commit_sha\\b",
"\\bgithub\\.event\\.workflow_run\\.head_commit\\.id\\b",
"\\bgithub\\.event\\.workflow_run\\.head_sha\\b",
"\\bgithub\\.event\\.check_suite\\.after\\b",
"\\bgithub\\.event\\.check_suite\\.head_commit\\.id\\b",
"\\bgithub\\.event\\.check_suite\\.head_sha\\b",
"\\bgithub\\.event\\.check_suite\\.pull_requests\\[\\d+\\]\\.head\\.sha\\b",
"\\bgithub\\.event\\.check_run\\.check_suite\\.after\\b",
"\\bgithub\\.event\\.check_run\\.check_suite\\.head_commit\\.id\\b",
"\\bgithub\\.event\\.check_run\\.check_suite\\.head_sha\\b",
"\\bgithub\\.event\\.check_run\\.check_suite\\.pull_requests\\[\\d+\\]\\.head\\.sha\\b",
"\\bgithub\\.event\\.check_run\\.head_sha\\b",
"\\bgithub\\.event\\.check_run\\.pull_requests\\[\\d+\\]\\.head\\.sha\\b",
"\\bgithub\\.event\\.merge_group\\.head_sha\\b",
"\\bgithub\\.event\\.merge_group\\.head_commit\\.id\\b",
// heuristics
"\\bhead\\.sha\\b", "\\bhead_sha\\b", "\\bmerge_sha\\b", "\\bpr_head_sha\\b"
], _, _)
)
}
bindingset[s]
predicate containsHeadRef(string s) {
exists(
normalizeExpr(s)
.regexpFind([
"\\bgithub\\.event\\.pull_request\\.head\\.ref\\b", "\\bgithub\\.head_ref\\b",
"\\bgithub\\.event\\.workflow_run\\.head_branch\\b",
"\\bgithub\\.event\\.check_suite\\.pull_requests\\[\\d+\\]\\.head\\.ref\\b",
"\\bgithub\\.event\\.check_run\\.check_suite\\.pull_requests\\[\\d+\\]\\.head\\.ref\\b",
"\\bgithub\\.event\\.check_run\\.pull_requests\\[\\d+\\]\\.head\\.ref\\b",
"\\bgithub\\.event\\.merge_group\\.head_ref\\b",
// heuristics
"\\bhead\\.ref\\b", "\\bhead_ref\\b", "\\bmerge_ref\\b", "\\bpr_head_ref\\b",
// env vars
"GITHUB_HEAD_REF",
], _, _)
)
}
class SimplePRHeadCheckoutStep extends Step {
SimplePRHeadCheckoutStep() {
// This should be:
// artifact instanceof PRHeadCheckoutStep
// but PRHeadCheckoutStep uses Taint Tracking anc causes a non-Monolitic Recursion error
// so we list all the subclasses of PRHeadCheckoutStep here and use actions/checkout as a workaround
// instead of using ActionsMutableRefCheckout and ActionsSHACheckout
exists(Uses uses |
this = uses and
uses.getCallee() = "actions/checkout" and
exists(uses.getArgument("ref")) and
not uses.getArgument("ref").matches("%base%") and
uses.getATriggerEvent().getName() = checkoutTriggers()
)
or
this instanceof GitMutableRefCheckout
or
this instanceof GitSHACheckout
or
this instanceof GhMutableRefCheckout
or
this instanceof GhSHACheckout
}
}
/** Checkout of a Pull Request HEAD */
abstract class PRHeadCheckoutStep extends Step {
abstract string getPath();
}
/** Checkout of a Pull Request HEAD ref */
abstract class MutableRefCheckoutStep extends PRHeadCheckoutStep { }
/** Checkout of a Pull Request HEAD ref */
abstract class SHACheckoutStep extends PRHeadCheckoutStep { }
/** Checkout of a Pull Request HEAD ref using actions/checkout action */
class ActionsMutableRefCheckout extends MutableRefCheckoutStep instanceof UsesStep {
ActionsMutableRefCheckout() {
this.getCallee() = "actions/checkout" and
(
exists(
ActionsMutableRefCheckoutFlow::PathNode source, ActionsMutableRefCheckoutFlow::PathNode sink
|
ActionsMutableRefCheckoutFlow::flowPath(source, sink) and
this.getArgumentExpr(["ref", "repository"]) = sink.getNode().asExpr()
)
or
// heuristic base on the step id and field name
exists(string value, Expression expr |
value.regexpMatch(".*(head|branch|ref).*") and expr = this.getArgumentExpr("ref")
|
expr.(StepsExpression).getStepId() = value
or
expr.(SimpleReferenceExpression).getFieldName() = value and
not expr instanceof GitHubExpression
or
expr.(NeedsExpression).getNeededJobId() = value
or
expr.(JsonReferenceExpression).getAccessPath() = value
or
expr.(JsonReferenceExpression).getInnerExpression() = value
)
)
}
override string getPath() {
if exists(this.(UsesStep).getArgument("path"))
then result = this.(UsesStep).getArgument("path")
else result = "GITHUB_WORKSPACE/"
}
}
/** Checkout of a Pull Request HEAD ref using actions/checkout action */
class ActionsSHACheckout extends SHACheckoutStep instanceof UsesStep {
ActionsSHACheckout() {
this.getCallee() = "actions/checkout" and
(
exists(ActionsSHACheckoutFlow::PathNode source, ActionsSHACheckoutFlow::PathNode sink |
ActionsSHACheckoutFlow::flowPath(source, sink) and
this.getArgumentExpr(["ref", "repository"]) = sink.getNode().asExpr()
)
or
// heuristic base on the step id and field name
exists(string value, Expression expr |
value.regexpMatch(".*(head|sha|commit).*") and expr = this.getArgumentExpr("ref")
|
expr.(StepsExpression).getStepId() = value
or
expr.(SimpleReferenceExpression).getFieldName() = value and
not expr instanceof GitHubExpression
or
expr.(NeedsExpression).getNeededJobId() = value
or
expr.(JsonReferenceExpression).getAccessPath() = value
or
expr.(JsonReferenceExpression).getInnerExpression() = value
)
)
}
override string getPath() {
if exists(this.(UsesStep).getArgument("path"))
then result = this.(UsesStep).getArgument("path")
else result = "GITHUB_WORKSPACE/"
}
}
/** Checkout of a Pull Request HEAD ref using git within a Run step */
class GitMutableRefCheckout extends MutableRefCheckoutStep instanceof Run {
GitMutableRefCheckout() {
exists(string cmd | this.getScript().getACommand() = cmd |
cmd.regexpMatch("git\\s+(fetch|pull).*") and
(
(containsHeadRef(cmd) or containsPullRequestNumber(cmd))
or
exists(string varname, string expr |
expr = this.getInScopeEnvVarExpr(varname).getExpression() and
(
containsHeadRef(expr) or
containsPullRequestNumber(expr)
) and
exists(cmd.regexpFind(varname, _, _))
)
)
)
}
override string getPath() { result = this.(Run).getWorkingDirectory() }
}
/** Checkout of a Pull Request HEAD ref using git within a Run step */
class GitSHACheckout extends SHACheckoutStep instanceof Run {
GitSHACheckout() {
exists(string cmd | this.getScript().getACommand() = cmd |
cmd.regexpMatch("git\\s+(fetch|pull).*") and
(
containsHeadSHA(cmd)
or
exists(string varname, string expr |
expr = this.getInScopeEnvVarExpr(varname).getExpression() and
containsHeadSHA(expr) and
exists(cmd.regexpFind(varname, _, _))
)
)
)
}
override string getPath() { result = this.(Run).getWorkingDirectory() }
}
/** Checkout of a Pull Request HEAD ref using gh within a Run step */
class GhMutableRefCheckout extends MutableRefCheckoutStep instanceof Run {
GhMutableRefCheckout() {
exists(string cmd | this.getScript().getACommand() = cmd |
cmd.regexpMatch(".*(gh|hub)\\s+pr\\s+checkout.*") and
(
(containsHeadRef(cmd) or containsPullRequestNumber(cmd))
or
exists(string varname |
(
containsHeadRef(this.getInScopeEnvVarExpr(varname).getExpression()) or
containsPullRequestNumber(this.getInScopeEnvVarExpr(varname).getExpression())
) and
exists(cmd.regexpFind(varname, _, _))
)
)
)
}
override string getPath() { result = this.(Run).getWorkingDirectory() }
}
/** Checkout of a Pull Request HEAD ref using gh within a Run step */
class GhSHACheckout extends SHACheckoutStep instanceof Run {
GhSHACheckout() {
exists(string cmd | this.getScript().getACommand() = cmd |
cmd.regexpMatch("gh\\s+pr\\s+checkout.*") and
(
containsHeadSHA(cmd)
or
exists(string varname |
containsHeadSHA(this.getInScopeEnvVarExpr(varname).getExpression()) and
exists(cmd.regexpFind(varname, _, _))
)
)
)
}
override string getPath() { result = this.(Run).getWorkingDirectory() }
}

View File

@@ -0,0 +1,22 @@
import actions
class KnownVulnerableAction extends UsesStep {
string vulnerable_action;
string fixed_version;
string vulnerable_version;
string vulnerable_sha;
KnownVulnerableAction() {
vulnerableActionsDataModel(vulnerable_action, vulnerable_version, vulnerable_sha, fixed_version) and
this.getCallee() = vulnerable_action and
(this.getVersion() = vulnerable_version or this.getVersion() = vulnerable_sha)
}
string getFixedVersion() { result = fixed_version }
string getVulnerableAction() { result = vulnerable_action }
string getVulnerableVersion() { result = vulnerable_version }
string getVulnerableSha() { result = vulnerable_sha }
}

View File

@@ -0,0 +1,28 @@
import actions
class UnversionedImmutableAction extends UsesStep {
string immutable_action;
UnversionedImmutableAction() {
isImmutableAction(this, immutable_action) and
not isSemVer(this.getVersion())
}
}
bindingset[version]
predicate isSemVer(string version) {
// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string with optional v prefix
version
.regexpMatch("^v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$") or
// or N or N.x or N.N.x with optional v prefix
version.regexpMatch("^v?[1-9]\\d*$") or
version.regexpMatch("^v?[1-9]\\d*\\.(x|0|([1-9]\\d*))$") or
version.regexpMatch("^v?[1-9]\\d*\\.(0|([1-9]\\d*))\\.(x|0|([1-9]\\d*))$") or
// or latest which will work
version = "latest"
}
predicate isImmutableAction(UsesStep actionStep, string actionName) {
immutableActionsDataModel(actionName) and
actionStep.getCallee() = actionName
}

View File

@@ -0,0 +1,177 @@
/** Provides classes for working with files and folders. */
private import codeql.Locations
/** A file or folder. */
abstract class Container extends @container {
/** Gets a file or sub-folder in this container. */
Container getAChildContainer() { this = result.getParentContainer() }
/** Gets a file in this container. */
File getAFile() { result = this.getAChildContainer() }
/** Gets a sub-folder in this container. */
Folder getAFolder() { result = this.getAChildContainer() }
/**
* Gets the absolute, canonical path of this container, using forward slashes
* as path separator.
*
* The path starts with a _root prefix_ followed by zero or more _path
* segments_ separated by forward slashes.
*
* The root prefix is of one of the following forms:
*
* 1. A single forward slash `/` (Unix-style)
* 2. An upper-case drive letter followed by a colon and a forward slash,
* such as `C:/` (Windows-style)
* 3. Two forward slashes, a computer name, and then another forward slash,
* such as `//FileServer/` (UNC-style)
*
* Path segments are never empty (that is, absolute paths never contain two
* contiguous slashes, except as part of a UNC-style root prefix). Also, path
* segments never contain forward slashes, and no path segment is of the
* form `.` (one dot) or `..` (two dots).
*
* Note that an absolute path never ends with a forward slash, except if it is
* a bare root prefix, that is, the path has no path segments. A container
* whose absolute path has no segments is always a `Folder`, not a `File`.
*/
abstract string getAbsolutePath();
/**
* Gets the base name of this container including extension, that is, the last
* segment of its absolute path, or the empty string if it has no segments.
*
* Here are some examples of absolute paths and the corresponding base names
* (surrounded with quotes to avoid ambiguity):
*
* <table border="1">
* <tr><th>Absolute path</th><th>Base name</th></tr>
* <tr><td>"/tmp/tst.go"</td><td>"tst.go"</td></tr>
* <tr><td>"C:/Program Files (x86)"</td><td>"Program Files (x86)"</td></tr>
* <tr><td>"/"</td><td>""</td></tr>
* <tr><td>"C:/"</td><td>""</td></tr>
* <tr><td>"D:/"</td><td>""</td></tr>
* <tr><td>"//FileServer/"</td><td>""</td></tr>
* </table>
*/
string getBaseName() {
result = this.getAbsolutePath().regexpCapture(".*/(([^/]*?)(?:\\.([^.]*))?)", 1)
}
/**
* Gets the extension of this container, that is, the suffix of its base name
* after the last dot character, if any.
*
* In particular,
*
* - if the name does not include a dot, there is no extension, so this
* predicate has no result;
* - if the name ends in a dot, the extension is the empty string;
* - if the name contains multiple dots, the extension follows the last dot.
*
* Here are some examples of absolute paths and the corresponding extensions
* (surrounded with quotes to avoid ambiguity):
*
* <table border="1">
* <tr><th>Absolute path</th><th>Extension</th></tr>
* <tr><td>"/tmp/tst.go"</td><td>"go"</td></tr>
* <tr><td>"/tmp/.classpath"</td><td>"classpath"</td></tr>
* <tr><td>"/bin/bash"</td><td>not defined</td></tr>
* <tr><td>"/tmp/tst2."</td><td>""</td></tr>
* <tr><td>"/tmp/x.tar.gz"</td><td>"gz"</td></tr>
* </table>
*/
string getExtension() {
result = this.getAbsolutePath().regexpCapture(".*/([^/]*?)(\\.([^.]*))?", 3)
}
/** Gets the file in this container that has the given `baseName`, if any. */
File getFile(string baseName) {
result = this.getAFile() and
result.getBaseName() = baseName
}
/** Gets the sub-folder in this container that has the given `baseName`, if any. */
Folder getFolder(string baseName) {
result = this.getAFolder() and
result.getBaseName() = baseName
}
/** Gets the parent container of this file or folder, if any. */
Container getParentContainer() { containerparent(result, this) }
/**
* Gets the relative path of this file or folder from the root folder of the
* analyzed source location. The relative path of the root folder itself is
* the empty string.
*
* This has no result if the container is outside the source root, that is,
* if the root folder is not a reflexive, transitive parent of this container.
*/
string getRelativePath() {
exists(string absPath, string pref |
absPath = this.getAbsolutePath() and sourceLocationPrefix(pref)
|
absPath = pref and result = ""
or
absPath = pref.regexpReplaceAll("/$", "") + "/" + result and
not result.matches("/%")
)
}
/**
* Gets the stem of this container, that is, the prefix of its base name up to
* (but not including) the last dot character if there is one, or the entire
* base name if there is not.
*
* Here are some examples of absolute paths and the corresponding stems
* (surrounded with quotes to avoid ambiguity):
*
* <table border="1">
* <tr><th>Absolute path</th><th>Stem</th></tr>
* <tr><td>"/tmp/tst.go"</td><td>"tst"</td></tr>
* <tr><td>"/tmp/.classpath"</td><td>""</td></tr>
* <tr><td>"/bin/bash"</td><td>"bash"</td></tr>
* <tr><td>"/tmp/tst2."</td><td>"tst2"</td></tr>
* <tr><td>"/tmp/x.tar.gz"</td><td>"x.tar"</td></tr>
* </table>
*/
string getStem() {
result = this.getAbsolutePath().regexpCapture(".*/([^/]*?)(?:\\.([^.]*))?", 1)
}
/**
* Gets a URL representing the location of this container.
*
* For more information see https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/#providing-urls.
*/
abstract string getURL();
/**
* Gets a textual representation of the path of this container.
*
* This is the absolute path of the container.
*/
string toString() { result = this.getAbsolutePath() }
}
/** A folder. */
class Folder extends Container, @folder {
override string getAbsolutePath() { folders(this, result) }
/** Gets the URL of this folder. */
override string getURL() { result = "folder://" + this.getAbsolutePath() }
}
/** A file. */
class File extends Container, @file {
override string getAbsolutePath() { files(this, result) }
/** Gets the URL of this file. */
override string getURL() { result = "file://" + this.getAbsolutePath() + ":0:0:0:0" }
/** Holds if this file was extracted from ordinary source code. */
predicate fromSource() { any() }
}

View File

@@ -0,0 +1,15 @@
extensions:
- addsTo:
pack: codeql/actions-all
extensible: argumentInjectionSinksDataModel
# https://gtfobins.github.io/
# https://0xn3va.gitbook.io/cheat-sheets/web-application/command-injection/argument-injection
data:
- ["(awk)\\s(.*?)", 1, 2]
- ["(find)\\s(.*?)", 1, 2]
- ["(git clone)\\s(.*?)", 1, 2]
- ["(sed)\\s(.*?)", 1, 2]
- ["(tar)\\s(.*?)", 1, 2]
- ["(wget)\\s(.*?)", 1, 2]
- ["(zip)\\s(.*?)", 1, 2]

View File

@@ -0,0 +1,53 @@
extensions:
- addsTo:
pack: codeql/actions-all
extensible: contextTriggerDataModel
data:
- ["commit_comment", "github.event.comment"]
- ["commit_comment", "github.event.changes"]
- ["discussion", "github.event.discussion"]
- ["discussion", "github.event.changes"]
- ["discussion_comment", "github.event.comment"]
- ["discussion_comment", "github.event.discussion"]
- ["discussion_comment", "github.event.changes"]
- ["issues", "github.event.issue"]
- ["issues", "github.event.changes"]
- ["issue_comment", "github.event.issue"]
- ["issue_comment", "github.event.comment"]
- ["issue_comment", "github.event.changes"]
- ["gollum", "github.event.pages"]
- ["gollum", "github.event.changes"]
- ["pull_request_comment", "github.event.comment"]
- ["pull_request_comment", "github.event.pull_request"]
- ["pull_request_comment", "github.head_ref"]
- ["pull_request_comment", "github.event.changes"]
- ["pull_request_review", "github.event.pull_request"]
- ["pull_request_review", "github.event.review"]
- ["pull_request_review", "github.head_ref"]
- ["pull_request_review", "github.event.changes"]
- ["pull_request_review_comment", "github.event.comment"]
- ["pull_request_review_comment", "github.event.pull_request"]
- ["pull_request_review_comment", "github.event.review"]
- ["pull_request_review_comment", "github.head_ref"]
- ["pull_request_review_comment", "github.event.changes"]
- ["pull_request_target", "github.event.pull_request"]
- ["pull_request_target", "github.head_ref"]
- ["pull_request_target", "github.event.changes"]
- ["push", "github.event.commits"]
- ["push", "github.event.head_commit"]
- ["push", "github.event.changes"]
- ["workflow_run", "github.event.workflow"]
- ["workflow_run", "github.event.workflow_run"]
- ["workflow_run", "github.event.changes"]
# workflow_call receives the same event payload as the calling workflow
- ["workflow_call", "github.event.comment"]
- ["workflow_call", "github.event.discussion"]
- ["workflow_call", "github.event.inputs"]
- ["workflow_call", "github.event.issue"]
- ["workflow_call", "github.event.pages"]
- ["workflow_call", "github.event.pull_request"]
- ["workflow_call", "github.event.review"]
- ["workflow_call", "github.event.workflow"]
- ["workflow_call", "github.event.workflow_run"]
- ["workflow_call", "github.event.changes"]

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