Skip to content

Commit

Permalink
Scan Docker images with Snyk container monitor in ci.yml (close #1191)
Browse files Browse the repository at this point in the history
Whenever we release RDB loader, we run a Snyk scan to check for security vulnerabilites.

Previously, we had a separate Github action for this, `snyk.yml` which just ran `snyk monitor` and
did not scan the docker images.

We are moving over to using `snyk container monitor` because we want to
- be able to keep track of vulnerabilities in the docker images we create on release without manually
adding them in the Snyk UI
- continue scanning our java/scala jar files

Note that even though we are already creating docker images in `ci.yml`, they are pushed to the remote
registry only, and that is why here we additionally add a step to create local Docker images for the
Snyk scan.
  • Loading branch information
lmath committed Feb 17, 2023
1 parent b9035a5 commit 0998f5b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 21 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ jobs:
platforms: linux/amd64,linux/arm64/v8
tags: ${{ steps.distroless-meta.outputs.tags }}
push: true
- name: Build local distroless image, which is needed to run Snyk
if: ${{ !contains(github.ref_name, 'rc') }}
run: sbt "project ${{ matrix.app }}Distroless" docker:publishLocal
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/docker@master
if: ${{ !contains(github.ref_name, 'rc') }}
with:
image: "${{ steps.packageName.outputs.package_name }}:${{ github.ref_name }}-distroless"
args: "--app-vulns --org=data-processing-new"
command: monitor
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

create_release:
needs: test
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/snyk.yml

This file was deleted.

1 change: 0 additions & 1 deletion project/BuildSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ object BuildSettings {
dockerBaseImage := "gcr.io/distroless/java11-debian11:nonroot",
Docker / daemonUser := "nonroot",
Docker / daemonGroup := "nonroot",
dockerRepository := Some("snowplow"),
Docker / daemonUserUid := None,
Docker / defaultLinuxInstallLocation := "/home/snowplow",
dockerEntrypoint := Seq("java", "-jar",s"/home/snowplow/lib/${(packageJavaLauncherJar / artifactPath).value.getName}"),
Expand Down

0 comments on commit 0998f5b

Please sign in to comment.