Skip to content

Add trivy vulnerability scanning to GHA#5683

Merged
sipsma merged 4 commits into
dagger:mainfrom
sipsma:update-go-x-net
Aug 24, 2023
Merged

Add trivy vulnerability scanning to GHA#5683
sipsma merged 4 commits into
dagger:mainfrom
sipsma:update-go-x-net

Conversation

@sipsma
Copy link
Copy Markdown
Contributor

@sipsma sipsma commented Aug 23, 2023

Adds trivy scanning of our engine image to GHA workflows:

  1. In PRs, a new job will build the dev engine and scan it from ./bin/engine.tar
  2. When pushing to main, a new job will run after the dev image is published to our registry and scan the image we just published.

Currently, the job only scans for CRITICAL and HIGH vulnerabilities, cc @samalba @jpadams easy to change if we care about lower severities; after the fix earlier today trivy no longer reports any vulnerabilities at any level so we could safely scan for all severities if it's important to us.

Obviously though there's a balance to be made between scanning for all severities and not forcing devs to spend time hunting down random dependencies that have vulnerabilities below HIGH (which can become extremely non-trivial if it's a many layers deep transitive dep that we can't just fix by upgrading our go.mod).


I earlier tried docker scout, but backed out because:

  1. It requires we sign into dockerhub (even if not scanning an image there)
  2. It's early-access and described as "free for now"
  3. Related to above, when I tried to run it locally on MacOS it crashed with a out of bounds panic, so seems to be still in an early rough state (it did work on Linux for me FWIW).

If there's strong reasons to prefer it, then we can obviously add some dockerhub credentials to our GHA jobs and take the risk it might cost us money in the future, but didn't seem like the right starting place at this exact moment.


I verified the PR GHA job works by temporarily reverting my earlier fix, it failed as expected: https://github.com/dagger/dagger/actions/runs/5957590220/job/16160498504?pr=5683

@sipsma sipsma changed the title Add docker scout scanning to GHA Add trivy vulnerability scanning to GHA Aug 23, 2023
@sipsma sipsma force-pushed the update-go-x-net branch 3 times, most recently from 1ae9b65 to 5ec65fc Compare August 23, 2023 23:46
@sipsma sipsma requested review from gerhard, jpadams, samalba and vito and removed request for vito August 23, 2023 23:58
@sipsma sipsma marked this pull request as ready for review August 23, 2023 23:59
@sipsma
Copy link
Copy Markdown
Contributor Author

sipsma commented Aug 23, 2023

Failing jobs are once again the dagger runners, not related to this PR

Copy link
Copy Markdown
Contributor

@jpadams jpadams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great improvement.
I did the local version of this with

git clone https://github.com/dagger/dagger
cd dagger
gh pr checkout 5683
./hack/dev
trivy image --input ./bin/engine.tar
Total: 0 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 0)

Will be great to get this into a Zenith check in the near future! 🚀

sipsma added 3 commits August 24, 2023 07:51
Signed-off-by: Erik Sipsma <erik@dagger.io>
Signed-off-by: Erik Sipsma <erik@dagger.io>
Signed-off-by: Erik Sipsma <erik@dagger.io>
Signed-off-by: Erik Sipsma <erik@dagger.io>
@sipsma sipsma merged commit bc15f22 into dagger:main Aug 24, 2023
kpenfound pushed a commit to kpenfound/dagger that referenced this pull request Aug 24, 2023
* engine: upgrade golang.org/x/net

Signed-off-by: Erik Sipsma <erik@dagger.io>

* Add trivy vulnerability scanning to GHA workflows.

Signed-off-by: Erik Sipsma <erik@dagger.io>

* use more readable format for gha trivy output

Signed-off-by: Erik Sipsma <erik@dagger.io>

* add guidance on addressing vulnerabilities to CONTRIBUTING.md

Signed-off-by: Erik Sipsma <erik@dagger.io>

---------

Signed-off-by: Erik Sipsma <erik@dagger.io>
Signed-off-by: kpenfound <kyle@dagger.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants