ci(security): install the latest Trivy release dynamically
This commit is contained in:
1 parent
74942e55f9
commit
fb4274bd5c
1 file changed
+10
-3
@@ -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}"
|
||||
|
||||
|
||||
Reference in new issue
Block a user