ci: scan app and web images with Trivy - #55
tomatotomata wants to merge 3 commits into
Conversation
Signed-off-by: ahmad <ahmadalgaidy@hotmail.com>
c91c07c to
628f603
Compare
|
The local validation is now complete on |
|
One note about the PR workflow here. While the PR is marked as draft, we understand that the implementation is still in progress. When it is ready for code review, please mark it as Ready for review. I reviewed this one early because it is your first contribution here and I wanted to give some direction before you continue. After addressing review comments and pushing the changes, please re-request the review so we know it is ready for another pass. |
Signed-off-by: ahmad <ahmadalgaidy@hotmail.com>
Signed-off-by: ahmad <ahmadalgaidy@hotmail.com>
|
The verification and publish jobs are split now, and both amd64 and arm64 must pass the Trivy gate before publishing either image. The local checks passed on 6347691; the app scan still finds the existing fixed gzip CVE, while the web image is clean. I marked the PR ready. GitHub would not let me re-request your review from my account, and the workflow still shows action_required, so the hosted image build and scans have not run yet. I kept the package update out of scope for now, but let me know if you want that handled here. |
|
Thanks. The two review points look addressed now. For the We need to fix that vulnerability before merging this PR, otherwise the new publish gate will immediately block the image workflow. I will first approve the workflow run so we can validate the new CI flow. |
| ## Scan runtime images | ||
|
|
||
| The image workflow scans the `app` and `web` images it builds. To run the same | ||
| vulnerability policy locally, install Docker with Buildx, GNU Make, Bash, and | ||
| Trivy `v0.74.0`, then run: | ||
|
|
||
| ```bash | ||
| make scan-images | ||
| ``` | ||
|
|
||
| This builds the app and web Dockerfiles for both `linux/amd64` and `linux/arm64`, | ||
| using the `NEXTCLOUD_VERSION` from `.env.example`, then applies the shared policy | ||
| in [`trivy.yaml`](trivy.yaml) to each architecture. The table reports are printed | ||
| to the terminal and separate SARIF reports for each image and architecture are | ||
| written to `trivy-results/`. High and critical vulnerabilities fail the command | ||
| only when a fix is available. An end-of-life base OS also fails. | ||
|
|
||
| The local arm64 builds require QEMU/binfmt support on non-arm64 hosts. The GitHub | ||
| workflow sets up QEMU before building both architectures. | ||
|
|
There was a problem hiding this comment.
I think this is too much implementation detail for the README.
The README should stay focused on what this project provides and how to use it. Details about Trivy, SARIF, the severity policy, architectures and QEMU are internal details of the CI implementation and can make the README grow every time we change the tooling.
I think it is enough to briefly say that the published images are scanned for vulnerabilities and keep the local command for contributors:
make scan-imagesThe scan policy itself is already documented by trivy.yaml and the implementation.
Summary
appandweb) with Trivy using one shared policy: HIGH and CRITICAL vulnerabilities fail when a fix is available, and end-of-life base OS versions fail.linux/amd64images locally in CI, then run the same scan script and save SARIF reports; pushes upload available SARIF reports to code scanning.make scan-imagesand document the local equivalent.Validation
actionlint .github/workflows/docker-image.ymlpassed.bash -n scripts/scan-images.shpassed.make -n scan-imagespassed.git diff --checkpassed.v0.74.0scanned a remote Alpine image under both labels, produced valid SARIF for each, and returned failure for its HIGH vulnerability with an available fix, as configured.Local limitation
Docker Desktop's Linux engine is not available in this WSL environment, so I could not build this repository's app and web images locally. The PR workflow builds and scans those actual images. I left this as a draft until that CI run completes.