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

Merge 4-0-93 to backup_sync #95

Open
wants to merge 186 commits into
base: backup_sync
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
186 commits
Select commit Hold shift + click to select a range
fe7b8b6
[c2cpg] Safe getType / getNodeType (#4706)
max-leuthaeuser Jul 1, 2024
5d58eb4
[c2cpg] Fixed match errors in astForCppCallExpression (#4711)
max-leuthaeuser Jul 1, 2024
9e5a6b2
[c2cpg] Fixed match errors in astForFunctionDeclarator (#4712)
max-leuthaeuser Jul 2, 2024
2fa5a03
[Ruby] Parser tests (#4704)
AndreiDreyer Jul 2, 2024
336c989
[jssrc2cpg] Update astgen version (#4714)
max-leuthaeuser Jul 2, 2024
5e3e9c9
[x2cpg] Rethrow any Throwable from createCpg (#4713)
max-leuthaeuser Jul 2, 2024
5afcd8f
[ruby] Arrow Lambda Tests & `self` Parameter Name Fix (#4716)
DavidBakerEffendi Jul 2, 2024
b76cdda
ignore case while matching excluded files (#4697)
Ferada Jul 2, 2024
fd2894c
use scala3-style `import foo.bar.*` rather than `._` (#4717)
mpollmeier Jul 2, 2024
b40cdca
[speculative] minor work on reachingDef (#4715)
bbrehm Jul 2, 2024
680be03
[jssrc2cpg] Update astgen to v3.16.0 (#4718)
max-leuthaeuser Jul 3, 2024
aad9fe3
[c2cpg] Safe .getOverload.getType access / safer AstCreator.createAst…
max-leuthaeuser Jul 3, 2024
b33a347
[c2cpg] Register call typefullnames correctly (#4722)
max-leuthaeuser Jul 3, 2024
16925e6
[ruby] Parser tests (#4720)
AndreiDreyer Jul 3, 2024
915b0ed
[ruby] Simplify `<` Base Classes (#4723)
DavidBakerEffendi Jul 3, 2024
ec6d03d
Removed joern-stats from install script (#4725)
max-leuthaeuser Jul 3, 2024
18f7fae
[ruby] Make `<body>` Call Static Dispatch (#4726)
DavidBakerEffendi Jul 3, 2024
dca780f
upgrade cpg and adapt (#4728)
mpollmeier Jul 3, 2024
ea45904
minify flatgraph diff: remove unnessecary (and misleading) typescheck…
mpollmeier Jul 3, 2024
dbdb02f
[gosrc2cpg] Multi module support (#4724)
pandurangpatil Jul 4, 2024
59b5ada
[c2cpg] Added typefullnames to all calls (#4731)
max-leuthaeuser Jul 4, 2024
cb2bb5c
[ruby] Singleton methods on objects (#4734)
AndreiDreyer Jul 4, 2024
d3b36e9
[c2cpg] Fixed more exceptions (#4736)
max-leuthaeuser Jul 4, 2024
ff80364
[javasrc2cpg] Fix always-crashing array initializer type resolution (…
johannescoetzee Jul 4, 2024
7abe33a
[c2cpg] Handle unknown in astForCppCallExpression (#4738)
max-leuthaeuser Jul 4, 2024
dd3fb0d
minify the flatgraph diff by bringing various things in before the bi…
mpollmeier Jul 5, 2024
0c49cb9
[TypeRecovery] Handle Member without AST Parent Safely (#4739)
DavidBakerEffendi Jul 5, 2024
cf8d139
[jssrc2cpg] Overhaul typedecl method bindings (#4727)
max-leuthaeuser Jul 5, 2024
3a98c4b
[ruby] Handle `super` Calls (#4740)
DavidBakerEffendi Jul 5, 2024
f446279
[c2cpg] Fixed MethodRef typeFullName (#4743)
max-leuthaeuser Jul 8, 2024
2bbece9
[ruby] `super` Argument `null` & Association Key Handling (#4746)
DavidBakerEffendi Jul 8, 2024
0acd0a2
[ruby] Bind nested method members to method type (#4747)
DavidBakerEffendi Jul 8, 2024
d9be183
pull out changes from michael/flatgraph to minify diff (#4749)
mpollmeier Jul 9, 2024
914aa46
[ruby] Fixed Persistence Issue of Captured Variable Info (#4750)
DavidBakerEffendi Jul 9, 2024
21d39c9
[c2cpg] More fullname fixes (#4751)
max-leuthaeuser Jul 9, 2024
18b6d88
[ruby] Emit TypeRef instead of MethodRef for Lambdas (#4753)
DavidBakerEffendi Jul 10, 2024
a547cd1
[ruby] Singleton Methods on Objects Follow-Up (#4754)
AndreiDreyer Jul 10, 2024
777c67a
[ruby] Method/Type Full Name Simplification (#4755)
DavidBakerEffendi Jul 10, 2024
d77252a
[c2cpg] Fix string repr for type of dependent expressions (#4756)
max-leuthaeuser Jul 11, 2024
19dd54e
[ruby] Handle Re-definitions (#4757)
DavidBakerEffendi Jul 11, 2024
4e43881
[ruby] Handle `NEXT` control structure (#4758)
AndreiDreyer Jul 11, 2024
243c29d
[c2cpg] Support for static modifier (#4759)
max-leuthaeuser Jul 11, 2024
9c13325
[ruby] Remodel `yield` Calls (#4763)
DavidBakerEffendi Jul 11, 2024
e6f5197
upgrade deps (#4761)
mpollmeier Jul 12, 2024
c67eeaf
[ruby] Consistently Model Getters/Setters (#4765)
DavidBakerEffendi Jul 12, 2024
57c2dfe
[php2cpg] Support array/list unpacking (#4764)
d1tto Jul 12, 2024
b2b2bc4
[c2cpg] Fix regression (incorrect end line numbers) (#4766)
fabsx00 Jul 12, 2024
8fac557
IF Cfg creation for if-statements with empty `then` block. (#4772)
ml86 Jul 15, 2024
5336780
[x2cpg] Improve Cfg creation. (#4773)
ml86 Jul 15, 2024
6426120
[ruby] Calls with reserved keywords (#4776)
AndreiDreyer Jul 16, 2024
88e5b1c
[php2cpg] Lowering the init part of foreach statement (#4767)
d1tto Jul 16, 2024
21f7c47
[c2cpg] Ignore ExpansionOverlapsBoundaryException while query static …
max-leuthaeuser Jul 16, 2024
d32a77c
flatgraph (#4630)
mpollmeier Jul 16, 2024
b2fc765
[ruby] Enable `FILE` node content (#4781)
AndreiDreyer Jul 17, 2024
a16b684
[php2cpg] array creation point marks and improved array unpacking (#4…
d1tto Jul 17, 2024
ee5f631
[ruby] Approximate Attribute Assignment (#4777)
DavidBakerEffendi Jul 17, 2024
2f543c1
[c2cpg] Fix CFG creation for INLINE calls (LOCALS with multiple AST p…
max-leuthaeuser Jul 18, 2024
c1919cf
[c2cpg] MethodRef from identifier also for method decl (#4782)
max-leuthaeuser Jul 18, 2024
03161bb
[c2cpg] Do not strip volatile from type names (#4784)
max-leuthaeuser Jul 19, 2024
10ab72d
Added `joern-slice` Data-Flow Script Test (#4786)
DavidBakerEffendi Jul 22, 2024
2c13c93
[ruby] Fix Case Where Field Access Prepends `@` on CONST (#4789)
DavidBakerEffendi Jul 22, 2024
75680e7
Updating Dockerfile (#4790)
itsacoderepo Jul 22, 2024
bd38a15
workaround for scala completion bug (#4791)
mpollmeier Jul 22, 2024
a8e6ca4
[c2cpg] Defer method decl handling (#4787)
max-leuthaeuser Jul 24, 2024
81a996b
[c2cpg] Do not dereference pointer types (#4795)
max-leuthaeuser Jul 24, 2024
e9fc48f
[c2cpg][x2cpg] Handle broken symlinks (#4797)
max-leuthaeuser Jul 25, 2024
4de0f0b
[c2cpg] Handle C function pointer decls (#4798)
max-leuthaeuser Jul 25, 2024
7ef91c9
[c2cpg] Create locals for function pointer decls (#4799)
max-leuthaeuser Jul 25, 2024
3387863
[c2cpg] Create .alloc CALLs for array decls (#4800)
max-leuthaeuser Jul 25, 2024
d269f5f
[c2cpg] Fixed typeFullName of members (#4801)
max-leuthaeuser Jul 25, 2024
1379bb9
[c2cpg] Fix for empty array init (#4802)
max-leuthaeuser Jul 25, 2024
dea147c
[x2cpg] Do not crash on .listRecursively (#4806)
max-leuthaeuser Jul 29, 2024
0e9ec2b
[c2cpg] Add implicit this param + access (#4803)
max-leuthaeuser Jul 29, 2024
4a7eb3b
Add support for THROW control structure. (#4807)
ml86 Jul 29, 2024
fed1d54
[jssrc2cpg] Apply file filtering also to .ejs and .vue files (#4808)
max-leuthaeuser Jul 30, 2024
3cd3f3c
Ammendment to previous `throw` statement cfg change. (#4814)
ml86 Jul 31, 2024
3a53fdb
[ruby] Fixed issue where init stmts and params were missing in classD…
AndreiDreyer Aug 1, 2024
b60732e
[c2cpg] Name/FullName/Signature refactoring (#4815)
max-leuthaeuser Aug 2, 2024
fd87a48
[ruby] Parser Tests (#4809)
AndreiDreyer Aug 2, 2024
a01e3f2
[ruby] String Array with Interpolations (#4813)
AndreiDreyer Aug 2, 2024
715c565
[ruby] Add handling for command literal `%x` (#4819)
AndreiDreyer Aug 2, 2024
75bf17d
Bump cpg version and cleanup. (#4821)
ml86 Aug 2, 2024
e61dba5
Bump cpg to bring in flatgraph node debugging feature. (#4827)
ml86 Aug 5, 2024
6c6857e
[ruby2cpg] Fix ImplicitRequirePass. (#4826)
ml86 Aug 6, 2024
f10a6bc
[ruby] Added handling for symbol interpolated array (#4820)
AndreiDreyer Aug 6, 2024
5a16654
[ruby] Add handling for `BracketAssignmentExpression` (#4828)
AndreiDreyer Aug 6, 2024
d6b1214
[ruby] Fix NPE when creating Ast on empty source files (#4824)
AndreiDreyer Aug 7, 2024
bea0f35
[rubysrc2cpg] Fix implicit import handling. (#4829)
ml86 Aug 7, 2024
8ea641b
[ruby] Fix assignment parser test (#4833)
AndreiDreyer Aug 12, 2024
3dd03f0
[ruby] Fixed bug where only 1 arg was present on MemberAccessCommand …
AndreiDreyer Aug 12, 2024
b766b3a
[ruby] Fix last parser tests (#4834)
AndreiDreyer Aug 12, 2024
e83cae3
[ruby] Fixed Pseudo-Variables as Literals (#4840)
DavidBakerEffendi Aug 12, 2024
71e5e7f
[ruby] `self` Param `REF` Edge (#4838)
DavidBakerEffendi Aug 12, 2024
8dcf938
[ruby] Consider `<<` as append calls (#4843)
DavidBakerEffendi Aug 13, 2024
9f15167
[ruby] Fix Implicit Require Call Structure (#4841)
DavidBakerEffendi Aug 13, 2024
cd45eea
[ruby] Incorrect class names (#4839)
AndreiDreyer Aug 13, 2024
00c911f
[ruby] Include `y(a)ml`, `xml`, and `erb` files (#4846)
DavidBakerEffendi Aug 13, 2024
10a089e
[ruby] Constructor Lowering Fix (#4845)
DavidBakerEffendi Aug 13, 2024
dfa2af1
[ruby] Save root-node for RubyNodeCreator after summary run (#4844)
AndreiDreyer Aug 14, 2024
c95bc86
[python] Include Pipfile[.lock] (#4847)
xavierpinho Aug 14, 2024
c977d4c
[ruby] Revert type changes in `self` PR #4838 (#4848)
DavidBakerEffendi Aug 14, 2024
ca4c172
[ruby] Implicit Require & Import Processing Tweaks (#4849)
DavidBakerEffendi Aug 15, 2024
e967d4c
[ruby] Move Post-Processing to `x2cpg` (#4851)
DavidBakerEffendi Aug 15, 2024
64a3ce3
[ruby] Conflicting local nodes (#4853)
AndreiDreyer Aug 16, 2024
162c2ca
[ruby] Fix `methodFullName` on `Initialize` callNodes (#4854)
AndreiDreyer Aug 16, 2024
6980ae2
[ruby] [ruby] Fixed type prefix on require paths from `ImplicitRequir…
AndreiDreyer Aug 16, 2024
f08389c
[ruby] Changed type of the this param on singleton method declaration…
AndreiDreyer Aug 16, 2024
7e24d92
[ruby] Fix namespace inconsistencies (#4857)
AndreiDreyer Aug 16, 2024
0144560
upgrade deps (#4859)
mpollmeier Aug 19, 2024
de2b9c0
[ruby] `raise` Calls Represented as Operator (#4858)
DavidBakerEffendi Aug 19, 2024
52cbc0e
[ruby] Use `try/catch/else/finally controlStructureNode` for `RescueE…
AndreiDreyer Aug 19, 2024
d804e8a
[ruby] removed assignment operator restriction on BracketedAssignment…
AndreiDreyer Aug 19, 2024
4b5c21f
[ruby] Visibility Access Modifiers (#4862)
DavidBakerEffendi Aug 20, 2024
4f44035
[ruby] Lower `||=` and `&&=` assignment operators (#4863)
AndreiDreyer Aug 20, 2024
9fdc4ca
[ruby] Remove `select` as Built-in Call (#4865)
DavidBakerEffendi Aug 20, 2024
caf75bc
[ruby] Add `commandTernaryExpression` to `command` (#4864)
AndreiDreyer Aug 21, 2024
b341067
[ruby] Apply Cached Side-Effect Variables (#4868)
DavidBakerEffendi Aug 21, 2024
5f89dfe
[php2cpg] Improve performance. (#4867)
ml86 Aug 22, 2024
fc7d004
[ruby] Added parser tests from official parser testS (#4872)
AndreiDreyer Aug 23, 2024
5e8eef6
[php2cpg] Fixed the initialization of static/const members of class (…
d1tto Aug 26, 2024
70d6efe
[repl] hide io.shiftleft.codepropertygraph.generated.help (#4874)
xavierpinho Aug 26, 2024
a03d4bf
[c2cpg] Fix infinite recursion in fullname calculation (#4873)
max-leuthaeuser Aug 26, 2024
ccb820b
[c#] Implements the `forAst` Construct (#4877)
DavidBakerEffendi Aug 26, 2024
086ccfa
ghidra 11.1.2 (#4876)
mpollmeier Aug 26, 2024
6a14e4d
[ruby] Handle `SingleAssignmentStatement` (#4878)
AndreiDreyer Aug 27, 2024
0517482
CPG version (#4881)
itsacoderepo Aug 27, 2024
e8df218
[c2cpg] Fix fullnames for overloaded operators (#4883)
max-leuthaeuser Aug 27, 2024
df3e8a4
[ruby] Add handling for ArrayLiteral used directly as argument in cal…
AndreiDreyer Aug 28, 2024
cd806a3
[ruby] Mixed elements in `Array` body (#4885)
AndreiDreyer Aug 28, 2024
4d8e7c3
[ruby] some AstPrinter fixes (#4886)
AndreiDreyer Aug 28, 2024
12a1080
[ruby] `ParameterList` parser fixes (#4887)
AndreiDreyer Aug 28, 2024
389bd50
[ruby] Implicit Imports: Additional Types & Qualified Names (#4879)
DavidBakerEffendi Aug 29, 2024
42ea828
[ruby] Splat operator fixes (#4889)
AndreiDreyer Aug 30, 2024
40cce81
[ruby] Added associations for yield arguments, fixed handling for dif…
AndreiDreyer Aug 30, 2024
a997dc3
[ruby] added handling for primaryValueListWithAssociation in RETURN s…
AndreiDreyer Aug 30, 2024
72bc423
[c2cpg] Restore pointer operator code representation (#4894)
max-leuthaeuser Sep 2, 2024
911e15d
[ruby] Temp Var Call `code` Fix (#4893)
DavidBakerEffendi Sep 3, 2024
b3c83c9
[ruby] `Block Parameter` fixes (#4895)
AndreiDreyer Sep 4, 2024
7587611
[ruby] General Maintenance & Cleanup Pt. 1 (#4897)
DavidBakerEffendi Sep 5, 2024
353b556
[semanticcpg] remove `runPass` (#4880)
xavierpinho Sep 5, 2024
03c9e10
[x2cpg] Added server mode (#4892)
max-leuthaeuser Sep 5, 2024
daef3c5
[ruby] Handle implicit multi-assignment returns (#4898)
DavidBakerEffendi Sep 6, 2024
d80fb41
[ruby] Fix Duplicate `self` References (#4902)
DavidBakerEffendi Sep 6, 2024
4ef4d66
XTypeRecoveryConfig: don't error when being passes unknown arguments …
mpollmeier Sep 9, 2024
c0c407e
[ruby] Named Arguments with Hash Rocket Syntax (#4905)
DavidBakerEffendi Sep 9, 2024
76e1e66
[ruby] All `require`-like Calls are Static (#4904)
DavidBakerEffendi Sep 9, 2024
da6cc25
[ruby] Fix `lambda` expression parser rule (#4906)
AndreiDreyer Sep 10, 2024
e19e4f3
[ruby] Add handling for `beginless` and `endless` range expressions (…
AndreiDreyer Sep 10, 2024
1eeff12
semanticcpg: harden inheritance steps against loops (#4909)
maltek Sep 10, 2024
ff73309
[ruby] add `methodInvocationWithoutParentheses` to RETURN argumentLis…
AndreiDreyer Sep 11, 2024
cd654b5
[rubysrc2cpg] Fix ImportPass. (#4901)
ml86 Sep 11, 2024
81aa12b
[ruby] Member Access Base as Call Fix (#4910)
DavidBakerEffendi Sep 11, 2024
fe64ec8
update cpg/flatgraph (#4917)
maltek Sep 12, 2024
bd79b8f
[ruby] Added mixed-elements functionality to array elements (#4919)
AndreiDreyer Sep 13, 2024
3ab71fe
[ruby] Fixed anltr warnings on possible empty string matches (#4921)
AndreiDreyer Sep 14, 2024
47c2f2f
[kotlin2cpg] Better fallback for annotation types. (#4925)
ml86 Sep 16, 2024
941a6d8
[kotlin2cpg] Fix field access representation. (#4927)
ml86 Sep 16, 2024
19011fb
[ruby] Access Modifier Names in Expr (#4928)
DavidBakerEffendi Sep 17, 2024
3a530c0
[dataflowengineoss] Turn `Semantics` into a node-directed trait (#4920)
xavierpinho Sep 17, 2024
3440c26
[ruby] Added return expression to last item of conditional (#4929)
AndreiDreyer Sep 17, 2024
17df32d
[kotlin2cpg] Fix "nacked" call representation. (#4930)
ml86 Sep 18, 2024
351c619
scalac: warn when type parameters are shadowed (#4937)
mpollmeier Sep 19, 2024
236bd8f
ExtendedCfgNodeMethods: rename type parameter (#4936)
xavierpinho Sep 19, 2024
6293a6e
[ruby] Antlr Profiler (#4933)
DavidBakerEffendi Sep 20, 2024
5fe5549
[ruby] Added handling of proc-param with no name (#4932)
AndreiDreyer Sep 20, 2024
624a864
[ruby] Removal of Deprecated Frontend (#4899)
DavidBakerEffendi Sep 20, 2024
226f441
Remove JavaSrc2CpgTestContext.scala (#4916)
xavierpinho Sep 20, 2024
2101f5a
[ruby] Reduce Array Parser Ambiguity (#4938)
DavidBakerEffendi Sep 20, 2024
c2d2005
[ruby] Add handling for multiple splat args in call) (#4941)
AndreiDreyer Sep 23, 2024
22a58fe
[Dependency Fetcher] Fix gradle dependency fetcher android detection …
johannescoetzee Sep 23, 2024
95bb4d1
[dataflowengineoss] provide FullNameSemantics.plus method (#4942)
xavierpinho Sep 24, 2024
c0955d7
[ruby] Add handling for different arguments in calls (#4946)
AndreiDreyer Sep 25, 2024
5a7453b
upgrade deps (#4947)
mpollmeier Sep 25, 2024
c27e67e
[ruby] Strip Unused Parser Rules (#4949)
DavidBakerEffendi Sep 25, 2024
10e1c33
[ruby] Add handling for multiple call args (#4948)
AndreiDreyer Sep 25, 2024
cc7f787
[dataflowengineoss] remove overriding operator semantics (#4952)
xavierpinho Sep 25, 2024
55871dc
[dataflowengineoss] FullNameSemantics logs and merges conflicting Flo…
xavierpinho Sep 26, 2024
9f6d756
[jssrc2cpg] Fix offsets for :program and <init> method nodes (#4954)
max-leuthaeuser Sep 26, 2024
3d38fec
[dataflowengineoss] SemanticTestCpg doesn't rebuild semantics (#4955)
xavierpinho Sep 26, 2024
87b4b63
[dataflowengineoss] replace `extraFlows` with `semantics` (#4957)
xavierpinho Sep 26, 2024
da64780
[ruby] Fixed Argument Order on `ArgumentListContextHelper` (#4972)
DavidBakerEffendi Sep 27, 2024
8b6992d
[python] fix methodFullName for methods named ^(import).* (#4973)
xavierpinho Sep 27, 2024
5e38766
[c2cpg] Fixed fileName helper (#4940)
max-leuthaeuser Sep 27, 2024
f141437
[ruby] ANTLR Profiler Summary (#4950)
DavidBakerEffendi Sep 27, 2024
f5dda21
[dataflowengineoss] composable semantics (#4974)
xavierpinho Sep 29, 2024
8a68459
Merge branch 'master' of https://github.com/joernio/joern into 4-0-93
Sep 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ jobs:
./joern --src /tmp/foo --run scan
./joern-scan /tmp/foo
./joern-scan --dump
./joern-slice data-flow -o target/slice
- run: |
mkdir /tmp/slice
./joern-slice data-flow tests/code/javasrc/SliceTest.java -o /tmp/slice/dataflow-slice-javasrc.json
./joern --script "./test-dataflow-slice.sc" --param sliceFile=/tmp/slice/dataflow-slice-javasrc.json | grep -q 'List(boolean b, b, this, s, "MALICIOUS", s, new Foo("MALICIOUS"), s, s, "SAFE", s, b, this, this, b, s, System.out)'
- run: |
cd joern-cli/target/universal/stage
./schema-extender/test.sh
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM alpine:3.17.3
FROM alpine:3.20

# dependencies
RUN apk update && apk upgrade && apk add --no-cache openjdk17-jdk python3 git curl gnupg bash nss ncurses php
RUN ln -sf python3 /usr/bin/python

# sbt
ENV SBT_VERSION 1.8.0
ENV SBT_VERSION 1.10.0
ENV SBT_HOME /usr/local/sbt
ENV PATH ${PATH}:${SBT_HOME}/bin
RUN curl -sL "https://github.com/sbt/sbt/releases/download/v$SBT_VERSION/sbt-$SBT_VERSION.tgz" | gunzip | tar -x -C /usr/local
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Specification: https://cpg.joern.io

## News / Changelog

- Joern v4.0.0 [migrates from overflowdb to flatgraph](changelog/4.0.0-flatgraph.md)
- Joern v2.0.0 [upgrades from Scala2 to Scala3](changelog/2.0.0-scala3.md)
- Joern v1.2.0 removes the `overflowdb.traversal.Traversal` class. This change is not completely backwards compatible. See [here](changelog/traversal_removal.md) for a detailed writeup.

Expand Down
5 changes: 3 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name := "joern"
ThisBuild / organization := "io.joern"
ThisBuild / scalaVersion := "3.4.2"

val cpgVersion = "1.6.16"
val cpgVersion = "1.7.10"

lazy val joerncli = Projects.joerncli
lazy val querydb = Projects.querydb
Expand Down Expand Up @@ -45,7 +45,8 @@ ThisBuild / compile / javacOptions ++= Seq(
ThisBuild / scalacOptions ++= Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"--release",
"11"
"11",
"-Wshadow:type-parameter-shadow",
)

lazy val createDistribution = taskKey[File]("Create a complete Joern distribution")
Expand Down
43 changes: 43 additions & 0 deletions changelog/4.0.0-flatgraph.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 4.0.x: Migration to flatgraph

Joern uses the domain-specific classes from codepropertygraph, which (up to joern 2.x) were generated by overflowdb (specifically https://github.com/ShiftLeftSecurity/overflowdb and https://github.com/ShiftLeftSecurity/overflowdb-codegen).
As of joern 4.0.x we replaced overflowdb with it's successor, [flatgraph](https://github.com/joernio/flatgraph). The most important PRs paving the way for flatgraph are https://github.com/ShiftLeftSecurity/codepropertygraph/pull/1769 and https://github.com/joernio/joern/pull/4630.

### Why the change?
Most importantly, flatgraph brings us about 40% less memory usage as well as faster traversals. The reduced memory footprint is achieved by flatgraph's efficient columnar layout, essentially we hold everything in few (albeit very large) arrays.
The faster traversals account for about 40% performance improvement for many joern use-cases, e.g. running the default passes while importing a large cpg into joern. Some numbers for Linux 4, as an example for a very large codebase. Numbers are based on my workstation and just rough measurements.

Linux 4.1.16, cpg created with c2cpg after `importCpg` into joern:
* 48M nodes with 630M properties (mostly `String` and `Integer`)
* 431M edges with 115M properties (all `String`)

| | joern 2 (overflowdb) | joern 4 (flatgraph) |
| --------------------------------------------|----------------------|-------------------- |
| heap after import (after garbage collection)| 33g | 20g |
| minimum required heap (Xmx) for import | 80g | 30g |
| time for importCpg | 18 minutes | 11 minutes |
| file size on disk | 2600M | 400m |

Linux 5 and 6 are considerably larger, so I wasn't able to import them into joern 2 on my workstation (which has 128G physical memory). With joern 4 it works just fine with `./joern -J-Xmx90g` for linux6 😀

Also worth noting: one of overflowdb's features was the overflowing-to-disk mechanism. While it sounds nice to be able to handle graphs larger than the available memory, in practice it was too slow to be useful, so we didn't reimplement it in flatgraph.

### API changes / upgrade guide
We tried to minimise the joern-user-facing API changes, and depending on your usage you may not notice anything at all. That being said, if your code makes use of the `overflowdb` namespace then you will have to make some changes. In most cases, it's simply a namespace change to `flatgraph`. Since hopefully no joern user used the overflowdb api (with one exception listed below), I won't list the changes here, instead please look at the [joern migration PR](https://github.com/joernio/joern/pull/4630/files) and/or ask us on [discord](https://discord.com/channels/832209896089976854/842699104383533076).

Most relevant changes:
1) `overflowdb.BatchedUpdate.applyDiff` -> `flatgraph.DiffGraphApplier.applyDiff`
1) `io.shiftleft.passes.IntervalKeyPool` -> `io.joern.x2cpg.utils.IntervalKeyPool`

1) `StoredNode.propertyOption` now returns an `Option` rather than a `java.util.Optional` - the API is almost identical, and there's builtin conversions both ways (`.toScala|.toJava` via `import scala.jdk.OptionConverters.*`).

1) the arrow syntax for quickly constructing graphs, e.g. `v0 --- "CFG" --> v1`, quite useful for testing, doesn't exist in flatgraph yet. You'll need to create a diffgraph instead. There's plenty of examples in the [joern migration PR](https://github.com/joernio/joern/pull/4630/files).

1) Edges can only have zero or one properties. Since the codepropertygraph schema never defined more than one property per edge type, this should not affect you as a joern user, unless you've extended the cpg schema...

### Credits and kudos
Flatgraph is based on [@bbrehm](https://github.com/bbrehm)'s great ideas for a memory efficient columnar layout on the jvm. He built a working prototype with very promising benchmarks that convinced us that the effort to migrate is worth-while, and that turned out to be true.

### Why did we leave out version 3?
I'm glad you asked! Version 3 is typically a source for trouble, you know... just look at Gnome 3, Python 3 and many more. The only exception is Scala 3, of course - ymmv :)

4 changes: 2 additions & 2 deletions console/src/main/scala/io/joern/console/Commit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package io.joern.console
import io.shiftleft.codepropertygraph.generated.Cpg
import io.shiftleft.passes.CpgPass
import io.shiftleft.semanticcpg.layers.{LayerCreator, LayerCreatorContext, LayerCreatorOptions}
import overflowdb.BatchedUpdate.DiffGraphBuilder
import io.shiftleft.codepropertygraph.generated.DiffGraphBuilder

object Commit {
val overlayName: String = "commit"
Expand All @@ -26,7 +26,7 @@ class Commit(opts: CommitOptions) extends LayerCreator {
builder.absorb(opts.diffGraphBuilder)
}
}
runPass(pass, context)
pass.createAndApply()
opts.diffGraphBuilder = Cpg.newDiffGraphBuilder
}

Expand Down
14 changes: 9 additions & 5 deletions console/src/main/scala/io/joern/console/Console.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import io.shiftleft.codepropertygraph.cpgloading.CpgLoader
import io.shiftleft.semanticcpg.language.*
import io.shiftleft.semanticcpg.language.dotextension.ImageViewer
import io.shiftleft.semanticcpg.layers.{LayerCreator, LayerCreatorContext}
import overflowdb.traversal.help.Doc
import overflowdb.traversal.help.Table.AvailableWidthProvider
import io.shiftleft.codepropertygraph.generated.help.Doc
import flatgraph.help.Table.AvailableWidthProvider

import scala.sys.process.Process
import scala.util.control.NoStackTrace
Expand Down Expand Up @@ -349,10 +349,14 @@ class Console[T <: Project](loader: WorkspaceLoader[T], baseDir: File = File.cur

val cpgDestinationPath = cpgDestinationPathOpt.get

if (CpgLoader.isLegacyCpg(cpgFile)) {
report("You have provided a legacy proto CPG. Attempting conversion.")
val isProtoFormat = CpgLoader.isProtoFormat(cpgFile.path)
val isOverflowDbFormat = CpgLoader.isOverflowDbFormat(cpgFile.path)
if (isProtoFormat || isOverflowDbFormat) {
if (isProtoFormat) report("You have provided a legacy proto CPG. Attempting conversion.")
else if (isOverflowDbFormat) report("You have provided a legacy overflowdb CPG. Attempting conversion.")
try {
CpgConverter.convertProtoCpgToOverflowDb(cpgFile.path.toString, cpgDestinationPath.toString)
val cpg = CpgLoader.load(cpgFile.path, cpgDestinationPath)
cpg.close()
} catch {
case exc: Exception =>
report("Error converting legacy CPG: " + exc.getMessage)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.joern.console

import better.files._
import better.files.*

import scala.annotation.tailrec
import scala.collection.mutable
Expand Down
16 changes: 10 additions & 6 deletions console/src/main/scala/io/joern/console/CpgConverter.scala
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package io.joern.console

import io.shiftleft.codepropertygraph.cpgloading.{CpgLoader, CpgLoaderConfig}
import overflowdb.Config
import io.shiftleft.codepropertygraph.cpgloading.{CpgLoader, ProtoCpgLoader}

import java.nio.file.Paths

object CpgConverter {

def convertProtoCpgToOverflowDb(srcFilename: String, dstFilename: String): Unit = {
val odbConfig = Config.withDefaults.withStorageLocation(dstFilename)
val config = CpgLoaderConfig.withDefaults.doNotCreateIndexesOnLoad.withOverflowConfig(odbConfig)
CpgLoader.load(srcFilename, config).close
def convertProtoCpgToFlatgraph(srcFilename: String, dstFilename: String): Unit = {
val cpg = ProtoCpgLoader.loadFromProtoZip(srcFilename, Option(Paths.get(dstFilename)))
cpg.close()
}

@deprecated("method got renamed to `convertProtoCpgToFlatgraph, please use that instead", "joern v3")
def convertProtoCpgToOverflowDb(srcFilename: String, dstFilename: String): Unit =
convertProtoCpgToFlatgraph(srcFilename, dstFilename)

}
6 changes: 3 additions & 3 deletions console/src/main/scala/io/joern/console/Help.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.joern.console

import overflowdb.traversal.help.DocFinder.*
import overflowdb.traversal.help.Table.AvailableWidthProvider
import overflowdb.traversal.help.{DocFinder, Table}
import flatgraph.help.DocFinder.*
import flatgraph.help.Table.AvailableWidthProvider
import flatgraph.help.{DocFinder, Table}

object Help {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package io.joern.console
import better.files.Dsl._
import better.files.Dsl.*
import better.files.File
import better.files.File.apply

Expand Down
8 changes: 4 additions & 4 deletions console/src/main/scala/io/joern/console/Run.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import io.shiftleft.semanticcpg.layers.{LayerCreator, LayerCreatorContext}
import org.reflections8.Reflections
import org.reflections8.util.{ClasspathHelper, ConfigurationBuilder}

import scala.jdk.CollectionConverters._
import scala.jdk.CollectionConverters.*

object Run {

Expand All @@ -22,7 +22,7 @@ object Run {
query.store()(builder)
}
}
runPass(pass, context)
pass.createAndApply()
}
})
}
Expand Down Expand Up @@ -64,7 +64,7 @@ object Run {
|
|val opts = new OptsDynamic()
|
| import _root_.overflowdb.BatchedUpdate.DiffGraphBuilder
| import _root_.io.shiftleft.codepropertygraph.generated.DiffGraphBuilder
| implicit def _diffGraph: DiffGraphBuilder = opts.commit.diffGraphBuilder
| def diffGraph = _diffGraph
|""".stripMargin
Expand All @@ -75,7 +75,7 @@ object Run {

val toStringCode =
s"""
| import overflowdb.traversal.help.Table
| import flatgraph.help.Table
| override def toString() : String = {
| val columnNames = List("name", "description")
| val rows =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package io.joern.console.cpgcreation
import better.files.File
import io.shiftleft.codepropertygraph.generated.Cpg

import scala.sys.process._
import scala.sys.process.*
import scala.util.Try

/** A CpgGenerator generates Code Property Graphs from code. Each supported language implements a Generator, e.g.,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package io.joern.console.cpgcreation

import better.files.Dsl._
import better.files.Dsl.*
import better.files.File
import io.shiftleft.codepropertygraph.cpgloading.{CpgLoader, CpgLoaderConfig}
import io.shiftleft.codepropertygraph.cpgloading.CpgLoader
import io.shiftleft.codepropertygraph.generated.Languages
import io.joern.console.ConsoleConfig
import overflowdb.Config
import io.joern.console.{ConsoleConfig, CpgConverter}

import java.nio.file.Path
import scala.util.Try
Expand Down Expand Up @@ -60,12 +59,12 @@ class CpgGeneratorFactory(config: ConsoleConfig) {
generator.generate(inputPath, outputPath).map(File(_))
outputFileOpt.map { outFile =>
val parentPath = outFile.parent.path.toAbsolutePath
if (isZipFile(outFile)) {
if (CpgLoader.isProtoFormat(outFile.path)) {
report("Creating database from bin.zip")
val srcFilename = outFile.path.toAbsolutePath.toString
val dstFilename = parentPath.resolve("cpg.bin").toAbsolutePath.toString
// MemoryHelper.hintForInsufficientMemory(srcFilename).map(report)
convertProtoCpgToOverflowDb(srcFilename, dstFilename)
convertProtoCpgToFlatgraph(srcFilename, dstFilename)
} else {
report("moving cpg.bin.zip to cpg.bin because it is already a database file")
val srcPath = parentPath.resolve("cpg.bin.zip")
Expand All @@ -77,18 +76,13 @@ class CpgGeneratorFactory(config: ConsoleConfig) {
}
}

def convertProtoCpgToOverflowDb(srcFilename: String, dstFilename: String): Unit = {
val odbConfig = Config.withDefaults.withStorageLocation(dstFilename)
val config = CpgLoaderConfig.withDefaults.doNotCreateIndexesOnLoad.withOverflowConfig(odbConfig)
CpgLoader.load(srcFilename, config).close
File(srcFilename).delete()
}
@deprecated("method got renamed to `convertProtoCpgToFlatgraph, please use that instead", "joern v3")
def convertProtoCpgToOverflowDb(srcFilename: String, dstFilename: String): Unit =
convertProtoCpgToFlatgraph(srcFilename, dstFilename)

def isZipFile(file: File): Boolean = {
val bytes = file.bytes
Try {
bytes.next() == 'P' && bytes.next() == 'K'
}.getOrElse(false)
def convertProtoCpgToFlatgraph(srcFilename: String, dstFilename: String): Unit = {
CpgConverter.convertProtoCpgToFlatgraph(srcFilename, dstFilename)
File(srcFilename).delete()
}

private def report(str: String): Unit = System.err.println(str)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import io.joern.console.workspacehandling.Project
import io.joern.console.{ConsoleException, FrontendConfig, Reporting}
import io.shiftleft.codepropertygraph.generated.Cpg
import io.shiftleft.codepropertygraph.generated.Languages
import overflowdb.traversal.help.Table
import overflowdb.traversal.help.Table.AvailableWidthProvider
import flatgraph.help.Table
import flatgraph.help.Table.AvailableWidthProvider

import java.nio.file.Path
import scala.util.{Failure, Success, Try}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package io.joern.console.cpgcreation
import io.joern.console.FrontendConfig

import java.nio.file.Path
import scala.sys.process._
import scala.sys.process.*
import scala.util.{Failure, Try}

/** Language frontend for Java archives (JAR files). Translates Java archives into code property graphs.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package io.joern.console.cpgcreation

import io.joern.console.FrontendConfig
import io.joern.x2cpg.X2Cpg
import io.joern.x2cpg.frontendspecific.pysrc2cpg
import io.joern.x2cpg.frontendspecific.pysrc2cpg.*
import io.joern.x2cpg.passes.base.AstLinkerPass
import io.joern.x2cpg.passes.callgraph.NaiveCallLinker
import io.joern.x2cpg.passes.frontend.XTypeRecoveryConfig
import io.shiftleft.codepropertygraph.generated.Cpg

import java.nio.file.Path
import scala.util.Try
import scala.compiletime.uninitialized
import scala.util.Try

case class PythonSrcCpgGenerator(config: FrontendConfig, rootPath: Path) extends CpgGenerator {
private lazy val command: Path = if (isWin) rootPath.resolve("pysrc2cpg.bat") else rootPath.resolve("pysrc2cpg")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ case class RubyCpgGenerator(config: FrontendConfig, rootPath: Path) extends CpgG
override def isJvmBased = true

override def applyPostProcessingPasses(cpg: Cpg): Cpg = {
// TODO: here we need a Ruby-specific `Config`, which we shall build from the existing `FrontendConfig`. We only
// care for `--useDeprecatedFrontend` though, for now. Nevertheless, there should be a better way of handling this.
val rubyConfig = Config().withUseDeprecatedFrontend(config.cmdLineParams.exists(_ == "--useDeprecatedFrontend"))
val rubyConfig = Config()
RubySrc2Cpg.postProcessingPasses(cpg, rubyConfig).foreach(_.createAndApply())
cpg
}
Expand Down
2 changes: 1 addition & 1 deletion console/src/main/scala/io/joern/console/package.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.joern

import overflowdb.traversal.help.Table.AvailableWidthProvider
import flatgraph.help.Table.AvailableWidthProvider
import replpp.Operators.*
import replpp.Colors

Expand Down
5 changes: 0 additions & 5 deletions console/src/main/scala/io/joern/console/scan/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ package object scan {

private val logger: Logger = LoggerFactory.getLogger(this.getClass)

implicit class ScannerStarters(val cpg: Cpg) extends AnyVal {
def finding: Iterator[Finding] =
overflowdb.traversal.InitialTraversal.from[Finding](cpg.graph, NodeTypes.FINDING)
}

implicit class QueryWrapper(q: Query) {

/** Obtain list of findings by running query on CPG
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.joern.console.workspacehandling

import better.files.Dsl._
import better.files.Dsl.*
import better.files.File
import io.shiftleft.codepropertygraph.generated.Cpg
import io.shiftleft.semanticcpg.Overlays
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.joern.console.workspacehandling

import io.joern.console.defaultAvailableWidthProvider
import overflowdb.traversal.help.Table
import overflowdb.traversal.help.Table.AvailableWidthProvider
import flatgraph.help.Table
import flatgraph.help.Table.AvailableWidthProvider

import scala.collection.mutable.ListBuffer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.joern.console.workspacehandling

import better.files.Dsl.mkdirs
import better.files.File
import overflowdb.traversal.help.Table.AvailableWidthProvider
import flatgraph.help.Table.AvailableWidthProvider

import java.nio.file.Path
import scala.collection.mutable.ListBuffer
Expand Down
Loading