Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync with upstream v4.0.29 #66

Merged
merged 180 commits into from
Dec 20, 2024
Merged

Sync with upstream v4.0.29 #66

merged 180 commits into from
Dec 20, 2024

Conversation

tuxology
Copy link

@tuxology tuxology commented Aug 7, 2024

max-leuthaeuser and others added 30 commits May 29, 2024 14:54
…nio#4612)

Just some fixed MAX_BATCH_SIZE until we come up with something better.

Fixes: joernio#4611
…ariables (joernio#4617)

* Add reproducing test

* Add tests for new lambdas

* Never add Unknown node for captured variable

* Add todos to comments about lambda parameter capturing
* [python] prevent overtainting dictLiterals

* use allAssignmentTypes in isAssignment

* use methodFullNameExact instead of nameExact in isAssignment
As pointed out in joernio#4240, combining this nested immutable map-like structure has a quadratic performance, and the more performant strategy would be to use nested data-structures to merge.

For now, I've decided not to opt for a builder pattern, but rather keep the underlying structure mutable, and accessor methods return immutable structures.
)

This PR does two things:
1) DEBUG logs the frontend name, version and raw arguments passed down
2) INFO logs the CPG output path if not set explicitly by the user
Added a recursive aspect to the call type recovery if the receiver of the call is possibly recoverable (and it's receiver if that's a call and so on)
- log cpg creation for each file in DEBUG only instead of INFO
 - log the astgen path only once with INFO
 - removed logging that astgen runs now in the given input folder
- Fix last error token position if error token itself is semicolon,
  newline or EOF.
- Also log the parser exception message.
Moved parser logging of memory clearing from INFO to DEBUG
A common pattern in JavaScript is something like

```javascript
var foo = {};
foo.bar = {};
foo.bar.someFunc = function someFunc() {};

foo.bar.someFunc();
```

This PR adds a post-processing pass to find instances where the definition and the call live in the same file and to link them. This "common file" limitation aims to reduce false linking.
also to minify the diff for the flatgraph port
Allow the frontend to continue analysis if the type stubs for built-ins is missing.
The `new` operator can prefix an ordinary call, e.g.
```javascript
var Print = function(str) {
	console.log(str)
}

new Print("Hello")
```
The type recovery pass only considers object instantiations from type declarations on `new` calls, but this change allows it to consider functions too.

Other changes include adding constants for `:program` and `<operator>.new`
Added implicit self receiver to simple calls.
In ruby as for all other dynamic language there is no vtable and thus
only a single entry in the binding tables with name=="" and
signature=="".
This change moves the type/method identifier references for entities exportable from the script to prefix the respective entity at the definition.
this caused me some headaches as I had an old jar lying around there,
likely from a bisect session...
This change moves the type/method identifier references for entities exportable from the script to prefix the respective entity at the definition.
ICPPASTExpression.getEvaluation may fail throwing an unrecoverable exception in case of unresolved includes etc.
* Added `Member` nodes for each method, to relate to their respective bound `TypeDecl` nodes.
* Added a type decl for "fake methods" that include the methods and classes exported by the file
To simplify the call graph, methods resolved to the `Kernel` class are dispatched as static.

Additionally, replaced `__builtin` with `Kernel` to map more closely to Ruby's internals and implemented `MemberAccessCommandContext`.
AndreiDreyer and others added 25 commits August 2, 2024 13:47
* [ruby] Added handling for String interpolated array literals

* [ruby] Added type check in tests

* cleanup

* [ruby] Fixed parser tests with new parser test framework

* [ruby] removed if check on element content
* [ruby] handling added for command literal. Modelled as exec call

* [ruby] fixed failing parser test

* [ruby] Removed print

* [ruby] Added expanded command literal to new parser tests
Using the old SerializedCpg API hat no effect anymore.
* [ruby2cpg] Fix ImplicitRequirePass.

- Fix method lookup via AST edges. The approach of looking up module
  methods via is not possible at the execution time of the pass because
  AST is not yet linked.
  I replaced this buy a fullname based regex lookup.
  We should likely just change the execution time to after AST linking.

- The other changes are just for better readability and debugability.

* Address review remarks.

* Fix field access lookup.

We are only interested on those field accesses which operator on "self"
since those describe the exported/imported objects.
* [ruby] Fixed bracket assignments

* [ruby] Add parser test for BracketAssignment
joern-cli/frontends/csharpsrc2cpg/src/main/scala/io/joern/csharpsrc2cpg/astcreation/AstForStatementsCreator.scala
joern-cli/frontends/jssrc2cpg/src/main/scala/io/joern/jssrc2cpg/Main.scala
joern-cli/frontends/jssrc2cpg/src/main/scala/io/joern/jssrc2cpg/utils/AstGenRunner.scala
joern-cli/frontends/x2cpg/src/main/scala/io/joern/x2cpg/passes/base/ContainsEdgePass.scala
joern-cli/frontends/x2cpg/src/main/scala/io/joern/x2cpg/passes/base/FileCreationPass.scala
joern-cli/frontends/x2cpg/src/main/scala/io/joern/x2cpg/passes/base/MethodStubCreator.scala
joern-cli/frontends/x2cpg/src/main/scala/io/joern/x2cpg/passes/base/NamespaceCreator.scala
joern-cli/frontends/x2cpg/src/main/scala/io/joern/x2cpg/passes/base/ParameterIndexCompatPass.scala
joern-cli/frontends/x2cpg/src/main/scala/io/joern/x2cpg/passes/base/TypeEvalPass.scala
joern-cli/frontends/x2cpg/src/main/scala/io/joern/x2cpg/passes/base/TypeRefPass.scala
joern-cli/frontends/x2cpg/src/main/scala/io/joern/x2cpg/passes/callgraph/DynamicCallLinker.scala
joern-cli/frontends/x2cpg/src/main/scala/io/joern/x2cpg/passes/callgraph/MethodRefLinker.scala
joern-cli/frontends/x2cpg/src/main/scala/io/joern/x2cpg/passes/controlflow/CfgCreationPass.scala
joern-cli/frontends/x2cpg/src/main/scala/io/joern/x2cpg/passes/controlflow/cfgdominator/CfgDominatorPass.scala
joern-cli/frontends/x2cpg/src/main/scala/io/joern/x2cpg/passes/typerelations/AliasLinkerPass.scala
joern-cli/frontends/x2cpg/src/main/scala/io/joern/x2cpg/passes/typerelations/FieldAccessLinkerPass.scala
joern-cli/frontends/x2cpg/src/main/scala/io/joern/x2cpg/passes/typerelations/TypeHierarchyPass.scala
joern-cli/frontends/x2cpg/src/main/scala/io/joern/x2cpg/utils/LinkingUtil.scala
We trigger the post-processing directly if a cpg is loaded on startup
(e.g. `./joern cpg.bin`). In that case, the typeRecoveryConfig has not
been initialized. There's a reason why in Scala you have to explicitly
make an effort to start with `null`, because more often than not
you'll be missing out some random edge case... lazy val is the better
alternative

fixes joernio#4999 (again...)
fixup initialisation order of cpg generators (joernio#5137)
@khemrajrathore khemrajrathore marked this pull request as ready for review December 20, 2024 10:20
@khemrajrathore khemrajrathore self-requested a review December 20, 2024 10:48
Copy link
Member

@khemrajrathore khemrajrathore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pandurangpatil pandurangpatil merged commit aaa0e92 into master Dec 20, 2024
7 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.