-
Notifications
You must be signed in to change notification settings - Fork 0
Joern Gateway
Rodolphe G. - RORO! edited this page Jul 2, 2026
·
2 revisions
A standalone Joern server in server mode plus a Python WebSocket gateway, in Docker. The gateway turns Joern's async protocol into one simple HTTP call that the agent drives with joernctl.

-
Joern server (
joern --server) speaks the scala-repl-pp protocol:POST /queryreturns a UUID, the finished UUID is pushed over the/connectWebSocket, and you fetch it fromGET /result/:uuid. -
gateway.pyholds the WebSocket open, correlates UUIDs, and exposesPOST /querythat returns{"success","stdout","uuid"}. -
joernctlis a stdlib-only host client. Only the gateway port127.0.0.1:8099is exposed. Joern's 8080 stays inside the container.
cd joern-gateway
docker compose up -d --build # first build pulls the JDK and Joern
./joernctl health
./joernctl import /work/target [name]
./joernctl query '<cpgql>' # use - to read from stdin
./joernctl script ./query.sc # send a file as one query
./joernctl --json query '...' # raw gateway JSON
docker compose downSet on the compose environment block:
-
JOERN_QUERY_TIMEOUT(default 300): per-query timeout in seconds. -
JOERN_USER/JOERN_PASS: enable basic auth on Joern (set both). -
JAVA_OPTS: JVM flags, for example-Xmx6Gfor large CPGs.
Build arg JOERN_VERSION pins a Joern release (default latest).
- First build is large (a JDK plus the Joern CLI).
- One session holds one CPG. A new
importCodereplaces it. Heavy queries queue. - The gateway runs whatever CPGQL you send, which is code execution inside the container. Keep the port on loopback and only analyze code you are authorized to.