Skip to content

ci: the weekly security sweep never scanned the container image - #44

Merged
0xmanhnv merged 1 commit into
mainfrom
ci/weekly-image-scan
Jul 30, 2026
Merged

ci: the weekly security sweep never scanned the container image#44
0xmanhnv merged 1 commit into
mainfrom
ci/weekly-image-scan

Conversation

@0xmanhnv

@0xmanhnv 0xmanhnv commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

The bug

docker-scan in .github/workflows/security.yml was gated on:

if: github.event_name == 'push' && github.ref == 'refs/heads/main'

The schedule event is not push, so the Monday cron skipped it — built no
image, scanned no image, and reported green anyway.

Verified rather than reasoned. The latest scheduled Security run:

Trivy Vulnerability Scanner: success
Docker Image Scan:           skipped     <--

The weekly cron exists to catch vulnerabilities disclosed since the last commit.
Base-image CVEs are exactly that class — they appear with no code change at
all. Excluding the image scan from the cron removed the only coverage they had.

All three repos with this job (api, ui, agent) carry the identical gate and all
three behave the same way. Companion PRs: api#380, plus one each for the
others.

The fix

if: github.event_name == 'schedule' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
Trigger Before After
weekly cron skipped runs
push to main runs runs
push to develop skipped skipped
pull request skipped skipped

Pull requests stay excluded deliberately — building the image on every PR costs
minutes, and the filesystem Trivy scan already covers dependencies a PR
introduces.

Known limit, stated rather than glossed

A schedule event always checks out the default branch, so the weekly image scan
covers that branch only. Extending it needs an explicit second checkout with an
Explicit ref:, which is a separate change.

Verification

.github/workflows/security.yml parses as valid YAML; the new condition and the
workflow triggers were read back from the parsed document rather than eyeballed,
and the diff is confined to the comment block and the one if: line.

docker-scan was gated on `github.event_name == 'push'`, which excludes the
`schedule` event. So the Monday cron — the one run whose whole purpose is to catch
CVEs disclosed since the last commit — built no image and scanned no image, and
still reported the run green.

Verified rather than reasoned: the latest scheduled run reports
"Docker Image Scan: skipped" while Trivy FS, CodeQL and License Compliance all
ran. api and agent carry the identical gate and behave the same way.

A base-image CVE is precisely the class that appears with no code change, so
excluding the image scan from the cron removed the only coverage that class had.

Pull requests stay excluded on purpose: building the image on every PR costs
minutes, and the filesystem Trivy scan already covers dependencies a PR
introduces.

Note the cron necessarily checks out the default branch, so the weekly image scan
covers that branch only. Extending it needs an explicit second checkout and is a
separate change.
@0xmanhnv
0xmanhnv merged commit 53c1f39 into main Jul 30, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant