chore(ci): install the latest Trivy release dynamically
Security / Secrets (gitleaks) (push) Successful in 1m5s
Security / Dependencies (Trivy) (push) Successful in 1m21s
Security / Code (Semgrep) (push) Successful in 1m48s
Docker / Docker Build & Push (push) Successful in 4m27s

This commit is contained in:
Gabriel20xx committed 2026-11-10 18:11:05 +01:00
1 parent 833eab04af
commit 5d9e3063c5
2 files changed
+20 -6

No files matched your search

+10 -3
View File
@@ -58,8 +58,6 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
env:
TRIVY_VERSION: '0.76.1'
steps:
- name: Checkout code
uses: actions/checkout@v7
@@ -76,11 +74,20 @@ jobs:
- name: Install uv
run: pip install uv==0.13.5
- name: Install Trivy
# Downloaded from the release and checked against its published checksums. The
# Always the newest Trivy release. The version is read from the release redirect when the job
# runs, and the download is checked against that release's published checksums. The
# aquasecurity/trivy-action version tags were repointed to malicious commits in March 2026,
# so that action is not used.
shell: bash
run: |
latest_url=$(curl --fail --location --silent --show-error --retry 5 --retry-delay 2 \
--output /dev/null --write-out '%{url_effective}' https://github.com/aquasecurity/trivy/releases/latest)
TRIVY_VERSION=${latest_url##*/tag/v}
if [[ ! "$TRIVY_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Could not read the latest Trivy version from $latest_url" >&2
exit 1
fi
echo "Installing Trivy $TRIVY_VERSION"
archive="trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
base_url="https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}"