Skip to content

Commit

Permalink
feat(security-actions/scan-docker-image): bump trivy 0.57.1 to use up…
Browse files Browse the repository at this point in the history
…dated mirror for `trivy-db` and `trivy-java-db`

feat(security-actions/scan-docker-image): use existing token input with default
  • Loading branch information
saisatishkarra committed Nov 26, 2024
1 parent b9ee13a commit 675f88f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/docker-image-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ jobs:
asset_prefix: kong-gateway-dev-linux-amd64
image: ${{env.IMAGE}}@${{ steps.image_manifest_metadata.outputs.amd64_sha }}
skip_cis_scan: false
trivy_db_cache: kong/trivy-db-mirror@main


- name: Scan ARM64 Image digest
if: steps.image_manifest_metadata.outputs.manifest_list_exists == 'true' && steps.image_manifest_metadata.outputs.arm64_sha != ''
Expand All @@ -75,6 +77,7 @@ jobs:
upload-sbom-release-assets: true
skip_cis_scan: false


test-download-sbom:
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
name: Download SBOM
Expand Down
15 changes: 10 additions & 5 deletions security-actions/scan-docker-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ inputs:
trivy_db_cache:
description: 'GitHub repository containing Trivy DB cache (format: owner/repo@ref). Database should be named `db.tar.gz` on the default branch.'
required: false
trivy_db_cache_token:
description: 'Token for accessing `trivy_db_cache`.'
required: false
# trivy_db_cache_token:
# description: 'Token for accessing `trivy_db_cache`.'
# required: false

outputs:
cis-json-report:
Expand Down Expand Up @@ -318,10 +318,13 @@ runs:
echo "repository=${REPO}" >> $GITHUB_OUTPUT
echo "ref=${REF}" >> $GITHUB_OUTPUT
# Issue: https://github.com/aquasecurity/trivy/issues/7938
# Discussion: https://github.com/aquasecurity/trivy/discussions/7668
# Fix: Refer https://github.com/aquasecurity/trivy/discussions/7951 usign mirror.gcr.io
- name: Install Trivy
shell: bash
run: |
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.55.2
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.57.1
- name: Checkout Trivy DB cache
if: inputs.trivy_db_cache != ''
Expand All @@ -330,7 +333,7 @@ runs:
repository: ${{ steps.parse_cache.outputs.repository }}
ref: ${{ steps.parse_cache.outputs.ref }}
path: trivy-db-cache
token: ${{ inputs.trivy_db_cache_token }}
token: ${{ inputs.github-token }}

- name: Setup Trivy DB from cache
if: inputs.trivy_db_cache != ''
Expand All @@ -345,6 +348,8 @@ runs:
cd ..
rm -rf trivy-db-cache
# Issue: https://github.com/aquasecurity/trivy/issues/7938
# Fix: Refer https://github.com/aquasecurity/trivy/discussions/7951 usign mirror.gcr.io
- name: Generate docker-cis JSON report
if: ${{ inputs.skip_cis_scan != 'true' && steps.meta.outputs.scan_image != '' }}
id: cis_json
Expand Down

0 comments on commit 675f88f

Please sign in to comment.