Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat][ci] Add Trivy container scan Github workflow #22063

Merged

Conversation

onobc
Copy link
Contributor

@onobc onobc commented Feb 16, 2024

This commit introduces a Github Actions workflow that runs a Trivy container scan on the following Docker containers:

  • apachepulsar/pulsar:3.2.0
  • apachepulsar/pulsar-all:3.2.0

The workflow runs daily @ 0800 UTC and if it finds any vulnerabilities of HIGH or CRITICAL severity it sends an email including the report to the Pulsar DEV mailing list as well as upload the report to the workflow run in Github.

Motivation

Our dependencies are currently scanned via the OWASP dependency checker but we have nothing checking on the vulnerability of our published Docker containers.

Modifications

As described in the summary, this adds a scheduled workflow that uses Trivy to run a scan against our published Docker containers.

Verifying this change

As always, Github Actions workflow are a pain to test. I have tested this one in isolation in prototype repository and it works well. We will not be able to verify it until it gets merged into mainline branch.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: onobc#4

I tested this thoroughly in a personal repo before submitting this PR. Here is what the output looks like:

Github Actions UI

Screenshot 2024-02-16 at 15 46 06

Generated email

Screenshot 2024-02-16 at 15 50 03

Attached email report

Note

This is the report in table format, we could instead use json

Screenshot 2024-02-16 at 15 50 29

This commit introduces a Github Actions workflow that runs a Trivy
container scan on the following Docker containers:

- apachepulsar/pulsar:3.2.0
- apachepulsar/pulsar-all:3.2.0

The workflow runs daily @ 0800 UTC and if it finds any vulnerabilities
of HIGH or CRITICAL severity it sends an email including the report
to the Pulsar DEV mailing list as well as upload the report to the
workflow run in Github.
@onobc onobc added type/feature The PR added a new feature or issue requested a new feature area/ci labels Feb 16, 2024
@onobc onobc requested a review from lhotari February 16, 2024 21:38
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Feb 16, 2024
@onobc onobc requested a review from merlimat February 16, 2024 21:40
Copy link
Contributor

@merlimat merlimat left a comment

Choose a reason for hiding this comment

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

Thanks for starting this!

.github/workflows/ci-trivy-container-scan.yaml Outdated Show resolved Hide resolved
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

Please remove the "Email Trivy container scan report" step so that we can merge this. We can add emailing later if we find out a way to do that.

- removed email
- removed choice of report format
- removed upload report step
@onobc
Copy link
Contributor Author

onobc commented Mar 28, 2024

The workflow has been simplified - PTAL @merlimat @lhotari

@merlimat merlimat merged commit 8fc30df into apache:master Mar 28, 2024
51 checks passed
Technoboy- pushed a commit to Technoboy-/pulsar that referenced this pull request Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci doc-not-needed Your PR changes do not impact docs ready-to-test type/feature The PR added a new feature or issue requested a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants