Compare commits

..

928 Commits

Author SHA1 Message Date
Angela P Wen
569b650916 Merge pull request #17649 from github/release-prep/2.19.1
Release preparation for version 2.19.1
2024-10-02 11:36:20 -07:00
github-actions[bot]
fe54961b84 Release preparation for version 2.19.1 2024-10-02 18:30:42 +00:00
Angela P Wen
b16ba61fcb Merge pull request #17636 from github/revert-17629-release-prep/2.19.1
Revert "Release preparation for version 2.19.1"
2024-10-02 11:27:40 -07:00
Angela P Wen
e8dd6a88e7 Revert "Release preparation for version 2.19.1" 2024-10-01 10:19:28 -07:00
Angela P Wen
7dcdd7429f Merge pull request #17629 from github/release-prep/2.19.1
Release preparation for version 2.19.1
2024-09-30 11:04:41 -07:00
github-actions[bot]
455c8c5953 Release preparation for version 2.19.1 2024-09-30 17:59:48 +00:00
Tom Hvitved
70b4ecf0a5 Merge pull request #17624 from github/aibaars/rust-comments
Rust: extract comments
2024-09-30 16:58:25 +02:00
Tom Hvitved
938e962d79 Merge remote-tracking branch 'upstream/main' into aibaars/rust-comments 2024-09-30 16:42:22 +02:00
Anders Schack-Mulligen
d0831ebd5a Merge pull request #17625 from aschackmull/java/collection-neutrals
Java: Minor model tweak and comment fix.
2024-09-30 16:29:54 +02:00
Tom Hvitved
52894f5b6a Merge pull request #17627 from hvitved/rust/accept-cfg-inconsistencies 2024-09-30 16:00:58 +02:00
Anders Schack-Mulligen
222ae6ad2d Java: Add a neutral for Comparable.compareTo 2024-09-30 15:51:48 +02:00
Anders Schack-Mulligen
fcb677e84d Java: Add a neutral for Collection.remove. 2024-09-30 15:46:43 +02:00
Anders Schack-Mulligen
38818f3cd2 Java: Adjust Set.clear model to apply to overrides. 2024-09-30 15:46:42 +02:00
Tom Hvitved
2018b6361d Rust: Accept CFG inconsistencies 2024-09-30 15:45:15 +02:00
Arthur Baars
d3c50727ed Rust: exclude Comment nodes from lines of code counts 2024-09-30 15:39:00 +02:00
Arthur Baars
45d3d381f5 Rust: test cases for comments 2024-09-30 15:38:59 +02:00
Arthur Baars
ef3f730d32 Rust: extract comment tokens 2024-09-30 15:38:58 +02:00
Arthur Baars
fd459be165 Rust: add Comment to schema 2024-09-30 15:38:54 +02:00
Tom Hvitved
3a210b77f9 Merge pull request #17626 from hvitved/rust/more-cfg-tests 2024-09-30 15:37:55 +02:00
Tom Hvitved
c3311e52a6 Merge pull request #17623 from hvitved/rust/labelled-block 2024-09-30 15:33:55 +02:00
Tom Hvitved
2e7e26b638 Rust: Add more CFG tests 2024-09-30 15:15:14 +02:00
Anders Schack-Mulligen
1f95fa10fb Java: Fix comment re. neutrals and WithoutElement.
The remove methods should not have been in this section, as they're
plain neutrals.
2024-09-30 15:08:56 +02:00
Tom Hvitved
5ae669937c Rust: Add labelled block example 2024-09-30 14:47:13 +02:00
Tamás Vajk
752502ba76 Merge pull request #17619 from tamasvajk/text-file-archiving-warning
C#: reduce extraction message severity for missing text files
2024-09-30 14:07:45 +02:00
Tamas Vajk
29948e4c0b C#: reduce extraction message severity for missing text files 2024-09-30 12:31:07 +02:00
Michael Nebel
6f74387600 Merge pull request #17521 from michaelnebel/modelgen/moreimprovements
C#/Java: Content based model generation improvements.
2024-09-30 11:22:30 +02:00
Tom Hvitved
4513643a0f Merge pull request #17617 from hvitved/rust/extraction-consistency
Rust: Add extraction error consistency query
2024-09-30 11:06:34 +02:00
Tom Hvitved
3e77dd8b6b Rust: Fix extraction errors 2024-09-30 10:36:56 +02:00
Tom Hvitved
bafef791f7 Rust: Add extraction error consistency query 2024-09-30 10:28:24 +02:00
Anders Schack-Mulligen
a017f92b78 Merge pull request #17579 from aschackmull/java/type-sanitizers
Java: Add more type-based sanitizers.
2024-09-30 10:07:06 +02:00
Tom Hvitved
8a1b4501dd Merge pull request #17602 from hvitved/rust/cfg-prune-bool-literal
Rust: Prune CFG for obviously impossible `true/false` edges
2024-09-30 10:05:03 +02:00
Anders Schack-Mulligen
b0ed47c277 Merge pull request #17605 from aschackmull/java/stringbuilder-neutrals
Java: Add a couple of neutrals
2024-09-30 10:03:41 +02:00
Michael Nebel
baae8d0bb2 Shared: Address model generator review comments. 2024-09-30 09:12:30 +02:00
Owen Mansel-Chan
654d97013f Merge pull request #17607 from owen-mc/go/add-comments-about-interface-methods-from-embedded-interfaces
Go: Add comments noting methods from embedded interfaces are already included
2024-09-28 13:49:50 +01:00
Chris Smowton
ca68aaa0de Remove test code 2024-09-27 19:07:00 +01:00
Owen Mansel-Chan
796db77104 Add comments noting methods from embedded interfaces are already included 2024-09-27 15:03:09 +01:00
Anders Schack-Mulligen
fb630d266e Java: Add a couple of neutrals 2024-09-27 15:24:06 +02:00
Tom Hvitved
90a8bef64c Rust: Run codegen 2024-09-27 13:39:15 +02:00
Ian Lynagh
7de1182f92 Merge pull request #17599 from igfoo/igfoo/constrs
Kotlin: Fix the return type for lambda constructors
2024-09-27 12:38:50 +01:00
Tom Hvitved
dc4160b24a Rust: Prune CFG for impossible true/false edges 2024-09-27 13:37:29 +02:00
Tom Hvitved
bf58bdd2bd Rust: Update CFG tests 2024-09-27 13:35:14 +02:00
Tom Hvitved
431b33a274 Rust: Implement LiteralExpr::toString() 2024-09-27 13:33:25 +02:00
Tom Hvitved
97ead6f462 Merge pull request #17560 from hvitved/codegen/remove-cached
Codegen: Do not cache injectors/projectors in `Synth` module
2024-09-27 13:17:02 +02:00
Ian Lynagh
2a5b48930a Kotlin: Fix the return type for lambda constructors 2024-09-27 11:21:40 +01:00
Ian Lynagh
08be35fc2c Kotlin: Add a test for constructors 2024-09-27 11:21:23 +01:00
Michael Nebel
0b39c5b982 C#/Java: Update model generator expected output. 2024-09-27 09:22:29 +02:00
Michael Nebel
80497f551e Shared: Only make unlifted models in case the API itself is relevant. 2024-09-27 09:22:25 +02:00
Michael Nebel
3d1a403655 C#: Add example of content based summary on private method. 2024-09-27 09:22:20 +02:00
Michael Nebel
ccadfa134e Shared: Update the model generator script to allow execution of the mixed model generator queries. 2024-09-27 09:22:15 +02:00
Michael Nebel
8310faa2e9 C#/Java: Add a query that uses both content based and non-content based model generation. 2024-09-27 09:22:11 +02:00
Owen Mansel-Chan
fdff209938 Merge pull request #17505 from owen-mc/go/inheritance-tests
Go: Add tests for model inheritance and fix bug in promoted methods
2024-09-26 16:42:25 +01:00
Calum Grant
8e85f24c95 Merge pull request #17553 from github/calumgrant/bmn/wrong-number-of-format-arguments
C++: Remove FPs in cpp/wrong-number-format-arguments due to BMN
2024-09-26 15:01:23 +01:00
Calum Grant
8967989c7b C++: Rename change-note 2024-09-26 13:39:46 +01:00
Tom Hvitved
7c473c38c0 Merge pull request #17585 from hvitved/shared/cfg-scope-no-first-consistency
Shared: Add CFG consistency check for scopes with missing entry points
2024-09-26 14:05:08 +02:00
Calum Grant
dcb75f490f Update cpp/ql/src/change-notes/2024-09-26-wrong-number-format-arguments
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-09-26 13:05:06 +01:00
Calum Grant
8045440d00 Update cpp/ql/lib/semmle/code/cpp/models/interfaces/FormattingFunction.qll
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-09-26 13:04:52 +01:00
Rasmus Wriedt Larsen
7c32efc218 Merge pull request #17203 from RasmusWL/threat-models
Python: Add support for threat models
2024-09-26 13:15:46 +02:00
Rasmus Wriedt Larsen
381ea93ec3 Merge pull request #17424 from RasmusWL/active-threat-model-source
Go/Java/C#: Rename `ThreatModelFlowSource` to `ActiveThreatModelSource`
2024-09-26 13:08:17 +02:00
Michael Nebel
a128383760 C#/Java: Add some dfc-generated test cases. 2024-09-26 13:01:01 +02:00
Michael Nebel
2a5dc204fb Shared: Add dfc as a valid model origin. 2024-09-26 13:00:57 +02:00
Michael Nebel
9a923d62ad C#/Java: Updated expected test output. 2024-09-26 13:00:52 +02:00
Michael Nebel
e70297a7bc Shared: Content based models is now printed with dfc-generated provenance. 2024-09-26 13:00:39 +02:00
Arthur Baars
d7fb7ab551 Merge pull request #17592 from github/aibaars/cargo-fmt
Rust: run cargo fmt
2024-09-26 12:57:15 +02:00
Michael Nebel
53c20ccaeb Shared: Some model generator re-factoring. 2024-09-26 12:55:01 +02:00
Michael Nebel
0cd4ccb790 C#/Java: Update model generator expected test output. 2024-09-26 12:49:18 +02:00
Michael Nebel
b041829569 Shared: steps in synthetic path chains should just mention the same synthetic fields. 2024-09-26 12:49:07 +02:00
Arthur Baars
6777a34dfb Rust: run cargo fmt 2024-09-26 12:40:25 +02:00
Geoffrey White
7b3960844d Merge pull request #17589 from geoffw0/missing2
Rust: Repair rust/diagnostics/unextracted-elements
2024-09-26 11:03:03 +01:00
Michael Nebel
aae8660acc C#/Java: Add some examples of missing synthetic field element flow. 2024-09-26 12:00:29 +02:00
Michael Nebel
58513cadbf C#/Java: Add model generator test examples. 2024-09-26 12:00:25 +02:00
Michael Nebel
6cd548f410 Shared: Only exclude API and parameter combinations where we could get more than three summaries. 2024-09-26 12:00:04 +02:00
Rasmus Wriedt Larsen
431a1af628 Merge branch 'main' into threat-models 2024-09-26 11:44:24 +02:00
Chris Smowton
76914c40c9 Merge pull request #17591 from github/smowton/admin/java-23-change-note
Add change note for Java 23 support
2024-09-26 10:14:21 +01:00
Tom Hvitved
f389a889ad Exclude consistency output from .gitignore files 2024-09-26 11:09:54 +02:00
Tom Hvitved
24f39ccae2 Rust: Weaken scopeNoFirst check 2024-09-26 11:09:52 +02:00
Tom Hvitved
a3ad6f5697 Ruby: Weaken scopeNoFirst check 2024-09-26 11:07:15 +02:00
Michael Nebel
dd993c3900 Merge pull request #17509 from michaelnebel/modelgen/parammodule
C#/Java: Re-factor the model generator to be a parameterized module.
2024-09-26 10:57:16 +02:00
Calum Grant
9b5c9af489 C++: Add change note 2024-09-26 09:31:45 +01:00
Calum Grant
7f2d485ae9 C++: Update comment 2024-09-26 09:31:43 +01:00
Calum Grant
c2871f4def Update cpp/ql/lib/semmle/code/cpp/Function.qll
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-09-26 09:31:42 +01:00
Calum Grant
4a14a3cacb Update cpp/ql/lib/semmle/code/cpp/models/interfaces/FormattingFunction.qll
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2024-09-26 09:31:40 +01:00
Calum Grant
0ad2e193e5 C++: Update test case 2024-09-26 09:31:18 +01:00
Calum Grant
31684d2548 C++: Remove FPs in cpp/wrong-number-format-arguments due to BMN 2024-09-26 09:27:59 +01:00
Calum Grant
6a0212ea44 C++: Add regression test 2024-09-26 09:27:51 +01:00
Michael Nebel
297d32180c Merge pull request #17582 from michaelnebel/csharp/attributecollectionsinks
C#: `AttributeCollection` is no longer considered a HTML sink.
2024-09-26 09:17:31 +02:00
Chris Smowton
ba5be80814 Typo 2024-09-25 21:32:52 +01:00
Chris Smowton
2c9488e475 Add change note for Java 23 support 2024-09-25 21:32:24 +01:00
Ian Lynagh
a9ecb26885 Merge pull request #17555 from igfoo/igfoo/kotlin2.1
Add support for Kotlin 2.1.0-Beta1
2024-09-25 16:25:55 +01:00
Geoffrey White
bc83106dd8 Rust: Repair rust/diagnostics/unextracted-elements. 2024-09-25 16:11:31 +01:00
Erik Krogh Kristensen
6a184e0c2e Merge pull request #17587 from 5idg5/users/js-dom-xss-tst-file-id-conflict-fix
Resolve id conflict with XssWithAdditionalSources.ql
2024-09-25 17:06:20 +02:00
Michael Nebel
1dcc6ac2b1 C#: Address review comments. 2024-09-25 17:06:19 +02:00
Tom Hvitved
1bd504bf61 C#: Restrict CfgScope 2024-09-25 16:43:15 +02:00
Tom Hvitved
ce2d959b7e Shared: Add CFG consistency check for scopes with missing entry points 2024-09-25 16:43:00 +02:00
Geoffrey White
8f1c1a8399 Revert "Rust: remove queries that no longer work"
This reverts commit e19bca0de8.
2024-09-25 15:33:21 +01:00
Jeroen Ketema
0520fc2d9f Merge pull request #17583 from jketema/rm-inline
C++: Remove `inline` pragma from sink
2024-09-25 16:30:30 +02:00
Ian Lynagh
a6fce19b0c Kotlin: Fix build with 2.1.0-Beta1 2024-09-25 15:23:35 +01:00
Ian Lynagh
5a03c35e9c Kotlin: Add 2.1.0-Beta1 2024-09-25 15:23:34 +01:00
Ian Lynagh
f193084f9f Kotlin: Add 2.1.0-Beta1 jars 2024-09-25 15:23:33 +01:00
Ian Lynagh
a8cad4963e Kotlin: 2.1.0 is supported 2024-09-25 15:23:31 +01:00
Sid Gawri
e8c68fff7f resolve id conflict with dom based xss test ql 2024-09-25 10:01:59 -04:00
Felicity Chapman
85cc596041 Merge pull request #17586 from github/felicitymay-patch-1
Fix link to change logs on landing page
2024-09-25 14:40:56 +01:00
Jeroen Ketema
7289476c80 Merge pull request #17576 from jketema/formatting
C++: Do not wrap quoted text to the next line
2024-09-25 15:32:16 +02:00
Felicity Chapman
53e33d3ef3 Fix link to change logs on landing page 2024-09-25 14:28:09 +01:00
Felicity Chapman
0baa9e9ac1 Merge pull request #17580 from github/felicitymay-fix-dropdown-links
Revert changes that made the links in the drop-down on CodeQL docs site relative
2024-09-25 14:16:14 +01:00
Tom Hvitved
90869ec96a Merge pull request #17558 from hvitved/rust/cfg-consistency-queries
Rust: Enable CFG consistency checks
2024-09-25 15:14:44 +02:00
Tom Hvitved
79620c1a89 Address review comment 2024-09-25 14:18:44 +02:00
Michael Nebel
af80797eda C#: Add change note. 2024-09-25 14:13:06 +02:00
Michael Nebel
e89a47f2f5 C#: Update XSS expected test output. 2024-09-25 14:13:03 +02:00
Michael Nebel
d00e27916d C#: No longer consider attribute collections as HTML sinks. 2024-09-25 14:12:59 +02:00
Michael Nebel
28c48fb471 C#: Add Xss attribute collection test example and update expected output. 2024-09-25 14:12:55 +02:00
Jeroen Ketema
0ee1383732 C++: Remove inline pragma from sink 2024-09-25 14:04:31 +02:00
Anders Schack-Mulligen
cc63abf0af Merge pull request #17578 from aschackmull/cpp/fix-inline-sink2
Cpp: Replace sink inlining with a forward scan from source.
2024-09-25 13:54:48 +02:00
Arthur Baars
f57dd0a596 Merge pull request #17552 from github/aibaars/diagnostics
Rust: extract parse errors as diagnostics
2024-09-25 13:15:24 +02:00
Felicity Chapman
329c3c7c56 Make links in drop-down absolute 2024-09-25 10:59:22 +01:00
Owen Mansel-Chan
0ae10ece39 Merge pull request #17571 from jsoref/issue-17570
Downgrade IncorrectIntegerConversionQuery precision to high
2024-09-25 09:58:43 +01:00
Tom Hvitved
cbc2389493 Rust: Accept CFG inconsistencies 2024-09-25 10:56:46 +02:00
Tom Hvitved
d299380a5a Rust: Enable CFG consistency checks 2024-09-25 10:56:44 +02:00
Tom Hvitved
f428fdc57c Rust: Run codegen 2024-09-25 10:55:18 +02:00
Tom Hvitved
8c956e8276 Rust: Add LogicalOperation.qll 2024-09-25 10:55:16 +02:00
Tom Hvitved
3bd5c6e445 Rust: Implement {BinaryExpr,PrefixExpr}.toString() 2024-09-25 10:55:15 +02:00
Tom Hvitved
1fb9835f23 Merge pull request #17557 from hvitved/rust/cfg-improvements
Rust: CFG improvements
2024-09-25 10:54:49 +02:00
Anders Schack-Mulligen
aaecb9bb7a Java: Add more type-based sanitizers. 2024-09-25 10:38:17 +02:00
Anders Schack-Mulligen
3a1b618a74 Cpp: Replace sink inlining with a forward scan from source. 2024-09-25 10:28:23 +02:00
Jeroen Ketema
29061a08ad C++: Do not wrap quoted text to the next line
Wrapping breaks the highlighting in VSCode, making the QLDoc
difficult to read.
2024-09-25 09:43:05 +02:00
Tom Hvitved
6e493f2baa Address review comments 2024-09-25 09:09:29 +02:00
Josh Soref
a9e07a88af Downgrade IncorrectIntegerConversionQuery precision to high
`very-high` implies near 0 false positives and we have run into a number and an entire class

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2024-09-24 22:08:00 -04:00
Owen Mansel-Chan
ea4f9cad3c Mark some test results as SPURIOUS 2024-09-24 22:04:50 +01:00
Chris Smowton
590e93d8ed Merge pull request #17360 from smowton/smowton/admin/go-function-pretty-printer
Go: Expose whether functions are variadic in their pp() output
2024-09-24 21:47:50 +01:00
Owen Mansel-Chan
bcb718ac77 Add change note 2024-09-24 21:39:49 +01:00
Arthur Baars
5714811071 Rust: fix panic when the last character in a range is multi-byte 2024-09-24 19:26:02 +02:00
Chris Smowton
d673d24ca6 Revise notation to more closely resemble real Go 2024-09-24 17:22:26 +01:00
Chris Smowton
11755482e4 Update test expectation (now signature types pretty-print indicating if they are variadic) 2024-09-24 17:18:10 +01:00
Chris Smowton
40035a0b62 Improve pretty-printer 2024-09-24 17:18:09 +01:00
Chris Smowton
4d3a140dd7 Expose whether functions are variadic in their pp() output 2024-09-24 17:18:08 +01:00
Owen Mansel-Chan
73209638e3 Improve comments in test library 2024-09-24 16:41:10 +01:00
Arthur Baars
1953e4f971 Rust: handle UTF-8 decoding errors 2024-09-24 17:34:33 +02:00
Arthur Baars
37f264df74 Rust: correct line and column numbers in printed error messages 2024-09-24 17:34:32 +02:00
Arthur Baars
ca2b8ef6c0 Apply suggestions from code review
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2024-09-24 17:34:31 +02:00
Arthur Baars
9b8cbdad49 Add QLDoc to Diagnostics.qll 2024-09-24 17:34:30 +02:00
Arthur Baars
c596205416 Rust: add some more diagnostics queries 2024-09-24 17:34:29 +02:00
Arthur Baars
bdb4d89f9f Rust: add Diagnostics.qll 2024-09-24 17:34:27 +02:00
Arthur Baars
b04abc09f0 Rust: extract syntax errors 2024-09-24 17:34:26 +02:00
Owen Mansel-Chan
b0caabac86 Also update QL tests 2024-09-24 16:25:55 +01:00
Owen Mansel-Chan
6e428d5083 Fix bug where some methods were inappropriately promoted 2024-09-24 16:25:53 +01:00
Owen Mansel-Chan
0255edf524 Remove tests for sources and sinks
This is redundant given that we test for paths, and for a path
we need the source, step and sink methods to be modeled.
2024-09-24 16:25:49 +01:00
Owen Mansel-Chan
afa4b6dd4a Make paths test an inline expectations test 2024-09-24 16:23:33 +01:00
Owen Mansel-Chan
5490f3a957 Add tests for interface embedding interface 2024-09-24 16:23:31 +01:00
Owen Mansel-Chan
279800ea62 Use shorter naming scheme for types 2024-09-24 16:23:26 +01:00
Ian Lynagh
4dbb15ddda Merge pull request #17503 from igfoo/igfoo/fields
Java/Kotlin: Deprecate Field.getSourceDeclaration(), Field.isSourceDeclaration()
2024-09-24 15:15:21 +01:00
Taus
8c015b0784 Merge pull request #17305 from Kwstubbs/CORSMiddleware-Starlette
Python: Add Support for CORS Middlewares
2024-09-24 15:51:49 +02:00
Arthur Baars
47953339db Merge pull request #17543 from github/aibaars/rust-gen-extractor
Rust: generate the extractor
2024-09-24 15:47:28 +02:00
Michael Nebel
e6085759ae Shared: Put the content of CaptureSummaryFlowQuery into the shared library code. 2024-09-24 15:46:44 +02:00
Michael Nebel
fd45d2dcbb Shared: Move the model generator implementation to an internal folder. 2024-09-24 15:27:29 +02:00
Michael Nebel
22c2522aac Shared: Make a ContentSensitive module with predicates and classes related to content flow. 2024-09-24 15:16:16 +02:00
Ian Lynagh
9b8152a44b Java: Add up/downgrade scripts 2024-09-24 14:06:56 +01:00
Ian Lynagh
76662a6002 Java: Add changenote for deprecation of Field.getSourceDeclaration() and Field.isSourceDeclaration() 2024-09-24 14:06:55 +01:00
Ian Lynagh
bda779a58d Java: Deprecate Field.getSourceDeclaration() and Field.isSourceDeclaration()
Also follows the removal of the sourceid column of fields.
2024-09-24 14:06:54 +01:00
Ian Lynagh
0be52f9660 Kotlin: Follow removal of sourceid column of the fields relation 2024-09-24 14:06:53 +01:00
Ian Lynagh
300864a38b Java: dbscheme: Remove sourceid column of fields/5
It was always the same as the id column.
2024-09-24 14:06:53 +01:00
Tom Hvitved
5b45d36610 Merge pull request #17300 from hvitved/dataflow/node-ex-cached
Data flow: Cache `TNodeEx`
2024-09-24 15:04:35 +02:00
Tom Hvitved
d3368be94a Swift: Run codegen 2024-09-24 14:42:37 +02:00
Tom Hvitved
c1f3e7389f Rust: Run codegen 2024-09-24 14:42:04 +02:00
Tom Hvitved
062127b42e Codegen: Do not cache injectors/projectors in Synth module 2024-09-24 14:41:20 +02:00
Tom Hvitved
300fdc344d Go: Update expected test output 2024-09-24 14:21:42 +02:00
Tom Hvitved
6a11120e50 Address review comments 2024-09-24 14:21:40 +02:00
Tom Hvitved
16925355a8 Data flow: Cache TNodeEx 2024-09-24 14:21:39 +02:00
Tom Hvitved
f287216060 Update expected test output 2024-09-24 14:21:38 +02:00
Tom Hvitved
37490de4a2 Data flow: Remove Boolean column from TNodeImplicitRead 2024-09-24 14:21:37 +02:00
Owen Mansel-Chan
6a67bd52a9 Add tests for MaD inheritance 2024-09-24 13:21:05 +01:00
Arthur Baars
d14e77ba48 Address comments 2024-09-24 14:09:23 +02:00
Tom Hvitved
8d8bbd5b12 Rust: Run codegen 2024-09-24 13:25:57 +02:00
Tom Hvitved
5f3663018e Rust: Remove spurious CFG edges in match expressions 2024-09-24 13:09:33 +02:00
Tom Hvitved
3b753da74e Rust: Expose SuccessorType and sub classes 2024-09-24 13:09:00 +02:00
Owen Mansel-Chan
d7614a71f4 Merge pull request #17529 from github/workflow/coverage/update
Update CSV framework coverage reports
2024-09-24 11:37:12 +01:00
Tom Hvitved
6ae03e67e6 Rust: Add case for ParenExpr in CFG 2024-09-24 11:20:57 +02:00
github-actions[bot]
15bb670b3f Add changed framework coverage reports 2024-09-24 00:20:17 +00:00
Kevin Stubbings
01aa63e170 Add tests 2024-09-23 16:47:10 -07:00
Chris Smowton
7e8da94d9a Merge pull request #17216 from smowton/smowton/feature/golang-test-extraction
Go: support extracting test code
2024-09-23 16:43:42 +01:00
Chuan-kai Lin
1cd8af54f2 Merge pull request #17190 from github/cklin/diff-informed-java-queries
Java: add support for alert location restrictions
2024-09-23 08:39:24 -07:00
Chris Smowton
209f9ec93d Amend comments per review 2024-09-23 15:20:18 +01:00
yoff
e7bc71f2da Merge pull request #17540 from joefarebrother/python-const-compare
Python: Expand `StringConstCompareBarrier` sanitizer gaurds to cover additional constants
2024-09-23 16:14:09 +02:00
Joe Farebrother
48f9e0efe5 Adress review comments: Add missing deprecation + additional test case 2024-09-23 10:57:04 +01:00
Arthur Baars
04e3b39ffb Merge pull request #17537 from github/redsun82/rust-doctest-gen
Rust: take test code also from property descriptions
2024-09-23 11:41:32 +02:00
Arthur Baars
05173fa7ac Merge pull request #17539 from github/redsun82/rust-codegen-detach
Rust/Codegen: allow to "detach" property emission
2024-09-23 11:40:11 +02:00
Rasmus Wriedt Larsen
535db98823 Python: Minor simplification of ActiveThreatModelSource
Co-authored-by: Taus <tausbn@github.com>
2024-09-23 11:21:55 +02:00
Rasmus Wriedt Larsen
4a21a85e73 Merge branch 'main' into threat-models 2024-09-23 11:19:58 +02:00
Rasmus Wriedt Larsen
63c3a71d95 Merge branch 'main' into active-threat-model-source 2024-09-23 11:18:14 +02:00
Chris Smowton
e528a08794 Autoformat 2024-09-21 22:12:24 +01:00
Chris Smowton
bb44a2fc8c Populate pkgInfoMapping for test packages if relevant 2024-09-21 13:38:41 +01:00
Arthur Baars
7b4137fbc8 Rust: generate the extractor 2024-09-20 19:24:55 +02:00
Paolo Tranquilli
e48e18af20 Merge pull request #17527 from github/aibaars/rust-annotations
Rust: add QL doc annotations to schema
2024-09-20 18:08:37 +02:00
Arthur Baars
45d9d8a25a Address comments 2024-09-20 17:53:27 +02:00
Arthur Baars
1f21d75399 Merge pull request #17533 from github/redsun82/codegen-parametrized-pragmas
Codegen: introduce inherited pragmas and move remaining decorations
2024-09-20 17:53:05 +02:00
Chuan-kai Lin
75ec8ce58e Java: apply query alert restrictions 2024-09-20 07:47:58 -07:00
Joe Farebrother
7aa2816570 Add changenote 2024-09-20 15:19:54 +01:00
Anders Schack-Mulligen
3a1e50dcf9 Dataflow: Simplify diff-informed implementation and tweak flag name. 2024-09-20 07:07:10 -07:00
Paolo Tranquilli
c74b6be136 Rust/Codegen: allow to "detach" property emission
By using the `rust.detach` pragma on a property, we make that property
not appear in the generated struct as a field, and provide instead
a `generated::Class::emit_property` function that can be used to emit
the corresponding TRAP entry independently.
2024-09-20 16:06:22 +02:00
Joe Farebrother
81e99bf1bb Add tests 2024-09-20 15:05:51 +01:00
Arthur Baars
69a172c7ba Rust: accept trivial expected output 2024-09-20 15:51:06 +02:00
Arthur Baars
db06ad2ac3 Rust: codegen 2024-09-20 15:51:03 +02:00
Arthur Baars
2ee61f9aaa Rust: add placeholder QLdoc annotations 2024-09-20 15:51:02 +02:00
Arthur Baars
e6e0e6eb66 Rust: accept expected output 2024-09-20 15:51:01 +02:00
Arthur Baars
a9423f4bdb Rust: codegen 2024-09-20 15:50:59 +02:00
Arthur Baars
57458d8f38 Rust: remove qldoc annotations for classes that no longer exist 2024-09-20 15:50:58 +02:00
Arthur Baars
2fdc529ac9 Rust: add qldoc annotations to schema 2024-09-20 15:50:57 +02:00
Arthur Baars
b2bddd3415 Rust: write generated schema into schema/ast.py 2024-09-20 15:50:55 +02:00
Joe Farebrother
3001a570b2 Replace uses of StringConstCompare 2024-09-20 14:47:22 +01:00
Florin Coada
f4071ddb28 Merge pull request #17538 from github/coadaflorin/docs-typo-fix
Update index.html
2024-09-20 14:47:07 +01:00
Florin Coada
d290591187 Update index.html 2024-09-20 14:40:45 +01:00
Paolo Tranquilli
2a95068a0a Rust: take test code also from property descriptions 2024-09-20 15:12:13 +02:00
Geoffrey White
d7aa5f1022 Merge pull request #17497 from geoffw0/unusedvar
Rust: Placeholder queries for unused variable, unused value
2024-09-20 12:52:33 +01:00
Chris Smowton
bcb84a84e1 Only skip test packages at the file-extraction phase 2024-09-20 12:48:08 +01:00
Joe Farebrother
164cf27e67 Add additional constant checks to constant barrier gaurd 2024-09-20 12:46:10 +01:00
Paolo Tranquilli
4e59fa9035 Codegen: remove unneeded code 2024-09-20 12:47:45 +02:00
Paolo Tranquilli
f7afcd038a Codegen: move use_for_null to pragmas 2024-09-20 12:47:45 +02:00
Paolo Tranquilli
d2ebe00492 Codegen: move group to parametrized pragmas 2024-09-20 12:47:44 +02:00
Paolo Tranquilli
2533f18a6e Codegen: move ql.hideable to pragmas 2024-09-20 12:47:44 +02:00
Paolo Tranquilli
8d291ab938 Codegen: move qltest.test_with to parametrized pragmas 2024-09-20 12:47:44 +02:00
Paolo Tranquilli
3e2f886595 Codegen: allow inheritable pragmas 2024-09-20 12:47:43 +02:00
Paolo Tranquilli
1bffc2a7d7 Merge pull request #17532 from github/redsun82/codegen-parametrized-pragmas
Codegen: parametrized pragmas
2024-09-20 12:47:33 +02:00
Paolo Tranquilli
db00cb6827 Codegen: move class synth decorators to pragmas 2024-09-20 11:09:22 +02:00
Paolo Tranquilli
9d6ee09f65 Codegen: move rust.doc_test_signature to parametrized pragmas 2024-09-20 11:09:21 +02:00
Paolo Tranquilli
70997e8189 Codegen: move default_doc_name to parametrized pragma 2024-09-20 11:09:21 +02:00
Paolo Tranquilli
9f1d50ebd1 Codegen: allow parametrized pragmas 2024-09-20 11:09:21 +02:00
Chris Smowton
f5ff822681 Convert extract-tests option to an official extractor option 2024-09-20 10:03:54 +01:00
Chris Smowton
94cb99e51d Adjust test expectations 2024-09-20 10:03:53 +01:00
Chris Smowton
9d79feb4d3 Autoformat go 2024-09-20 10:03:52 +01:00
Chris Smowton
eb6918f88f Autoformat 2024-09-20 10:03:51 +01:00
Chris Smowton
fd592fa18f Add tests 2024-09-20 10:03:46 +01:00
Chris Smowton
c3dffc955b Apply review comments 2024-09-20 09:56:29 +01:00
Chris Smowton
76e6942594 Go: support extracting test code
This implements support for test extraction by two mechanisms:

* In autobuild mode, setting `CODEQL_EXTRACTOR_GO_EXTRACT_TESTS` to `true`.
* In manual build mode, tracing a `go test` command (`go test -c` is to be recommended for efficiency).

Go deals with test compilation by creating several extra packages on top of those expected from inspection of the source code (see docs of `packages.Load` for more detail): packages whose IDs include a suffix like `mydomain.com/mypackage [mydomain.com/mypackage.test]`, and packages containing generated test driver code like `mydomain.com/mypackage.test`. There are also additional packages like `mydomain.com/mypackage_tests` which are explicitly present in source code, but not compiled by a normal `go build`.

So far as I can tell, the purpose of the two variants of the package is to resolve dependency cycles (because the tests variant of the package can have more dependencies than the non-tests variant, and non-test code can compile against non-test package variants). Since the test package variants seems to be a superset of the non-tests variant, I employ the simple heuristic of ignoring the variant of each package with the shortest ID. I haven't seen a case where there are three or more variants of a package, so I expect this to always identify the tests variant as the preferred one. If several variants were extracted, and we were to attempt to match Golang's linkage strategy among the different variants, we would need to extend trap-file name and most top-level symbol trap IDs with the package variant they come from; I hope this won't prove necessary.

"Real" `_tests` packages, and wholly synthetic driver code packages, are extracted just like normal.
2024-09-20 09:56:28 +01:00
Arthur Baars
594045b634 Merge pull request #17530 from github/redsun82/codegen-annotate
Codegen: allow full annotation of classes
2024-09-20 10:38:44 +02:00
Tom Hvitved
f2e943f9ba Merge pull request #17520 from hvitved/cfg/no-kind-graph
Shared: Do not use `@kind graph` for CFG test output
2024-09-20 10:10:05 +02:00
Paolo Tranquilli
74c0fa7154 Codegen: allow annotations to add class decorations 2024-09-20 08:40:34 +02:00
Paolo Tranquilli
cc5882a3c3 Codegen: allow full annotation of classes 2024-09-20 06:55:17 +02:00
Arthur Baars
cf5d56addf Merge pull request #17524 from github/revert-17514-redsun82/codegen-include
Revert "Codegen: allow to include `.py` files in `schema.py`"
2024-09-19 21:43:28 +02:00
Jeroen Ketema
a065434dd7 Merge pull request #16811 from porcupineyhairs/curlssl
CPP: Disabled SSL certificate verification
2024-09-19 20:02:17 +02:00
Porcupiney Hairs
ee41e65e90 Include changes from review 2024-09-19 22:52:20 +05:30
Tom Hvitved
16813240ae Shared: Do not use @kind graph for CFG test output 2024-09-19 18:13:31 +02:00
Florin Coada
ec74595671 Merge pull request #17511 from github/changedocs/2.19.0
Adding unified changelog for 2.19.0
2024-09-19 17:05:30 +01:00
Simon Friis Vindum
95c18ce431 Merge pull request #17498 from paldepind/rust-improve-cfg
Rust: Improve CFG
2024-09-19 17:33:30 +02:00
Paolo Tranquilli
97cca76970 Revert "Codegen: allow to include .py files in schema.py" 2024-09-19 16:58:20 +02:00
Paolo Tranquilli
6a540d833e Merge pull request #17523 from github/redsun82/rust-break-up-schema
Codegen/Rust: allow breaking up schema file
2024-09-19 16:57:58 +02:00
Chris Smowton
fe1081e880 Merge pull request #17510 from mbaluda/patch-1
Model summary for `org.springframework.core.io.getInputStream` methods
2024-09-19 15:47:31 +01:00
Chris Smowton
0deefaddc5 Merge pull request #17483 from smowton/smowton/feature/csharp-dataflow-fewer-nodes-including-virtual-dispatch
C#: Restrict dataflow node creation to source and source-referenced entities [virtual-dispatch-inclusive variant]
2024-09-19 15:33:47 +01:00
Florin Coada
0e828bb5da Merge branch 'main' into changedocs/2.19.0 2024-09-19 15:16:49 +01:00
Chris Smowton
bb82dc1b18 Change note 2024-09-19 15:12:11 +01:00
Chris Smowton
bc9eb993b8 Remove unnecessary fromSource conditions 2024-09-19 15:08:08 +01:00
Paolo Tranquilli
a5e3fbf367 Codegen/Rust: allow breaking up schema file 2024-09-19 15:57:42 +02:00
Simon Friis Vindum
19697b9a77 Merge branch 'main' into rust-improve-cfg 2024-09-19 15:53:41 +02:00
Arthur Baars
f38f818578 Merge pull request #17516 from github/redsun82/codegen-annotate
Codegen: allow to attach docstrings after the definition
2024-09-19 15:35:16 +02:00
Owen Mansel-Chan
682f08ceb9 Merge pull request #17515 from owen-mc/go/run-ci-when-shared-libs-change
Go: Run CI when shared libraries change
2024-09-19 14:28:44 +01:00
Simon Friis Vindum
db9f5fdf81 Rust: Handle nested if expressions, address review comments 2024-09-19 15:10:37 +02:00
Arthur Baars
3c09f70e0d Merge pull request #17502 from github/aibaars/rust-extract-ast
Rust: ast-based extractor
2024-09-19 14:13:25 +02:00
Simon Friis Vindum
2511986324 Rust: Address PR review comments 2024-09-19 14:11:58 +02:00
Arthur Baars
919a9002bc Merge pull request #17514 from github/redsun82/codegen-include
Codegen: allow to include `.py` files in `schema.py`
2024-09-19 13:22:49 +02:00
Arthur Baars
3aa47a3950 Rust: accept test changes 2024-09-19 13:13:18 +02:00
Arthur Baars
1c0f60fa2e Rust: lines of code, exclude 'SourceFile' node 2024-09-19 13:00:52 +02:00
Arthur Baars
24f24855f0 Rust: update expected output 2024-09-19 13:00:51 +02:00
Arthur Baars
e19bca0de8 Rust: remove queries that no longer work 2024-09-19 13:00:50 +02:00
Arthur Baars
c3b10bf90b Rust: patch cfg implementation 2024-09-19 13:00:49 +02:00
Arthur Baars
80d32a2333 Rust: re-generate code 2024-09-19 13:00:46 +02:00
Arthur Baars
9104c3fc81 Rust: re-generate schema and extractor 2024-09-19 13:00:45 +02:00
Arthur Baars
1f30d5f41b Rust: generate schema.py and extractor from ungrammar 2024-09-19 13:00:05 +02:00
Paolo Tranquilli
c117a53fb0 Codegen: allow to attach docstrings after the definition 2024-09-19 12:43:34 +02:00
Owen Mansel-Chan
f2fbe64137 Go: Run CI when shared libraries change 2024-09-19 11:32:46 +01:00
Michael Nebel
f142af50b7 Shared: QL doc improvement. 2024-09-19 12:20:59 +02:00
Michael Nebel
de4a7da286 Java/C#: No longer sync CaptureModels.qll. 2024-09-19 12:20:55 +02:00
Michael Nebel
2033818e39 Java: Use the shared model generator implementation. 2024-09-19 12:20:51 +02:00
Michael Nebel
1f3b28a555 C#: Use the shared model generator implementation. 2024-09-19 12:20:46 +02:00
Michael Nebel
3b9f3c2c29 Shared: Add a model generator parameterised module. 2024-09-19 12:20:42 +02:00
Paolo Tranquilli
ec9bb1da56 Codegen: allow to include .py files in schema.py 2024-09-19 12:18:52 +02:00
Tom Hvitved
4baa4ae2aa Merge pull request #17513 from owen-mc/fix-test-expectations
C#/Go: Fix test expectations including double space
2024-09-19 12:17:18 +02:00
Michael B. Gale
a5ab5d9236 Merge pull request #17422 from github/dependabot/go_modules/go/extractor/extractor-dependencies-f3a1f89f55 2024-09-19 11:02:34 +01:00
Owen Mansel-Chan
ded52ccb8e Fix test expectations including double space 2024-09-19 11:01:38 +01:00
Florin Coada
54632b289e Adding unified changelog for 2.19.0 2024-09-19 10:03:07 +01:00
Arthur Baars
61ac8d66f5 Rust: make things compile 2024-09-19 10:51:52 +02:00
Arthur Baars
fabdb3c841 Rust: copy files from rust-analyzer's codegenerator
Files copied from: 50882fbfa2/xtask/src/codegen/grammar
2024-09-19 10:51:51 +02:00
Arthur Baars
5ccb45e7d3 Rust: add rust.ungram
Copied from 50882fbfa2/crates/syntax/rust.ungram
2024-09-19 10:51:46 +02:00
Arthur Baars
d5c0d41f98 Rust: add generate-schema project 2024-09-19 10:51:44 +02:00
Michael Nebel
4a9e3ee3aa Merge pull request #17363 from michaelnebel/modelgen/fieldbasedimprovements
C#/Java: Content based model generation improvements.
2024-09-19 10:49:11 +02:00
Tom Hvitved
cfa4cb432a Merge pull request #17504 from hvitved/dataflow/sink-provenance-space
Data flow: Remove spurious space in ` Sink:x` provenance
2024-09-19 10:21:38 +02:00
dependabot[bot]
67fa9738e6 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.24.0 to 0.25.0
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.24.0...v0.25.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-09-19 03:46:50 +00:00
Paolo Tranquilli
9a8d9f857f Merge pull request #17491 from github/redsun82/rust-integration-test
Rust: add basic integration tests and fix archiving on Windows
2024-09-19 05:25:14 +02:00
Porcupiney Hairs
57d1035acd Include changes from review 2024-09-19 03:32:34 +05:30
Mauro Baluda
cab35a25a5 Remove duplicate summary for MultipartFile.getInputStream and update .expected file 2024-09-18 20:43:04 +02:00
Mauro Baluda
5ae51f0b56 Address review 2024-09-18 19:28:03 +02:00
Mauro Baluda
cfa14ad5eb Update org.springframework.core.io.model.yml
Model summary for `getInputStream` methods
2024-09-18 18:13:29 +02:00
Simon Friis Vindum
e43d39a0fe Merge pull request #17508 from paldepind/rust-consistency-queries-pack
Rust: Add consistency-queries pack
2024-09-18 14:17:52 +02:00
Tom Hvitved
485dc9619d Merge pull request #17506 from hvitved/rust/code-block-examples
Rust: Use ```rust for code block examples
2024-09-18 14:15:07 +02:00
Simon Friis Vindum
7c2b149728 Rust: Add consistency-queries pack 2024-09-18 14:09:41 +02:00
Geoffrey White
2769bd6f35 Rust: Make the placeholder queries produce no results, to avoid confusion. 2024-09-18 13:07:31 +01:00
Geoffrey White
3632a76eaf Rust: Add test annotations. 2024-09-18 13:05:06 +01:00
Geoffrey White
d79aa073ea Rust: Clean up the UnusedValue examples. 2024-09-18 13:03:09 +01:00
Geoffrey White
463a1254d3 Update rust/ql/src/queries/unusedentities/UnusedValueBad.rs
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
2024-09-18 12:55:11 +01:00
Tom Hvitved
ed9008a064 Update expected test output 2024-09-18 13:51:02 +02:00
Simon Friis Vindum
bbf5902b18 Rust: Tweak imports 2024-09-18 13:48:50 +02:00
Tom Hvitved
43c0bd36be Rust: Run code generator 2024-09-18 13:48:02 +02:00
Tom Hvitved
5554c0f28f Rust: Use ```rust for code block examples
Also added some missing code block terminators.
2024-09-18 13:47:45 +02:00
Tom Hvitved
98b5ef5e01 Rust: Halt codegen on code block without ``` terminator 2024-09-18 13:47:44 +02:00
Simon Friis Vindum
6f555f3ad7 Merge branch 'main' into rust-improve-cfg 2024-09-18 13:42:51 +02:00
Tom Hvitved
2972a4eace Data flow: Remove spurious space in Sink:x provenance 2024-09-18 13:10:24 +02:00
Michael Nebel
24a101297c Merge pull request #15884 from michaelnebel/csharp/cleanupcil
C#: CIL and Dotnet cleanup (removal).
2024-09-18 11:43:41 +02:00
Chris Smowton
cfd281b319 Merge pull request #17400 from smowton/smowton/admin/further-golang-aliasing-tests
Go: add tests for dataflow relating to type aliasing
2024-09-18 10:30:37 +01:00
Tom Hvitved
0516d75c44 Merge pull request #17500 from hvitved/rust/move-generated
Rust: Use `elements/internal/generated` instead of `internal/generated`
2024-09-18 11:04:44 +02:00
Simon Friis Vindum
db351bdb05 Rust: Align test output with CI 2024-09-18 10:50:26 +02:00
Tom Hvitved
18ae8b14e9 Rust: Use elements/internal/generated instead of internal/generated 2024-09-18 10:44:20 +02:00
Paolo Tranquilli
c53179f742 Merge pull request #17499 from geoffw0/morestats
Rust: Add more summary stats.
2024-09-18 10:43:20 +02:00
Tom Hvitved
c5cbf82dbf Merge pull request #17495 from hvitved/codegen/internal
Codegen: Create `internal` folders
2024-09-18 10:42:04 +02:00
Simon Friis Vindum
dd25b3ecbe Rust: Don't use macro in test and add documentation string 2024-09-18 10:10:27 +02:00
Simon Friis Vindum
c18c35d737 Merge branch 'main' into rust-improve-cfg 2024-09-18 09:51:16 +02:00
Simon Friis Vindum
6a5a50521b Rust: Address QL suggestions for CFG implementation 2024-09-18 09:49:59 +02:00
Anders Schack-Mulligen
2837d2551a Merge pull request #17490 from aschackmull/java/capture-in-obinit
Java: Fix support for variable capture inside object initializers.
2024-09-18 09:29:01 +02:00
Michael Nebel
295861d577 Merge pull request #17459 from michaelnebel/csharp/accessormad
C#: Add MaD support for `Attribute.Getter` and `Attribute.Setter`.
2024-09-18 09:11:51 +02:00
Paolo Tranquilli
db812df06f Merge pull request #17492 from github/redsun82/rust-windows
Rust: add windows tools
2024-09-18 06:54:10 +02:00
Tom Hvitved
8c0d2e910c Swift: Run code generator 2024-09-17 20:25:57 +02:00
Tom Hvitved
9ea63fe716 Rust: Run code generator 2024-09-17 20:06:38 +02:00
Tom Hvitved
1433363523 Codegen: Create internal folders 2024-09-17 20:06:35 +02:00
Geoffrey White
83376afd15 Rust: Improve layout locality in summary stats. 2024-09-17 17:45:09 +01:00
Geoffrey White
07fccf8064 Rust: Add extracted + unextracted elements to summary stats. 2024-09-17 17:42:50 +01:00
Geoffrey White
6ebc615fd4 Rust: Add extracted files to summary stats. 2024-09-17 17:36:43 +01:00
Chris Smowton
0d0c94375d Adjust test expectations 2024-09-17 17:27:04 +01:00
Chris Smowton
2d5cbfd4c9 Elaborate comments 2024-09-17 17:18:48 +01:00
Chris Smowton
41726924e0 Update expectations 2024-09-17 17:02:47 +01:00
Chris Smowton
a803d3fb26 Add comments explaining tests 2024-09-17 17:02:46 +01:00
Chris Smowton
09015df8a4 Format 2024-09-17 17:02:45 +01:00
Chris Smowton
992b3c74fc Add data-flow tests for aliasing 2024-09-17 17:02:43 +01:00
Geoffrey White
a2bf2c7edb Rust: Fix query result columns. 2024-09-17 16:53:02 +01:00
Simon Friis Vindum
7a369f8734 Rust: Update CFG test and expected output 2024-09-17 17:34:11 +02:00
Simon Friis Vindum
73a430bd18 Merge branch 'main' into rust-improve-cfg 2024-09-17 17:31:10 +02:00
Geoffrey White
1c7d5217a0 Rust: Autoformat. 2024-09-17 16:24:28 +01:00
Geoffrey White
f93fd7cd6b Rust: Add qhelp and example for the unused variable query. 2024-09-17 16:13:25 +01:00
Geoffrey White
68f8e17186 Rust: Add a placeholder query + tests for unused variables query. 2024-09-17 16:13:23 +01:00
Geoffrey White
b7ad331b75 Rust: Add qhelp and example for the unused values query. 2024-09-17 16:13:22 +01:00
Geoffrey White
1fc6a0e103 Rust: Add placeholder query + tests for unused values query. 2024-09-17 16:13:21 +01:00
Simon Friis Vindum
6e868c2a6d Rust: CFG edges for break and continue with labels 2024-09-17 17:11:28 +02:00
Paolo Tranquilli
9f8c3c5778 Merge branch 'redsun82/rust-windows' into redsun82/rust-integration-test 2024-09-17 16:17:17 +02:00
Paolo Tranquilli
26d2e355bb Merge branch 'main' into redsun82/rust-windows 2024-09-17 16:16:48 +02:00
Michael Nebel
68165bbce4 C#/Java: Address review comments. 2024-09-17 16:09:17 +02:00
Chris Smowton
3e91f0f53f Expand range of callables requiring nodes to include unbound declarations of generic instantiations, static targets, and methods that have a body even if not flagged fromSource 2024-09-17 15:00:15 +01:00
Chris Smowton
349268cbf7 Expand the range of callables used in source to include potential virtual dispatch targets and referenced callables (e.g., in assigning a delegate) 2024-09-17 15:00:14 +01:00
Chris Smowton
66f48f767e Restrict dataflow node creation to source and source-referenced entities 2024-09-17 15:00:13 +01:00
Paolo Tranquilli
56f2732bbb Rust: ignore failing DB-CHECK 2024-09-17 15:35:52 +02:00
Paolo Tranquilli
5432493945 Rust: log detected manifests 2024-09-17 15:35:26 +02:00
Ian Lynagh
c7e3682597 Merge pull request #17451 from igfoo/igfoo/dbscheme
Java: Remove deprecated elements from dbscheme
2024-09-17 13:22:17 +01:00
Tom Hvitved
d680a549bd Merge pull request #16936 from hvitved/csharp/ssa-integration
C#: Adopt shared SSA data-flow integration
2024-09-17 13:45:31 +02:00
Simon Friis Vindum
581d0c59c4 Rust: Handle more AST nodes in the CFG 2024-09-17 13:05:27 +02:00
Felicity Chapman
0675ba0fa4 Merge pull request #17361 from github/12707-felicity-docs-landing
Update the Docs landing page for the CodeQL docs site
2024-09-17 11:40:53 +01:00
Ian Lynagh
9a398aa9a8 Java: Add up/downgrade scripts 2024-09-17 11:39:07 +01:00
Ian Lynagh
9f1c251809 Java: Follow removeal of typeVars.kind in qlls 2024-09-17 11:39:07 +01:00
Ian Lynagh
baace41488 Java: Remove stats for typeVars.kind 2024-09-17 11:39:06 +01:00
Ian Lynagh
b1f5f9a5cd Kotlin: Follow removal of typeVars.kind 2024-09-17 11:39:06 +01:00
Ian Lynagh
c5569cf5ad Java: Remove long-deprecated 'kind' from typeVars 2024-09-17 11:39:05 +01:00
Ian Lynagh
6968d7c17c Java: Remove duplicate/similar code from dbscheme
It's not been used for some time
2024-09-17 11:39:04 +01:00
Ian Lynagh
6166d061f2 Java: Move diagnostic_for next to diagnostics in the dbscheme
No code change, but it makes a bit more sense there
2024-09-17 11:39:04 +01:00
Ian Lynagh
7c99d9c648 Java: Remove snapshotDate from dbscheme
It's not been used for some time.
2024-09-17 11:39:03 +01:00
Ian Lynagh
9a62561336 Merge pull request #17484 from igfoo/igfoo/nestedName
Java: Deprecate RefType.nestedName(), and add RefType.getNestedName()
2024-09-17 11:37:16 +01:00
Paolo Tranquilli
89a8cbc536 Rust: use shared path utilities 2024-09-17 12:27:57 +02:00
Felicity Chapman
40fdd00e16 Merge pull request #17383 from github/10819-felicity-discovery
Update "About CodeQL" to cover the information needs of security researchers better
2024-09-17 11:10:52 +01:00
Felicity Chapman
7d49624e1c Update docs/codeql/codeql-overview/about-codeql.rst
Co-authored-by: Ben Ahmady <32935794+subatoi@users.noreply.github.com>
2024-09-17 11:09:48 +01:00
Anders Schack-Mulligen
a1a885efeb Java: Expand test. 2024-09-17 11:38:53 +02:00
Simon Friis Vindum
22edece201 Rust: Add CFG construction for if let expressions 2024-09-17 11:26:45 +02:00
Paolo Tranquilli
aae33db137 Rust: add basic integration tests
This adds testing of well-formed rust projects and workspaces, using
both `Cargo.toml` and `rust-project.json` manifests.
2024-09-17 11:23:39 +02:00
Paolo Tranquilli
afb9ffa50e Rust: add windows tools 2024-09-17 11:22:32 +02:00
Simon Friis Vindum
20e968751c Rust: Handle let statements with pattern and else branch in CFG 2024-09-17 10:54:48 +02:00
Anders Schack-Mulligen
20661a3c56 Java: Fix support for variable capture inside object initializers. 2024-09-17 10:42:21 +02:00
Michael Nebel
8d0cb07ba2 C#: Update the internal MaD attribute documentation. 2024-09-17 09:27:37 +02:00
Tom Hvitved
6618906380 Merge pull request #17488 from hvitved/rust/generated-internal
Rust: Move `codeql/rust/generated` files into `codeql/rust/internal/generated`
2024-09-17 09:12:44 +02:00
Paolo Tranquilli
fc9c4a8e14 Merge pull request #17477 from github/redsun82/rust-default-doc-signature
Rust/Codegen: make `() -> ()` the default signature
2024-09-17 08:51:46 +02:00
Tom Hvitved
efa52acf73 Rust: Move codeql/rust/generated files into codeql/rust/internal/generated 2024-09-17 08:51:24 +02:00
Paolo Tranquilli
0d8d9a3447 Merge branch 'main' into redsun82/rust-default-doc-signature 2024-09-17 08:29:01 +02:00
Tom Hvitved
9b8ba41c44 Merge pull request #17487 from hvitved/swift/change-note
Swift: Add change note
2024-09-16 19:57:24 +02:00
Tom Hvitved
961b077954 Swift: Add change note 2024-09-16 19:27:31 +02:00
Dave Bartolomeo
8b4114c422 Merge pull request #17485 from smowton/smowton/admin/merge-rc315-into-main
Merge rc/3.15 into main
2024-09-16 13:05:58 -04:00
Geoffrey White
27dca746ea Merge pull request #17465 from geoffw0/missing
Rust: Add Missing Elements query
2024-09-16 17:46:09 +01:00
Chris Smowton
01b47573b3 Merge remote-tracking branch 'origin/rc/3.15' into smowton/admin/merge-rc315-into-main 2024-09-16 17:36:18 +01:00
Paolo Tranquilli
f949ca919a Merge pull request #17479 from github/redsun82/rust-unextracted
Rust: introduce `Unextracted` and `Missing` "marker" classes
2024-09-16 18:26:55 +02:00
Ian Lynagh
41ed6e6695 Java: Deprecate RefType.nestedName(), and add RefType.getNestedName() 2024-09-16 17:16:25 +01:00
Geoffrey White
b907100d82 Rust: Rename files. 2024-09-16 16:25:56 +01:00
Geoffrey White
f60879bfb5 Rust: Rename missing -> unextracted. 2024-09-16 16:25:55 +01:00
Florin Coada
8090619117 Merge pull request #17456 from github/changedocs/2.18.4
CodeQL 2.18.4 unified changelog
2024-09-16 16:22:01 +01:00
Simon Friis Vindum
a935bded36 Rust: CFG for match expressions 2024-09-16 17:16:37 +02:00
Paolo Tranquilli
de4ab44e06 Merge branch 'main' into redsun82/rust-unextracted 2024-09-16 17:10:26 +02:00
Florin Coada
cbc390ebe5 Merge branch 'rc/3.15' into changedocs/2.18.4 2024-09-16 16:08:52 +01:00
Chris Smowton
30be6803c3 Merge pull request #17480 from github/post-release-prep/codeql-cli-2.19.0
Post-release preparation for codeql-cli-2.19.0
2024-09-16 16:06:58 +01:00
Paolo Tranquilli
d24d933ad7 Merge pull request #17460 from github/redsun82/rust-typed-labels
Rust: introduce typed labels
2024-09-16 16:56:37 +02:00
Paolo Tranquilli
37f3ea137b Merge pull request #17474 from github/redsun82/swift-cfg-order-disambuigation
Swift: tentative fix to Cfg disambuigation
2024-09-16 16:54:26 +02:00
Paolo Tranquilli
cf603108d4 Merge pull request #17478 from github/redsun82/python-fix-ql-test-exclusions
Python: replace `src_archive` exclusion patterns with `*.testproj` ones
2024-09-16 16:53:44 +02:00
Paolo Tranquilli
3eaee1249c Merge pull request #17464 from geoffw0/loc
Rust: Add lines-of-code queries
2024-09-16 16:47:12 +02:00
Paolo Tranquilli
1ce4707ff9 Merge branch 'main' into redsun82/rust-typed-labels 2024-09-16 16:44:55 +02:00
Paolo Tranquilli
d1704cfb14 Merge pull request #17444 from hvitved/rust/final-classes
Rust/Swift: Make all public AST classes `final`
2024-09-16 16:42:40 +02:00
Geoffrey White
3748365729 Rust: Comment out the printlin! macro invocations for now. 2024-09-16 15:29:13 +01:00
github-actions[bot]
79be301984 Post-release preparation for codeql-cli-2.19.0 2024-09-16 14:09:32 +00:00
Paolo Tranquilli
64f77051bd Rust: commit forgotten new files 2024-09-16 16:02:59 +02:00
Paolo Tranquilli
a4399a184a Rust: introduce Unextracted and Missing "marker" classes 2024-09-16 15:49:37 +02:00
Tom Hvitved
964e97c842 Update misc/codegen/lib/ql.py
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
2024-09-16 15:48:13 +02:00
Michael Nebel
bdc00841c0 C#: Add change note. 2024-09-16 15:45:14 +02:00
Michael Nebel
0b579c0a1a C#: Update external models tests and expected test output. 2024-09-16 15:45:12 +02:00
Michael Nebel
308aca632e C#: Make support for Attribute.Getter and Attribute.Setter in MaD. 2024-09-16 15:45:09 +02:00
Michael Nebel
368ba1c5e2 C#: Update external models expected test output. 2024-09-16 15:45:07 +02:00
Michael Nebel
367bbc4039 C#: Add some examples of using attributes on properties and indexers for use in external models. 2024-09-16 15:45:05 +02:00
Michael Nebel
3c97bcb790 C#: Exclude properties from the Attribute selection. 2024-09-16 15:45:03 +02:00
Michael Nebel
5de9e7c3ad C#: Add change note. 2024-09-16 15:39:44 +02:00
Chris Smowton
e99d7db428 Merge pull request #17476 from github/release-prep/2.19.0
Release preparation for version 2.19.0
2024-09-16 14:29:09 +01:00
Michael Nebel
add033249f Merge pull request #17475 from michaelnebel/csharp/indexerattributes
C#: Extract attributes on indexers.
2024-09-16 15:26:53 +02:00
Geoffrey White
63a635c89c Revert "Rust: Restrict the query to user code."
This reverts commit aed44ba5f3.
2024-09-16 13:46:43 +01:00
Paolo Tranquilli
10e42237f3 Codegen: fix test 2024-09-16 14:46:42 +02:00
Tom Hvitved
d0eae97bcf Address review comment 2024-09-16 14:46:23 +02:00
Geoffrey White
7a21b3ba46 Rust: Accept the new results. 2024-09-16 13:42:18 +01:00
Geoffrey White
4656b3a43d Revert "Rust: Only test the 'user code' queries, as the non-user stuff is not stable between platforms."
This reverts commit 00b9647aa1.
2024-09-16 13:39:50 +01:00
Paolo Tranquilli
e280e1ebee Merge pull request #17441 from github/redsun82/rust-cli-flags
Rust: make the cli flags override automatic
2024-09-16 14:37:43 +02:00
Paolo Tranquilli
8953ad6b76 Python: replace src_archive exclusion patterns with *.testproj ones
The `**/src_archive/**` exclusion patterns seem to have to do with
trying to exclude archived source files from being picked up for the
extractor while running the test itself. However it seems that directory
is not being used any more by `codeql` (which uses a `src` directory
instead).

A `*.testproj` exclusion pattern will work in a more robust way, by
excluding any file inside the database being built.
2024-09-16 14:30:55 +02:00
Tom Hvitved
8d68bdf4d6 Codegen: Fix return type of getResolveStep and resolve 2024-09-16 14:19:29 +02:00
Michael Nebel
03ee7b99d2 C#: Add downgrade script. 2024-09-16 14:12:12 +02:00
Michael Nebel
b76613901c C#: Add upgrade script. 2024-09-16 14:12:10 +02:00
Michael Nebel
0104f96f4a C#: Remove metadata_handle part of the extractor implementation. 2024-09-16 14:12:07 +02:00
Michael Nebel
a6f95c577a C#: Remove deprecated predicates. 2024-09-16 14:12:05 +02:00
Michael Nebel
982208cd81 C#: Remove all CIL and Dotnet related tables and types from the dbscheme. 2024-09-16 14:12:03 +02:00
Michael Nebel
21b3daa2c0 C#: Delete Dotnet and CIL library code. 2024-09-16 14:12:01 +02:00
Tom Hvitved
2cafa3c228 Merge pull request #6 from redsun82/rust/final-classes
Pre-commit: bump up `autopep8` check version and fix formatting
2024-09-16 14:09:58 +02:00
Paolo Tranquilli
95b32fb541 Pre-commit: bump up autopep8 check version and fix formatting 2024-09-16 14:03:48 +02:00
Geoffrey White
aed44ba5f3 Rust: Restrict the query to user code. 2024-09-16 12:56:06 +01:00
Tom Hvitved
575023f212 Swift: Add up/downgrade scripts 2024-09-16 13:40:06 +02:00
Tom Hvitved
d2f633b3b4 Swift: Manual changes after running code generator 2024-09-16 13:40:05 +02:00
Tom Hvitved
c785cd9d7b Swift: Revert Impl rename for manually added files 2024-09-16 13:40:03 +02:00
Tom Hvitved
4ab5a1a060 Swift: Run code generator 2024-09-16 13:40:02 +02:00
Tom Hvitved
5fc762d811 Swift: Add Impl suffix to all stub/implementation classes
```
find . -maxdepth 5 -type f -not -name "*Constructor.qll" -print | sed 's/.qll//g' | xargs -I '{}' mv '{}'.qll '{}'Impl.qll
```
2024-09-16 13:39:59 +02:00
Tom Hvitved
683ecc39d8 Rust: Adjust some generated Impl files 2024-09-16 13:39:57 +02:00
Tom Hvitved
4dd3059f16 Rust: Run code generator 2024-09-16 13:39:55 +02:00
Tom Hvitved
9c0cafeeb8 Codegen: Make public AST classes final 2024-09-16 13:39:53 +02:00
Paolo Tranquilli
73e9b46853 Rust/Codegen: make () -> () the default signature 2024-09-16 13:32:55 +02:00
Chris Smowton
be02864281 Copyedit 2024-09-16 12:25:49 +01:00
Chris Smowton
8c92d92427 Copyedit 2024-09-16 12:23:10 +01:00
Chris Smowton
8f345f9618 Copyedit Java change note 2024-09-16 12:22:20 +01:00
Simon Friis Vindum
04aa7b471b Rust: Add support in CFG for various simple AST nodes 2024-09-16 13:22:15 +02:00
Tamás Vajk
d72f8b2e46 Merge pull request #17455 from tamasvajk/add-launch-json
C#: Add VSCode `launch.json`
2024-09-16 13:19:04 +02:00
Geoffrey White
fb6fbf6d21 Rust: Repair after Unimplemented.getLocation was removed. 2024-09-16 12:06:51 +01:00
github-actions[bot]
acdafd9646 Release preparation for version 2.19.0 2024-09-16 10:56:10 +00:00
Geoffrey White
00b9647aa1 Rust: Only test the 'user code' queries, as the non-user stuff is not stable between platforms. 2024-09-16 11:49:27 +01:00
Geoffrey White
c61970d8fe Merge branch 'main' into loc 2024-09-16 11:49:01 +01:00
Michael Nebel
f2360542e0 C#: Add change note. 2024-09-16 11:00:37 +02:00
Michael Nebel
7db73c8771 C#: Update expected test output. 2024-09-16 10:57:25 +02:00
Michael Nebel
1eff6fdf73 C#: Add extractor support for attributes on indexers. 2024-09-16 10:53:45 +02:00
Michael Nebel
5c5da3791e C#: Update attributes expected test output. 2024-09-16 10:53:00 +02:00
Paolo Tranquilli
ece815750e Merge branch 'main' into redsun82/rust-typed-labels 2024-09-16 10:51:07 +02:00
Michael Nebel
cc0d99a141 C#: Add attibute test examples for properties and indexers. 2024-09-16 10:50:51 +02:00
Simon Friis Vindum
c62c397cda Merge branch 'main' into rust-improve-cfg 2024-09-16 10:34:15 +02:00
Chris Smowton
030977003e Merge pull request #17472 from github/dbartol/rc-3.15-mergeback
Mergeback from `rc/3.15`
2024-09-16 09:10:45 +01:00
Paolo Tranquilli
f1233b14e8 Rust: fix generated hierarchy 2024-09-16 10:06:01 +02:00
Arthur Baars
ab4788a2ce Merge branch 'main' into missing 2024-09-16 09:50:56 +02:00
Arthur Baars
762bf87663 Merge branch 'main' into loc 2024-09-16 09:50:48 +02:00
Paolo Tranquilli
cb53911224 Merge branch 'main' into redsun82/rust-cli-flags 2024-09-16 09:36:06 +02:00
Paolo Tranquilli
39ce3fbd33 Merge pull request #17463 from hvitved/swift/callable-ast-node
Swift: Make `Callable` a sub type of `AstNode`
2024-09-16 09:27:41 +02:00
Paolo Tranquilli
d74dd2161a Swift: tentative fix to Cfg disambuigation 2024-09-16 09:14:09 +02:00
Paolo Tranquilli
e1ac40e750 Merge pull request #17432 from github/aibaars/rust-doc-tests
Rust: AST: add docs with examples for qltest
2024-09-16 09:00:31 +02:00
Tom Hvitved
74440273f1 Swift: Add DB up/downgrade scripts 2024-09-16 08:47:49 +02:00
Porcupiney Hairs
e768e2e5fe Include changes from review 2024-09-16 05:17:11 +05:30
Dave Bartolomeo
d6a7c87696 Update test expectations after merge 2024-09-15 13:42:46 +00:00
Dave Bartolomeo
485fc04029 Initial merge from main 2024-09-15 08:55:31 -04:00
Geoffrey White
36f54cc6c9 Rust: Clean up the query output. 2024-09-13 19:18:03 +01:00
Geoffrey White
551c4e83f4 Rust: Improve getNumberOfLinesOfCode (in particular, it will now include the closing of blocks { } ). 2024-09-13 18:23:11 +01:00
Geoffrey White
0d5c25b400 Rust: Repair getNumberOfLinesOfCode. 2024-09-13 18:19:01 +01:00
Arthur Baars
7f8bb7e859 Apply clippy fixes 2024-09-13 19:00:28 +02:00
Geoffrey White
d21cbe57aa Merge branch 'main' into loc 2024-09-13 17:55:09 +01:00
Arthur Baars
90537f9132 Fix other QL code
This reverts commit 5c02fb4a2e.
2024-09-13 18:47:10 +02:00
Geoffrey White
57eafb81c7 Rust: Update results for changes on main. 2024-09-13 17:40:44 +01:00
Arthur Baars
3fdc49c4cb Rename Literal, Type, and BinExpr 2024-09-13 18:33:55 +02:00
Geoffrey White
81aeb3b755 Merge branch 'main' into missing 2024-09-13 17:33:46 +01:00
Arthur Baars
ebe1e5e0d2 Fix locations for Path and LiteralOrConstPat 2024-09-13 18:23:39 +02:00
Arthur Baars
661a4e07be Merge remote-tracking branch 'upstream/main' into aibaars/rust-doc-tests 2024-09-13 17:31:38 +02:00
Paolo Tranquilli
8f93f5e34b Rust: move to Label<T> and mark unsafety of from_untyped 2024-09-13 17:17:19 +02:00
Paolo Tranquilli
5108799224 Merge pull request #17448 from github/redsun82/rust-std-files
Rust: integrate into standard files+location library
2024-09-13 16:23:25 +02:00
Simon Friis Vindum
afa4e79756 Rust: Add support for more AST nodes to CFG contruction 2024-09-13 16:22:18 +02:00
Simon Friis Vindum
9061536cca Rust: Make logical operator pre order nodes and eliminate impossible paths in CFG 2024-09-13 16:14:33 +02:00
Geoffrey White
a3de3a1c51 Rust: Update results for latest main. 2024-09-13 15:10:38 +01:00
Geoffrey White
af7cd238e5 Rust: Test query for missing elements. 2024-09-13 15:09:18 +01:00
Geoffrey White
2894653421 Rust: Query for missing elements. 2024-09-13 15:09:17 +01:00
Rasmus Wriedt Larsen
13a4df9b68 Go: autoformat 2024-09-13 16:07:27 +02:00
Geoffrey White
6e01270fec Rust: Better (still incomplete) results on latest main. 2024-09-13 15:06:22 +01:00
Geoffrey White
fdf079265d Rust: Add test. 2024-09-13 15:05:20 +01:00
Geoffrey White
c124820256 Rust: Add summary stats query showing all of the summary data, for convenience. 2024-09-13 15:05:19 +01:00
Geoffrey White
6e9f2a3b61 Rust: Add tests. 2024-09-13 15:05:18 +01:00
Geoffrey White
2f98c5ba47 Rust: Add lines-of-code queries. 2024-09-13 15:05:17 +01:00
Paolo Tranquilli
c7be2ae08a Merge pull request #17462 from github/redsun82/rust-codegen-codeql
Rust: fetch `codeql` prior to checking `codegen`
2024-09-13 15:45:36 +02:00
Tom Hvitved
4912ee8ab3 Swift: Make Callable a sub type of AstNode 2024-09-13 15:39:40 +02:00
Jeroen Ketema
087a8484aa Merge pull request #17430 from jketema/fix-finally-inconsistency
C++: Fix `__finally` related inconsistencies
2024-09-13 15:27:56 +02:00
Geoffrey White
e1299143c6 Merge pull request #17442 from geoffw0/files
Rust: Extracted Files diagnostic query
2024-09-13 14:13:43 +01:00
Geoffrey White
40c5f10fea Merge pull request #17450 from geoffw0/rustsuite
Rust: Add query suites
2024-09-13 14:13:07 +01:00
Paolo Tranquilli
5cd4d88d44 Rust: fetch codeql prior to checking codegen 2024-09-13 14:35:24 +02:00
Paolo Tranquilli
faf1eeeb0d Rust: introduce typed labels 2024-09-13 13:57:14 +02:00
Paolo Tranquilli
23dd572d5e Rust: add CODEQL_ base env layer 2024-09-13 13:39:39 +02:00
Arthur Baars
d73d90dba2 Avoid use of plain 'None' in tests
For some reason the parser resolves the ambiguity between None as a PathPat or IdentPat
differently on the Action runners vs local machine.
2024-09-13 12:48:58 +02:00
Simon Friis Vindum
61aad2ec68 Rust: Sort CFG trees and add scope for closures 2024-09-13 11:57:31 +02:00
Simon Friis Vindum
1a85dfd9ce Rust: Loops propagate CFG return completions but captures continue and break 2024-09-13 11:51:16 +02:00
Arthur Baars
e68229892e Add some more QL docs 2024-09-13 11:48:36 +02:00
Arthur Baars
5c02fb4a2e Fix CFG library 2024-09-13 11:41:21 +02:00
Simon Friis Vindum
b979df61ea Rust: Handle functions correctly through scope in CFG 2024-09-13 11:40:26 +02:00
Florin Coada
194c2fa9c4 Add changedocs for 2.18.4 2024-09-13 10:18:04 +01:00
Arthur Baars
e46ad61bb8 Update test data 2024-09-13 11:16:25 +02:00
Arthur Baars
d99c2031ac Workaround nameclash in dbscheme generator 2024-09-13 11:07:02 +02:00
Geoffrey White
587ebbffba Rust: Edit test slightly to avoid DBCheck failure. 2024-09-13 10:02:28 +01:00
Arthur Baars
b0939cfffa Update extractor 2024-09-13 10:58:01 +02:00
Arthur Baars
fa9cfc1104 Regenerate code 2024-09-13 10:52:43 +02:00
Arthur Baars
8dcf93d065 Make class names match rust.ungram
811905fce8/crates/syntax/rust.ungram
2024-09-13 10:51:11 +02:00
Arthur Baars
452424a0d2 Fix tests for Path and TypeRef 2024-09-13 10:25:36 +02:00
Arthur Baars
085aad3b3c Update test data 2024-09-13 10:22:01 +02:00
Arthur Baars
c634b0a000 Don't extract non-source crates 2024-09-13 10:16:53 +02:00
Arthur Baars
197fb04184 Improve docs 2024-09-13 10:16:34 +02:00
Tamas Vajk
549b294a05 C#: Add VSCode launch.json 2024-09-13 09:42:55 +02:00
Kevin Stubbings
c30332818f Reorder and rename 2024-09-13 00:41:55 -07:00
Kevin Stubbings
03f375e436 missed some 2024-09-13 00:21:33 -07:00
Paolo Tranquilli
403cc3df90 Rust: avoid cli flag defaults overriding env settings 2024-09-13 06:50:12 +02:00
Kevin Stubbings
7657b3e115 Fix tests 2024-09-12 21:30:32 -07:00
Kevin Stubbings
831d522025 First round feedback 2024-09-12 20:49:10 -07:00
Arthur Baars
c825ae4eab Add some examples for some of the unimplemented nodes 2024-09-12 22:18:02 +02:00
Arthur Baars
8e378d86df Update test data 2024-09-12 22:18:00 +02:00
Arthur Baars
7572546efa Improve handling of unimplemented nodes 2024-09-12 22:17:39 +02:00
Arthur Baars
69761a2942 Rust: AST: add docs with examples for qltest 2024-09-12 19:54:37 +02:00
Arthur Baars
292c6b6159 Clear out unused comments 2024-09-12 17:58:17 +02:00
Arthur Baars
2a88086544 Rust: AST: add docs with examples for qltest 2024-09-12 17:58:15 +02:00
Simon Friis Vindum
f73680ba21 Rust: Handle short-circuiting logical binary operators 2024-09-12 17:30:05 +02:00
Geoffrey White
7907cbeae1 Rust: Add query suites (identical to the Swift ones apart from their names). 2024-09-12 15:55:06 +01:00
Paolo Tranquilli
0b850a2dff Rust: add missing doc 2024-09-12 16:51:52 +02:00
Simon Friis Vindum
c821ec21bb Rust: CFG edge for return in functions 2024-09-12 16:25:43 +02:00
Paolo Tranquilli
beb27bf5e3 Rust: fix QL compilation and schema includes ordering 2024-09-12 15:05:30 +02:00
Simon Friis Vindum
e1f2fa8c7e Rust: Support break and continue in loops 2024-09-12 14:07:43 +02:00
Geoffrey White
f77c79593e Rust: Updated expected for changes on main. 2024-09-12 12:46:04 +01:00
Geoffrey White
9d8b514b5c Merge remote-tracking branch 'upstream/main' into files 2024-09-12 12:29:44 +01:00
Paolo Tranquilli
b4b680775c Rust: integrate into standard files+location library 2024-09-12 13:17:10 +02:00
Tamás Vajk
9250c29bd5 Merge pull request #17439 from tamasvajk/feature/include-razor-files-in-fromSource
C#: Include `.razor` files in `File::fromSource`
2024-09-12 13:14:34 +02:00
Paolo Tranquilli
a4c1ec75db Merge pull request #17445 from github/redsun82/rust-qltest
Rust: make ql tests extract files together
2024-09-12 12:53:16 +02:00
Paolo Tranquilli
ed0370b715 Rust: update rust/tools/qltest.sh
Co-authored-by: Arthur Baars <aibaars@github.com>
2024-09-12 12:28:22 +02:00
Simon Friis Vindum
3dc517c82b Rust: Handle absence of else branch in if expression in CFG 2024-09-12 10:35:00 +02:00
Rasmus Wriedt Larsen
66b61ee25a Go/Java/C#: Add change-note 2024-09-12 10:16:55 +02:00
Rasmus Wriedt Larsen
8c10155eb7 mass rename to ActiveThreatModelSource 2024-09-12 10:16:55 +02:00
Simon Friis Vindum
67a06cb772 Rust: Support loop in CFG 2024-09-12 09:29:19 +02:00
Paolo Tranquilli
aeae922ef3 Rust: make ql tests extract files together
For the moment this removes the possibility to set custom flags or env
variables for the extractor via comments, but that can be added back
easily if needed with a different mechanism (like an `env` file).
2024-09-12 09:13:35 +02:00
Paolo Tranquilli
5ae8824303 Rust: add context to parameter file expansion errors 2024-09-12 08:56:07 +02:00
Paolo Tranquilli
6adf88542e Rust: fix linting script 2024-09-12 08:53:08 +02:00
Paolo Tranquilli
0a8c0f5ab4 Rust: fix bazel build 2024-09-12 08:46:50 +02:00
Owen Mansel-Chan
076dd07cdc Merge pull request #17429 from owen-mc/go/fix/multiple-anonymous-type-parameters
Go: fix multiple anonymous type parameters
2024-09-12 00:38:56 +01:00
Chuan-kai Lin
ff78bebf19 Shared support for alert filtering 2024-09-11 13:18:26 -07:00
Geoffrey White
c2e86423b9 Rust: Test the successfully extracted files diagnostic. 2024-09-11 17:10:08 +01:00
Geoffrey White
f1d281ffcc Rust: Add test cases for diagnostics. 2024-09-11 17:10:07 +01:00
Paolo Tranquilli
5bfe2a9e18 Merge branch 'main' into redsun82/rust-cli-flags 2024-09-11 18:00:47 +02:00
Geoffrey White
a933f0d695 Rust: Add diagnostic query for successfully extracted files. 2024-09-11 16:45:33 +01:00
Paolo Tranquilli
f9e4c0af13 Merge pull request #17435 from github/rust-experiment
Rust: merge current status of experimental extractor into main
2024-09-11 17:31:24 +02:00
Paolo Tranquilli
1b3a5cdab1 Rust: make the cli flags override automatic
This makes the clap flags overlay over `Config` entirely derived via an
attribute macro. Also, the `--intputs-file` option is replaced by a more
standard and versatile `@` parameter file mechanism.
2024-09-11 17:28:59 +02:00
Tamas Vajk
da3c5f44f2 C#: Include .razor files in File::fromSource 2024-09-11 16:13:42 +02:00
Asger F
07bd854868 Merge pull request #17401 from pwntester/js/actions/secrets-in-artifacts
Javascript: Query to detect GITHUB_TOKEN leaked in artifacts
2024-09-11 15:54:36 +02:00
Andrew Eisenberg
15cdc7210e Merge pull request #17431 from github/aeisenberg/query-add-autofix 2024-09-11 06:34:08 -07:00
Owen Mansel-Chan
f46b4b344f Merge pull request #17277 from github/owen-mc-patch-1
Docs: Give clearer example of multiple query predicates in one ql file
2024-09-11 14:22:33 +01:00
Simon Friis Vindum
fea6017688 Merge pull request #17415 from paldepind/rust-control-flow-graph
Rust: Basic control flow graph setup
2024-09-11 15:08:33 +02:00
Paolo Tranquilli
43984212a5 Merge branch 'main' into rust-experiment 2024-09-11 13:52:38 +02:00
Sid Shankar
983eb1924f Merge pull request #17433 from github/sidshank/ts-5.6 2024-09-11 07:23:00 -04:00
Paolo Tranquilli
e4766b60c3 Rust: make QL test crates workspaces 2024-09-11 11:29:04 +02:00
Simon Friis Vindum
857edb791c Rust: Fix control flow tree for function and block expression 2024-09-11 11:18:56 +02:00
Paolo Tranquilli
8bf3c42213 Merge branch 'main' into rust-experiment 2024-09-11 11:06:24 +02:00
Paolo Tranquilli
d8db0e43da Ruby: update new cargo target directory in make and actions 2024-09-11 11:01:10 +02:00
Paolo Tranquilli
aa6726a401 Bazel: bump up rules_rust version 2024-09-11 10:43:49 +02:00
Geoffrey White
d374935008 Merge pull request #17384 from microsoft/brodes/overflow-buffer-fixes-upstream
Brodes/overflow buffer fixes upstream
2024-09-11 09:12:22 +01:00
Paolo Tranquilli
f624a1b7a7 Ruby: fix extractor pack script after workspace root change 2024-09-11 09:40:44 +02:00
Simon Friis Vindum
809d040528 Make more classes private and final 2024-09-11 09:37:39 +02:00
Paolo Tranquilli
2a7533c441 Rust: add to `labeler.yml 2024-09-11 09:33:43 +02:00
Paolo Tranquilli
304e68df30 Merge pull request #17426 from geoffw0/readme
Rust: Add a README.md
2024-09-11 09:26:27 +02:00
Paolo Tranquilli
f464759eb3 Merge pull request #17434 from github/redsun82/rust-experiment
Bazel: remove non-working fake `tree-sitter-extractor` workaround
2024-09-11 09:14:59 +02:00
Simon Friis Vindum
6d972bea2c Rust: Add a few control flow tree classes 2024-09-11 09:08:54 +02:00
Simon Friis Vindum
91d5171d90 Add base setup for control flow graph construction 2024-09-11 09:08:53 +02:00
Paolo Tranquilli
f8c9d96882 Bazel: remove non-working fake tree-sitter-extractor workaround
The `.cargo/config.toml` override based workaround wasn't really
working, as while `cargo build|check` was reading that, `cargo metadata`
wasn't, ending up in a completely broken IDE experience.

For the moment, we just use a unified workspace `Cargo.toml` for all
extractors using the shared tree-sitter code, which has the downside of
making bazel pull in dependencies for all of them, and not being able to
do sparse checkouts for them. We should investigate and rivist this in
the future.
2024-09-11 08:17:11 +02:00
Sid Shankar
bc70d5ceb1 Adds change note 2024-09-11 00:52:21 +00:00
Sid Shankar
3436fc6177 Updates supported compiler docs 2024-09-11 00:46:09 +00:00
Sid Shankar
3516117215 Adds test for arbitrary specifiers in TS files
Adds test for arbitrary identifiers used in imports and exports
2024-09-11 00:37:49 +00:00
Sid Shankar
785af12f1c Renames test file 2024-09-11 00:28:44 +00:00
Sid Shankar
aa787a9cb1 Handles arbitrary module identifiers
This commit enables support for arbitrary names for identifier and namespace imports and exports
2024-09-11 00:27:42 +00:00
Sid Shankar
2c74b5ee50 Updates TS extractor dependency to 5.6.2 2024-09-11 00:22:17 +00:00
Owen Mansel-Chan
13f8488148 Undo spurious test changes
The go libraries on my local computer seem to have
slightly different go libraries for some reason.
2024-09-10 23:50:33 +01:00
Alvaro Muñoz
061d58ae4a Update javascript/ql/src/change-notes/2024-09-06-new-actions-artifact-leak-query.md
Co-authored-by: Asger F <asgerf@github.com>
2024-09-10 22:18:04 +02:00
Jeroen Ketema
ca10953761 C++: Update syntax zoo expected test results 2024-09-10 21:25:29 +02:00
Andrew Eisenberg
969c57c1c8 Update pull_request_template.md
Include a reminder about adding a query to autofix,
2024-09-10 11:42:14 -07:00
Jeroen Ketema
5754f8bac8 C++: Fix __finally related inconsistencies 2024-09-10 20:39:13 +02:00
Ben Rodes
58779e1b90 Merge branch 'main' into brodes/overflow-buffer-fixes-upstream 2024-09-10 13:46:24 -04:00
Jeroen Ketema
4c8aec0db5 Merge pull request #17421 from jketema/fix-except-inconsistency
C++: Fix IR inconsistency due to throwing `__except` block
2024-09-10 18:37:10 +02:00
Geoffrey White
7c95bb243e Rust: Update example path. 2024-09-10 17:09:51 +01:00
Geoffrey White
6b0d7bcda8 Rust: Remove repo warning because we're merging into main real soon now... 2024-09-10 17:08:11 +01:00
Owen Mansel-Chan
270fa8d507 Add change note 2024-09-10 16:58:24 +01:00
Owen Mansel-Chan
84c41744c1 Include type parameter's index in its label 2024-09-10 16:52:44 +01:00
Owen Mansel-Chan
9aafcbc1e3 Add test for multiple anonymous type parameters 2024-09-10 16:40:53 +01:00
Paolo Tranquilli
4f90f5fb4c Rust: accept test changes 2024-09-10 17:36:18 +02:00
Paolo Tranquilli
d04f0200e2 Rust: skip change note check for now 2024-09-10 17:35:53 +02:00
Arthur Baars
00bc40765c Merge pull request #17427 from github/aibaars/rust-experiment
Fix definition of trap compression option
2024-09-10 17:15:04 +02:00
Arthur Baars
d6d52a97a2 Fix definition of trap compression option
unless the -Oextract_dependencies=true flag is supplied
2024-09-10 17:13:49 +02:00
Paolo Tranquilli
9c8f6145ab Merge pull request #17408 from github/aibaars/rust-experiment
Rust: add partial extractor for Expr, Statement, Pattern
2024-09-10 17:09:47 +02:00
Geoffrey White
d9a37119f8 Update rust/README.md
Co-authored-by: Paolo Tranquilli <redsun82@github.com>
2024-09-10 16:04:22 +01:00
Geoffrey White
ac9afea75e Rust: Add experimental warning and Bazelisk link. 2024-09-10 16:02:53 +01:00
Arthur Baars
bffdf2b179 Replace println with log statements 2024-09-10 16:59:32 +02:00
Rasmus Wriedt Larsen
e11bfc27bd Docs: Fix link 2024-09-10 16:53:52 +02:00
Arthur Baars
f37b4aebc2 Only extract function bodies for local crates,
unless the -Oextract_dependencies=true flag is supplied
2024-09-10 16:49:13 +02:00
Arthur Baars
43e54fb0ae Use custom target folder 2024-09-10 16:49:12 +02:00
Geoffrey White
8213bbb14a Rust: Add a README.md 2024-09-10 15:47:40 +01:00
Rasmus Wriedt Larsen
e35c2b243a Docs: Include 'Threat models' for Python 2024-09-10 16:44:03 +02:00
Michael Nebel
0abc08c773 C#: Add some synthetic field content based examples. 2024-09-10 15:24:00 +02:00
Michael Nebel
b94940b6d9 C#: Adjust existing model generator tests and update expected output. 2024-09-10 15:23:57 +02:00
Michael Nebel
da012a7a44 C#: Add the capture content summary models query. 2024-09-10 15:23:54 +02:00
Michael Nebel
e94890280a C#: Sync changes and make language specific parts. 2024-09-10 15:23:51 +02:00
Michael Nebel
0fbeca14ad Java: Add content based example with multiple paths. 2024-09-10 15:23:44 +02:00
Michael Nebel
9149a17d79 Java: Only keep the best generated model in terms of taint/value. 2024-09-10 15:23:38 +02:00
Michael Nebel
d7e61d07d1 Java: Update some model generator test cases. 2024-09-10 15:23:34 +02:00
Michael Nebel
d2c98c86dc Java: Improve content based model generation. 2024-09-10 15:23:20 +02:00
Michael Nebel
7c0101ad06 Shared: Add some helper predicates to the AccessPath class in content flow. 2024-09-10 15:23:08 +02:00
Arthur Baars
1e830dad1a Add ra_ap_paths dependency 2024-09-10 15:14:36 +02:00
Chuan-kai Lin
ba5218dfc0 Merge pull request #17420 from github/cklin/upgrade-properties-fix
C#: Fix trivial upgrade.properties errors
2024-09-10 06:11:23 -07:00
Paolo Tranquilli
26b9de3d63 Merge branch 'main' into rust-experiment 2024-09-10 15:00:20 +02:00
Rasmus Wriedt Larsen
038bc832a7 Go/Java/C#: Rename to ActiveThreatModelSource
As part of adding support for threat-models to Python/JS (see
https://github.com/github/codeql/pull/17203), we ran into some trouble
with name clashes.

Naming in existing languages supporting threat-models:
- `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 we had to come up with new names.

Initially I used `ThreatModelSource` for the "QL only modeling", but
that meant that we needed a new name to represent the active sources
coming from either QL or data-extensions... for this I came up with
`ActiveThreatModelSource`, and I really liked it. To me, it's much
clearer that this class only contains the currently active threat
model sources.

So to align languages, I got approval from @michaelnebel to rename the
existing classes.
2024-09-10 14:46:15 +02:00
Rasmus Wriedt Larsen
5ff7b6557f Python: Add links to threat-model docs 2024-09-10 14:32:39 +02:00
Rasmus Wriedt Larsen
cbebf7b392 Python: Additional threatModelSource annotations 2024-09-10 14:32:39 +02:00
Rasmus Wriedt Larsen
333367c07d Python: Add threat-modeling of raw_input 2024-09-10 14:32:39 +02:00
Rasmus Wriedt Larsen
7d3793e718 Docs: Update threat-model list to include Python 2024-09-10 14:32:38 +02:00
Rasmus Wriedt Larsen
0ccb5b198a Python: Add change-note 2024-09-10 14:32:38 +02:00
Rasmus Wriedt Larsen
a0b24d6194 Python: Add e2e threat-model test 2024-09-10 14:32:38 +02:00
Rasmus Wriedt Larsen
8d8cd05b94 Python: Add basic support for database threat-model 2024-09-10 14:32:37 +02:00
Rasmus Wriedt Larsen
7483075b7e Python: Fixup modeling of os.open 2024-09-10 14:32:37 +02:00
Rasmus Wriedt Larsen
d245db54a1 Python: Model file threat-model 2024-09-10 14:32:37 +02:00
Rasmus Wriedt Larsen
66f389a4b6 Python: Model stdin thread-model 2024-09-10 14:32:36 +02:00
Rasmus Wriedt Larsen
e1801f3a29 Python: Proper threat-model handling for argparse 2024-09-10 14:32:36 +02:00
Rasmus Wriedt Larsen
56c85ffe54 Python: Fixup threat-models for os.environ.get()
Since using `.DictionaryElementAny` doesn't actually do a store on the
source, (so we can later follow any dict read-steps).

I added the ensure_tainted steps to highlight that the result of the
WHOLE expression ends up "tainted", and that we don't just mark
`os.environ` as the source without further flow.
2024-09-10 14:32:36 +02:00
Rasmus Wriedt Larsen
b9239d7101 Python: Add basic support for environment/commandargs threat-models 2024-09-10 14:32:36 +02:00
Rasmus Wriedt Larsen
528f08fb83 Python: Make queries use ActiveThreatModelSource 2024-09-10 14:32:35 +02:00
Jeroen Ketema
5f4fee0780 C++: Address review comments 2024-09-10 14:23:10 +02:00
Arthur Baars
a5d1d9e167 Make implementation more complete
Use Unimplemented to mark AstNodes  that need implementing
2024-09-10 14:13:05 +02:00
Jeroen Ketema
500a2a0738 C++: Fix IR inconsistency due to throwing __except block
The fix consists of three parts:
* Ensure that an `Unwind` instruction is generated for functions that contain
  a Microsoft `__try` statement, or a function that must throw.
* Do not manually introduce `Unwind` instructions for `__except` blocks, but
  depend on the `Unwind` that we now insert in the function.
* Add missing `getExceptionSuccessorInstruction` predicate to
  `TranslatedMicrosoftTryExceptHandler`
2024-09-10 12:41:43 +02:00
Arthur Baars
2ae725784c Don't use _ to ignore things so rustc will show warnings for all the gaps in the implementation 2024-09-10 12:26:56 +02:00
Arthur Baars
b2451c6667 Improve schema 2024-09-10 12:26:54 +02:00
Arthur Baars
46bfefc99a Address comments 2024-09-10 12:26:53 +02:00
Paolo Tranquilli
ef06b555c1 Rust: accept test changes 2024-09-10 11:29:54 +02:00
Jeroen Ketema
90f7b30997 Merge pull request #17418 from jketema/throw-inconsistent
C++: Add IR inconsistency test
2024-09-10 11:07:16 +02:00
Paolo Tranquilli
437b671035 Merge branch 'rust-experiment' into aibaars/rust-experiment
Also fixed conflicts and applied linting (can be done via
`rust/lint.py` or `pre-commit` configuration).
2024-09-10 10:24:49 +02:00
Paolo Tranquilli
38c25f96e5 Rust: add linting pre-commit hook 2024-09-10 10:22:45 +02:00
Paolo Tranquilli
37afad2f70 Merge pull request #17410 from github/redsun82/rust-ci
Rust: set up `codeql` CI
2024-09-10 10:04:24 +02:00
Dave Bartolomeo
ae3f3d0c25 Merge pull request #17419 from github/dbartol/cherry-pick-ruby
Fix upload in Ruby build
2024-09-09 16:49:57 -04:00
Dave Bartolomeo
78281168c2 Merge pull request #17417 from github/post-release-prep/codeql-cli-2.18.4
Post-release preparation for codeql-cli-2.18.4
2024-09-09 16:45:30 -04:00
Chuan-kai Lin
fae180f612 C#: Fix trivial upgrade.properties errors 2024-09-09 13:33:04 -07:00
Dave Bartolomeo
5961774f84 Include hidden files when uploading Ruby pack 2024-09-09 16:22:43 -04:00
Jeroen Ketema
dfa16423c0 C++: Add IR inconsistency test 2024-09-09 21:50:42 +02:00
github-actions[bot]
97edff3f70 Post-release preparation for codeql-cli-2.18.4 2024-09-09 18:45:46 +00:00
Dave Bartolomeo
561abced2d Merge pull request #17416 from github/release-prep/2.18.4
Release preparation for version 2.18.4
2024-09-09 12:25:56 -04:00
Jeroen Ketema
6e0b5bcb63 Merge pull request #17414 from MathiasVP/add-more-try-except-testcases
C++: Add more IR inconsistency tests
2024-09-09 18:10:42 +02:00
github-actions[bot]
91537cdf9a Release preparation for version 2.18.4 2024-09-09 16:08:48 +00:00
Mathias Vorreiter Pedersen
353cd8cc74 C++: Add more IR inconsistency tests. 2024-09-09 16:37:55 +01:00
Arthur Baars
42b1112be6 Rust: add default Element::toString 2024-09-09 15:05:04 +02:00
Arthur Baars
20ca8801e6 Revert "Rust: PrintAstNode: tolerate elements without toString"
This reverts commit 85e51bf0ec.
2024-09-09 15:01:32 +02:00
Arthur Baars
61592a3256 Rust: fix locations
In QL locations are 1-based inclusive ranges. The locations is rust are 0-based
and the end position is exclusive.

To patch things up, subtract 1 from the end offset and add 1 to all line and column numbers.
2024-09-09 14:56:37 +02:00
Jeroen Ketema
1250e72ebb Merge pull request #17399 from jketema/simplify
C++: Re-introduce the original version of the `many_defs_per_use` IR test
2024-09-09 14:18:19 +02:00
Paolo Tranquilli
6f36ea9188 Merge branch 'main' into rust-experiment
Conflicts:
  shared/tree-sitter-extractor/src/trap.rs
2024-09-09 14:15:34 +02:00
Paolo Tranquilli
f1cd9211e7 Merge pull request #17407 from github/redsun82/rust-extractor-generalize-location-cache
Tree-sitter: allow multiple sources per trap file
2024-09-09 14:12:33 +02:00
Michael B. Gale
6c8780a2f9 Merge pull request #17395 from github/mbg/go/1.23-changenote
Go: Add change note and update docs for Go 1.23
2024-09-09 13:06:46 +01:00
Arthur Baars
86215b4f02 Rename IfLet to IfStmt 2024-09-09 13:33:17 +02:00
Arthur Baars
85e51bf0ec Rust: PrintAstNode: tolerate elements without toString 2024-09-09 13:29:49 +02:00
Arthur Baars
b40476423b Rust: schema.py add '| child' markers 2024-09-09 13:29:45 +02:00
Arthur Baars
6acc107021 Prevent a panic on generated labels 2024-09-09 13:25:46 +02:00
Arthur Baars
6e6942b1d7 Rust: initial extractor for expressions and patterns 2024-09-09 13:25:45 +02:00
Arthur Baars
da8750e95e Rust: extract each project only once 2024-09-09 13:25:44 +02:00
Arthur Baars
7c4383975f Filter out trailing empty strings 2024-09-09 13:25:43 +02:00
Michael B. Gale
d69c1e9af6 Accept suggestion from review
Co-authored-by: Chris Smowton <smowton@github.com>
2024-09-09 12:19:30 +01:00
Paolo Tranquilli
45c9eb1b94 Merge pull request #17411 from github/redsun82/rust-ci-internal
Rust: add dummy integration test
2024-09-09 13:06:29 +02:00
Paolo Tranquilli
d6b8dd15a9 Rust: add dummy integration test 2024-09-09 12:57:47 +02:00
Paolo Tranquilli
b0ca7935d7 Rust: update generated list file 2024-09-09 12:32:54 +02:00
Paolo Tranquilli
573b8b9373 Merge branch 'rust-experiment' into redsun82/rust-ci 2024-09-09 12:32:02 +02:00
Paolo Tranquilli
56e127849f Rust/Codegen: fix generated list files 2024-09-09 12:31:09 +02:00
Paolo Tranquilli
9d08d248fe Merge pull request #17396 from github/redsun82/rust-doctest-gen
Rust: generate test code from schema docstrings
2024-09-09 12:21:22 +02:00
Paolo Tranquilli
10a23c0843 Merge branch 'rust-experiment' into redsun82/rust-doctest-gen 2024-09-09 12:20:55 +02:00
Paolo Tranquilli
c979a949e1 Rust: fix CI codegen check 2024-09-09 12:15:07 +02:00
Paolo Tranquilli
ee2a8b09f6 Rust: fix formatting 2024-09-09 12:11:50 +02:00
Paolo Tranquilli
4512e4280d Rust: add CI 2024-09-09 12:05:31 +02:00
Paolo Tranquilli
d8f37cf1f9 Rust: add codegen pre commit hook 2024-09-09 12:05:28 +02:00
Paolo Tranquilli
2c472dd5b8 Tree-sitter: fix formatting 2024-09-09 11:59:17 +02:00
Joe Farebrother
d1cca13563 Merge pull request #17314 from joefarebrother/python-x509-cert
Python: Exclude certificate classification fo sensitive data queries
2024-09-09 10:48:36 +01:00
Arthur Baars
ef34d24e53 Merge pull request #17390 from github/aibaars/rust-experiment
Add Expr, Stmt, Pat to schema.py
2024-09-09 11:27:53 +02:00
Paolo Tranquilli
7637393f75 Rust: resolve clippy and rustc warnings 2024-09-09 10:28:50 +02:00
Paolo Tranquilli
4454566d8d Tree-sitter: allow multiple sources per trap file
This generalizes the location cache to allow multiple sources to be
extracted in the same trap file, by adding `file_label` to `Location`,
and therefore to location cache keys. This will be used by the Rust
extractor.
2024-09-09 09:17:45 +02:00
Paolo Tranquilli
3cd8aaf4b0 Rust: simplify rust doc test annotation 2024-09-09 08:59:17 +02:00
Arthur Baars
c8f73587cc Rust: codegen: fix generated code 2024-09-07 10:32:59 +02:00
Alvaro Muñoz
d34a0ba306 Add change note 2024-09-06 23:28:57 +02:00
Alvaro Muñoz
5d1da861a2 fix: Use YamlScalar for booleans 2024-09-06 23:21:41 +02:00
Alvaro Muñoz
5df3af2272 Fix alert message 2024-09-06 23:06:57 +02:00
Alvaro Muñoz
d9e8792d33 [javascript] Query to detect GITHUB_TOKEN leaked in artifacts 2024-09-06 22:55:58 +02:00
Michael B. Gale
e165fc77b5 Merge pull request #17386 from github/dependabot/go_modules/go/extractor/extractor-dependencies-cf6e4563c3
Bump golang.org/x/mod from 0.20.0 to 0.21.0 in /go/extractor in the extractor-dependencies group
2024-09-06 18:54:36 +01:00
Arthur Baars
1a9b2329f4 Add SlicePat::{slice, suffix} 2024-09-06 19:27:35 +02:00
Arthur Baars
406d03edfc Rename IfLet::else_branch to IfLet::else_ 2024-09-06 18:40:03 +02:00
Arthur Baars
e8277015ab Add subclasses for Array 2024-09-06 18:23:01 +02:00
Arthur Baars
69b05e835c Add fields for OffsetOf 2024-09-06 18:17:15 +02:00
Arthur Baars
75113367c9 Add InlineAsm::expr 2024-09-06 18:14:14 +02:00
Arthur Baars
bc6da117d2 Fix type of Closure::arg_types 2024-09-06 17:59:24 +02:00
Jeroen Ketema
915d24c62f C++: Re-introduce the original version of the many_defs_per_use IR test
See: 28cff2ea20
2024-09-06 17:38:29 +02:00
Paolo Tranquilli
928f3f11f1 Rust: remove <> from function wrapper 2024-09-06 14:34:12 +02:00
Paolo Tranquilli
ac9e977baa Rust: remove accidental test source file 2024-09-06 14:29:10 +02:00
Paolo Tranquilli
18c423eb55 Rust: fix formatting of code snippet in docstring 2024-09-06 14:27:57 +02:00
Paolo Tranquilli
6111a7497d Rust: remove accidental schema annotation 2024-09-06 14:26:36 +02:00
Paolo Tranquilli
8c5cc2efdc Rust: generate test code from schema docstrings
This generates test source files from code blocks in class docstrings.

By default the test code is generated as is, but it can optionally:
* be wrapped in a function providing an adequate context using
  `@rust.doc_test_function(name, *, lifetimes=(), return_type="()", **kwargs)`,
  with `kwargs` providing both generic and normal params depending on
  capitalization
* be skipped altogether using `@rust.skip_doc_test`

So for example an annotation like
```python
@rust.doc_test_function("foo",
                        lifetimes=("a",),
                        T="Eq",
                        x="&'a T",
                        y="&'a T",
                        return_type="&'a T")
```
will result in the following wrapper:
```rust
fn foo<'a, T: Eq>(x: &'a T, y: &'a T) -> &'a T {
    // example code here
}
```
2024-09-06 14:24:42 +02:00
Felicity Chapman
967367bba6 Apply suggestions from code review
Co-authored-by: Joe Clark <31087804+jc-clark@users.noreply.github.com>
2024-09-06 12:30:18 +01:00
Arthur Baars
a33c7703cd Add Label class 2024-09-06 12:42:43 +02:00
Arthur Baars
e14b626917 Add 'BlockBase' class 2024-09-06 12:15:35 +02:00
Paolo Tranquilli
122e5a7598 Rust: remove accidental IDE files 2024-09-06 12:05:11 +02:00
Cornelius Riemenschneider
9b12df5ae4 Merge pull request #17389 from github/criemen/bzlmod-upgrades
CI: Upgrade bazel rules.
2024-09-06 12:02:13 +02:00
Michael B. Gale
c34fe9eda2 Go: Add change note for 1.23 support 2024-09-06 10:52:10 +01:00
Michael B. Gale
3f94ed19bd Docs: Add Go 1.23 to supported range 2024-09-06 10:50:08 +01:00
Arthur Baars
ce2fdb3463 Address comments 2024-09-06 11:47:08 +02:00
Michael B. Gale
d1b311f11f Merge pull request #17358 from github/mbg/go/1.23-transparent-aliases
Go: Support 1.23 (Transparent aliases)
2024-09-06 10:46:41 +01:00
Michael Nebel
a5b462292f Merge pull request #17330 from michaelnebel/java/modelgenfieldbased
Java/C#: Field based model generator (Experimental).
2024-09-06 11:11:46 +02:00
Cornelius Riemenschneider
c75f55debf Merge branch 'main' into criemen/bzlmod-upgrades 2024-09-06 10:41:52 +02:00
Jeroen Ketema
b73b8682b4 Merge pull request #17371 from jketema/correct-include
C++: Update expected test results after extractor changes
2024-09-06 09:38:06 +02:00
Paolo Tranquilli
8ecba44ea9 Rust: add experimental bazel target 2024-09-06 09:29:54 +02:00
dependabot[bot]
3c1e3b66ec 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.20.0 to 0.21.0
- [Commits](https://github.com/golang/mod/compare/v0.20.0...v0.21.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-09-06 03:21:50 +00:00
Michael B. Gale
1e32e84b1f Merge pull request #17369 from smowton/smowton/admin/aliasing-tests
Go: add tests regarding type aliasing
2024-09-05 21:16:08 +01:00
Michael B. Gale
772bc9b5c8 Go: Bump everything to 1.23.1 2024-09-05 21:12:46 +01:00
Michael B. Gale
9aeaae6068 Go: Bump maxGoVersion to 1.23 2024-09-05 21:12:45 +01:00
Michael B. Gale
6ef5063ff0 Go: Format Aliases.ql 2024-09-05 21:12:44 +01:00
Michael B. Gale
195f37267e Go: Accept new test results 2024-09-05 21:12:44 +01:00
Michael B. Gale
8380d71b01 Go: Add test for AliasType extraction 2024-09-05 21:12:43 +01:00
Michael B. Gale
1a9608a1f5 Go: Don't extract objects for type aliases 2024-09-05 21:12:42 +01:00
Michael B. Gale
97c3efccd1 Go: Factor out isAlias function 2024-09-05 21:12:42 +01:00
Michael B. Gale
c5b8163493 Go: Handle Alias types by extracting the underlying types 2024-09-05 21:12:41 +01:00
Michael B. Gale
c8e732468a Go: Update frontend error messages for Go 1.23 2024-09-05 21:12:40 +01:00
Michael B. Gale
4dead2bd8d Go: Use 1.23 for extractor 2024-09-05 21:12:40 +01:00
Michael B. Gale
ca796b0383 Go: Use 1.23 in tests 2024-09-05 21:12:39 +01:00
Michael B. Gale
d790d1ff08 Go: Use 1.23 in build process 2024-09-05 21:12:38 +01:00
REDMOND\brodes
1005a89007 Updating test cases. 2024-09-05 15:25:23 -04:00
Jeroen Ketema
a8b8eb42c0 Merge pull request #17391 from MathiasVP/add-unexpected-loop-inconsistency
C++: Add testcase with IR inconsistencies
2024-09-05 21:03:57 +02:00
Mathias Vorreiter Pedersen
25d7f17efc C++: Add testcase with IR inconsistencies. 2024-09-05 19:32:53 +01:00
Jeroen Ketema
78c6c09912 Merge pull request #13560 from am0o0/amammad-cpp-bombs
C++: Decompression Bombs
2024-09-05 20:01:02 +02:00
Am
a226bdfbd3 Merge pull request #3 from jketema/amammad-cpp-bombs
C++: Fix expected test results
2024-09-05 21:31:03 +04:00
Michael Nebel
e1048cf8ea Java/C#: Address review comments. 2024-09-05 19:23:05 +02:00
Jeroen Ketema
e891c5a882 C++: Fix expected test results 2024-09-05 17:48:11 +02:00
am0o0
401bb24fde remove redundent zStreamAccess in flow steps 2024-09-05 17:09:26 +02:00
am0o0
faef6359dd add '// BAD' comment for the zstd sink 2024-09-05 17:05:21 +02:00
Arthur Baars
679d81ab00 Rust: extract dummy Function body 2024-09-05 16:59:30 +02:00
Arthur Baars
46d6bbb458 Rust: update generated code 2024-09-05 16:59:29 +02:00
Arthur Baars
76c35bec93 Rust: add Expr, Pat, Stmt to schema 2024-09-05 16:59:28 +02:00
Arthur Baars
0516505033 Rust: update dependencies 2024-09-05 16:58:41 +02:00
Ben Rodes
8ab22feae1 Update cpp/ql/test/query-tests/Security/CWE/CWE-119/semmle/tests/tests.cpp
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2024-09-05 10:07:19 -04:00
Jeroen Ketema
5b65f98e2c C++: Update expected test results after extractor changes
The updated test results look more correct, as the documentation of
`#include_next` [1] that it should start looking in the next directory
in the search path. Before this update, the frontend was actually
looking in the current directory first, which is incorrect.

[1] https://gcc.gnu.org/onlinedocs/cpp/Wrapper-Headers.html
2024-09-05 15:17:43 +02:00
Arthur Baars
6fd469c807 Rust: use autodiscovery for sysroot
This should make the rust-analyzer library look for a rust toolchain and
try to start the proc-macro server.
2024-09-05 14:49:37 +02:00
Arthur Baars
d93330bc4c Rust: make printAst work 2024-09-05 14:49:36 +02:00
Arthur Baars
d8eb5d463d Rust: run cargo fmt 2024-09-05 14:45:47 +02:00
Arthur Baars
60b349f7e5 Rust: remove 'take(1)' from crates iterator 2024-09-05 14:45:46 +02:00
Arthur Baars
be16954521 Rust: add autobuild.sh 2024-09-05 14:45:45 +02:00
Arthur Baars
52ef1e382a Add 'version' field to generated Cargo.toml file 2024-09-05 14:45:44 +02:00
Owen Mansel-Chan
013ee34de7 Merge pull request #17381 from owen-mc/go/fix/qldoc/resultvariabledecl
Go: Fix QLDoc for ResultVariableDecl
2024-09-05 11:57:45 +01:00
Paolo Tranquilli
b23e482ed2 Merge branch 'main' into rust-experiment 2024-09-05 12:29:29 +02:00
Paolo Tranquilli
28a7fca7ed Merge pull request #17387 from github/redsun82/bazel
Bazel: stub internal repo parts needed for building rust binaries
2024-09-05 12:28:18 +02:00
Owen Mansel-Chan
9786934d9a Remove errant space at end of line 2024-09-05 11:27:20 +01:00
Cornelius Riemenschneider
f76a190ed1 CI: Upgrade bazel rules. 2024-09-05 11:40:06 +02:00
Simon Friis Vindum
5950af390d Merge pull request #17351 from paldepind/swap-member-data-flow
C++: Make swap member functions data-flow functions
2024-09-05 11:39:16 +02:00
Owen Mansel-Chan
5bafa8ace2 Add comment about x, y int being a single ResultVariableDecl 2024-09-05 10:27:11 +01:00
Jeroen Ketema
b6e38ff862 Merge pull request #17342 from jketema/coroutine
C++: Fix coroutine IR inconsistencies
2024-09-05 10:15:16 +02:00
Paolo Tranquilli
57534599c8 Merge pull request #17352 from github/redsun82/swift
Swift: upgrade prebuilt toolchain to 5.10.1
2024-09-05 09:17:06 +02:00
Paolo Tranquilli
7c80b33a63 Bazel: add forgotten files 2024-09-05 08:26:41 +02:00
Paolo Tranquilli
913a9263d2 Bazel: stub internal repo parts needed for building rust binaries
This is another shot at https://github.com/github/codeql/pull/17382,
using a different and more lightweight approach.

This allows building the ruby and python (and in the future also rust)
packs from within the codeql repository. This will:
* skip defining the glibc symbols checking, which only makes sense when
  building the release from the internal repository
* stub out our `universal_binary` rule, which we only need when building
  the release.
2024-09-05 08:16:28 +02:00
Am
05bdce1cd3 Merge pull request #2 from jketema/amammad-cpp-bombs
C++: Fix zstd and clean up test
2024-09-05 07:53:00 +04:00
Joe Farebrother
959715ac8e Merge pull request #16814 from porcupineyhairs/pyCors
WIP: Python: CORS Bypass
2024-09-05 02:43:02 +01:00
Chris Smowton
fe9d879e37 Prettify tests 2024-09-04 22:33:21 +01:00
Chris Smowton
4c5344d62a Accept test suggestions
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
2024-09-04 22:30:17 +01:00
Jeroen Ketema
3aa68b34bb C++: Fix zstd and clean up test 2024-09-04 22:25:44 +02:00
Cornelius Riemenschneider
f9e956dc94 Merge pull request #17377 from github/criemen/csharp-move-jobs
C#: Delete jobs that moved to the internal repo.
2024-09-04 20:10:26 +02:00
Cornelius Riemenschneider
e542d66719 Merge pull request #17380 from github/mbg/backport/bazel/dependencies/rules_go-0.50.0
Backport "Bazel/Go: Bump rules_go to 0.50.0" to `rc/3.15`
2024-09-04 19:32:02 +02:00
Cornelius Riemenschneider
627c533e98 Fix typo. 2024-09-04 19:27:00 +02:00
REDMOND\brodes
78898955b6 Updating change log 2024-09-04 12:54:27 -04:00
Chris Smowton
cbd129fddd Add test for aliasing interface method definitions 2024-09-04 17:53:45 +01:00
REDMOND\brodes
6f1aade8e0 Added change log 2024-09-04 12:51:37 -04:00
Jeroen Ketema
fd9a5ee453 Update cpp/downgrades/7ff6a6e53dbcff09d1b9b758b594bc6d17366863/coroutine.ql
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2024-09-04 18:45:33 +02:00
REDMOND\brodes
77b88afa9e Removing commented out code and altering comments to explain why the code was removed. 2024-09-04 12:44:36 -04:00
Andrew Eisenberg
c86b5790ff Merge pull request #17281 from github/aeisenberg/pr-template
Add a pull request template
2024-09-04 09:41:46 -07:00
REDMOND\brodes
cc953c87d9 Added test case to demonstrate type error corrected in this branch. 2024-09-04 12:41:05 -04:00
Pierre
9bd706a576 Merge pull request #17375 from github/changedocs-2.18.3-2
Add changelogs up to 2.18.3
2024-09-04 18:13:22 +02:00
REDMOND\brodes
e4d29905a9 Formatting and updating tests. 2024-09-04 11:16:24 -04:00
REDMOND\brodes
f0eeaaf44e BufferAccess must be reachable. False positives observed where accesses occur in dead code. 2024-09-04 11:16:23 -04:00
REDMOND\brodes
abd0a076a8 Addressing false positive with strncpy. 2024-09-04 11:16:21 -04:00
REDMOND\brodes
9105375097 Addreessing false positive due to incorrect use of getType 2024-09-04 11:16:19 -04:00
Felicity Chapman
529bee4d73 Add link to MRVA 2024-09-04 15:57:01 +01:00
Felicity Chapman
4cdef853d2 Add metadata to two key topics to help with SEO 2024-09-04 15:42:18 +01:00
Felicity Chapman
e58bb88ee8 Make more security researcher focused 2024-09-04 15:29:47 +01:00
Am
4fa462417f Merge pull request #1 from jketema/amammad-cpp-bombs
Cleanup cpp bombs
2024-09-04 18:06:04 +04:00
Owen Mansel-Chan
351c50afc1 Fix QLDoc for ResultVariableDecl 2024-09-04 14:02:35 +01:00
Michael B. Gale
66af4fd337 Bazel: Bump rules_go to 0.50.0 2024-09-04 13:47:21 +01:00
Michael B. Gale
cd8a5d7707 Merge pull request #17378 from github/mbg/go/improve-typeparamtype
Go: Add `getParent` and `getIndex` for `TypeParamType`
2024-09-04 13:31:51 +01:00
Erik Krogh Kristensen
8508056e72 Merge pull request #17349 from erik-krogh/del-deps-sep-2024
All: delete outdated deprecations
2024-09-04 14:18:31 +02:00
Jeroen Ketema
9b905d5e84 C++: Set precision to low
There are no barriers, so the query as is will flag up any use of the
identified functions.
2024-09-04 14:13:43 +02:00
Jeroen Ketema
238895e677 C++: Fix formatting 2024-09-04 14:10:24 +02:00
Jeroen Ketema
92c6170a76 C++: Simplify QLhelp
One good and one bad example suffices to get the point across, and makes the
help more readable. The examples also do not have to be complete.
2024-09-04 14:06:12 +02:00
Simon Friis Vindum
f066f21751 C++: Make swap member functions data-flow functions 2024-09-04 13:55:19 +02:00
Tom Hvitved
ce2df04854 Merge pull request #17350 from hvitved/tree-sitter-0.23
Bump `tree-sitter` to `0.23.0`
2024-09-04 13:45:14 +02:00
Jeroen Ketema
2369b18ca6 C++: Make additional flow steps more uniform 2024-09-04 13:43:03 +02:00
Michael B. Gale
db72bd4f96 Go: Add getParent and getIndex for TypeParamType 2024-09-04 12:28:58 +01:00
Tamás Vajk
6c28abdad7 Merge pull request #17373 from tamasvajk/add-build-mode-none-change-note-2
C#: Add change note for `build-mode:none` GA
2024-09-04 13:24:17 +02:00
Jeroen Ketema
8fe0d0a045 C++: Improve query output 2024-09-04 13:22:02 +02:00
Jeroen Ketema
8d22d147b8 C++: Clean up QLDoc 2024-09-04 13:16:56 +02:00
Cornelius Riemenschneider
05ffb47711 Merge pull request #17334 from github/criemen/rename-java
Java: Rename integration test directories.
2024-09-04 12:51:51 +02:00
Erik Krogh Kristensen
4258119ba3 Merge branch 'main' into del-deps-sep-2024 2024-09-04 12:43:41 +02:00
Erik Krogh Kristensen
49aaf65f3f fix mistake in the Python change-note
Co-authored-by: Taus <tausbn@github.com>
2024-09-04 12:43:01 +02:00
Cornelius Riemenschneider
b253b4ff49 C#: Delete jobs that moved to the internal repo.
All jobs that are deleted have been moved to the internal repo.

The unit tests are also run internally through bazel,
but keeping them here also tests the msbuild build.
2024-09-04 12:39:30 +02:00
Paolo Tranquilli
c38281528f Merge branch 'main' into redsun82/swift 2024-09-04 12:14:34 +02:00
Jeroen Ketema
65fafbf4df C++: Fix QL-for-QL warnings 2024-09-04 11:57:10 +02:00
Jeroen Ketema
084dbc4e12 C++: Rename qhelp file to match ql file 2024-09-04 11:48:42 +02:00
Jeroen Ketema
c048401ca7 C++: Clean up Brotli test 2024-09-04 11:40:32 +02:00
turbo
bd45c1fdbe Add changelogs 2024-09-04 11:39:35 +02:00
Jeroen Ketema
0f98e292ed C++: Cleanup minizip test 2024-09-04 11:19:22 +02:00
Tamas Vajk
d4947cc1a2 C#: Add change note for build-mode:none GA 2024-09-04 11:13:31 +02:00
Owen Mansel-Chan
27e9c1b885 Merge pull request #17266 from github/workflow/coverage/update
Update CSV framework coverage reports
2024-09-04 10:05:20 +01:00
Jeroen Ketema
09f6576e6b C++: Simplify libarchive test 2024-09-04 11:04:21 +02:00
Jeroen Ketema
078e63524c C++: Remove code that is irrelevant for the zlib test 2024-09-04 10:48:25 +02:00
Anders Schack-Mulligen
7b8e707465 Merge pull request #17362 from aschackmull/dataflow/typofix
Dataflow: Fix minor typo.
2024-09-04 10:39:31 +02:00
Owen Mansel-Chan
1e225d7c44 Merge pull request #17366 from owen-mc/go/edit-release-change-notes
Go: Remove threat models change note from 1.15.md
2024-09-04 09:37:28 +01:00
Jeroen Ketema
ad3605c595 C++: Minor test clean up 2024-09-04 10:26:53 +02:00
Jeroen Ketema
d8a70d8d58 C++: Add test annotations 2024-09-04 10:23:51 +02:00
Jeroen Ketema
751e7e6bfb C++: Remove useless function bodies from tests 2024-09-04 10:03:19 +02:00
Jeroen Ketema
d526f1d081 C++: Disentangle confusing test results by declaring only a single main 2024-09-04 09:51:03 +02:00
Tom Hvitved
eb1b2a5594 Bump tree-sitter to 0.23.0 2024-09-04 09:47:59 +02:00
Jeroen Ketema
50d9e77339 C++: Move experimental files into the correct locations 2024-09-04 09:33:27 +02:00
Simon Friis Vindum
04f4039adc Merge pull request #17354 from paldepind/realloc-data-flow
C++: Make realloc a data-flow function
2024-09-04 09:04:12 +02:00
Michael Nebel
99400fe3d4 Merge pull request #17346 from michaelnebel/csharp/madsynthetics
C#: Support SyntheticField in MaD.
2024-09-04 08:28:07 +02:00
Simon Friis Vindum
75643043bc Update change note for realloc
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2024-09-04 07:38:49 +02:00
github-actions[bot]
3eeb79c599 Add changed framework coverage reports 2024-09-04 00:19:10 +00:00
Andrew Eisenberg
3f5a146a1c Reformulate bullet points 2024-09-03 15:25:43 -07:00
Chris Smowton
6ed0a37efd Autoformat 2024-09-03 21:29:56 +01:00
Chris Smowton
bf2fb2f6e2 Add tests for interface implementation across aliasing 2024-09-03 21:18:20 +01:00
erik-krogh
e2b16bd8f9 add some change-notes 2024-09-03 22:06:07 +02:00
erik-krogh
e76dcf9df9 delete a test for a deleted file 2024-09-03 20:31:01 +02:00
erik-krogh
846882d22c delete imports to a deleted file 2024-09-03 20:31:00 +02:00
erik-krogh
20dfdc9661 delete some deprecated files 2024-09-03 20:30:59 +02:00
erik-krogh
0fdd06fff5 use my script to delete outdated deprecations 2024-09-03 20:30:58 +02:00
Chris Smowton
73cc7460f3 Fix test; update expectations per autoformat changes 2024-09-03 18:44:30 +01:00
Chris Smowton
a94601c8c0 Add test checking for entity counts and def-use matches under aliasing 2024-09-03 17:58:09 +01:00
Dave Bartolomeo
ea0877769e Merge pull request #17368 from github/dbartol/ruby-hidden
Include hidden files when uploading Ruby pack
2024-09-03 12:49:26 -04:00
Jeroen Ketema
8ca52f278a C++: Fix coroutine IR inconsistencies
While here, remove some dead code related to fixed points from the database
scheme.
2024-09-03 18:12:36 +02:00
Dave Bartolomeo
36c71a9592 Include hidden files when uploading Ruby pack 2024-09-03 11:47:02 -04:00
Jeroen Ketema
62766f68fc Merge pull request #17138 from jketema/generic
C++: Support C11 `_Generic` expressions
2024-09-03 17:26:50 +02:00
Owen Mansel-Chan
f5c195d830 Remove change note from 1.15.md
We will include this change note when there is documentation about how to use the functionality.
2024-09-03 16:24:55 +01:00
Jeroen Ketema
52819432c0 C++: Address review comment 2024-09-03 17:18:18 +02:00
Simon Friis Vindum
d5948d2d95 C++: Add change-note note for realloc as data-flow function 2024-09-03 16:15:05 +02:00
am0o0
386e45a11e delete bzip2 as it is not updated for more than three years so it is not in the priority 2024-09-03 15:33:14 +02:00
am0o0
81283d59ab remove more unused imports, add tests for zstd, add flow steps for zstd
zstd is not finilized
2024-09-03 15:26:38 +02:00
Michael B. Gale
5e390a3b01 Merge pull request #17359 from github/mbg/bazel/dependencies/rules_go-0.50.0
Bazel/Go: Bump `rules_go` to 0.50.0
2024-09-03 14:00:18 +01:00
am0o0
4fc971dbcb remove xz(lzma) 2024-09-03 14:48:52 +02:00
Anders Schack-Mulligen
a0f0854fdb Dataflow: Fix minor typo. 2024-09-03 14:26:02 +02:00
am0o0
6c97096642 remove unused imports, add tests for libarchive 2024-09-03 14:16:25 +02:00
Felicity Chapman
68cbe35d96 Fix a bad link 2024-09-03 13:08:07 +01:00
Simon Friis Vindum
037912fd2d C++: Add data-flow test for realloc 2024-09-03 14:02:03 +02:00
Felicity Chapman
44ca530087 Update template to match changes to landing page 2024-09-03 12:59:29 +01:00
Felicity Chapman
f44905324e Add article on running queries 2024-09-03 12:55:56 +01:00
Felicity Chapman
5f1e62aefe Update landing page to focus on language 2024-09-03 12:54:45 +01:00
Michael B. Gale
c05c1d5087 Bazel: Bump rules_go to 0.50.0 2024-09-03 12:42:40 +01:00
am0o0
9531701129 delete miniz support because there is no good documents and i don't have enough time as the library is not popular enough. add tests for minizip lib 2024-09-03 13:08:00 +02:00
Michael Nebel
7bf7df2f99 C#/Java: Add model generator option for making content based summaries. 2024-09-03 12:58:13 +02:00
Michael Nebel
6e8941ea9d C#: Add a couple more testcases. 2024-09-03 12:58:09 +02:00
Michael Nebel
4123876343 C#: Add content based summary generation test. 2024-09-03 12:58:06 +02:00
Michael Nebel
486246c82d C#: Sync changes and make C# implementation. 2024-09-03 12:58:04 +02:00
Michael Nebel
5ddcb16cd6 Java: Add content based model generation test. 2024-09-03 12:58:01 +02:00
am0o0
e85ca79d77 add tests for brotli 2024-09-03 12:28:16 +02:00
Simon Friis Vindum
78068a488f C++: Make realloc a data-flow function 2024-09-03 11:25:18 +02:00
Cornelius Riemenschneider
2dfca8ab20 Merge branch 'main' into criemen/rename-java 2024-09-03 11:04:29 +02:00
Paolo Tranquilli
59423c692f Swift: upgrade prebuilt toolchain to 5.10.1 2024-09-03 10:38:58 +02:00
Michael Nebel
6365e5edff Java: Initial implementation of content based model generation. 2024-09-03 09:45:11 +02:00
Michael Nebel
4bdf21b022 Java: Add Content Flow module. 2024-09-03 09:45:07 +02:00
am0o0
49eaaf55a5 Merge branch 'amammad-cpp-bombs' of https://github.com/am0o0/codeql into amammad-cpp-bombs 2024-09-03 09:13:08 +02:00
am0o0
8c1c537150 finilize tests for zlib 2024-09-03 09:12:54 +02:00
am0o0
89e842b147 finilize tests for zlib 2024-09-03 09:12:13 +02:00
Porcupiney Hairs
f86570f6e7 WIP: Python: CORS Bypass
This PR adds a query to detect a Cross Origin Resource Sharing(CORS) policy bypass due to an incorrect check.

This PR attempts to detect the vulnerability pattern found in CVE-2022-3457

```python
if request.method in ['POST', 'PUT', 'PATCH', 'DELETE']:
    origin = request.headers.get('Origin', None)
    if origin and not origin.startswith(request.base):
        raise cherrypy.HTTPError(403, 'Unexpected Origin header')
```

In this case, a value obtained from a header is compared using `startswith` call. This comparision is easily bypassed resulting in a CORS bypass. Given that similar bugs have been found in other languages as well, I think this PR would be a great addition to the exisitng python query pack.

The databases for CVE-2022-3457 can be downloaded from
```
https://filetransfer.io/data-package/i4Mfepls#link
https://file.io/V67T4SSgmExF
```
2024-09-03 03:11:35 +05:30
Michael Nebel
4f4c7bfbb9 C#: Update expected test output. 2024-09-02 11:13:16 +02:00
Michael Nebel
6e81d74558 C#: Add support for synthetic fields in MaD for C#. 2024-09-02 11:13:11 +02:00
Michael Nebel
0d343c5ce1 C#: Add external flow tests for synthetic fields. 2024-09-02 11:13:06 +02:00
Paolo Tranquilli
885e89a927 Rust: first running tests 2024-08-30 17:45:51 +02:00
Paolo Tranquilli
7e1290aa74 Rust: reuse shared rust trap library 2024-08-30 16:08:37 +02:00
Joe Farebrother
ec7ad84cd1 Update formatting 2024-08-30 13:51:33 +01:00
Joe Farebrother
5360192a58 Apply review suggestions - change = to in
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
2024-08-30 13:25:59 +01:00
Jeroen Ketema
4945943732 C++: Support C11 _Generic expressions 2024-08-30 14:24:03 +02:00
Paolo Tranquilli
4f0fe1ce3a Rust: bazel packaging 2024-08-30 13:05:46 +02:00
Jeroen Ketema
30335ab81e C++: Add C11 _Generic IR tests 2024-08-30 10:50:49 +02:00
Paolo Tranquilli
3da6cee6ef Merge branch 'main' into rust-experiment 2024-08-30 10:30:43 +02:00
Cornelius Riemenschneider
321820e758 Java: Rename integration test directories.
We are no longer bound to the platform-specific directories, so simplify the test organization.
If you don't want this change, just skip merging this PR. It's purely optional.

I kept the platform-specific directories around under `kotlin`,
but you could also easily merge all these together if you find them unhelpful.
I'll leave that change to you.
2024-08-30 10:28:25 +02:00
Paolo Tranquilli
04753b286f Rust: tweak trap_key 2024-08-30 10:12:20 +02:00
Andrew Eisenberg
13705531b5 Update .github/pull_request_template.md
Co-authored-by: Aditya Sharad <6874315+adityasharad@users.noreply.github.com>
2024-08-29 14:47:54 -07:00
Paolo Tranquilli
590a146b49 Rust: some basic extraction of function names (with locations!) 2024-08-29 17:58:50 +02:00
Joe Farebrother
5494389c4b Update changenote
Co-authored-by: Sid Shankar <sidshank@github.com>
2024-08-29 09:44:23 +01:00
Paolo Tranquilli
f40901f391 Rust: archiving + skeleton def translator 2024-08-28 17:15:49 +02:00
Joe Farebrother
a8591c79c5 Update test 2024-08-28 09:11:34 +01:00
Joe Farebrother
f3dea1d647 Add changenote 2024-08-28 09:04:01 +01:00
Paolo Tranquilli
2a2b79e6df Rust: skeleton trap file emission code 2024-08-27 17:50:53 +02:00
Paolo Tranquilli
927710017e Rust: add some configuration and logging 2024-08-27 17:07:23 +02:00
Joe Farebrother
fc24ca304d Update tests 2024-08-27 14:18:50 +01:00
Joe Farebrother
1cb23e7e86 Exclude certificates from being cinsidered sensitive data by cleartext-storage and cleartext-logging queries 2024-08-27 14:18:39 +01:00
Kevin Stubbings
c60f459530 Grammar 2024-08-26 23:57:19 -07:00
Kevin Stubbings
812abea0de change-notes 2024-08-26 22:25:00 -07:00
Kevin Stubbings
0420d25c13 refactor 2024-08-26 22:09:24 -07:00
Kevin Stubbings
1db7865d49 Corrections 2024-08-26 22:06:12 -07:00
Kevin Stubbings
8bf8893307 Add support for vulnerable CORS middlewares 2024-08-26 21:30:48 -07:00
Andrew Eisenberg
d19102c399 Separate into two groups 2024-08-26 14:38:32 -07:00
Andrew Eisenberg
c1c9ef2c1f Add a pull request template 2024-08-22 12:36:24 -07:00
Owen Mansel-Chan
113ab755d9 Give clearer example of multiple query predicates in one ql file
The new names aren't great, so feel free to change them, but I think we do need an explicit example of updating two relations using one ql file.
2024-08-21 14:18:11 +01:00
Rasmus Wriedt Larsen
8f7dec07b8 Python: Remove 'response' from default threat-models
I didn't want to put the configuration file in
`semmle/python/frameworks/**/*.model.yml`, so created `ext/` as in other
languages
2024-08-19 10:54:48 +02:00
Rasmus Wriedt Larsen
617ab27c75 Python: Add test showing default active threat-models 2024-08-19 10:54:48 +02:00
Rasmus Wriedt Larsen
766dcc4dd6 ThreatModels: Expose knownThreatModel
Without, it's impossible to write test showing what threat-models are
active by default... unless I provide a hardcoded list in the test
itself, which is not any fun.
2024-08-19 10:54:47 +02:00
Rasmus Wriedt Larsen
5ec8e5dd30 Python: Setup support for threat-models
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-08-19 10:54:47 +02:00
Paolo Tranquilli
0e3c867cb9 Toy rust program listing definitions of a cargo project 2024-08-16 10:37:49 +02:00
Tom Hvitved
89a2381165 C#: Adopt shared SSA data-flow integration 2024-08-14 08:39:17 +02:00
am0o0
f97b1039cd update test files, add one more additional flow step for inflate function, fix gzopen additional flow step thanks to @jketema 2024-07-30 17:49:34 +02:00
Am
6f8eec2bf9 Merge branch 'github:main' into amammad-cpp-bombs 2024-07-28 18:49:15 +03:30
am0o0
a10b5021b4 fix tests, it is not fixed 100% 2024-07-15 10:13:57 +02:00
am0o0
87b6495c91 add zlib tests with stubs :) 2024-07-14 21:10:56 +02:00
am0o0
361ad6be6a use abstract class for decompression flow steps 2024-06-26 12:45:31 +02:00
am0o0
656dc4e276 use abstract class for decompression sinks 2024-06-25 18:09:27 +02:00
am0o0
13f697c056 relocate the query 2024-06-25 17:31:40 +02:00
Porcupiney Hairs
a7cdf0e2fd CPP: Disabled SSL certificate verification
Disable SSL certificate verification can expose the communication to MITM attacks.

This PR adds a query to detect the same. This also include the tests and qhelp for the same.
2024-06-23 14:27:04 +05:30
am0o0
11a416ea7c add FlowSources as a common source for all sinks, so we don't need States anymore 2024-06-13 03:30:07 +02:00
am0o0
273848c879 remove old comments 2024-06-07 05:40:17 +02:00
am0o0
a5363286f1 add implicit this 2024-06-07 05:37:58 +02:00
am0o0
184aa0480e Merge branch 'amammad-cpp-bombs' of https://github.com/amammad/codeql into amammad-cpp-bombs 2024-06-07 05:27:12 +02:00
Am
a5c9dc74bf Merge branch 'github:main' into amammad-cpp-bombs 2024-06-07 05:27:08 +02:00
am0o0
e37ceac3b1 merge all query files into one query file 2024-06-07 05:26:51 +02:00
amammad
e0798b29da stash: change sinks to zip handles and sources to the zip handle initializers 2023-07-04 18:28:00 +10:00
amammad
065c527615 update Miniz 2023-07-04 07:19:33 +10:00
amammad
16be908cb3 add Miniz 2023-07-04 06:56:30 +10:00
amammad
56bc32ff91 add libarchive 2023-07-04 01:17:22 +10:00
amammad
d4d505d7af complete the minizip query 2023-07-03 20:39:08 +10:00
amammad
042133a991 add queries for more popular libs 2023-07-03 09:12:37 +10:00
amammad
f715a3437b better examples 2023-06-26 05:29:16 +10:00
amammad
3ddc9a8b31 fix warnings, more sinks,sources,comments 2023-06-26 05:26:30 +10:00
amammad
ae98510f77 add more source and sinks and sanitizers 2023-06-26 00:21:55 +10:00
amammad
430375e2f0 fix a commit mistake 2023-06-25 20:28:45 +10:00
amammad
4a37da3593 V1 2023-06-25 20:26:21 +10:00
5667 changed files with 220522 additions and 114976 deletions

View File

@@ -6,9 +6,6 @@ inputs:
description: 'The CodeQL channel to use'
required: false
default: 'nightly'
tag_name:
description: 'The tag name of the CodeQL release to use. Leave blank to use the latest release.'
required: false
runs:
using: composite
@@ -18,13 +15,9 @@ runs:
env:
GITHUB_TOKEN: ${{ github.token }}
CHANNEL: ${{ inputs.channel }}
VERSION: ${{ inputs.version }}
run: |
gh extension install github/gh-codeql
gh codeql set-channel "$CHANNEL"
if [[ -n "$VERSION" ]]; then
gh codeql set-version "$VERSION"
fi
gh codeql version
printf "CODEQL_FETCHED_CODEQL_PATH=" >> "${GITHUB_ENV}"
gh codeql version --format=json | jq -r .unpackedLocation >> "${GITHUB_ENV}"

4
.github/labeler.yml vendored
View File

@@ -30,6 +30,10 @@ Ruby:
- ruby/**/*
- change-notes/**/*ruby*
Rust:
- rust/**/*
- change-notes/**/*rust*
Swift:
- swift/**/*
- change-notes/**/*swift*

14
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,14 @@
### Pull Request checklist
#### All query authors
- [ ] A change note is added if necessary. See [the documentation](https://github.com/github/codeql/blob/main/docs/change-notes.md) in this repository.
- [ ] All new queries have appropriate `.qhelp`. See [the documentation](https://github.com/github/codeql/blob/main/docs/query-help-style-guide.md) in this repository.
- [ ] QL tests are added if necessary. See [Testing custom queries](https://docs.github.com/en/code-security/codeql-cli/using-the-advanced-functionality-of-the-codeql-cli/testing-custom-queries) in the GitHub documentation.
- [ ] New and changed queries have correct query metadata. See [the documentation](https://github.com/github/codeql/blob/main/docs/query-metadata-style-guide.md) in this repository.
#### Internal query authors only
- [ ] Autofixes generated based on these changes are valid, only needed if this PR makes significant changes to `.ql`, `.qll`, or `.qhelp` files. See [the documentation](https://github.com/github/codeql-team/blob/main/docs/best-practices/validating-autofix-for-query-changes.md) (internal access required).
- [ ] Changes are validated [at scale](https://github.com/github/codeql-dca/) (internal access required).
- [ ] Adding a new query? Consider also [adding the query to autofix](https://github.com/github/codeml-autofix/blob/main/docs/updating-query-support.md#adding-a-new-query-to-the-query-suite).

View File

@@ -16,11 +16,12 @@ on:
- "shared/**/*.qll"
- "!**/experimental/**"
- "!ql/**"
- "!rust/**"
- ".github/workflows/check-change-note.yml"
jobs:
check-change-note:
env:
env:
REPO: ${{ github.repository }}
PULL_REQUEST_NUMBER: ${{ github.event.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -33,7 +34,7 @@ jobs:
!contains(github.event.pull_request.labels.*.name, 'no-change-note-required')
run: |
change_note_files=$(gh api "repos/$REPO/pulls/$PULL_REQUEST_NUMBER/files" --paginate --jq '.[].filename | select(test("/change-notes/.*[.]md$"))')
if [ -z "$change_note_files" ]; then
echo "No change note found. Either add one, or add the 'no-change-note-required' label."
exit 1

View File

@@ -29,45 +29,6 @@ permissions:
contents: read
jobs:
qlupgrade:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/fetch-codeql
- name: Check DB upgrade scripts
run: |
echo >empty.trap
codeql dataset import -S ql/lib/upgrades/initial/semmlecode.csharp.dbscheme testdb empty.trap
codeql dataset upgrade testdb --additional-packs ql/lib
diff -q testdb/semmlecode.csharp.dbscheme ql/lib/semmlecode.csharp.dbscheme
- name: Check DB downgrade scripts
run: |
echo >empty.trap
rm -rf testdb; codeql dataset import -S ql/lib/semmlecode.csharp.dbscheme testdb empty.trap
codeql resolve upgrades --format=lines --allow-downgrades --additional-packs downgrades \
--dbscheme=ql/lib/semmlecode.csharp.dbscheme --target-dbscheme=downgrades/initial/semmlecode.csharp.dbscheme |
xargs codeql execute upgrades testdb
diff -q testdb/semmlecode.csharp.dbscheme downgrades/initial/semmlecode.csharp.dbscheme
qltest:
if: github.repository_owner == 'github'
runs-on: ubuntu-latest-xl
strategy:
fail-fast: false
matrix:
slice: ["1/2", "2/2"]
steps:
- uses: actions/checkout@v4
- uses: ./csharp/actions/create-extractor-pack
- name: Cache compilation cache
id: query-cache
uses: ./.github/actions/cache-query-compilation
with:
key: csharp-qltest-${{ matrix.slice }}
- name: Run QL tests
run: |
codeql test run --threads=0 --ram 50000 --slice ${{ matrix.slice }} --search-path "${{ github.workspace }}" --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
env:
GITHUB_TOKEN: ${{ github.token }}
unit-tests:
strategy:
matrix:

View File

@@ -3,6 +3,7 @@ on:
push:
paths:
- "go/**"
- "shared/**"
- .github/workflows/go-tests.yml
- .github/actions/**
- codeql-workspace.yml
@@ -12,6 +13,7 @@ on:
pull_request:
paths:
- "go/**"
- "shared/**"
- .github/workflows/go-tests.yml
- .github/actions/**
- codeql-workspace.yml

View File

@@ -2,6 +2,30 @@ name: "Ruby: Build"
on:
push:
paths:
- "ruby/**"
- .github/workflows/ruby-build.yml
- .github/actions/fetch-codeql/action.yml
- codeql-workspace.yml
- "shared/tree-sitter-extractor/**"
branches:
- main
- "rc/*"
pull_request:
paths:
- "ruby/**"
- .github/workflows/ruby-build.yml
- .github/actions/fetch-codeql/action.yml
- codeql-workspace.yml
- "shared/tree-sitter-extractor/**"
branches:
- main
- "rc/*"
workflow_dispatch:
inputs:
tag:
description: "Version tag to create"
required: false
env:
CARGO_TERM_COLOR: always
@@ -41,8 +65,8 @@ jobs:
id: cache-extractor
with:
path: |
ruby/extractor/target/release/codeql-extractor-ruby
ruby/extractor/target/release/codeql-extractor-ruby.exe
target/release/codeql-extractor-ruby
target/release/codeql-extractor-ruby.exe
ruby/extractor/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-extractor-${{ hashFiles('ruby/extractor/rust-toolchain.toml', 'ruby/extractor/Cargo.lock') }}-${{ hashFiles('shared/tree-sitter-extractor') }}-${{ hashFiles('ruby/extractor/**/*.rs') }}
- uses: actions/cache@v3
@@ -51,7 +75,7 @@ jobs:
path: |
~/.cargo/registry
~/.cargo/git
ruby/target
target
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'
@@ -67,7 +91,7 @@ jobs:
run: cd extractor && cargo build --release
- name: Generate dbscheme
if: ${{ matrix.os == 'ubuntu-latest' && steps.cache-extractor.outputs.cache-hit != 'true'}}
run: extractor/target/release/codeql-extractor-ruby generate --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
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
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
@@ -82,8 +106,8 @@ jobs:
with:
name: extractor-${{ matrix.os }}
path: |
ruby/extractor/target/release/codeql-extractor-ruby
ruby/extractor/target/release/codeql-extractor-ruby.exe
target/release/codeql-extractor-ruby
target/release/codeql-extractor-ruby.exe
retention-days: 1
compile-queries:
if: github.repository_owner == 'github'
@@ -92,8 +116,6 @@ jobs:
- uses: actions/checkout@v4
- name: Fetch CodeQL
uses: ./.github/actions/fetch-codeql
with:
version: codeql-bundle-20240902
- name: Cache compilation cache
id: query-cache
uses: ./.github/actions/cache-query-compilation
@@ -118,6 +140,7 @@ jobs:
path: |
${{ runner.temp }}/query-packs/*
retention-days: 1
include-hidden-files: true
package:
runs-on: ubuntu-latest
@@ -154,6 +177,7 @@ jobs:
name: codeql-ruby-pack
path: ruby/codeql-ruby.zip
retention-days: 1
include-hidden-files: true
- uses: actions/download-artifact@v3
with:
name: codeql-ruby-queries
@@ -171,6 +195,7 @@ jobs:
name: codeql-ruby-bundle
path: ruby/codeql-ruby-bundle.zip
retention-days: 1
include-hidden-files: true
test:
defaults:
@@ -187,8 +212,6 @@ jobs:
- uses: actions/checkout@v4
- name: Fetch CodeQL
uses: ./.github/actions/fetch-codeql
with:
version: codeql-bundle-20240902
- name: Download Ruby bundle
uses: actions/download-artifact@v3

58
.github/workflows/rust.yml vendored Normal file
View File

@@ -0,0 +1,58 @@
name: "Rust"
on:
pull_request:
paths:
- "rust/**"
- "misc/bazel/**"
- "misc/codegen/**"
- "shared/**"
- "MODULE.bazel"
- .github/workflows/rust.yml
- .github/actions/**
- codeql-workspace.yml
- "!**/*.md"
- "!**/*.qhelp"
branches:
- rust-experiment
- main
- rc/*
- codeql-cli-*
permissions:
contents: read
jobs:
rust-code:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- 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
rust-codegen:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install CodeQL
uses: ./.github/actions/fetch-codeql
- name: Code generation
shell: bash
run: |
bazel run //rust/codegen
git add .
git diff --exit-code HEAD

6
.gitignore vendored
View File

@@ -65,3 +65,9 @@ node_modules/
# bazel-built in-tree extractor packs
/*/extractor-pack
# Jetbrains IDE files
.idea
# cargo build directory
/target

View File

@@ -5,9 +5,9 @@ repos:
rev: v3.2.0
hooks:
- id: trailing-whitespace
exclude: /test/.*$(?<!\.ql)(?<!\.qll)(?<!\.qlref)|.*\.patch
exclude: /test/.*$(?<!\.qlref)|.*\.patch$|.*\.qll?$
- id: end-of-file-fixer
exclude: /test/.*$(?<!\.ql)(?<!\.qll)(?<!\.qlref)|.*\.patch
exclude: /test/.*$(?<!\.qlref)|.*\.patch$|.*\.qll?$
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6
@@ -15,7 +15,7 @@ repos:
- id: clang-format
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.6.0
rev: v2.0.4
hooks:
- id: autopep8
files: ^misc/codegen/.*\.py
@@ -45,7 +45,7 @@ repos:
- id: sync-files
name: Fix files required to be identical
files: \.(qll?|qhelp|swift)$|^config/identical-files\.json$
files: \.(qll?|qhelp|swift|toml)$|^config/identical-files\.json$
language: system
entry: python3 config/sync-files.py --latest
pass_filenames: false
@@ -58,7 +58,7 @@ repos:
- id: swift-codegen
name: Run Swift checked in code generation
files: ^swift/(schema.py$|codegen/|.*/generated/|ql/lib/(swift\.dbscheme$|codeql/swift/elements)|ql/\.generated.list)
files: ^misc/codegen/|^swift/(schema.py$|codegen/|.*/generated/|ql/lib/(swift\.dbscheme$|codeql/swift/elements)|ql/\.generated.list)
language: system
entry: bazel run //swift/codegen -- --quiet
pass_filenames: false
@@ -69,3 +69,17 @@ repos:
language: system
entry: bazel test //misc/codegen/test
pass_filenames: false
- 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)
language: system
entry: bazel run //rust/codegen -- --quiet
pass_filenames: false
- id: rust-lint
name: Run fmt and clippy on Rust code
files: ^rust/extractor/(.*rs|Cargo.toml)$
language: system
entry: python3 rust/lint.py
pass_filenames: false

2684
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

16
Cargo.toml Normal file
View File

@@ -0,0 +1,16 @@
# This is the shared workspace file for extractor using shared/tree-sitter/extractor
[workspace]
resolver = "2"
members = [
"shared/tree-sitter-extractor",
"ruby/extractor",
"rust/extractor",
"rust/extractor/macros",
"rust/generate-schema",
]
[patch.crates-io]
# patch for build script bug preventing bazel build
# see https://github.com/rust-lang/rustc_apfloat/pull/17
rustc_apfloat = { git = "https://github.com/redsun82/rustc_apfloat.git", rev = "096d585100636bc2e9f09d7eefec38c5b334d47b" }

View File

@@ -15,10 +15,10 @@ 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.49.0")
bazel_dep(name = "rules_pkg", version = "0.10.1")
bazel_dep(name = "rules_go", version = "0.50.0")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_nodejs", version = "6.2.0-codeql.1")
bazel_dep(name = "rules_python", version = "0.32.2")
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 = "nlohmann_json", version = "3.11.3", repo_name = "json")
@@ -27,7 +27,7 @@ bazel_dep(name = "rules_kotlin", version = "1.9.4-codeql.1")
bazel_dep(name = "gazelle", version = "0.38.0")
bazel_dep(name = "rules_dotnet", version = "0.15.1")
bazel_dep(name = "googletest", version = "1.14.0.bcr.1")
bazel_dep(name = "rules_rust", version = "0.49.1")
bazel_dep(name = "rules_rust", version = "0.50.0")
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
@@ -47,21 +47,25 @@ cp.from_cargo(
)
use_repo(cp, "py_deps")
# crate_ruby, but shortened due to windows file paths
# 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 = "rd",
cargo_lockfile = "//ruby/extractor:Cargo.lock",
name = "r",
cargo_lockfile = "//:Cargo.lock",
manifests = [
"//:Cargo.toml",
"//ruby/extractor:Cargo.toml",
"//ruby/extractor/codeql-extractor-fake-crate:Cargo.toml",
"//rust/extractor:Cargo.toml",
"//rust/extractor/macros:Cargo.toml",
"//rust/generate-schema:Cargo.toml",
"//shared/tree-sitter-extractor:Cargo.toml",
],
)
use_repo(r, ruby_deps = "rd")
use_repo(r, tree_sitter_extractors_deps = "r")
dotnet = use_extension("@rules_dotnet//dotnet:extensions.bzl", "dotnet")
dotnet.toolchain(dotnet_version = "8.0.101")
@@ -124,6 +128,7 @@ use_repo(
"kotlin-compiler-1.9.20-Beta",
"kotlin-compiler-2.0.0-RC1",
"kotlin-compiler-2.0.20-Beta2",
"kotlin-compiler-2.1.0-Beta1",
"kotlin-compiler-embeddable-1.5.0",
"kotlin-compiler-embeddable-1.5.10",
"kotlin-compiler-embeddable-1.5.20",
@@ -137,6 +142,7 @@ use_repo(
"kotlin-compiler-embeddable-1.9.20-Beta",
"kotlin-compiler-embeddable-2.0.0-RC1",
"kotlin-compiler-embeddable-2.0.20-Beta2",
"kotlin-compiler-embeddable-2.1.0-Beta1",
"kotlin-stdlib-1.5.0",
"kotlin-stdlib-1.5.10",
"kotlin-stdlib-1.5.20",
@@ -150,10 +156,11 @@ use_repo(
"kotlin-stdlib-1.9.20-Beta",
"kotlin-stdlib-2.0.0-RC1",
"kotlin-stdlib-2.0.20-Beta2",
"kotlin-stdlib-2.1.0-Beta1",
)
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.22.2")
go_sdk.download(version = "1.23.1")
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//go/extractor:go.mod")

View File

@@ -57,10 +57,6 @@
"java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/SsaReadPositionCommon.qll",
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SsaReadPositionCommon.qll"
],
"Model as Data Generation Java/C# - CaptureModels": [
"java/ql/src/utils/modelgenerator/internal/CaptureModels.qll",
"csharp/ql/src/utils/modelgenerator/internal/CaptureModels.qll"
],
"Sign Java/C#": [
"java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/Sign.qll",
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/Sign.qll"
@@ -356,8 +352,8 @@
"python/ql/test/library-tests/dataflow/model-summaries/InlineTaintTest.ext.yml",
"python/ql/test/library-tests/dataflow/model-summaries/NormalDataflowTest.ext.yml"
],
"shared tree-sitter extractor cargo.toml": [
"shared/tree-sitter-extractor/Cargo.toml",
"ruby/extractor/codeql-extractor-fake-crate/Cargo.toml"
"Diagnostics.qll": [
"ruby/ql/lib/codeql/ruby/Diagnostics.qll",
"rust/ql/lib/codeql/rust/Diagnostics.qll"
]
}

View File

@@ -0,0 +1,32 @@
/*
* Approach: replace conversion expressions of kind 389 (= @c11_generic) by
* conversion expressions of kind 12 (= @parexpr), i.e., a `ParenthesisExpr`,
* and drop the relation which its child expressions, which are just syntactic
* sugar. Parenthesis expressions are equally benign as C11 _Generic expressions,
* and behave similarly in the context of the IR.
*/
class Expr extends @expr {
string toString() { none() }
}
class Location extends @location {
string toString() { none() }
}
class ExprParent extends @exprparent {
string toString() { none() }
}
query predicate new_exprs(Expr expr, int new_kind, Location loc) {
exists(int kind | exprs(expr, kind, loc) | if kind = 389 then new_kind = 12 else new_kind = kind)
}
query predicate new_exprparents(Expr expr, int index, ExprParent expr_parent) {
exprparents(expr, index, expr_parent) and
(
not expr_parent instanceof @expr
or
exists(int kind | exprs(expr_parent.(Expr), kind, _) | kind != 389)
)
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
description: Expose C11 _Generics
compatibility: partial
exprs.rel: run downgrades.ql new_exprs
exprparents.rel: run downgrades.ql new_exprparents

View File

@@ -0,0 +1,18 @@
class Function extends @function {
string toString() { none() }
}
class Type extends @type {
string toString() { none() }
}
class Variable extends @variable {
string toString() { none() }
}
from Function func, Type traits, Variable handle, Variable promise
where
coroutine(func, traits) and
coroutine_placeholder_variable(handle, 1, func) and
coroutine_placeholder_variable(promise, 2, func)
select func, traits, handle, promise

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
description: Improve handling of coroutine placeholder variables
compatibility: full
coroutine.rel: run coroutine.qlo
coroutine_placeholder_variable.rel: delete

View File

@@ -1,3 +1,35 @@
## 2.0.1
No user-facing changes.
## 2.0.0
### Breaking Changes
* Deleted many deprecated taint-tracking configurations based on `TaintTracking::Configuration`.
* Deleted many deprecated dataflow configurations based on `DataFlow::Configuration`.
* Deleted the deprecated `hasQualifiedName` and `isDefined` predicates from the `Declaration` class, use `hasGlobalName` and `hasDefinition` respectively instead.
* Deleted the `getFullSignature` predicate from the `Function` class, use `getIdentityString(Declaration)` from `semmle.code.cpp.Print` instead.
* Deleted the deprecated `freeCall` predicate from `Alloc.qll`. Use `DeallocationExpr` instead.
* Deleted the deprecated `explorationLimit` predicate from `DataFlow::Configuration`, use `FlowExploration<explorationLimit>` instead.
* Deleted the deprecated `getFieldExpr` predicate from `ClassAggregateLiteral`, use `getAFieldExpr` instead.
* Deleted the deprecated `getElementExpr` predicate from `ArrayOrVectorAggregateLiteral`, use `getAnElementExpr` instead.
### New Features
* Added a class `C11GenericExpr` to represent C11 generic selection expressions. The generic selection is represented as a `Conversion` on the expression that will be selected.
* Added subclasses of `BuiltInOperations` for the `__is_scoped_enum`, `__is_trivially_equality_comparable`, and `__is_trivially_relocatable` builtin operations.
* Added a subclass of `Expr` for `__datasizeof` expressions.
### Minor Analysis Improvements
* Added a data flow model for `swap` member functions, which were previously modeled as taint tracking functions. This change improves the precision of queries where flow through `swap` member functions might affect the results.
* Added a data flow model for `realloc`-like functions, which were previously modeled as a taint tracking functions. This change improves the precision of queries where flow through `realloc`-like functions might affect the results.
## 1.4.2
No user-facing changes.
## 1.4.1
No user-facing changes.

View File

@@ -1,5 +0,0 @@
---
category: feature
---
* Added subclasses of `BuiltInOperations` for the `__is_scoped_enum`, `__is_trivially_equality_comparable`, and `__is_trivially_relocatable` builtin operations.
* Added a subclass of `Expr` for `__datasizeof` expressions.

View File

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

View File

@@ -0,0 +1,23 @@
## 2.0.0
### Breaking Changes
* Deleted many deprecated taint-tracking configurations based on `TaintTracking::Configuration`.
* Deleted many deprecated dataflow configurations based on `DataFlow::Configuration`.
* Deleted the deprecated `hasQualifiedName` and `isDefined` predicates from the `Declaration` class, use `hasGlobalName` and `hasDefinition` respectively instead.
* Deleted the `getFullSignature` predicate from the `Function` class, use `getIdentityString(Declaration)` from `semmle.code.cpp.Print` instead.
* Deleted the deprecated `freeCall` predicate from `Alloc.qll`. Use `DeallocationExpr` instead.
* Deleted the deprecated `explorationLimit` predicate from `DataFlow::Configuration`, use `FlowExploration<explorationLimit>` instead.
* Deleted the deprecated `getFieldExpr` predicate from `ClassAggregateLiteral`, use `getAFieldExpr` instead.
* Deleted the deprecated `getElementExpr` predicate from `ArrayOrVectorAggregateLiteral`, use `getAnElementExpr` instead.
### New Features
* Added a class `C11GenericExpr` to represent C11 generic selection expressions. The generic selection is represented as a `Conversion` on the expression that will be selected.
* Added subclasses of `BuiltInOperations` for the `__is_scoped_enum`, `__is_trivially_equality_comparable`, and `__is_trivially_relocatable` builtin operations.
* Added a subclass of `Expr` for `__datasizeof` expressions.
### Minor Analysis Improvements
* Added a data flow model for `swap` member functions, which were previously modeled as taint tracking functions. This change improves the precision of queries where flow through `swap` member functions might affect the results.
* Added a data flow model for `realloc`-like functions, which were previously modeled as a taint tracking functions. This change improves the precision of queries where flow through `realloc`-like functions might affect the results.

View File

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

View File

@@ -1,2 +1,2 @@
---
lastReleaseVersion: 1.4.1
lastReleaseVersion: 2.0.1

View File

@@ -36,16 +36,6 @@ module PrivateCleartextWrite {
}
}
deprecated class WriteConfig extends TaintTracking::Configuration {
WriteConfig() { this = "Write configuration" }
override predicate isSource(DataFlow::Node source) { source instanceof Source }
override predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
override predicate isSanitizer(DataFlow::Node node) { node instanceof Sanitizer }
}
private module WriteConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof Source }

View File

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

View File

@@ -60,18 +60,6 @@ class Declaration extends Locatable, @declaration {
*/
string getQualifiedName() { result = underlyingElement(this).(Q::Declaration).getQualifiedName() }
/**
* DEPRECATED: Prefer `hasGlobalName` or the 2-argument or 3-argument
* `hasQualifiedName` predicates. To get the exact same results as this
* predicate in all edge cases, use `getQualifiedName()`.
*
* Holds if this declaration has the fully-qualified name `qualifiedName`.
* See `getQualifiedName`.
*/
deprecated predicate hasQualifiedName(string qualifiedName) {
this.getQualifiedName() = qualifiedName
}
/**
* Holds if this declaration has a fully-qualified name with a name-space
* component of `namespaceQualifier`, a declaring type of `typeQualifier`,
@@ -185,9 +173,6 @@ class Declaration extends Locatable, @declaration {
/** Holds if the declaration has a definition. */
predicate hasDefinition() { exists(this.getDefinition()) }
/** DEPRECATED: Use `hasDefinition` instead. */
deprecated predicate isDefined() { this.hasDefinition() }
/** Gets the preferred location of this declaration, if any. */
override Location getLocation() { none() }

View File

@@ -30,46 +30,6 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
override string getName() { functions(underlyingElement(this), result, _) }
/**
* DEPRECATED: Use `getIdentityString(Declaration)` from `semmle.code.cpp.Print` instead.
* Gets the full signature of this function, including return type, parameter
* types, and template arguments.
*
* For example, in the following code:
* ```
* template<typename T> T min(T x, T y);
* int z = min(5, 7);
* ```
* The full signature of the function called on the last line would be
* `min<int>(int, int) -> int`, and the full signature of the uninstantiated
* template on the first line would be `min<T>(T, T) -> T`.
*/
deprecated string getFullSignature() {
exists(string name, string templateArgs, string args |
result = name + templateArgs + args + " -> " + this.getType().toString() and
name = this.getQualifiedName() and
(
if exists(this.getATemplateArgument())
then
templateArgs =
"<" +
concat(int i |
exists(this.getTemplateArgument(i))
|
this.getTemplateArgument(i).toString(), ", " order by i
) + ">"
else templateArgs = ""
) and
args =
"(" +
concat(int i |
exists(this.getParameter(i))
|
this.getParameter(i).getType().toString(), ", " order by i
) + ")"
)
}
/** Gets a specifier of this function. */
override Specifier getASpecifier() {
funspecifiers(underlyingElement(this), unresolveElement(result)) or
@@ -691,7 +651,8 @@ class FunctionDeclarationEntry extends DeclarationEntry, @fun_decl {
/**
* Holds if this declaration is an implicit function declaration, that is,
* where a function is used before it is declared (under older C standards).
* where a function is used before it is declared (under older C standards,
* or when there were parse errors).
*/
predicate isImplicit() { fun_implicit(underlyingElement(this)) }

View File

@@ -286,9 +286,6 @@ abstract class BaseAstNode extends PrintAstNode {
* Gets the AST represented by this node.
*/
final Locatable getAst() { result = ast }
/** DEPRECATED: Alias for getAst */
deprecated Locatable getAST() { result = this.getAst() }
}
/**
@@ -385,6 +382,21 @@ class CastNode extends ConversionNode {
}
}
/**
* A node representing a `C11GenericExpr`.
*/
class C11GenericNode extends ConversionNode {
C11GenericExpr generic;
C11GenericNode() { generic = conv }
override AstNode getChildInternal(int childIndex) {
result = super.getChildInternal(childIndex - count(generic.getAChild()))
or
result.getAst() = generic.getChild(childIndex)
}
}
/**
* A node representing a `StmtExpr`.
*/
@@ -860,6 +872,15 @@ private predicate namedExprChildPredicates(Expr expr, Element ele, string pred)
or
expr.(BuiltInVarArgsStart).getLastNamedParameter() = ele and pred = "getLastNamedParameter()"
or
expr.(C11GenericExpr).getControllingExpr() = ele and pred = "getControllingExpr()"
or
exists(int n |
expr.(C11GenericExpr).getAssociationType(n) = ele.(TypeName).getType() and
pred = "getAssociationType(" + n + ")"
or
expr.(C11GenericExpr).getAssociationExpr(n) = ele and pred = "getAssociationExpr(" + n + ")"
)
or
expr.(Call).getQualifier() = ele and pred = "getQualifier()"
or
exists(int n | expr.(Call).getArgument(n) = ele and pred = "getArgument(" + n.toString() + ")")

View File

@@ -39,8 +39,8 @@ class Type extends Locatable, @type {
/**
* Gets a specifier of this type, recursively looking through `typedef` and
* `decltype`. For example, in the context of `typedef const int *restrict
* t`, the type `volatile t` has specifiers `volatile` and `restrict` but not
* `decltype`. For example, in the context of `typedef const int *restrict t`,
* the type `volatile t` has specifiers `volatile` and `restrict` but not
* `const` since the `const` is attached to the type being pointed to rather
* than the pointer itself.
*/

View File

@@ -409,11 +409,18 @@ class LocalVariable extends LocalScopeVariable, @localvariable {
exists(ConditionDeclExpr e | e.getVariable() = this and e.getEnclosingFunction() = result)
or
orphaned_variables(underlyingElement(this), unresolveElement(result))
or
coroutine_placeholder_variable(underlyingElement(this), _, unresolveElement(result))
}
override predicate isStatic() {
super.isStatic() or orphaned_variables(underlyingElement(this), _)
}
override predicate isCompilerGenerated() {
super.isCompilerGenerated() or
coroutine_placeholder_variable(underlyingElement(this), _, _)
}
}
/**

View File

@@ -7,15 +7,6 @@ import semmle.code.cpp.models.interfaces.Deallocation
*/
predicate freeFunction(Function f, int argNum) { argNum = f.(DeallocationFunction).getFreedArg() }
/**
* A call to a library routine that frees memory.
*
* DEPRECATED: Use `DeallocationExpr` instead (this also includes `delete` expressions).
*/
deprecated predicate freeCall(FunctionCall fc, Expr arg) {
arg = fc.(DeallocationExpr).getFreedExpr()
}
/**
* Is e some kind of allocation or deallocation (`new`, `alloc`, `realloc`, `delete`, `free` etc)?
*/

View File

@@ -57,7 +57,7 @@ private int isSource(Expr bufferExpr, Element why) {
exists(Type bufferType |
// buffer is the address of a variable
why = bufferExpr.(AddressOfExpr).getAddressable() and
bufferType = why.(Variable).getType() and
bufferType = why.(Variable).getUnspecifiedType() and
result = bufferType.getSize() and
not bufferType instanceof ReferenceType and
not any(Union u).getAMemberVariable() = why

View File

@@ -168,14 +168,6 @@ abstract deprecated class Configuration extends string {
*/
predicate hasFlowToExpr(DataFlowExpr sink) { this.hasFlowTo(exprNode(sink)) }
/**
* DEPRECATED: Use `FlowExploration<explorationLimit>` instead.
*
* Gets the exploration limit for `hasPartialFlow` and `hasPartialFlowRev`
* measured in approximate number of interprocedural steps.
*/
deprecated int explorationLimit() { none() }
/**
* Holds if hidden nodes should be included in the data flow graph.
*
@@ -291,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }
predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }
predicate observeDiffInformedIncrementalMode() { none() }
}
deprecated private import Impl<Config> as I

View File

@@ -168,14 +168,6 @@ abstract deprecated class Configuration extends string {
*/
predicate hasFlowToExpr(DataFlowExpr sink) { this.hasFlowTo(exprNode(sink)) }
/**
* DEPRECATED: Use `FlowExploration<explorationLimit>` instead.
*
* Gets the exploration limit for `hasPartialFlow` and `hasPartialFlowRev`
* measured in approximate number of interprocedural steps.
*/
deprecated int explorationLimit() { none() }
/**
* Holds if hidden nodes should be included in the data flow graph.
*
@@ -291,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }
predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }
predicate observeDiffInformedIncrementalMode() { none() }
}
deprecated private import Impl<Config> as I

View File

@@ -168,14 +168,6 @@ abstract deprecated class Configuration extends string {
*/
predicate hasFlowToExpr(DataFlowExpr sink) { this.hasFlowTo(exprNode(sink)) }
/**
* DEPRECATED: Use `FlowExploration<explorationLimit>` instead.
*
* Gets the exploration limit for `hasPartialFlow` and `hasPartialFlowRev`
* measured in approximate number of interprocedural steps.
*/
deprecated int explorationLimit() { none() }
/**
* Holds if hidden nodes should be included in the data flow graph.
*
@@ -291,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }
predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }
predicate observeDiffInformedIncrementalMode() { none() }
}
deprecated private import Impl<Config> as I

View File

@@ -168,14 +168,6 @@ abstract deprecated class Configuration extends string {
*/
predicate hasFlowToExpr(DataFlowExpr sink) { this.hasFlowTo(exprNode(sink)) }
/**
* DEPRECATED: Use `FlowExploration<explorationLimit>` instead.
*
* Gets the exploration limit for `hasPartialFlow` and `hasPartialFlowRev`
* measured in approximate number of interprocedural steps.
*/
deprecated int explorationLimit() { none() }
/**
* Holds if hidden nodes should be included in the data flow graph.
*
@@ -291,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }
predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }
predicate observeDiffInformedIncrementalMode() { none() }
}
deprecated private import Impl<Config> as I

View File

@@ -168,14 +168,6 @@ abstract deprecated class Configuration extends string {
*/
predicate hasFlowToExpr(DataFlowExpr sink) { this.hasFlowTo(exprNode(sink)) }
/**
* DEPRECATED: Use `FlowExploration<explorationLimit>` instead.
*
* Gets the exploration limit for `hasPartialFlow` and `hasPartialFlowRev`
* measured in approximate number of interprocedural steps.
*/
deprecated int explorationLimit() { none() }
/**
* Holds if hidden nodes should be included in the data flow graph.
*
@@ -291,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }
predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }
predicate observeDiffInformedIncrementalMode() { none() }
}
deprecated private import Impl<Config> as I

View File

@@ -632,6 +632,106 @@ class ParenthesisExpr extends Conversion, @parexpr {
override string getAPrimaryQlClass() { result = "ParenthesisExpr" }
}
/**
* A node representing a C11 `_Generic` selection expression.
*
* For example:
* ```
* _Generic(e, int: "int", default: "unknown")
* ```
*/
class C11GenericExpr extends Conversion, @c11_generic {
int associationCount;
C11GenericExpr() { associationCount = (count(this.getAChild()) - 1) / 2 }
override string toString() { result = "_Generic" }
override string getAPrimaryQlClass() { result = "C11GenericExpr" }
/**
* Gets the controlling expression of the generic selection.
*
* For example, for
* ```
* _Generic(e, int: "a", default: "b")
* ```
* the result is `e`.
*/
Expr getControllingExpr() { result = this.getChild(0) }
/**
* Gets the type of the `n`th element in the association list of the generic selection.
*
* For example, for
* ```
* _Generic(e, int: "a", default: "b")
* ```
* the type of the 0th element is `int`. In the case of the default element the
* type will an instance of `VoidType`.
*/
Type getAssociationType(int n) {
n in [0 .. associationCount - 1] and
result = this.getChild(n * 2 + 1).(TypeName).getType()
}
/**
* Gets the type of an element in the association list of the generic selection.
*/
Type getAnAssociationType() { result = this.getAssociationType(_) }
/**
* Gets the expression of the `n`th element in the association list of
* the generic selection.
*
* For example, for
* ```
* _Generic(e, int: "a", default: "b")
* ```
* the expression for 0th element is `"a"`, and the expression for the
* 1st element is `"b"`. For the selected expression, this predicate
* will yield a `ReuseExpr`, such that
* ```
* this.getAssociationExpr(n).(ReuseExpr).getReusedExpr() = this.getExpr()
* ```
*/
Expr getAssociationExpr(int n) {
n in [0 .. associationCount - 1] and
result = this.getChild(n * 2 + 2)
}
/**
* Gets the expression of an element in the association list of the generic selection.
*/
Expr getAnAssociationExpr() { result = this.getAssociationExpr(_) }
/**
* Holds if the `n`th element of the association list of the generic selection is the
* default element.
*
* For example, for
* ```
* _Generic(e, int: "a", default: "b")
* ```
* this holds for 1.
*/
predicate isDefaultAssociation(int n) { this.getAssociationType(n) instanceof VoidType }
/**
* Holds if the `n`th element of the association list of the generic selection is the
* one whose expression was selected.
*
* For example, with `e` of type `int` and
* ```
* _Generic(e, int: "a", default: "b")
* ```
* this holds for 0.
*/
predicate isSelectedAssociation(int n) {
this.getAssociationExpr(n).(ReuseExpr).getReusedExpr() = this.getExpr()
}
}
/**
* A C/C++ expression that could not be resolved, or that can no longer be
* represented due to a database upgrade or downgrade.
@@ -668,6 +768,8 @@ class AssumeExpr extends Expr, @assume {
/**
* A C/C++ comma expression.
*
* For example:
* ```
* int c = compute1(), compute2(), resulting_value;
* ```

View File

@@ -195,17 +195,6 @@ class ClassAggregateLiteral extends AggregateLiteral {
*/
Expr getAFieldExpr(Field field) { result = this.getFieldExpr(field, _) }
/**
* DEPRECATED: Use `getAFieldExpr` instead.
*
* Gets the expression within the aggregate literal that is used to initialize
* field `field`, if present.
*
* This predicate may have multiple results since a field can be initialized
* multiple times in the same initializer.
*/
deprecated Expr getFieldExpr(Field field) { result = this.getFieldExpr(field, _) }
/**
* Gets the expression within the aggregate literal that is used to initialize
* field `field`, if present. The expression is the `position`'th entry in the
@@ -300,17 +289,6 @@ class ArrayOrVectorAggregateLiteral extends AggregateLiteral {
*/
Expr getAnElementExpr(int elementIndex) { result = this.getElementExpr(elementIndex, _) }
/**
* DEPRECATED: Use `getAnElementExpr` instead.
*
* Gets the expression within the aggregate literal that is used to initialize
* element `elementIndex`, if present.
*
* This predicate may have multiple results since an element can be initialized
* multiple times in the same initializer.
*/
deprecated Expr getElementExpr(int elementIndex) { result = this.getElementExpr(elementIndex, _) }
/**
* Gets the expression within the aggregate literal that is used to initialize
* element `elementIndex`, if present. The expression is the `position`'th entry

View File

@@ -168,14 +168,6 @@ abstract deprecated class Configuration extends string {
*/
predicate hasFlowToExpr(DataFlowExpr sink) { this.hasFlowTo(exprNode(sink)) }
/**
* DEPRECATED: Use `FlowExploration<explorationLimit>` instead.
*
* Gets the exploration limit for `hasPartialFlow` and `hasPartialFlowRev`
* measured in approximate number of interprocedural steps.
*/
deprecated int explorationLimit() { none() }
/**
* Holds if hidden nodes should be included in the data flow graph.
*
@@ -291,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }
predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }
predicate observeDiffInformedIncrementalMode() { none() }
}
deprecated private import Impl<Config> as I

View File

@@ -168,14 +168,6 @@ abstract deprecated class Configuration extends string {
*/
predicate hasFlowToExpr(DataFlowExpr sink) { this.hasFlowTo(exprNode(sink)) }
/**
* DEPRECATED: Use `FlowExploration<explorationLimit>` instead.
*
* Gets the exploration limit for `hasPartialFlow` and `hasPartialFlowRev`
* measured in approximate number of interprocedural steps.
*/
deprecated int explorationLimit() { none() }
/**
* Holds if hidden nodes should be included in the data flow graph.
*
@@ -291,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }
predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }
predicate observeDiffInformedIncrementalMode() { none() }
}
deprecated private import Impl<Config> as I

View File

@@ -168,14 +168,6 @@ abstract deprecated class Configuration extends string {
*/
predicate hasFlowToExpr(DataFlowExpr sink) { this.hasFlowTo(exprNode(sink)) }
/**
* DEPRECATED: Use `FlowExploration<explorationLimit>` instead.
*
* Gets the exploration limit for `hasPartialFlow` and `hasPartialFlowRev`
* measured in approximate number of interprocedural steps.
*/
deprecated int explorationLimit() { none() }
/**
* Holds if hidden nodes should be included in the data flow graph.
*
@@ -291,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }
predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }
predicate observeDiffInformedIncrementalMode() { none() }
}
deprecated private import Impl<Config> as I

View File

@@ -168,14 +168,6 @@ abstract deprecated class Configuration extends string {
*/
predicate hasFlowToExpr(DataFlowExpr sink) { this.hasFlowTo(exprNode(sink)) }
/**
* DEPRECATED: Use `FlowExploration<explorationLimit>` instead.
*
* Gets the exploration limit for `hasPartialFlow` and `hasPartialFlowRev`
* measured in approximate number of interprocedural steps.
*/
deprecated int explorationLimit() { none() }
/**
* Holds if hidden nodes should be included in the data flow graph.
*
@@ -291,6 +283,8 @@ deprecated private module Config implements FullStateConfigSig {
FlowFeature getAFeature() { result = any(Configuration config).getAFeature() }
predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }
predicate observeDiffInformedIncrementalMode() { none() }
}
deprecated private import Impl<Config> as I

View File

@@ -546,7 +546,7 @@ module ProductFlow {
Flow1::PathGraph::edges(pred1, succ1, _, _) and
exists(ReturnKindExt returnKind |
succ1.getNode() = returnKind.getAnOutNode(call) and
paramReturnNode(_, pred1.asParameterReturnNode(), _, returnKind)
returnKind = getParamReturnPosition(_, pred1.asParameterReturnNode()).getKind()
)
}
@@ -574,7 +574,7 @@ module ProductFlow {
Flow2::PathGraph::edges(pred2, succ2, _, _) and
exists(ReturnKindExt returnKind |
succ2.getNode() = returnKind.getAnOutNode(call) and
paramReturnNode(_, pred2.asParameterReturnNode(), _, returnKind)
returnKind = getParamReturnPosition(_, pred2.asParameterReturnNode()).getKind()
)
}

View File

@@ -50,9 +50,6 @@ abstract private class AbstractIRVariable extends TIRVariable {
*/
abstract Language::AST getAst();
/** DEPRECATED: Alias for getAst */
deprecated Language::AST getAST() { result = this.getAst() }
/**
* Gets an identifier string for the variable. This identifier is unique
* within the function.
@@ -96,9 +93,6 @@ class IRUserVariable extends AbstractIRVariable, TIRUserVariable {
final override Language::AST getAst() { result = var }
/** DEPRECATED: Alias for getAst */
deprecated override Language::AST getAST() { result = this.getAst() }
final override string getUniqueId() {
result = this.getVariable().toString() + " " + this.getVariable().getLocation().toString()
}
@@ -163,9 +157,6 @@ abstract private class AbstractIRGeneratedVariable extends AbstractIRVariable {
final override Language::AST getAst() { result = ast }
/** DEPRECATED: Alias for getAst */
deprecated override Language::AST getAST() { result = this.getAst() }
override string toString() { result = this.getBaseString() + this.getLocationString() }
override string getUniqueId() { none() }

View File

@@ -285,9 +285,6 @@ abstract private class MemoryLocation0 extends TMemoryLocation {
predicate isAlwaysAllocatedOnStack() { none() }
final predicate canReuseSsa() { none() }
/** DEPRECATED: Alias for canReuseSsa */
deprecated predicate canReuseSSA() { this.canReuseSsa() }
}
/**

View File

@@ -50,9 +50,6 @@ abstract private class AbstractIRVariable extends TIRVariable {
*/
abstract Language::AST getAst();
/** DEPRECATED: Alias for getAst */
deprecated Language::AST getAST() { result = this.getAst() }
/**
* Gets an identifier string for the variable. This identifier is unique
* within the function.
@@ -96,9 +93,6 @@ class IRUserVariable extends AbstractIRVariable, TIRUserVariable {
final override Language::AST getAst() { result = var }
/** DEPRECATED: Alias for getAst */
deprecated override Language::AST getAST() { result = this.getAst() }
final override string getUniqueId() {
result = this.getVariable().toString() + " " + this.getVariable().getLocation().toString()
}
@@ -163,9 +157,6 @@ abstract private class AbstractIRGeneratedVariable extends AbstractIRVariable {
final override Language::AST getAst() { result = ast }
/** DEPRECATED: Alias for getAst */
deprecated override Language::AST getAST() { result = this.getAst() }
override string toString() { result = this.getBaseString() + this.getLocationString() }
override string getUniqueId() { none() }

View File

@@ -216,9 +216,6 @@ abstract class TranslatedSideEffects extends TranslatedElement {
final override Locatable getAst() { result = this.getExpr() }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
final override Declaration getFunction() { result = getEnclosingDeclaration(this.getExpr()) }
final override TranslatedElement getChild(int i) {
@@ -616,9 +613,6 @@ class TranslatedArgumentExprSideEffect extends TranslatedArgumentSideEffect,
final override Locatable getAst() { result = arg }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
final override Type getIndirectionType() {
result = arg.getUnspecifiedType().(DerivedType).getBaseType()
or
@@ -651,9 +645,6 @@ class TranslatedStructorQualifierSideEffect extends TranslatedArgumentSideEffect
final override Locatable getAst() { result = call }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
final override Type getIndirectionType() { result = call.getTarget().getDeclaringType() }
final override string getArgString() { result = "this" }
@@ -675,9 +666,6 @@ class TranslatedCallSideEffect extends TranslatedSideEffect, TTranslatedCallSide
override Locatable getAst() { result = expr }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
override Expr getPrimaryExpr() { result = expr }
override predicate sortOrder(int group, int indexInGroup) {
@@ -716,9 +704,6 @@ class TranslatedAllocationSideEffect extends TranslatedSideEffect, TTranslatedAl
override Locatable getAst() { result = expr }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
override Expr getPrimaryExpr() { result = expr }
override predicate sortOrder(int group, int indexInGroup) {

View File

@@ -29,9 +29,6 @@ abstract class TranslatedCondition extends TranslatedElement {
final override Locatable getAst() { result = expr }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
final ConditionContext getConditionContext() { result = this.getParent() }
final Expr getExpr() { result = expr }

View File

@@ -45,9 +45,6 @@ abstract class TranslatedDeclarationEntry extends TranslatedElement, TTranslated
final override string toString() { result = entry.toString() }
final override Locatable getAst() { result = entry.getAst() }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
}
/**
@@ -248,9 +245,6 @@ class TranslatedStaticLocalVariableInitialization extends TranslatedElement,
final override Locatable getAst() { result = entry.getAst() }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
final override LocalVariable getVariable() { result = var }
final override Declaration getFunction() { result = var.getFunction() }
@@ -277,9 +271,6 @@ class TranslatedConditionDecl extends TranslatedLocalVariableDeclaration, TTrans
override Locatable getAst() { result = conditionDeclExpr }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
override Declaration getFunction() { result = getEnclosingFunction(conditionDeclExpr) }
override LocalVariable getVariable() { result = conditionDeclExpr.getVariable() }

View File

@@ -128,6 +128,9 @@ private predicate ignoreExprAndDescendants(Expr expr) {
vaStartExpr.getLastNamedParameter().getFullyConverted() = expr
)
or
// The children of C11 _Generic expressions are just surface syntax.
exists(C11GenericExpr generic | generic.getAChild() = expr)
or
// Do not translate implicit destructor calls for unnamed temporary variables that are
// conditionally constructed (until we have a mechanism for calling these only when the
// temporary's constructor was run)
@@ -432,6 +435,9 @@ predicate ignoreLoad(Expr expr) {
// The load is duplicated from the right operand.
isExtractorFrontendVersion65OrHigher() and expr instanceof CommaExpr
or
// The load is duplicated from the chosen expression.
expr instanceof C11GenericExpr
or
expr.(PointerDereferenceExpr).getOperand().getFullyConverted().getType().getUnspecifiedType()
instanceof FunctionPointerType
or
@@ -761,7 +767,10 @@ newtype TTranslatedElement =
} or
// A statement
TTranslatedStmt(Stmt stmt) { translateStmt(stmt) } or
// The `__except` block of a `__try __except` statement
TTranslatedMicrosoftTryExceptHandler(MicrosoftTryExceptStmt stmt) or
// The `__finally` block of a `__try __finally` statement
TTranslatedMicrosoftTryFinallyHandler(MicrosoftTryFinallyStmt stmt) or
// A function
TTranslatedFunction(Function func) { translateFunction(func) } or
// A constructor init list
@@ -920,9 +929,6 @@ abstract class TranslatedElement extends TTranslatedElement {
*/
abstract Locatable getAst();
/** DEPRECATED: Alias for getAst */
deprecated Locatable getAST() { result = this.getAst() }
/** Gets the location of this element. */
Location getLocation() { result = this.getAst().getLocation() }

View File

@@ -893,7 +893,8 @@ class TranslatedTransparentConversion extends TranslatedTransparentExpr {
(
expr instanceof ParenthesisExpr or
expr instanceof ReferenceDereferenceExpr or
expr instanceof ReferenceToExpr
expr instanceof ReferenceToExpr or
expr instanceof C11GenericExpr
)
}

View File

@@ -67,9 +67,6 @@ class TranslatedFunction extends TranslatedRootElement, TTranslatedFunction {
final override Locatable getAst() { result = func }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
/**
* Gets the function being translated.
*/
@@ -212,8 +209,13 @@ class TranslatedFunction extends TranslatedRootElement, TTranslatedFunction {
(
// Only generate the `Unwind` instruction if there is any exception
// handling present in the function.
exists(TryStmt try | try.getEnclosingFunction() = func) or
exists(TryOrMicrosoftTryStmt try | try.getEnclosingFunction() = func)
or
exists(ThrowExpr throw | throw.getEnclosingFunction() = func)
or
exists(FunctionCall call | call.getEnclosingFunction() = func |
getTranslatedExpr(call).(TranslatedCallExpr).mayThrowException()
)
)
or
tag = AliasedUseTag() and
@@ -483,9 +485,6 @@ class TranslatedThisParameter extends TranslatedParameter, TTranslatedThisParame
final override Locatable getAst() { result = func }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
final override Function getFunction() { result = func }
final override predicate hasIndirection() { any() }
@@ -518,9 +517,6 @@ class TranslatedPositionalParameter extends TranslatedParameter, TTranslatedPara
final override Locatable getAst() { result = param }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
final override Function getFunction() {
result = param.getFunction() or
result = param.getCatchBlock().getEnclosingFunction()
@@ -558,9 +554,6 @@ class TranslatedEllipsisParameter extends TranslatedParameter, TTranslatedEllips
final override Locatable getAst() { result = func }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
final override Function getFunction() { result = func }
final override predicate hasIndirection() { any() }
@@ -597,9 +590,6 @@ class TranslatedConstructorInitList extends TranslatedElement, InitializationCon
override Locatable getAst() { result = func }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
override TranslatedElement getChild(int id) {
exists(ConstructorFieldInit fieldInit |
fieldInit = func.(Constructor).getInitializer(id) and
@@ -677,9 +667,6 @@ class TranslatedDestructorDestructionList extends TranslatedElement,
override Locatable getAst() { result = func }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
override TranslatedElement getChild(int id) {
exists(DestructorFieldDestruction fieldDestruction |
fieldDestruction = func.(Destructor).getDestruction(id) and
@@ -733,9 +720,6 @@ class TranslatedReadEffects extends TranslatedElement, TTranslatedReadEffects {
override Locatable getAst() { result = func }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
override Function getFunction() { result = func }
override string toString() { result = "read effects: " + func.toString() }
@@ -839,9 +823,6 @@ class TranslatedThisReadEffect extends TranslatedReadEffect, TTranslatedThisRead
override Locatable getAst() { result = func }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
override Function getFunction() { result = func }
override string toString() { result = "read effect: this" }
@@ -865,9 +846,6 @@ class TranslatedParameterReadEffect extends TranslatedReadEffect, TTranslatedPar
override Locatable getAst() { result = param }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
override string toString() { result = "read effect: " + param.toString() }
override Function getFunction() { result = param.getFunction() }

View File

@@ -153,9 +153,6 @@ abstract class TranslatedInitialization extends TranslatedElement, TTranslatedIn
final override Locatable getAst() { result = expr }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
/**
* Gets the expression that is doing the initialization.
*/
@@ -528,9 +525,6 @@ abstract class TranslatedFieldInitialization extends TranslatedElement {
final override Locatable getAst() { result = ast }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
final override Declaration getFunction() {
result = getEnclosingFunction(ast) or
result = getEnclosingVariable(ast).(GlobalOrNamespaceVariable) or
@@ -701,9 +695,6 @@ abstract class TranslatedElementInitialization extends TranslatedElement {
final override Locatable getAst() { result = initList }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
final override Declaration getFunction() {
result = getEnclosingFunction(initList)
or
@@ -912,9 +903,6 @@ abstract class TranslatedStructorCallFromStructor extends TranslatedElement, Str
final override Locatable getAst() { result = call }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
final override TranslatedElement getChild(int id) {
id = 0 and
result = this.getStructorCall()
@@ -1058,9 +1046,6 @@ class TranslatedConstructorBareInit extends TranslatedElement, TTranslatedConstr
override Locatable getAst() { result = init }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
final override string toString() { result = "construct base (no constructor)" }
override Instruction getFirstInstruction(EdgeKind kind) {

View File

@@ -79,11 +79,6 @@ class TranslatedMicrosoftTryExceptHandler extends TranslatedElement,
tag = TryExceptCompareOneBranch() and
opcode instanceof Opcode::ConditionalBranch and
resultType = getVoidType()
or
// unwind stack
tag = UnwindTag() and
opcode instanceof Opcode::Unwind and
resultType = getVoidType()
}
final override Instruction getInstructionRegisterOperand(InstructionTag tag, OperandTag operandTag) {
@@ -156,7 +151,7 @@ class TranslatedMicrosoftTryExceptHandler extends TranslatedElement,
// TODO: This is not really correct. The semantics of `EXCEPTION_CONTINUE_EXECUTION` is that
// we should continue execution at the point where the exception occurred. But we don't have
// any instruction to model this behavior.
result = this.getInstruction(UnwindTag())
result = this.getExceptionSuccessorInstruction(any(GotoEdge edge))
or
kind instanceof FalseEdge and
result = this.getInstruction(TryExceptGenerateZero())
@@ -176,7 +171,7 @@ class TranslatedMicrosoftTryExceptHandler extends TranslatedElement,
tag = TryExceptCompareZeroBranch() and
(
kind instanceof TrueEdge and
result = this.getInstruction(UnwindTag())
result = this.getExceptionSuccessorInstruction(any(GotoEdge edge))
or
kind instanceof FalseEdge and
result = this.getInstruction(TryExceptGenerateOne())
@@ -196,10 +191,6 @@ class TranslatedMicrosoftTryExceptHandler extends TranslatedElement,
tag = TryExceptCompareOneBranch() and
kind instanceof TrueEdge and
result = this.getTranslatedHandler().getFirstInstruction(any(GotoEdge edge))
or
// Unwind -> Parent
tag = UnwindTag() and
result = this.getParent().getChildSuccessor(this, kind)
}
override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
@@ -215,8 +206,6 @@ class TranslatedMicrosoftTryExceptHandler extends TranslatedElement,
override Instruction getALastInstructionInternal() {
result = this.getTranslatedHandler().getALastInstruction()
or
result = this.getInstruction(UnwindTag())
}
private TranslatedExpr getTranslatedCondition() {
@@ -236,6 +225,68 @@ class TranslatedMicrosoftTryExceptHandler extends TranslatedElement,
}
final override Function getFunction() { result = tryExcept.getEnclosingFunction() }
override Instruction getExceptionSuccessorInstruction(EdgeKind kind) {
// A throw from within a `__except` block flows to the handler for the parent of
// the `__try`.
result = this.getParent().getParent().getExceptionSuccessorInstruction(kind)
}
}
TranslatedMicrosoftTryFinallyHandler getTranslatedMicrosoftTryFinallyHandler(
MicrosoftTryFinallyStmt tryFinally
) {
result.getAst() = tryFinally.getFinally()
}
class TranslatedMicrosoftTryFinallyHandler extends TranslatedElement,
TTranslatedMicrosoftTryFinallyHandler
{
MicrosoftTryFinallyStmt tryFinally;
TranslatedMicrosoftTryFinallyHandler() {
this = TTranslatedMicrosoftTryFinallyHandler(tryFinally)
}
final override string toString() { result = tryFinally.toString() }
final override Locatable getAst() { result = tryFinally.getFinally() }
override Instruction getFirstInstruction(EdgeKind kind) {
result = this.getTranslatedFinally().getFirstInstruction(kind)
}
override Instruction getALastInstructionInternal() {
result = this.getTranslatedFinally().getALastInstruction()
}
override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
child = this.getTranslatedFinally() and
result = this.getParent().getChildSuccessor(this, kind)
}
override Instruction getInstructionSuccessorInternal(InstructionTag tag, EdgeKind kind) { none() }
override TranslatedElement getChild(int id) {
id = 0 and
result = this.getTranslatedFinally()
}
override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) {
none()
}
final override Function getFunction() { result = tryFinally.getEnclosingFunction() }
private TranslatedStmt getTranslatedFinally() {
result = getTranslatedStmt(tryFinally.getFinally())
}
override Instruction getExceptionSuccessorInstruction(EdgeKind kind) {
// A throw from within a `__finally` block flows to the handler for the parent of
// the `__try`.
result = this.getParent().getParent().getExceptionSuccessorInstruction(kind)
}
}
abstract class TranslatedStmt extends TranslatedElement, TTranslatedStmt {
@@ -268,9 +319,6 @@ abstract class TranslatedStmt extends TranslatedElement, TTranslatedStmt {
final override Locatable getAst() { result = stmt }
/** DEPRECATED: Alias for getAst */
deprecated override Locatable getAST() { result = this.getAst() }
final override Function getFunction() { result = stmt.getEnclosingFunction() }
}
@@ -586,7 +634,7 @@ class TranslatedNoValueReturnStmt extends TranslatedReturnStmt, TranslatedVariab
/**
* A C/C++ `try` statement, or a `__try __except` or `__try __finally` statement.
*/
private class TryOrMicrosoftTryStmt extends Stmt {
class TryOrMicrosoftTryStmt extends Stmt {
TryOrMicrosoftTryStmt() {
this instanceof TryStmt or
this instanceof MicrosoftTryStmt
@@ -619,7 +667,9 @@ private class TryOrMicrosoftTryStmt extends Stmt {
}
/** Gets the `finally` statement (usually a BlockStmt), if any. */
Stmt getFinally() { result = this.(MicrosoftTryFinallyStmt).getFinally() }
TranslatedElement getTranslatedFinally() {
result = getTranslatedMicrosoftTryFinallyHandler(this)
}
}
/**
@@ -689,11 +739,14 @@ class TranslatedTryStmt extends TranslatedStmt {
final override Instruction getExceptionSuccessorInstruction(EdgeKind kind) {
result = this.getHandler(0).getFirstInstruction(kind)
or
not exists(this.getHandler(_)) and
result = this.getFinally().getFirstInstruction(kind)
}
private TranslatedElement getHandler(int index) { result = stmt.getTranslatedHandler(index) }
private TranslatedStmt getFinally() { result = getTranslatedStmt(stmt.getFinally()) }
private TranslatedElement getFinally() { result = stmt.getTranslatedFinally() }
private TranslatedStmt getBody() { result = getTranslatedStmt(stmt.getStmt()) }
}

View File

@@ -50,9 +50,6 @@ abstract private class AbstractIRVariable extends TIRVariable {
*/
abstract Language::AST getAst();
/** DEPRECATED: Alias for getAst */
deprecated Language::AST getAST() { result = this.getAst() }
/**
* Gets an identifier string for the variable. This identifier is unique
* within the function.
@@ -96,9 +93,6 @@ class IRUserVariable extends AbstractIRVariable, TIRUserVariable {
final override Language::AST getAst() { result = var }
/** DEPRECATED: Alias for getAst */
deprecated override Language::AST getAST() { result = this.getAst() }
final override string getUniqueId() {
result = this.getVariable().toString() + " " + this.getVariable().getLocation().toString()
}
@@ -163,9 +157,6 @@ abstract private class AbstractIRGeneratedVariable extends AbstractIRVariable {
final override Language::AST getAst() { result = ast }
/** DEPRECATED: Alias for getAst */
deprecated override Language::AST getAST() { result = this.getAst() }
override string toString() { result = this.getBaseString() + this.getLocationString() }
override string getUniqueId() { none() }

View File

@@ -71,9 +71,6 @@ class MemoryLocation extends TMemoryLocation {
final string getUniqueId() { result = var.getUniqueId() }
final predicate canReuseSsa() { canReuseSsaForVariable(var) }
/** DEPRECATED: Alias for canReuseSsa */
deprecated predicate canReuseSSA() { this.canReuseSsa() }
}
predicate canReuseSsaForOldResult(Instruction instr) { none() }

View File

@@ -5,13 +5,13 @@
*/
import semmle.code.cpp.models.interfaces.Allocation
import semmle.code.cpp.models.interfaces.Taint
import semmle.code.cpp.models.interfaces.DataFlow
/**
* An allocation function (such as `realloc`) that has an argument for the size
* in bytes, and an argument for an existing pointer that is to be reallocated.
*/
private class ReallocAllocationFunction extends AllocationFunction, TaintFunction {
private class ReallocAllocationFunction extends AllocationFunction, DataFlowFunction {
int sizeArg;
int reallocArg;
@@ -44,7 +44,7 @@ private class ReallocAllocationFunction extends AllocationFunction, TaintFunctio
override int getReallocPtrArg() { result = reallocArg }
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
override predicate hasDataFlow(FunctionInput input, FunctionOutput output) {
input.isParameterDeref(this.getReallocPtrArg()) and output.isReturnValueDeref()
}
}

View File

@@ -26,7 +26,7 @@ private class Swap extends DataFlowFunction {
* obj1.swap(obj2)
* ```
*/
private class MemberSwap extends TaintFunction, MemberFunction, AliasFunction {
private class MemberSwap extends DataFlowFunction, MemberFunction, AliasFunction {
MemberSwap() {
this.hasName("swap") and
this.getNumberOfParameters() = 1 and
@@ -34,7 +34,7 @@ private class MemberSwap extends TaintFunction, MemberFunction, AliasFunction {
this.getDeclaringType()
}
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
override predicate hasDataFlow(FunctionInput input, FunctionOutput output) {
input.isQualifierObject() and
output.isParameterDeref(0)
or

View File

@@ -118,19 +118,34 @@ abstract class FormattingFunction extends ArrayFunction, TaintFunction {
/**
* Gets the position of the first format argument, corresponding with
* the first format specifier in the format string.
* the first format specifier in the format string. We ignore all
* implicit function definitions.
*/
int getFirstFormatArgumentIndex() {
result = this.getNumberOfParameters() and
// the formatting function either has a definition in the snapshot, or all
// The formatting function either has a definition in the snapshot, or all
// `DeclarationEntry`s agree on the number of parameters (otherwise we don't
// really know the correct number)
(
this.hasDefinition()
or
forall(FunctionDeclarationEntry fde | fde = this.getADeclarationEntry() |
result = fde.getNumberOfParameters()
)
if this.hasDefinition()
then result = this.getDefinition().getNumberOfParameters()
else result = this.getNumberOfExplicitParameters()
}
/**
* Gets a non-implicit function declaration entry.
*/
private FunctionDeclarationEntry getAnExplicitDeclarationEntry() {
result = this.getADeclarationEntry() and
not result.isImplicit()
}
/**
* Gets the number of parameters, excluding any parameters that have been defined
* from implicit function declarations. If there is some inconsistency in the number
* of parameters, then don't return anything.
*/
private int getNumberOfExplicitParameters() {
forex(FunctionDeclarationEntry fde | fde = this.getAnExplicitDeclarationEntry() |
result = fde.getNumberOfParameters()
)
}

View File

@@ -14,7 +14,11 @@ int getPointedSize(Type t) {
* BufferWrite differ.
*/
abstract class BufferAccess extends Expr {
BufferAccess() { not this.isUnevaluated() }
BufferAccess() {
not this.isUnevaluated() and
//A buffer access must be reachable (not in dead code)
reachable(this)
}
abstract string getName();
@@ -26,6 +30,8 @@ abstract class BufferAccess extends Expr {
* - 1 = buffer range [0, getSize) is accessed entirely.
* - 2 = buffer range [0, getSize) may be accessed partially or entirely.
* - 3 = buffer is accessed at offset getSize - 1.
* - 4 = buffer is accessed with null terminator read protections
* (does not read past null terminator, regardless of access size)
*/
abstract Expr getBuffer(string bufferDesc, int accessType);
@@ -128,7 +134,7 @@ class StrncpyBA extends BufferAccess {
or
result = this.(FunctionCall).getArgument(1) and
bufferDesc = "source buffer" and
accessType = 2
accessType = 4
}
override Expr getSizeExpr() { result = this.(FunctionCall).getArgument(2) }

View File

@@ -160,6 +160,26 @@ private module InvalidPointerToDerefBarrier {
}
}
/**
* BEWARE: This configuration uses an unrestricted sink, so accessing its full
* flow computation or any stages beyond the first 2 will likely diverge.
* Stage 1 will still be fast and we use it to restrict the subsequent sink
* computation.
*/
private module InvalidPointerReachesConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { invalidPointerToDerefSource(_, _, source) }
predicate isSink(DataFlow::Node sink) { any() }
predicate isBarrier(DataFlow::Node node) { InvalidPointerToDerefConfig::isBarrier(node) }
int fieldFlowBranchLimit() { result = invalidPointerToDereferenceFieldFlowBranchLimit() }
}
private module InvalidPointerReachesFlow = DataFlow::Global<InvalidPointerReachesConfig>;
private import semmle.code.cpp.ir.dataflow.internal.DataFlowImplCommon as DataFlowImplCommon
/**
* A configuration to track flow from a pointer-arithmetic operation found
* by `AllocToInvalidPointerConfig` to a dereference of the pointer.
@@ -173,8 +193,13 @@ private module InvalidPointerToDerefConfig implements DataFlow::StateConfigSig {
invalidPointerToDerefSource(_, pai, source)
}
pragma[inline]
predicate isSink(DataFlow::Node sink) { isInvalidPointerDerefSink(sink, _, _, _, _) }
predicate isSink(DataFlow::Node sink) {
exists(DataFlowImplCommon::NodeEx n |
InvalidPointerReachesFlow::Stages::Stage1::sinkNode(n, _) and
n.asNode() = sink and
isInvalidPointerDerefSink(sink, _, _, _, _)
)
}
predicate isSink(DataFlow::Node sink, FlowState pai) { none() }

View File

@@ -353,22 +353,6 @@ module BoostorgAsio {
}
//////////////////////// Dataflow /////////////////////
/**
* Abstract class for flows of protocol values to the first argument of a context
* constructor.
*/
abstract deprecated class SslContextCallAbstractConfig extends DataFlow::Configuration {
bindingset[this]
SslContextCallAbstractConfig() { any() }
override predicate isSink(DataFlow::Node sink) {
exists(ConstructorCall cc, SslContextClass c, Expr e | e = sink.asExpr() |
c.getAContructorCall() = cc and
cc.getArgument(0) = e
)
}
}
/**
* Signature for flows of protocol values to the first argument of a context
* constructor.
@@ -402,20 +386,6 @@ module BoostorgAsio {
import DataFlow::Global<C>
}
/**
* Any protocol value that flows to the first argument of a context constructor.
*/
deprecated class SslContextCallConfig extends SslContextCallAbstractConfig {
SslContextCallConfig() { this = "SslContextCallConfig" }
override predicate isSource(DataFlow::Node source) {
exists(Expr e | e = source.asExpr() |
e.fromSource() and
not e.getLocation().getFile().toString().matches("%/boost/asio/%")
)
}
}
/**
* Any protocol value that flows to the first argument of a context constructor.
*/
@@ -430,21 +400,6 @@ module BoostorgAsio {
module SslContextCallFlow = SslContextCallGlobal<SslContextCallConfig>;
/**
* A banned protocol value that flows to the first argument of a context constructor.
*/
deprecated class SslContextCallBannedProtocolConfig extends SslContextCallAbstractConfig {
SslContextCallBannedProtocolConfig() { this = "SslContextCallBannedProtocolConfig" }
override predicate isSource(DataFlow::Node source) {
exists(Expr e | e = source.asExpr() |
e.fromSource() and
not e.getLocation().getFile().toString().matches("%/boost/asio/%") and
isExprBannedBoostProtocol(e)
)
}
}
/**
* A banned protocol value that flows to the first argument of a context constructor.
*/
@@ -461,21 +416,6 @@ module BoostorgAsio {
module SslContextCallBannedProtocolFlow =
SslContextCallGlobal<SslContextCallBannedProtocolConfig>;
/**
* A TLS 1.2 protocol value that flows to the first argument of a context constructor.
*/
deprecated class SslContextCallTls12ProtocolConfig extends SslContextCallAbstractConfig {
SslContextCallTls12ProtocolConfig() { this = "SslContextCallTls12ProtocolConfig" }
override predicate isSource(DataFlow::Node source) {
exists(Expr e | e = source.asExpr() |
e.fromSource() and
not e.getLocation().getFile().toString().matches("%/boost/asio/%") and
isExprTls12BoostProtocol(e)
)
}
}
/**
* A TLS 1.2 protocol value that flows to the first argument of a context constructor.
*/
@@ -491,21 +431,6 @@ module BoostorgAsio {
module SslContextCallTls12ProtocolFlow = SslContextCallGlobal<SslContextCallTls12ProtocolConfig>;
/**
* A TLS 1.3 protocol value that flows to the first argument of a context constructor.
*/
deprecated class SslContextCallTls13ProtocolConfig extends SslContextCallAbstractConfig {
SslContextCallTls13ProtocolConfig() { this = "SslContextCallTls12ProtocolConfig" }
override predicate isSource(DataFlow::Node source) {
exists(Expr e | e = source.asExpr() |
e.fromSource() and
not e.getLocation().getFile().toString().matches("%/boost/asio/%") and
isExprTls13BoostProtocol(e)
)
}
}
/**
* A TLS 1.3 protocol value that flows to the first argument of a context constructor.
*/
@@ -521,21 +446,6 @@ module BoostorgAsio {
module SslContextCallTls13ProtocolFlow = SslContextCallGlobal<SslContextCallTls13ProtocolConfig>;
/**
* A generic TLS protocol value that flows to the first argument of a context constructor.
*/
deprecated class SslContextCallTlsProtocolConfig extends SslContextCallAbstractConfig {
SslContextCallTlsProtocolConfig() { this = "SslContextCallTlsProtocolConfig" }
override predicate isSource(DataFlow::Node source) {
exists(Expr e | e = source.asExpr() |
e.fromSource() and
not e.getLocation().getFile().toString().matches("%/boost/asio/%") and
isExprTlsBoostProtocol(e)
)
}
}
/**
* A generic TLS protocol value that flows to the first argument of a context constructor.
*/
@@ -551,30 +461,6 @@ module BoostorgAsio {
module SslContextCallTlsProtocolFlow = SslContextCallGlobal<SslContextCallTlsProtocolConfig>;
/**
* A context constructor call that flows to a call to `SetOptions()`.
*/
deprecated class SslContextFlowsToSetOptionConfig extends DataFlow::Configuration {
SslContextFlowsToSetOptionConfig() { this = "SslContextFlowsToSetOptionConfig" }
override predicate isSource(DataFlow::Node source) {
exists(SslContextClass c, ConstructorCall cc |
cc = source.asExpr() and
c.getAContructorCall() = cc
)
}
override predicate isSink(DataFlow::Node sink) {
exists(FunctionCall fc, SslSetOptionsFunction f, Variable v, VariableAccess va |
va = sink.asExpr()
|
f.getACallToThisFunction() = fc and
v.getAnAccess() = va and
va = fc.getQualifier()
)
}
}
/**
* A context constructor call that flows to a call to `SetOptions()`.
*/
@@ -599,28 +485,6 @@ module BoostorgAsio {
module SslContextFlowsToSetOptionFlow = DataFlow::Global<SslContextFlowsToSetOptionConfig>;
/**
* An option value that flows to the first parameter of a call to `SetOptions()`.
*/
deprecated class SslOptionConfig extends DataFlow::Configuration {
SslOptionConfig() { this = "SslOptionConfig" }
override predicate isSource(DataFlow::Node source) {
exists(Expr e | e = source.asExpr() |
e.fromSource() and
not e.getLocation().getFile().toString().matches("%/boost/asio/%")
)
}
override predicate isSink(DataFlow::Node sink) {
exists(SslSetOptionsFunction f, FunctionCall call |
sink.asExpr() = call.getArgument(0) and
f.getACallToThisFunction() = call and
not sink.getLocation().getFile().toString().matches("%/boost/asio/%")
)
}
}
/**
* An option value that flows to the first parameter of a call to `SetOptions()`.
*/

View File

@@ -72,7 +72,6 @@ module FlowFromFree<FlowFromFreeParamSig P> {
predicate isSource(DataFlow::Node node, FlowState state) { isFree(node, _, state, _) }
pragma[inline]
predicate isSink(DataFlow::Node sink, FlowState state) {
exists(Expr e, DataFlow::Node source, DeallocationExpr dealloc |
P::isSink(sink, e) and

View File

@@ -384,11 +384,23 @@ function_return_type(
*/
coroutine(
unique int function: @function ref,
int traits: @type ref,
int handle: @variable ref,
int promise: @variable ref
int traits: @type ref
);
/*
case @coroutine_placeholder_variable.kind of
1 = @handle
| 2 = @promise
| 3 = @init_await_resume
;
*/
coroutine_placeholder_variable(
unique int placeholder_variable: @variable ref,
int kind: int ref,
int function: @function ref
)
/** The `new` function used for allocating the coroutine state, if any. */
coroutine_new(
unique int function: @function ref,
@@ -829,22 +841,6 @@ variable_template_argument_value(
int arg_value: @expr ref
);
/*
Fixed point types
precision(1) = short, precision(2) = default, precision(3) = long
is_unsigned(1) = unsigned is_unsigned(2) = signed
is_fract_type(1) = declared with _Fract
saturating(1) = declared with _Sat
*/
/* TODO
fixedpointtypes(
unique int id: @fixedpointtype,
int precision: int ref,
int is_unsigned: int ref,
int is_fract_type: int ref,
int saturating: int ref);
*/
routinetypes(
unique int id: @routinetype,
int return_type: @type ref
@@ -1210,6 +1206,7 @@ conversionkinds(
| @reference_to
| @ref_indirect
| @temp_init
| @c11_generic
;
/*
@@ -1792,6 +1789,7 @@ case @expr.kind of
| 386 = @isscopedenum
| 387 = @istriviallyrelocatable
| 388 = @datasizeof
| 389 = @c11_generic
;
@var_args_expr = @vastartexpr

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: Expose C11 _Generics
compatibility: backwards

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
description: Improve handling of coroutine placeholder variables
compatibility: partial
coroutine.rel: run upgrades.qlo new_coroutine
coroutine_placeholder_variable.rel: run upgrades.qlo new_coroutine_placeholder_variable

View File

@@ -0,0 +1,19 @@
class Function extends @function {
string toString() { none() }
}
class Type extends @type {
string toString() { none() }
}
class Variable extends @variable {
string toString() { none() }
}
query predicate new_coroutine(Function func, Type traits) { coroutine(func, traits, _, _) }
query predicate new_coroutine_placeholder_variable(Variable var, int kind, Function func) {
coroutine(func, _, var, _) and kind = 1
or
coroutine(func, _, _, var) and kind = 2
}

View File

@@ -1,3 +1,21 @@
## 1.2.4
### Minor Analysis Improvements
* Fixed false positives in the `cpp/wrong-number-format-arguments` ("Too few arguments to formatting function") query when the formatting function has been declared implicitly.
## 1.2.3
### Minor Analysis Improvements
* Removed false positives caused by buffer accesses in unreachable code
* Removed false positives caused by inconsistent type checking
* Add modeling of C functions that don't throw, thereby increasing the precision of the `cpp/incorrect-allocation-error-handling` ("Incorrect allocation-error handling") query. The query now produces additional true positives.
## 1.2.2
No user-facing changes.
## 1.2.1
### Minor Analysis Improvements

View File

@@ -42,7 +42,9 @@ class BufferAccess extends ArrayExpr {
not exists(Macro m |
m.getName() = "strcmp" and
m.getAnInvocation().getAnExpandedElement() = this
)
) and
//A buffer access must be reachable (not in dead code)
reachable(this)
}
int bufferSize() { staticBuffer(this.getArrayBase(), _, result) }

View File

@@ -205,20 +205,6 @@ class ChecksForLeapYearFunctionCall extends FunctionCall {
ChecksForLeapYearFunctionCall() { this.getTarget() instanceof ChecksForLeapYearFunction }
}
/**
* Data flow configuration for finding a variable access that would flow into
* a function call that includes an operation to check for leap year.
*/
deprecated class LeapYearCheckConfiguration extends DataFlow::Configuration {
LeapYearCheckConfiguration() { this = "LeapYearCheckConfiguration" }
override predicate isSource(DataFlow::Node source) { source.asExpr() instanceof VariableAccess }
override predicate isSink(DataFlow::Node sink) {
exists(ChecksForLeapYearFunctionCall fc | sink.asExpr() = fc.getAnArgument())
}
}
/**
* Data flow configuration for finding a variable access that would flow into
* a function call that includes an operation to check for leap year.
@@ -233,33 +219,6 @@ private module LeapYearCheckConfig implements DataFlow::ConfigSig {
module LeapYearCheckFlow = DataFlow::Global<LeapYearCheckConfig>;
/**
* Data flow configuration for finding an operation with hardcoded 365 that will flow into
* a `FILEINFO` field.
*/
deprecated class FiletimeYearArithmeticOperationCheckConfiguration extends DataFlow::Configuration {
FiletimeYearArithmeticOperationCheckConfiguration() {
this = "FiletimeYearArithmeticOperationCheckConfiguration"
}
override predicate isSource(DataFlow::Node source) {
exists(Expr e, Operation op | e = source.asExpr() |
op.getAChild*().getValue().toInt() = 365 and
op.getAChild*() = e
)
}
override predicate isSink(DataFlow::Node sink) {
exists(StructLikeClass dds, FieldAccess fa, AssignExpr aexpr, Expr e | e = sink.asExpr() |
dds instanceof PackedTimeType and
fa.getQualifier().getUnderlyingType() = dds and
fa.isModified() and
aexpr.getAChild() = fa and
aexpr.getChild(1).getAChild*() = e
)
}
}
/**
* Data flow configuration for finding an operation with hardcoded 365 that will flow into
* a `FILEINFO` field.
@@ -286,51 +245,6 @@ private module FiletimeYearArithmeticOperationCheckConfig implements DataFlow::C
module FiletimeYearArithmeticOperationCheckFlow =
DataFlow::Global<FiletimeYearArithmeticOperationCheckConfig>;
/**
* Taint configuration for finding an operation with hardcoded 365 that will flow into any known date/time field.
*/
deprecated class PossibleYearArithmeticOperationCheckConfiguration extends TaintTracking::Configuration
{
PossibleYearArithmeticOperationCheckConfiguration() {
this = "PossibleYearArithmeticOperationCheckConfiguration"
}
override predicate isSource(DataFlow::Node source) {
exists(Operation op | op = source.asExpr() |
op.getAChild*().getValue().toInt() = 365 and
(
not op.getParent() instanceof Expr or
op.getParent() instanceof Assignment
)
)
}
override predicate isAdditionalTaintStep(DataFlow::Node node1, DataFlow::Node node2) {
// flow from anything on the RHS of an assignment to a time/date structure to that
// assignment.
exists(StructLikeClass dds, FieldAccess fa, Assignment aexpr, Expr e |
e = node1.asExpr() and
fa = node2.asExpr()
|
(dds instanceof PackedTimeType or dds instanceof UnpackedTimeType) and
fa.getQualifier().getUnderlyingType() = dds and
aexpr.getLValue() = fa and
aexpr.getRValue().getAChild*() = e
)
}
override predicate isSink(DataFlow::Node sink) {
exists(StructLikeClass dds, FieldAccess fa, AssignExpr aexpr |
aexpr.getRValue() = sink.asExpr()
|
(dds instanceof PackedTimeType or dds instanceof UnpackedTimeType) and
fa.getQualifier().getUnderlyingType() = dds and
fa.isModified() and
aexpr.getLValue() = fa
)
}
}
/**
* Taint configuration for finding an operation with hardcoded 365 that will flow into any known date/time field.
*/

View File

@@ -129,24 +129,6 @@ class NetworkFunctionCall extends FunctionCall {
NetworkFunctionCall() { this.getTarget().hasName(["ntohd", "ntohf", "ntohl", "ntohll", "ntohs"]) }
}
deprecated class NetworkToBufferSizeConfiguration extends DataFlow::Configuration {
NetworkToBufferSizeConfiguration() { this = "NetworkToBufferSizeConfiguration" }
override predicate isSource(DataFlow::Node node) { node.asExpr() instanceof NetworkFunctionCall }
override predicate isSink(DataFlow::Node node) {
node.asExpr() = any(BufferAccess ba).getAccessedLength()
}
override predicate isBarrier(DataFlow::Node node) {
exists(GuardCondition gc, GVN gvn |
gc.getAChild*() = gvn.getAnExpr() and
globalValueNumber(node.asExpr()) = gvn and
gc.controls(node.asExpr().getBasicBlock(), _)
)
}
}
private module NetworkToBufferSizeConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node node) { node.asExpr() instanceof NetworkFunctionCall }

View File

@@ -41,20 +41,6 @@ class ExternalApiDataNode extends DataFlow::Node {
string getFunctionDescription() { result = this.getExternalFunction().toString() }
}
/** A configuration for tracking flow from `RemoteFlowSource`s to `ExternalApiDataNode`s. */
deprecated class UntrustedDataToExternalApiConfig extends TaintTracking::Configuration {
UntrustedDataToExternalApiConfig() { this = "UntrustedDataToExternalAPIConfig" }
override predicate isSource(DataFlow::Node source) {
exists(RemoteFlowSourceFunction remoteFlow |
remoteFlow = source.asExpr().(Call).getTarget() and
remoteFlow.hasRemoteFlowSource(_, _)
)
}
override predicate isSink(DataFlow::Node sink) { sink instanceof ExternalApiDataNode }
}
/** A configuration for tracking flow from `RemoteFlowSource`s to `ExternalApiDataNode`s. */
private module UntrustedDataToExternalApiConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {

View File

@@ -41,15 +41,6 @@ class ExternalApiDataNode extends DataFlow::Node {
string getFunctionDescription() { result = this.getExternalFunction().toString() }
}
/** A configuration for tracking flow from `RemoteFlowSource`s to `ExternalApiDataNode`s. */
deprecated class UntrustedDataToExternalApiConfig extends TaintTracking::Configuration {
UntrustedDataToExternalApiConfig() { this = "UntrustedDataToExternalAPIConfigIR" }
override predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
override predicate isSink(DataFlow::Node sink) { sink instanceof ExternalApiDataNode }
}
/** A configuration for tracking flow from `RemoteFlowSource`s to `ExternalApiDataNode`s. */
private module UntrustedDataToExternalApiConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }

View File

@@ -26,6 +26,7 @@ from
BufferAccess ba, string bufferDesc, int accessSize, int accessType, Element bufferAlloc,
int bufferSize, string message
where
accessType != 4 and
accessSize = ba.getSize() and
bufferSize = getBufferSize(ba.getBuffer(bufferDesc, accessType), bufferAlloc) and
(

View File

@@ -1,4 +0,0 @@
---
category: minorAnalysis
---
* Add modeling of C functions that don't throw, thereby increasing the precision of the `cpp/incorrect-allocation-error-handling` ("Incorrect allocation-error handling") query. The query now produces additional true positives.

View File

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

View File

@@ -0,0 +1,7 @@
## 1.2.3
### Minor Analysis Improvements
* Removed false positives caused by buffer accesses in unreachable code
* Removed false positives caused by inconsistent type checking
* Add modeling of C functions that don't throw, thereby increasing the precision of the `cpp/incorrect-allocation-error-handling` ("Incorrect allocation-error handling") query. The query now produces additional true positives.

View File

@@ -0,0 +1,5 @@
## 1.2.4
### Minor Analysis Improvements
* Fixed false positives in the `cpp/wrong-number-format-arguments` ("Too few arguments to formatting function") query when the formatting function has been declared implicitly.

View File

@@ -1,2 +1,2 @@
---
lastReleaseVersion: 1.2.1
lastReleaseVersion: 1.2.4

View File

@@ -0,0 +1,34 @@
<!DOCTYPE qhelp PUBLIC "-//Semmle//qhelp//EN" "qhelp.dtd">
<qhelp>
<overview>
<p>
Disabling verification of the SSL certificate allows man-in-the-middle attacks. A SSL
connection is vulnerable to man-in-the-middle attacks if the certification is not checked
properly. If the peer or the host's certificate verification is not verified, the underlying
SSL communication is insecure.</p>
</overview>
<recommendation>
<p>It is recommended that all communications be done post verification of the host as well as
the
peer.</p>
</recommendation>
<example>
<p>The following snippet disables certification verification by setting the value of <code>
CURLOPT_SSL_VERIFYHOST</code> and <code>CURLOPT_SSL_VERIFYHOST</code> to <code>0</code>:</p>
<sample src="CurlSSLBad.cpp" />
<p>This is bad as the certificates are not verified any more. This can be easily fixed by
setting the values of the options to <code>2</code>. </p>
<sample src="CurlSSLGood.cpp" />
</example>
<references>
<li> Curl Documentation:<a href="https://curl.se/libcurl/c/CURLOPT_SSL_VERIFYHOST.html">
CURLOPT_SSL_VERIFYHOST</a></li>
<li> Curl Documentation:<a href="https://curl.se/libcurl/c/CURLOPT_SSL_VERIFYPEER.html">
CURLOPT_SSL_VERIFYPEER</a></li>
<li> Related CVE: <a href="https://github.com/advisories/GHSA-5r3h-c3r7-9w4h"> CVE-2022-33684</a></li>
<li> Related security advisory: <a
href="https://huntr.com/bounties/42325662-6329-4e04-875a-49e2f5d69f78">
openframeworks/openframeworks
</a></li>
</references>
</qhelp>

View File

@@ -0,0 +1,39 @@
/**
* @name Disabled certifcate verification
* @description Disabling SSL certificate verification of host or peer could expose the communication to man-in-the-middle(MITM) attacks.
* @kind problem
* @problem.severity warning
* @id cpp/curl-disabled-ssl
* @tags security
* external/cwe/cwe-295
*/
import cpp
import semmle.code.cpp.dataflow.new.TaintTracking
/** Models the `curl_easy_setopt` function call */
private class CurlSetOptCall extends FunctionCall {
CurlSetOptCall() {
exists(FunctionCall fc, Function f |
f.hasGlobalOrStdName("curl_easy_setopt") and
fc.getTarget() = f
|
this = fc
)
}
}
/** Models an access to any enum constant which could affect SSL verification */
private class CurlVerificationConstant extends EnumConstantAccess {
CurlVerificationConstant() {
exists(EnumConstant e | e.getName() = ["CURLOPT_SSL_VERIFYHOST", "CURLOPT_SSL_VERIFYPEER"] |
e.getAnAccess() = this
)
}
}
from CurlSetOptCall c
where
c.getArgument(1) = any(CurlVerificationConstant v) and
c.getArgument(2).getValue() = "0"
select c, "This call disables Secure Socket Layer and could potentially lead to MITM attacks"

View File

@@ -0,0 +1,9 @@
string host = "codeql.com"
void bad(void) {
std::unique_ptr<CURL, void(*)(CURL*)> curl =
std::unique_ptr<CURL, void(*)(CURL*)>(curl_easy_init(), curl_easy_cleanup);
curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYHOST, 0);
curl_easy_setopt(curl.get(), CURLOPT_URL, host.c_str());
curl_easy_perform(curl.get());
}

View File

@@ -0,0 +1,9 @@
string host = "codeql.com"
void good(void) {
std::unique_ptr<CURL, void(*)(CURL*)> curl =
std::unique_ptr<CURL, void(*)(CURL*)>(curl_easy_init(), curl_easy_cleanup);
curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYPEER, 2);
curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYHOST, 2);
curl_easy_setopt(curl.get(), CURLOPT_URL, host.c_str());
curl_easy_perform(curl.get());
}

View File

@@ -0,0 +1,26 @@
/**
* https://github.com/google/brotli
*/
import cpp
import DecompressionBomb
/**
* The `BrotliDecoderDecompress` function is used in flow sink.
* See https://www.brotli.org/decode.html.
*/
class BrotliDecoderDecompressFunction extends DecompressionFunction {
BrotliDecoderDecompressFunction() { this.hasGlobalName("BrotliDecoderDecompress") }
override int getArchiveParameterIndex() { result = 1 }
}
/**
* The `BrotliDecoderDecompressStream` function is used in flow sink.
* See https://www.brotli.org/decode.html.
*/
class BrotliDecoderDecompressStreamFunction extends DecompressionFunction {
BrotliDecoderDecompressStreamFunction() { this.hasGlobalName("BrotliDecoderDecompressStream") }
override int getArchiveParameterIndex() { result = 2 }
}

View File

@@ -0,0 +1,26 @@
import cpp
import semmle.code.cpp.ir.dataflow.TaintTracking
import MiniZip
import ZlibGzopen
import ZlibInflator
import ZlibUncompress
import LibArchive
import ZSTD
import Brotli
/**
* The Decompression Sink instances, extend this class to define new decompression sinks.
*/
abstract class DecompressionFunction extends Function {
abstract int getArchiveParameterIndex();
}
/**
* The Decompression Flow Steps, extend this class to define new decompression sinks.
*/
abstract class DecompressionFlowStep extends string {
bindingset[this]
DecompressionFlowStep() { any() }
abstract predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2);
}

View File

@@ -0,0 +1,39 @@
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>Extracting Compressed files with any compression algorithm like gzip can cause denial of service attacks.</p>
<p>Attackers can compress a huge file consisting of repeated similiar bytes into a small compressed file.</p>
</overview>
<recommendation>
<p>When you want to decompress a user-provided compressed file you must be careful about the decompression ratio or read these files within a loop byte by byte to be able to manage the decompressed size in each cycle of the loop.</p>
</recommendation>
<example>
<p>
Reading an uncompressed Gzip file within a loop and check for a threshold size in each cycle.
</p>
<sample src="example_good.cpp"/>
<p>
The following example is unsafe, as we do not check the uncompressed size.
</p>
<sample src="example_bad.cpp" />
</example>
<references>
<li>
<a href="https://zlib.net/manual.html">Zlib documentation</a>
</li>
<li>
<a href="https://www.bamsoftware.com/hacks/zipbomb/">An explanation of the attack</a>
</li>
</references>
</qhelp>

View File

@@ -0,0 +1,40 @@
/**
* @name User-controlled file decompression
* @description User-controlled data that flows into decompression library APIs without checking the compression rate is dangerous
* @kind path-problem
* @problem.severity error
* @precision low
* @id cpp/data-decompression-bomb
* @tags security
* experimental
* external/cwe/cwe-409
*/
import cpp
import semmle.code.cpp.security.FlowSources
import DecompressionBomb
predicate isSink(FunctionCall fc, DataFlow::Node sink) {
exists(DecompressionFunction f | fc.getTarget() = f |
fc.getArgument(f.getArchiveParameterIndex()) = [sink.asExpr(), sink.asIndirectExpr()]
)
}
module DecompressionTaintConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof FlowSource }
predicate isSink(DataFlow::Node sink) { isSink(_, sink) }
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
any(DecompressionFlowStep s).isAdditionalFlowStep(node1, node2)
}
}
module DecompressionTaint = TaintTracking::Global<DecompressionTaintConfig>;
import DecompressionTaint::PathGraph
from DecompressionTaint::PathNode source, DecompressionTaint::PathNode sink, FunctionCall fc
where DecompressionTaint::flowPath(source, sink) and isSink(fc, sink.getNode())
select sink.getNode(), source, sink, "The decompression output of $@ is not limited", fc,
fc.getTarget().getName()

View File

@@ -0,0 +1,32 @@
/**
* https://github.com/libarchive/libarchive/wiki
*/
import cpp
import DecompressionBomb
/**
* The `archive_read_data*` functions are used in flow sink.
* See https://github.com/libarchive/libarchive/wiki/Examples.
*/
class Archive_read_data_block extends DecompressionFunction {
Archive_read_data_block() {
this.hasGlobalName(["archive_read_data_block", "archive_read_data", "archive_read_data_into_fd"])
}
override int getArchiveParameterIndex() { result = 0 }
}
/**
* The `archive_read_open_filename` function as a flow step.
*/
class ReadOpenFunctionStep extends DecompressionFlowStep {
ReadOpenFunctionStep() { this = "ReadOpenFunction" }
override predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
exists(FunctionCall fc | fc.getTarget().hasGlobalName("archive_read_open_filename") |
node1.asIndirectExpr() = fc.getArgument(1) and
node2.asIndirectExpr() = fc.getArgument(0)
)
}
}

View File

@@ -0,0 +1,56 @@
/**
* https://github.com/zlib-ng/minizip-ng
*/
import cpp
import DecompressionBomb
/**
* The `mz_zip_entry` function is used in flow sink.
* See https://github.com/zlib-ng/minizip-ng/blob/master/doc/mz_zip.md.
*/
class Mz_zip_entry extends DecompressionFunction {
Mz_zip_entry() { this.hasGlobalName("mz_zip_entry_read") }
override int getArchiveParameterIndex() { result = 1 }
}
/**
* The `mz_zip_reader_entry_*` and `mz_zip_reader_save_all` functions are used in flow sink.
* See https://github.com/zlib-ng/minizip-ng/blob/master/doc/mz_zip_rw.md.
*/
class Mz_zip_reader_entry extends DecompressionFunction {
Mz_zip_reader_entry() {
this.hasGlobalName([
"mz_zip_reader_entry_save", "mz_zip_reader_entry_read", "mz_zip_reader_entry_save_process",
"mz_zip_reader_entry_save_file", "mz_zip_reader_entry_save_buffer", "mz_zip_reader_save_all"
])
}
override int getArchiveParameterIndex() { result = 0 }
}
/**
* The `UnzOpen*` functions are used in flow sink.
*/
class UnzOpenFunction extends DecompressionFunction {
UnzOpenFunction() { this.hasGlobalName(["UnzOpen", "unzOpen64", "unzOpen2", "unzOpen2_64"]) }
override int getArchiveParameterIndex() { result = 0 }
}
/**
* The `mz_zip_reader_open_file` and `mz_zip_reader_open_file_in_memory` functions as a flow step.
*/
class ReaderOpenFunctionStep extends DecompressionFlowStep {
ReaderOpenFunctionStep() { this = "ReaderOpenFunctionStep" }
override predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
exists(FunctionCall fc |
fc.getTarget().hasGlobalName(["mz_zip_reader_open_file_in_memory", "mz_zip_reader_open_file"])
|
node1.asIndirectExpr() = fc.getArgument(1) and
node2.asIndirectExpr() = fc.getArgument(0)
)
}
}

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