Commit Graph

4303 Commits

Author SHA1 Message Date
Nora Dimitrijević
5faa44389e Swift: Basic acceptance of UnsafeJsEval test
TODO: Fix remaining problem in a separate PR:
- path found to one async `@MainActor` evaluateJavaScript
  call, but not others. Investigate why.
- Remove duplicate paths and those with unnecessary [summary] nodes.
2022-12-14 15:02:15 -05:00
Nora Dimitrijević
95d4c304da Swift: Fix .expected tests
Only UnsafeJsEval remains.
2022-12-14 15:02:15 -05:00
Nora Dimitrijević
6269e6b24d Swift: move getName to Callable (generated)
Now that getStaticTarget returns a Callable.
2022-12-14 14:30:33 -05:00
Nora Dimitrijević
535daf39b7 Swift: move getName to Callable (hand-written)
Now that getStaticTarget returns a Callable.
2022-12-14 14:29:13 -05:00
Nora Dimitrijević
89cd082f0a Swift: {Method,Initializer}CallExpr + SelfRefExpr
Adds a bit of symmetry in the API.

Also, fix a couple of tests that were using the old types.
2022-12-14 14:28:01 -05:00
Nora Dimitrijević
5f03099000 Swift: clarify DotSyntaxBaseIgnoredExpr
- Add docstring with implementation note.
- Avoid `concat` aggregate in toString().

Still, this class should really be cleaned up in the following ways:

- Rename to a sane name at the schema level
- Have subtypes that change the return type of getSubExpr to reflect
  the structure of the desugared closure. E.g. one for methods,
  one for fields.
2022-12-14 14:28:00 -05:00
Nora Dimitrijević
16a119248d Swift: remove toString() = "call to call to ..." 2022-12-14 14:28:00 -05:00
Nora Dimitrijević
91f35a5d53 Swift: isStaticOrClassMethod + isInstanceMethod
Still, we should really be extracting these attributes.
2022-12-14 14:28:00 -05:00
Nora Dimitrijević
6a0b020573 Swift: move methodlookup test to library-tests 2022-12-14 14:28:00 -05:00
Nora Dimitrijević
15d5674d12 Swift: update .expected files based on last commit 2022-12-14 14:28:00 -05:00
Nora Dimitrijević
a620658a66 Swift: fix PrintAst order, double parents, orphan decl refs
The main problem is that a lot of the old DotSyntaxApplyExpr->MethodRefExpr
synth-constructor hacks were not fully generalized to SelfApplyExpr
and OtherConstructorDeclRefExpr.

Also:

- Gave a index-in-parent-based ordering to PrintAst nodes(), to stabilize it more.
- Use a slightly more general SelfApplyExpr->Decl conversion
2022-12-14 14:28:00 -05:00
Nora Dimitrijević
b5bb814112 Swift: fix toString of some invisible DeclRefExprs 2022-12-14 14:28:00 -05:00
Nora Dimitrijević
f6d5e8db5f Swift: update test .expected files 2022-12-14 14:27:59 -05:00
Nora Dimitrijević
799b4c932f Swift: DotSyntaxBaseIgnored calls now have static target
This relies on getStaticTarget() returning a Callable... Not sure how I feel about that, since often we want to say

```
exists(Call c |
  c.getStaticTarget().hasName("...")
)
```

and Callable has a sparse interface. Maybe some AbstractFunctionDecl
methods can be moved to Callable.
2022-12-14 14:24:36 -05:00
Nora Dimitrijević
89bfad0420 Swift: fix MethodLookupExpr.getMethod()
By adding a couple missing cases.
2022-12-14 14:24:36 -05:00
Nora Dimitrijević
c1e746a980 Swift: add InitializerLookupExpr < MethodLookupExpr 2022-12-14 14:24:36 -05:00
Nora Dimitrijević
2af8ec86e6 Swift: init/deinit stringifies with qualifier 2022-12-14 14:24:36 -05:00
Nora Dimitrijević
14b84c6e06 Swift: add MethodDecl.isStatic/0 2022-12-14 14:24:36 -05:00
Nora Dimitrijević
668d79a62d Swift: one more rename 2022-12-14 14:24:36 -05:00
Nora Dimitrijević
2b060b1433 Swift: initial schema change (generated part) 2022-12-14 14:24:35 -05:00
Nora Dimitrijević
0c55561b8e Swift: initial schema change (hand-written part) 2022-12-14 14:22:53 -05:00
Nora Dimitrijević
1ede851cf5 Swift: initial getStaticTarget test 2022-12-14 14:22:53 -05:00
Nora Dimitrijević
99719d0ee1 Swift: initial PrintAst test for Method Lookups 2022-12-14 14:22:53 -05:00
Paolo Tranquilli
793de3196b Revert "Swift: accept test changes"
This reverts commit 26ae8f177b.
2022-12-14 18:34:12 +01:00
Paolo Tranquilli
14fd89d482 Swift: generalize output redirection code 2022-12-14 18:26:48 +01:00
Paolo Tranquilli
45c0c7fe6c Merge branch 'main' into redsun82/swift-open-redirection 2022-12-14 18:26:16 +01:00
Erik Krogh Kristensen
7615668f92 Merge pull request #11662 from erik-krogh/c-useInstanceOf
Swift/C++: Use instanceof in more places
2022-12-14 14:30:21 +01:00
Tom Hvitved
25b2d11368 Merge pull request #11635 from hvitved/dataflow/approx-content
Data flow: Introduce `ApproxContent` in a new pruning stage between stages 2 and 3
2022-12-14 12:56:50 +01:00
Paolo Tranquilli
de2e92d5e1 Swift: remove / delimiters from regex extracted patterns 2022-12-14 09:18:36 +01:00
Paolo Tranquilli
fb5b6eab19 Swift: extract RegexLiteralExpr 2022-12-14 09:12:07 +01:00
Jami Cogswell
a33436a39b Java: update hasProvenance 2022-12-13 11:26:23 -05:00
Alex Denisov
ee94849528 Swift: switch to bootstrapped Swift compiler 2022-12-13 13:59:13 +01:00
Tony Torralba
85b3092b16 Add security-severity and fix alert message 2022-12-13 12:01:01 +01:00
Tony Torralba
d72d096c86 Add predicate injection query 2022-12-13 10:27:29 +01:00
Tom Hvitved
da6a42980f Swift: Implement ContentApprox 2022-12-13 09:53:01 +01:00
Tom Hvitved
0c2eee2a72 Data flow: Sync files 2022-12-13 09:52:55 +01:00
Paolo Tranquilli
0dc717fd9c Swift: remove no more needed library path setting in qltest.sh 2022-12-13 09:13:43 +01:00
Paolo Tranquilli
03d7adb303 Swift: wrap extractor with shell script
This is in preparation for the extractor to use shared libraries
packaged alongside it.

We could probably also move the `CODEQL_EXTRACTOR_SWIFT_RUN_UNDER` logic
in it, where it would be simpler and more robust.
2022-12-13 09:07:37 +01:00
Jami
93d8a03e73 Merge branch 'main' into jcogs33/mad-metrics-query 2022-12-12 20:31:53 -05:00
Jami Cogswell
623068c4b9 Java: add hasProvenance predicate, remove isManuallyGenerated and isBothAutoAndManuallyGenerated 2022-12-12 11:23:46 -05:00
erik-krogh
698e05f85a Swift/C++: Use instanceof in more places 2022-12-12 16:58:13 +01:00
Paolo Tranquilli
250ac686a2 Merge branch 'main' into redsun82/swift-open-redirection 2022-12-12 08:46:23 +01:00
Michael Nebel
e0f1b38439 Merge pull request #11580 from michaelnebel/renamenegativemodels
C#/Java: Rename Negative Summary Model to Neutral Model
2022-12-12 07:59:06 +01:00
Jami Cogswell
6854845b75 Java: refactor isManuallyGenerated and isBothAutoAndManuallyGenerated 2022-12-09 18:37:50 -05:00
Michael Nebel
d13307e417 Swift: Rename Negative Summary Model to Neutral Model. 2022-12-09 15:04:43 +01:00
Michael Nebel
079d48c42a Sync files. 2022-12-09 15:04:42 +01:00
Paolo Tranquilli
a93e361aca Merge branch 'main' into redsun82/swift-open-redirection 2022-12-09 12:19:38 +01:00
Paolo Tranquilli
7162692656 Swift: exit directly on actions not requiring extraction 2022-12-09 10:00:01 +01:00
Paolo Tranquilli
4a41bb4061 Merge branch 'main' into redsun82/swift-open-redirection 2022-12-09 09:59:21 +01:00
Tony Torralba
6822399dbb Swift: Rename NSData.qll to NsData.qll 2022-12-09 09:18:55 +01:00