ci: add Hadolint and Trivy security scanning workflows - #2711
Merged
Conversation
- Hadolint: PR-time Dockerfile linting - Trivy (PR/push): filesystem scan for go.mod/yarn.lock CVEs - Trivy (push-image): scan built Docker images before pushing to registry - .hadolint.yaml: temporarily ignore DL3008/DL3018/DL4006 for gradual adoption Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds Dockerfile linting and vulnerability scanning to the repo’s GitHub Actions CI to improve supply-chain and container security visibility during PRs and before publishing images.
Changes:
- Add Hadolint PR workflow triggered by Dockerfile /
.hadolint.yamlchanges. - Add Trivy filesystem vulnerability scan workflow triggered by dependency-lockfile changes (PR + main push).
- Add Trivy image scanning step to
push-imageprior to pushing images (report-only for now).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.hadolint.yaml |
Defines initial ignored Hadolint rules for gradual adoption. |
.github/workflows/push-image.yaml |
Installs Trivy and scans built images before pushing to registries. |
.github/workflows/pr-trivy.yaml |
Adds PR/main push Trivy filesystem vulnerability scan for dependency file changes. |
.github/workflows/pr-hadolint.yaml |
Adds PR Hadolint workflow for Dockerfiles. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove pr-trivy.yaml (filesystem scan redundant with Dependabot) - Revert push-image.yaml to original (no per-push image scan) - Add trivy-scheduled.yaml scanning GHCR images weekly for OS-level CVEs that Dependabot cannot detect (e.g., base image vulnerabilities) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Trivy weekly image scan is redundant if Dependabot docker ecosystem is configured (follow-up). Keep Trivy only at PR time to catch newly added vulnerable dependencies before Dependabot picks them up. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Add two CI workflows for Docker security:
**/Dockerfile*or.hadolint.yaml**/go.mod,**/yarn.lock), catching newly added vulnerable packages before Dependabot's monthly cycleBackground
No Dockerfile linting exists in CI. Dependabot covers ongoing dependency updates (gomod, npm) but cannot catch a newly introduced vulnerable dependency at PR time.
Points
failure-threshold: error-- warnings are reported but do not block merge. Existing violations (DL3008/DL3018/DL4006) are ignored via.hadolint.yamlfor gradual adoptionTODO (follow-up)