Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.

Commit cbba92c

Browse files
authored
joern 2 (#36)
* joern 2 Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> * joern 2 Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> * joern 2 Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> * joern 2 Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com> --------- Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
1 parent ed2ed61 commit cbba92c

File tree

12 files changed

+23
-234
lines changed

12 files changed

+23
-234
lines changed

.github/workflows/exetests.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,6 @@ jobs:
170170
with:
171171
repository: 'ShiftLeftSecurity/shiftleft-go-example'
172172
path: 'repotests/shiftleft-go-example'
173-
- uses: actions/checkout@v3
174-
with:
175-
repository: 'prabhu/shiftleft-scala-example'
176-
path: 'repotests/shiftleft-scala-example'
177-
- uses: actions/checkout@v3
178-
with:
179-
repository: 'HooliCorp/vulnerable_net_core'
180-
path: 'repotests/vulnerable_net_core'
181-
- uses: actions/checkout@v3
182-
with:
183-
repository: 'HooliCorp/Goatly.NET'
184-
path: 'repotests/Goatly.NET'
185173
- uses: actions/checkout@v3
186174
with:
187175
repository: 'HooliCorp/DjanGoat'

.github/workflows/joern2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ jobs:
3434
/tmp/querydb.json
3535
querydb/target/querydb.zip
3636
target/joern-cli.zip
37-
target/joern-cli.zip.
37+
target/joern-cli.zip.sha512
3838
joern-install.sh

.github/workflows/pythonpublish.yml

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,14 @@ jobs:
7272
with:
7373
images: |
7474
ghcr.io/appthreat/cpggen
75+
ghcr.io/appthreat/cpggen-oss
7576
7677
- name: Build and push Docker images
7778
uses: docker/build-push-action@v4
7879
with:
7980
context: .
8081
file: Dockerfile
81-
platforms: linux/amd64
82+
platforms: linux/amd64,linux/arm64
8283
push: true
8384
tags: ${{ steps.meta.outputs.tags }}
8485
labels: ${{ steps.meta.outputs.labels }}
@@ -120,41 +121,7 @@ jobs:
120121
labels: ${{ steps.meta2.outputs.labels }}
121122
cache-from: type=gha,scope=cpggen-alma8
122123
cache-to: type=gha,mode=max,scope=cpggen-alma8
123-
oss-container:
124-
runs-on: ubuntu-latest
125-
permissions:
126-
contents: write
127-
packages: write
128-
steps:
129-
- uses: actions/checkout@v3
130-
- name: Set up QEMU
131-
uses: docker/setup-qemu-action@v2
132-
- name: Set up Docker Buildx
133-
uses: docker/setup-buildx-action@v2
134-
- name: Log in to the Container registry
135-
uses: docker/login-action@v2
136-
with:
137-
registry: ghcr.io
138-
username: ${{ github.actor }}
139-
password: ${{ secrets.GITHUB_TOKEN }}
140124

141-
- name: Extract metadata (tags, labels) for Docker
142-
id: meta3
143-
uses: docker/metadata-action@v4
144-
with:
145-
images: |
146-
ghcr.io/appthreat/cpggen-oss
147-
- name: Build and push Docker OSS images
148-
uses: docker/build-push-action@v4
149-
with:
150-
context: .
151-
file: ci/Dockerfile-oss
152-
platforms: linux/amd64,linux/arm64
153-
push: true
154-
tags: ${{ steps.meta3.outputs.tags }}
155-
labels: ${{ steps.meta3.outputs.labels }}
156-
cache-from: type=gha,scope=cpggen-oss
157-
cache-to: type=gha,mode=max,scope=cpggen-oss
158125
slim-container:
159126
runs-on: ubuntu-latest
160127
permissions:

.github/workflows/repotests.yml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,6 @@ jobs:
4242
with:
4343
repository: 'ShiftLeftSecurity/shiftleft-ts-example'
4444
path: 'repotests/shiftleft-ts-example'
45-
- uses: actions/checkout@v3
46-
with:
47-
repository: 'ShiftLeftSecurity/shiftleft-go-example'
48-
path: 'repotests/shiftleft-go-example'
49-
- uses: actions/checkout@v3
50-
with:
51-
repository: 'prabhu/shiftleft-scala-example'
52-
path: 'repotests/shiftleft-scala-example'
53-
- uses: actions/checkout@v3
54-
with:
55-
repository: 'HooliCorp/vulnerable_net_core'
56-
path: 'repotests/vulnerable_net_core'
57-
- uses: actions/checkout@v3
58-
with:
59-
repository: 'HooliCorp/Goatly.NET'
60-
path: 'repotests/Goatly.NET'
6145
- uses: actions/checkout@v3
6246
with:
6347
repository: 'HooliCorp/DjanGoat'
@@ -80,15 +64,15 @@ jobs:
8064
docker build -t ghcr.io/appthreat/atomgen -f ci/Dockerfile-atom .
8165
docker build -t ghcr.io/appthreat/cpggen .
8266
docker run --rm -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/appthreat/cpggen cpggen -i /app/repotests/shiftleft-java-example -o /tmp/all_cpgs/shiftleft-java-example
83-
docker run --rm -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/appthreat/cpggen joern -J-Xmx7G --script /app/contrib/joern_scripts/cpg-methods.sc --params payload=/tmp/all_cpgs/shiftleft-java-example/shiftleft-java-example-java.cpg.bin,resultFile=/tmp/all_cpgs/shiftleft-java-example/java-cpg-methods.json
67+
docker run --rm -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/appthreat/cpggen joern -J-Xmx7G --script /app/contrib/joern_scripts/cpg-methods.sc --param payload=/tmp/all_cpgs/shiftleft-java-example/shiftleft-java-example-java.cpg.bin --param resultFile=/tmp/all_cpgs/shiftleft-java-example/java-cpg-methods.json
8468
if [ -e "/tmp/all_cpgs/shiftleft-java-example/java-cpg-methods.json" ]; then
8569
echo "Java cpg test was successful"
8670
else
8771
echo "Java cpg test was not successful"
8872
exit 1
8973
fi
9074
docker run --rm -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/appthreat/atomgen -i /app/repotests/shiftleft-java-example -o /tmp/all_cpgs/shiftleft-java-example
91-
docker run --rm -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/appthreat/cpggen joern -J-Xmx7G --script /app/contrib/joern_scripts/cpg-methods.sc --params payload=/tmp/all_cpgs/shiftleft-java-example/shiftleft-java-example-java.⚛,resultFile=/tmp/all_cpgs/shiftleft-java-example/java-cpg-methods.json
75+
docker run --rm -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/appthreat/cpggen joern -J-Xmx7G --script /app/contrib/joern_scripts/cpg-methods.sc --param payload=/tmp/all_cpgs/shiftleft-java-example/shiftleft-java-example-java.⚛ --param resultFile=/tmp/all_cpgs/shiftleft-java-example/java-cpg-methods.json
9276
if [ -e "/tmp/all_cpgs/shiftleft-java-example/java-cpg-methods.json" ]; then
9377
echo "Java atom test was successful"
9478
else
@@ -145,7 +129,7 @@ jobs:
145129
echo "Binary cpg test was not successful"
146130
exit 1
147131
fi
148-
docker run --rm -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/appthreat/cpggen joern -J-Xmx7G --script /app/contrib/joern_scripts/cpg-methods.sc --params payload=/tmp/all_cpgs/juicy-malware/juicy_malware_linux_amd_64-binary.cpg.bin,resultFile=/tmp/all_cpgs/juicy-malware/binary-cpg-methods.json
132+
docker run --rm -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/appthreat/cpggen joern -J-Xmx7G --script /app/contrib/joern_scripts/cpg-methods.sc --param payload=/tmp/all_cpgs/juicy-malware/juicy_malware_linux_amd_64-binary.cpg.bin --param resultFile=/tmp/all_cpgs/juicy-malware/binary-cpg-methods.json
149133
if [ -e "/tmp/all_cpgs/juicy-malware/binary-cpg-methods.json" ]; then
150134
echo "Binary cpg test was successful"
151135
else

.github/workflows/ubuntu.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,6 @@ jobs:
3434
with:
3535
repository: 'ShiftLeftSecurity/shiftleft-ts-example'
3636
path: 'repotests/shiftleft-ts-example'
37-
- uses: actions/checkout@v3
38-
with:
39-
repository: 'ShiftLeftSecurity/shiftleft-go-example'
40-
path: 'repotests/shiftleft-go-example'
41-
- uses: actions/checkout@v3
42-
with:
43-
repository: 'HooliCorp/vulnerable_net_core'
44-
path: 'repotests/vulnerable_net_core'
45-
- uses: actions/checkout@v3
46-
with:
47-
repository: 'HooliCorp/Goatly.NET'
48-
path: 'repotests/Goatly.NET'
4937
- uses: actions/checkout@v3
5038
with:
5139
repository: 'HooliCorp/DjanGoat'

Dockerfile

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ LABEL maintainer="appthreat" \
44
org.opencontainers.image.authors="Team AppThreat <cloud@appthreat.com>" \
55
org.opencontainers.image.source="https://github.com/appthreat/cpggen" \
66
org.opencontainers.image.url="https://github.com/appthreat/cpggen" \
7-
org.opencontainers.image.version="1.5.2" \
7+
org.opencontainers.image.version="1.6.0" \
88
org.opencontainers.image.vendor="AppThreat" \
99
org.opencontainers.image.licenses="Apache-2.0" \
1010
org.opencontainers.image.title="cpggen" \
@@ -13,28 +13,22 @@ LABEL maintainer="appthreat" \
1313

1414
ARG TARGETPLATFORM
1515

16-
ENV JOERN_HOME=/usr/local/bin \
16+
ENV JOERN_HOME=/opt/joern-cli \
1717
LC_ALL=en_US.UTF-8 \
1818
LANG=en_US.UTF-8 \
1919
LANGUAGE=en_US.UTF-8 \
20-
GOROOT=/usr/local/go \
21-
GO_VERSION=1.19.9 \
2220
SBT_VERSION=1.9.0 \
2321
GRADLE_VERSION=8.1.1 \
2422
GRADLE_HOME=/opt/gradle-8.1.1 \
2523
GRADLE_OPTS="-Dorg.gradle.daemon=false" \
2624
JAVA_HOME="/etc/alternatives/jre_17" \
2725
JAVA_17_HOME="/etc/alternatives/jre_17" \
28-
JAVA_8_HOME="/usr/lib/jvm/jre-1.8.0" \
29-
CGO_ENABLED=1 \
30-
GO111MODULE="" \
31-
GOOS="linux" \
3226
PYTHONUNBUFFERED=1 \
3327
PYTHONIOENCODING="utf-8" \
3428
DOTNET_CLI_TELEMETRY_OPTOUT=1 \
3529
JOERN_DATAFLOW_TRACKED_WIDTH=128 \
3630
ANDROID_HOME=/opt/android-sdk-linux \
37-
PATH=${PATH}:/opt/joern/joern-cli:/opt/joern/joern-cli/bin:/usr/local/go/bin:/usr/local/bin:/root/.local/bin:/opt/sbt/bin:/usr/local/go/pkg/tool/linux_amd64:${JAVA_HOME}/bin:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools:
31+
PATH=${PATH}:/opt/joern-cli:/opt/joern-cli/bin:/usr/local/bin:/root/.local/bin:/opt/sbt/bin:${JAVA_HOME}/bin:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools:
3832

3933
COPY . /usr/local/src/
4034

@@ -54,21 +48,17 @@ RUN set -e; \
5448
echo -e "[nodejs]\nname=nodejs\nstream=20\nprofiles=\nstate=enabled\n" > /etc/dnf/modules.d/nodejs.module \
5549
&& microdnf module enable maven php -y \
5650
&& microdnf install -y gcc gcc-c++ libstdc++-devel git-core php php-cli python3.11 python3.11-devel python3.11-pip pcre2 which tar zip unzip sudo \
57-
java-17-openjdk-headless java-1.8.0-openjdk-headless maven ncurses jq krb5-libs libicu openssl-libs compat-openssl11 zlib \
58-
dotnet-sdk-7.0 dotnet-targeting-pack-7.0 dotnet-templates-7.0 dotnet-hostfxr-7.0 nodejs graphviz graphviz-gd graphviz-python3 glibc-common glibc-all-langpacks xorg-x11-fonts-75dpi \
51+
java-17-openjdk-headless maven ncurses jq krb5-libs libicu openssl-libs compat-openssl11 zlib \
52+
nodejs graphviz graphviz-gd graphviz-python3 glibc-common glibc-all-langpacks xorg-x11-fonts-75dpi \
5953
&& alternatives --install /usr/bin/python3 python /usr/bin/python3.11 1 \
6054
&& python3 --version \
6155
&& python3 -m pip install --upgrade pip \
6256
&& curl -LO https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox-0.12.6.1-2.almalinux9.${ARCH_NAME}.rpm \
6357
&& rpm -ivh wkhtmltox-0.12.6.1-2.almalinux9.${ARCH_NAME}.rpm \
6458
&& rm wkhtmltox-0.12.6.1-2.almalinux9.${ARCH_NAME}.rpm \
65-
&& curl -LO "https://dl.google.com/go/go${GO_VERSION}.linux-${OS_ARCH_SUFFIX}.tar.gz" \
66-
&& tar -C /usr/local -xzf go${GO_VERSION}.linux-${OS_ARCH_SUFFIX}.tar.gz \
67-
&& rm go${GO_VERSION}.linux-${OS_ARCH_SUFFIX}.tar.gz \
68-
&& go install github.com/magefile/mage@latest \
69-
&& curl -LO https://github.com/appthreat/joern/releases/latest/download/joern-install.sh \
70-
&& chmod +x ./joern-install.sh \
71-
&& ./joern-install.sh --without-plugins \
59+
&& curl -LO https://github.com/appthreat/cpggen/releases/latest/download/joern-cli.zip \
60+
&& unzip -q joern-cli.zip -d /opt/ \
61+
&& rm joern-cli.zip \
7262
&& curl -LO "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \
7363
&& unzip -q gradle-${GRADLE_VERSION}-bin.zip -d /opt/ \
7464
&& chmod +x /opt/gradle-${GRADLE_VERSION}/bin/gradle \
@@ -94,7 +84,6 @@ RUN set -e; \
9484
&& python3 -m pip install --no-cache-dir poetry \
9585
&& poetry config virtualenvs.create false \
9686
&& cd /usr/local/src/ && poetry install --no-cache --without dev \
97-
&& rm /joern-cli.zip /joern-install.sh \
9887
&& rm -rf /var/cache/yum \
9988
&& microdnf clean all
10089

ci/Dockerfile-alma8

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ LABEL maintainer="appthreat" \
44
org.opencontainers.image.authors="Team AppThreat <cloud@appthreat.com>" \
55
org.opencontainers.image.source="https://github.com/appthreat/cpggen" \
66
org.opencontainers.image.url="https://github.com/appthreat/cpggen" \
7-
org.opencontainers.image.version="1.5.2" \
7+
org.opencontainers.image.version="1.6.0" \
88
org.opencontainers.image.vendor="AppThreat" \
99
org.opencontainers.image.licenses="Apache-2.0" \
1010
org.opencontainers.image.title="cpggen" \
@@ -13,45 +13,36 @@ LABEL maintainer="appthreat" \
1313

1414
ARG TARGETPLATFORM
1515

16-
ENV JOERN_HOME=/usr/local/bin \
16+
ENV JOERN_HOME=/opt/joern-cli \
1717
LC_ALL=en_US.UTF-8 \
1818
LANG=en_US.UTF-8 \
1919
LANGUAGE=en_US.UTF-8 \
20-
GOROOT=/usr/local/go \
21-
GO_VERSION=1.19.9 \
2220
SBT_VERSION=1.9.0 \
2321
GRADLE_VERSION=8.1.1 \
2422
GRADLE_HOME=/opt/gradle-8.1.1 \
2523
GRADLE_OPTS="-Dorg.gradle.daemon=false" \
2624
JAVA_HOME="/etc/alternatives/jre_17" \
2725
JAVA_17_HOME="/etc/alternatives/jre_17" \
2826
JAVA_8_HOME="/usr/lib/jvm/jre-1.8.0" \
29-
CGO_ENABLED=1 \
30-
GO111MODULE="" \
31-
GOOS="linux" \
3227
PYTHONUNBUFFERED=1 \
3328
PYTHONIOENCODING="utf-8" \
3429
DOTNET_CLI_TELEMETRY_OPTOUT=1 \
3530
JOERN_DATAFLOW_TRACKED_WIDTH=128 \
36-
PATH=${PATH}:/opt/joern/joern-cli:/opt/joern/joern-cli/bin:/usr/local/go/bin:/usr/local/bin:/root/.local/bin:/opt/sbt/bin:/usr/local/go/pkg/tool/linux_amd64:${JAVA_HOME}/bin:
31+
PATH=${PATH}:/opt/joern-cli:/opt/joern-cli/bin:/usr/local/bin:/root/.local/bin:/opt/sbt/bin:${JAVA_HOME}/bin:
3732

3833
COPY . /usr/local/src/
3934

4035
RUN echo -e "[nodejs]\nname=nodejs\nstream=18\nprofiles=\nstate=enabled\n" > /etc/dnf/modules.d/nodejs.module \
4136
&& microdnf module enable maven php -y \
4237
&& microdnf install -y gcc gcc-c++ libstdc++-devel git-core php php-cli python38 python38-devel pcre2 which tar zip unzip sudo \
4338
java-17-openjdk-headless java-1.8.0-openjdk-headless maven ncurses jq krb5-libs libicu openssl-libs compat-openssl10 zlib \
44-
dotnet-sdk-7.0 dotnet-targeting-pack-7.0 dotnet-templates-7.0 dotnet-hostfxr-7.0 nodejs graphviz glibc-common glibc-all-langpacks xorg-x11-fonts-75dpi \
39+
nodejs graphviz glibc-common glibc-all-langpacks xorg-x11-fonts-75dpi \
4540
&& curl -LO https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox-0.12.6.1-2.almalinux8.x86_64.rpm \
4641
&& if [ "$TARGETPLATFORM" = "linux/amd64" ]; then rpm -ivh wkhtmltox-0.12.6.1-2.almalinux8.x86_64.rpm; fi \
4742
&& rm wkhtmltox-0.12.6.1-2.almalinux8.x86_64.rpm \
48-
&& curl -LO "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz" \
49-
&& tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz \
50-
&& rm go${GO_VERSION}.linux-amd64.tar.gz \
51-
&& go install github.com/magefile/mage@latest \
52-
&& curl -LO https://github.com/appthreat/joern/releases/latest/download/joern-install.sh \
53-
&& chmod +x ./joern-install.sh \
54-
&& ./joern-install.sh --without-plugins \
43+
&& curl -LO https://github.com/appthreat/cpggen/releases/latest/download/joern-cli.zip \
44+
&& unzip -q joern-cli.zip -d /opt/ \
45+
&& rm joern-cli.zip \
5546
&& curl -LO "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \
5647
&& unzip -q gradle-${GRADLE_VERSION}-bin.zip -d /opt/ \
5748
&& chmod +x /opt/gradle-${GRADLE_VERSION}/bin/gradle \
@@ -68,7 +59,6 @@ RUN echo -e "[nodejs]\nname=nodejs\nstream=18\nprofiles=\nstate=enabled\n" > /et
6859
&& python3 -m pip install --no-cache-dir poetry==1.3.2 \
6960
&& poetry config virtualenvs.create false \
7061
&& cd /usr/local/src/ && poetry install --no-cache --without dev \
71-
&& rm /joern-cli.zip /joern-install.sh \
7262
&& rm -rf /var/cache/yum \
7363
&& microdnf clean all
7464

ci/Dockerfile-atom

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ LABEL maintainer="appthreat" \
44
org.opencontainers.image.authors="Team AppThreat <cloud@appthreat.com>" \
55
org.opencontainers.image.source="https://github.com/appthreat/cpggen" \
66
org.opencontainers.image.url="https://github.com/appthreat/cpggen" \
7-
org.opencontainers.image.version="1.5.2" \
7+
org.opencontainers.image.version="1.6.0" \
88
org.opencontainers.image.vendor="AppThreat" \
99
org.opencontainers.image.licenses="Apache-2.0" \
1010
org.opencontainers.image.title="cpggen" \

0 commit comments

Comments
 (0)