Commit Graph

50251 Commits

Author SHA1 Message Date
Rasmus Wriedt Larsen
321a4b4ef2 Python: ModuleExport.ql test: ignore main.py
It's not very useful to look at, and it's a mess when you change any
tests to see all the changes lines in the expected output that you
really do not care about!
2023-02-23 00:31:05 +01:00
Rasmus Wriedt Larsen
8eaaf8e3e5 Python: Ignore trace.py in ModuleExport.ql test
I guess we could have done this at the very start of introducing this
test in this PR, but I think the last commit was mostly inspired from
looking at all the things that evidently was re-exported from the trace
import, even when I knew they were not available because of the
`__all__` definition.
2023-02-22 15:42:28 +01:00
Rasmus Wriedt Larsen
c8a76246d8 Python: Take __all__ into consideration for re-export of from <pkg> import *
However, we can see that `from <pkg> import *` and `import pkg` are
handled differently. Would have liked `has_defined_all_indirection` to
behave in the same way no matter how the import was made.
2023-02-22 15:39:57 +01:00
Rasmus Wriedt Larsen
be5812cf91 Python: from <pkg> import * ignores __all__ regression
Notice that `has_defined_all_indirection` all have both
`all_defined_bar_copy` and `all_defined_foo_copy` marked as exported,
even though only `all_defined_foo_copy` is available.
2023-02-22 15:38:24 +01:00
Rasmus Wriedt Larsen
d77ce4f3d7 Python: minor rewrite of from <pkg> import * handling 2023-02-22 15:00:55 +01:00
Rasmus Wriedt Larsen
4df7dfbff6 Python: Don't import module as module_attr
For `from <pkg> import <attr>` we would use to treat the `<pkg>`
(ImportExpr) as a definition of the name `<attr>`.

Since this removes bad import-flow, and nothing broke, I'm guessing this
was never intentional.
2023-02-22 14:52:35 +01:00
Rasmus Wriedt Larsen
6ba39d5fb3 Python: Add import regression for re-exported things 2023-02-22 14:50:42 +01:00
Rasmus Wriedt Larsen
6a5eebe891 Python: Add test of module_export 2023-02-22 12:26:01 +01:00
Rasmus Wriedt Larsen
4a66e48dc5 Python: Allow import resolution with recursive phi/refine steps 2023-02-21 17:46:39 +01:00
Rasmus Wriedt Larsen
e522009666 Python: More complex import examples
We need some recursive unwinding to get all of these right
2023-02-21 17:46:28 +01:00
Rasmus Wriedt Larsen
00eec6986c Python: Allow import of refined variable
However, as illustrated by the `CWE-327-InsecureProtocol` test, this fix
is NOT good enough, since now even the `secure_context` is considered to
be insecure (for both versions). Ouch.

Will fix this in a later commit, since it was only discoverd late on.
2023-02-21 17:45:58 +01:00
Rasmus Wriedt Larsen
fb425b73fc Python: Add import test of py/insecure-protocol 2023-02-21 17:43:04 +01:00
Rasmus Wriedt Larsen
27e2307d0c Python: Add import regression for refined variable 2023-02-17 16:34:34 +01:00
Calum Grant
35a53fa990 Merge pull request #12183 from RasmusWL/example-update
Python: Update a few examples so queries work on them
2023-02-17 14:21:38 +00:00
Chris Smowton
d3e73891b5 Merge pull request #12229 from smowton/smowton/fix/gradle-wrapper-for-java-tests
Java: Add Gradle wrappers for Kotlin tests
2023-02-17 12:37:25 +00:00
Geoffrey White
4356d359a6 Merge pull request #12226 from geoffw0/stringfix
Swift: Fix minor mistakes in the String models.
2023-02-17 10:23:56 +00:00
Chris Smowton
d1cd4cd099 Add Gradle wrappers for Kotlin tests
This avoids tests' behaviour changing due to environmental Gradle version changes
2023-02-17 10:10:22 +00:00
Rasmus Wriedt Larsen
39e7bba563 Merge pull request #12203 from RasmusWL/import-resolution-phi
Python: Handle if-then-else definitions in import resolution
2023-02-17 10:10:42 +01:00
yoff
2f8dddabb6 Merge pull request #11570 from Sim4n6/UnsafeUnpack
Python: Unsafe unpacking using `shutil.unpack_archive()` query and tests
2023-02-17 09:48:05 +01:00
Michael Nebel
2f6ffdd88f Merge pull request #12207 from michaelnebel/csharp/requiredmembers
C# 11: Required fields and properties.
2023-02-17 09:29:46 +01:00
Michael Nebel
b87de911ba C#: Add change note. 2023-02-17 08:40:39 +01:00
Michael Nebel
3971dedcf6 C#: Add testcase for required members. 2023-02-17 08:40:39 +01:00
Michael Nebel
c0b8e852c5 C#: Add library support for required members. 2023-02-17 08:40:39 +01:00
Michael Nebel
2d46dd2936 C#: Add extractor support for the required modifier for fields and properties. 2023-02-17 08:40:39 +01:00
Michael Nebel
ff9e738d38 Merge pull request #12167 from michaelnebel/csharp/deprecategetassemblyname
C#: Checked operator support.
2023-02-17 08:39:32 +01:00
Geoffrey White
a894fc6ce8 Swift: Fix mistakes in String.qll models. 2023-02-16 18:24:36 +00:00
Geoffrey White
f64cb2983a Swift: Add tests for a few models we didn't cover. 2023-02-16 18:15:17 +00:00
Paolo Tranquilli
300db4f236 Merge pull request #12214 from github/redsun82/swift-codegen
Swift: fix weird module naming in codegen
2023-02-16 17:24:03 +01:00
Geoffrey White
cb11524dde Merge pull request #12154 from geoffw0/pathinjectionext
Swift: More path injection sinks
2023-02-16 16:00:31 +00:00
Erik Krogh Kristensen
2b529fbf53 Merge pull request #12213 from github/erik-krogh/patch-test
CI: inline the move-caches script into the action
2023-02-16 16:00:13 +01:00
Michael B. Gale
35b60167e1 Merge pull request #12153 from github/mbg/fix/msbuild-on-macos-arm
C#: Improve C# autobuilder compatibility with Arm-based Macs
2023-02-16 14:12:43 +00:00
erik-krogh
767da59397 remove the paths requirement from running QL-for-QL 2023-02-16 14:57:00 +01:00
Paolo Tranquilli
f50382ba70 Swift: fix weird module naming in codegen 2023-02-16 14:53:31 +01:00
erik-krogh
45d00ae9dd inline the move-caches script into the action 2023-02-16 14:52:46 +01:00
Paolo Tranquilli
7cfe15c304 Merge pull request #12205 from github/redsun82/swift-codegen
Swift: fix subtle `codegen` bug on missing files
2023-02-16 13:45:35 +01:00
Rasmus Wriedt Larsen
9ed021ad66 Python: Accept change to WeakFilePermissions.expected
💪
2023-02-16 13:27:16 +01:00
Joe Farebrother
430b432add Merge pull request #12195 from joefarebrother/testgen-improvements
Java: Test generator improvements
2023-02-16 11:20:55 +00:00
Michael B. Gale
eab3c6dd5e Fix missing implementations for C++ tests 2023-02-16 11:07:38 +00:00
Michael B. Gale
e28be5d98f Make msbuild work on Arm-based Macs 2023-02-16 11:07:38 +00:00
Michael B. Gale
75c75ea49c Correctly select dotnet platform on arm-based macs 2023-02-16 11:07:37 +00:00
Paolo Tranquilli
3ec2a3c711 Swift: fix subtle codegen bug on missing files
While the internal registry was being cleaned up from files removed by
codegen itself, it was not dropping files removed outside of codegen.

Because of this files removed by the user were not being regenerated
again if no change was staged to them, unless `--force` was provided.

This also fixes some such "ghost" entries in the registry and some
missing generated files.
2023-02-16 11:46:51 +01:00
Paolo Tranquilli
3b1b3b46ae Merge pull request #12202 from github/redsun82/swift-codegen
> Out of curiosity: What is the end goal that we're trying to get to with this?

Up until now we would be writing that predicate by hand, see [this example](29c8260004/swift/ql/lib/codeql/swift/elements/expr/MethodLookupExpr.qll (L29-L30)). Now this will be given to us from the get go.

For me this was prompted to give a nicer live demo later at my presentation 🙂
2023-02-16 11:35:05 +01:00
Michael B. Gale
29c8260004 Merge pull request #12196 from github/mbg/csharp/add-msbuild-integration-tests 2023-02-16 10:29:28 +00:00
Rasmus Wriedt Larsen
766e6c400e Python: Handle if-then-else definitions in import resolution 2023-02-16 11:18:30 +01:00
Rasmus Wriedt Larsen
80f5342a6d Python: Add import regression for if-then-else definitions 2023-02-16 11:12:08 +01:00
Tony Torralba
87b54e674e Merge pull request #12178 from felickz/main
Java - Adding support for com.microsoft.sqlserver.jdbc.SQLServerDataSource  to CWE-798
2023-02-16 11:03:34 +01:00
Michael B. Gale
9db1366e4b Change target framework to 4.0 for mono 2023-02-16 09:55:58 +00:00
Michael B. Gale
f1adb4319a Add C# integration test which uses MSBuild 2023-02-16 09:55:57 +00:00
Paolo Tranquilli
e2d7a6910c Swift: generate raw helpers in synthesized stubs
This will add helpers to get the underlying raw entities or constructor
arguments on stubs for synthesized classes.

For example a schema like:

```
@synth.from_class(A)
class B:
    pass

@synth.on_arguments(base=A, index=int)
class C:
    pass
```

will generate

```
cached
private Raw::A getUnderlyingEntity() { this = Synth::TB(result) }
```
in the `B.qll` stub and
```
cached
private Raw::A getUnderlyingBase() { this = Synth::TC(result, _) }

cached
private int getUnderlyingIndex() { this = Synth::TC(_, result) }
```
in the `C.qll` stub.

As stubs these can be freely changed later on.
2023-02-16 10:49:21 +01:00
Chris Smowton
180246b99c Merge pull request #12197 from smowton/smowton/admin/go-120-features
Go: complete Go 1.20 support
2023-02-16 08:12:02 +00:00