📈 GH Trending Explorer 🎲 Surprise me

← all repos

ShiftLeftSecurity / codepropertygraph

git clone https://github.com/ShiftLeftSecurity/codepropertygraph.git v1.7.82 · 2d ago 🔥 on GitHub Trending today

Specification and Scala tooling for the Code Property Graph, a language-agnostic representation of program code for analysis.

Why you might care

Provides a minimal base schema for code graphs that can be extended with application-specific data, plus generated Scala domain classes for accessing the graph. Most first-time users are pointed to Joern, which pairs this with a C/C++ frontend for a complete analysis platform.

Categories

Alternatives

JoernSemgrepCodeQL
+8
stars, 24h · #4,103
+~35
stars, 7 days · #5,392
+~150
stars, 30 days · #4,982
640
★ total · +6% this week
85
forks · 5 open issues

Star history (as recorded here)

2026-10-20 · 625 ★ 2026-10-23 · 640 ★
LanguageScala
LicenseApache-2.0
Created2018-06-28 (8y ago)
Last push2d ago
Watchers29
OwnerOrganization

Seen on GitHub Trending

  • 2026-10-23 — #6 daily in scala · +7 ★

Links

README excerpt
# Code Property Graph - Specification and Tooling
You can find a clickable specification at:
https://cpg.joern.io
**Note: for first-time users, we recommend building "joern" at https://github.com/joernio/joern/ instead. It combines this repo with a C/C++ language frontend to construct a complete code analysis platform.**
A Code Property Graph (CPG) is an extensible and language-agnostic
representation of program code designed for incremental and
distributed code analysis. This repository hosts the base
specification together with a build process that generates data
structure definitions for accessing the graph with different
programming languages.
We are publishing the Code Property Graph specification as a
suggestion for an open standard for the exchange of code in
intermediate representations along with analysis results. With this
goal in mind, the specification consists of a minimal base schema that
can be augmented via extension schemas to enable storage of
application-specific data.
# Usage as a dependency
`build.sbt`:
 [code] 
# Building the code
The build process has been verified on Linux and it should be possible
to build on OS X and BSD systems as well. The build process requires
the following prerequisites:
* Java runtime 11
* Scala build tool (SBT)
* Git-lfs
* Protocol Buffer
Some binary files required for testing are managed through `git-lfs`. If you haven't cloned this repository yet, simply run `git lfs install`.
If you have cloned it already, additionally run `git lfs pull` (from within the repository).
Additional build-time dependencies are automatically downloaded as
part of the build process. To build and install into your local Maven
cache, issue the command `sbt clean test publishM2`.
# Domain class generation
The Scala domain classes under `domainClasses/src/main/generated/` are generated from the schema defined in `schema/src/main/scala/io/shiftleft/codepropertygraph/schema/`. They are checked into the repository, so you only need to regenerate them when the schema changes.
Generation is handled by the `sbt-flatgraph` plugin via the `generateDomainClasses` task in the `schema` subproject. It reads `CpgSchema.instance`, which composes all schema modules, and writes Scala source files to `domainClasses/src/main/generated/`.
The task is wired as a dependency of `domainClasses/compile` and `stage`, so it runs automatically when you compile or stage:
 [code] 
To run generation on its own:
 [code] 
# Code style
Code style is automatically verified by scalafmt
If your PR build fails code formatting check, simply run `sbt scalafmt` and submit the change along with the rest of the code. The commands runs necessary formatting in the right order.
# Creating Protocol Buffer bindings for different languages
The _codepropertygraph-VERSION.jar_ artifact contains a Protocol Buffer definition file _cpg.proto_ that you
can use to generate your own language-specific bindings. For instance, to create C++ and Python bindings, issue the followin

Blurb generated by claude-haiku-5-5 today. Star deltas marked ~ are extrapolated from partial history.