Skip to content

ci: add Hadolint and Trivy security scanning workflows - #2711

Merged
t-kikuc merged 5 commits into
mainfrom
security-scanning
Aug 3, 2026
Merged

ci: add Hadolint and Trivy security scanning workflows#2711
t-kikuc merged 5 commits into
mainfrom
security-scanning

Conversation

@t-kikuc

@t-kikuc t-kikuc commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What this PR does

Add two CI workflows for Docker security:

  • pr-hadolint: lint Dockerfiles on PRs that modify **/Dockerfile* or .hadolint.yaml
  • pr-trivy: filesystem vulnerability scan on PRs when dependency files change (**/go.mod, **/yarn.lock), catching newly added vulnerable packages before Dependabot's monthly cycle

Background

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

  • Hadolint failure-threshold: error -- warnings are reported but do not block merge. Existing violations (DL3008/DL3018/DL4006) are ignored via .hadolint.yaml for gradual adoption
  • Trivy triggers only on dependency file changes -- minimal CI cost, no overlap with Dependabot's ongoing monitoring role
  • No scheduled/weekly scan or push-image integration -- Dependabot handles ongoing updates; a Dependabot docker ecosystem config should be added separately to cover base image updates

TODO (follow-up)

  • Add Dependabot docker ecosystem to keep base image versions updated
  • Enable Branch Protection and set Hadolint/Trivy as Required Status Checks

- 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>
Copilot AI review requested due to automatic review settings July 24, 2026 06:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.yaml changes.
  • Add Trivy filesystem vulnerability scan workflow triggered by dependency-lockfile changes (PR + main push).
  • Add Trivy image scanning step to push-image prior 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.

Comment thread .github/workflows/push-image.yaml Outdated
Comment thread .github/workflows/push-image.yaml Outdated
t-kikuc and others added 4 commits July 24, 2026 15:54
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>
@t-kikuc t-kikuc added the ci label Jul 24, 2026
@t-kikuc
t-kikuc marked this pull request as ready for review July 24, 2026 13:33
@t-kikuc
t-kikuc requested review from cre8ivejp and hvn2k1 as code owners July 24, 2026 13:33

@cre8ivejp cre8ivejp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice!

@t-kikuc
t-kikuc merged commit edccfb1 into main Aug 3, 2026
12 checks passed
@t-kikuc
t-kikuc deleted the security-scanning branch August 3, 2026 07:37
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