From fb4274bd5ccdfc1cabfa277e7c51832a7382d6c2 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Tue, 10 Nov 2026 18:14:16 +0100 Subject: [PATCH] ci(security): install the latest Trivy release dynamically --- .github/workflows/security.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 67ef3ab..cb35fe2 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -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}"