Pin all GitHub Actions to SHA hashes & modernize Trivy SARIF output#39
Draft
Pin all GitHub Actions to SHA hashes & modernize Trivy SARIF output#39
Conversation
…plate Co-authored-by: beevelop <6891349+beevelop@users.noreply.github.com> Agent-Logs-Url: https://github.com/beevelop/docker-java/sessions/be8812a6-b645-4ed8-8bd3-7bad66963436
Copilot
AI
changed the title
[WIP] Update Docker workflow for security and modern standards
Pin all GitHub Actions to SHA hashes & modernize Trivy SARIF output
Mar 25, 2026
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.
Mutable tag references in workflow
uses:directives are a supply chain attack vector — demonstrated by the Trivy Action March 2026 compromise where tags were force-pushed to malicious commits. All actions are now pinned to immutable commit SHAs.Changes
SHA-pin all actions — every
uses:line now references a full 40-char commit SHA with a# vX.Y.Zcomment for readability:Replace deprecated Trivy SARIF template — migrates from the legacy
format: "template"+template: "@/contrib/sarif.tpl"pattern toformat: 'sarif'(direct native support)Add severity filter — scopes Trivy scan to
CRITICAL,HIGHto reduce noiseWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/actions/cache/git/ref/tags/v5/usr/bin/curl curl -s REDACTED(http block)https://api.github.com/repos/github/codeql-action/git/ref/tags/v4/usr/bin/curl curl -s REDACTED(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Problem
The
.github/workflows/docker.ymlworkflow uses mutable tag references for GitHub Actions, which is a supply chain attack vector. This is especially critical given the Trivy Action supply chain compromise in March 2026 where nearly all tags were force-pushed to malicious commits.Additionally, the Trivy action uses the deprecated
format: "template"+template: "@/contrib/sarif.tpl"pattern instead of the modernformat: 'sarif'.Required Changes
Update
.github/workflows/docker.ymlto:format: 'sarif'approach.severity: 'CRITICAL,HIGH').Current action references to update:
actions/checkout@v6→ pin to SHA hash (# v6.0.2)crazy-max/ghaction-docker-meta@v6→ pin to SHA hash (# v6.0.0)docker/setup-qemu-action@v4→ pin to SHA hash (# v4.0.0)docker/setup-buildx-action@v4→ pin to SHA hash (# v4.0.0)docker/login-action@v4→ pin to SHA hash (# v4.0.0)actions/cache@v5→ pin to SHA hash (# v5)docker/build-push-action@v7→ pin to SHA hash (# v7.0.0)aquasecurity/trivy-action@0.35.0→ pin to SHA57a97c7e41536f44adcf59faf14cd94554d91eb0(# v0.35.0)github/codeql-action/upload-sarif@v4→ pin to SHA hash (# v4)Trivy step changes:
Replace:
With:
For every
uses:line, look up the full 40-character commit SHA for the tag version and use that. Add a comment with the human-readable tag after the SHA, e.g.uses: actions/checkout@<full-sha> # v6.0.2.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: where do i use trivy actions in my github pipelines. give me a full overview
Assistant: Here's a full overview of all the places you use
aquasecurity/trivy-actionacross your GitHub pipelines. I found 9 repositories using it, organized into 3 distinct usage patterns:Summary Table
beevelop/docker-javadocker.yml@0.35.0beevelop/docker-cuberitedocker.yml@masterbeevelop/docker-nodejs-pythondocker.yml@masterbeevelop/docker-uniqushdocker.yml@masterbeevelop/docker-varnishdocker.yml@masterbeevelop/docker-nodejsdocker.yml@masterbeevelop/docker-hedgewarsdocker.yml@masterbeevelop/semiatrixbuild-studio-image.yml@masterCRITICAL,HIGH(SARIF) /CRITICAL,HIGH,MEDIUM(table)beevelop/BeeComposeci-cd.yml@masterCRITICAL,HIGH,MEDIUM,LOWPattern 1: Docker Image Repos (Legacy Template) — 7 repos
Used in: docker-java, docker-cuberite, docker-nodejs-python, docker-uniqush, docker-varnish, docker-nodejs, docker-hedgewars
These all follow the same pattern — Trivy runs after
docker/build-push-action, scans the built image, outputs SARIF using the legacy template approach, and uploads to the GitHub Security tab:This pull request was created from Copilot chat.
⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.