Skip to content

ci: scan images with docker scout#5184

Merged
crazy-max merged 1 commit into
moby:masterfrom
crazy-max:scout-scan
Aug 6, 2024
Merged

ci: scan images with docker scout#5184
crazy-max merged 1 commit into
moby:masterfrom
crazy-max:scout-scan

Conversation

@crazy-max
Copy link
Copy Markdown
Member

@crazy-max crazy-max commented Jul 23, 2024

Adds an extra job for buildkit and frontend workflows to scan images with Docker Scout to report vulnerabilities.

Runs scout cves command and output a SARIF report that will be uploaded to GitHub Code scanning so we have these issues reported in the Security tab.

Example can be seen here for moby/buildkit:master: https://github.com/crazy-max/.github/security/code-scanning

image

Comment thread .github/workflows/buildkit.yml Outdated

scout:
runs-on: ubuntu-24.04
if: ${{ github.ref == 'refs/heads/master' }}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

we only want to scan when merged on default branch

Copy link
Copy Markdown
Collaborator

@thompson-shaun thompson-shaun Jul 23, 2024

Choose a reason for hiding this comment

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

Do we need to cover maintenance branches as well (e.g., v0.16)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes as follow-up if possible. I need to check how GitHub code scanning handles multiple refs within Security tab.

Copy link
Copy Markdown
Member Author

@crazy-max crazy-max Jul 25, 2024

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@thompson-shaun Seems affected branches are correctly reported in security tab:

image

So I guess we could scan for release branches as follow-up.

Comment on lines +202 to +212
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Scout
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I would have liked to run scout on PR but docker login is required by the tool.

Comment thread .github/workflows/buildkit.yml Outdated
-
name: Scout
id: scout
uses: crazy-max/.github/.github/actions/docker-scout@7ea918c968b43fbee013e94ef2dde3e76af5f5a1
Copy link
Copy Markdown
Member Author

@crazy-max crazy-max Jul 23, 2024

Choose a reason for hiding this comment

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

We are not using the official https://github.com/docker/scout-action for now as it takes at least one minute to fetch it because of the repo size: 5.7GB! https://api.github.com/repos/docker/scout-action (size: 5790458)

Binaries for each supported arch are in the working tree: https://github.com/docker/scout-action/tree/main/dist. Around 64MB each so ~384MB to be fetched for each run.

So for now I've created a composite action that downloads scout from https://hub.docker.com/r/docker/scout-cli for current platform. More info: https://github.com/crazy-max/.github/blob/main/.github/actions/docker-scout/action.yml

Comment thread .github/workflows/frontend.yml Outdated
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max crazy-max merged commit a3999ae into moby:master Aug 6, 2024
@crazy-max crazy-max deleted the scout-scan branch August 6, 2024 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants