Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 82f7575aa1 |
@@ -1,12 +0,0 @@
|
|||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "github-actions"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "weekly"
|
|
||||||
cooldown:
|
|
||||||
default-days: 7
|
|
||||||
groups:
|
|
||||||
actions:
|
|
||||||
patterns:
|
|
||||||
- "*"
|
|
||||||
@@ -10,13 +10,13 @@ on:
|
|||||||
|
|
||||||
run-name: Bump trivy to v${{ inputs.trivy_version }}
|
run-name: Bump trivy to v${{ inputs.trivy_version }}
|
||||||
|
|
||||||
permissions: {}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
bump:
|
bump:
|
||||||
runs-on: ubuntu-2404-2core
|
runs-on: ubuntu-2404-2core
|
||||||
|
permissions:
|
||||||
|
contents: read # for actions/checkout
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Setup Bats and bats libs
|
- name: Setup Bats and bats libs
|
||||||
id: setup-bats
|
id: setup-bats
|
||||||
uses: bats-core/bats-action@77d6fb60505b4d0d1d73e48bd035b55074bbfb43 # 4.0.0
|
uses: bats-core/bats-action@42fcc8700f773c075a16a90eb11674c0318ad507 # 3.0.1
|
||||||
|
|
||||||
- name: Install Trivy
|
- name: Install Trivy
|
||||||
run: make ensure-trivy TRIVY_INSTALL_DIR=/usr/local/bin
|
run: make ensure-trivy TRIVY_INSTALL_DIR=/usr/local/bin
|
||||||
@@ -42,38 +42,26 @@ jobs:
|
|||||||
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }}
|
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }}
|
||||||
run: make test
|
run: make test
|
||||||
|
|
||||||
# Use a GitHub App token because GITHUB_TOKEN does not trigger CI on PRs created by workflows
|
# - name: Create PR
|
||||||
- name: Generate token
|
# env:
|
||||||
id: app-token
|
# GH_TOKEN: ${{ secrets.TRIVY_ACTION_DEPLOY_TOKEN }}
|
||||||
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
# TRIVY_VERSION: ${{ inputs.trivy_version }}
|
||||||
with:
|
# REPO: ${{ github.repository }}
|
||||||
client-id: ${{ secrets.REPO_TRIVY_ACTION_WRITE_GH_APP_CLIENT_ID }}
|
# BASE_BRANCH: ${{ github.event.repository.default_branch }}
|
||||||
private-key: ${{ secrets.REPO_TRIVY_ACTION_WRITE_GH_APP_PRIVATE_KEY }}
|
# run: |
|
||||||
owner: ${{ github.repository_owner }}
|
# gh auth setup-git
|
||||||
repositories: ${{ github.event.repository.name }}
|
# git config user.name "github-actions[bot]"
|
||||||
permission-contents: write
|
# git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
permission-pull-requests: write
|
# BRANCH="bump-trivy-${TRIVY_VERSION}"
|
||||||
|
# git checkout -b "${BRANCH}"
|
||||||
- name: Create PR
|
# git add action.yaml README.md test/
|
||||||
env:
|
# git commit -m "chore(deps): Update trivy to v${TRIVY_VERSION}"
|
||||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
# git push origin "${BRANCH}"
|
||||||
TRIVY_VERSION: ${{ inputs.trivy_version }}
|
# PR_RESPONSE=$(gh api repos/${REPO}/pulls \
|
||||||
REPO: ${{ github.repository }}
|
# --method POST \
|
||||||
BASE_BRANCH: ${{ github.event.repository.default_branch }}
|
# --field title="chore(deps): Update trivy to v${TRIVY_VERSION}" \
|
||||||
run: |
|
# --field body="This PR was automatically generated by the bump-trivy workflow." \
|
||||||
gh auth setup-git
|
# --field base="${BASE_BRANCH}" \
|
||||||
git config user.name "GitHub Actions"
|
# --field head="${BRANCH}")
|
||||||
git config user.email "actions@github.com"
|
# echo "Pull Request Number - $(echo "${PR_RESPONSE}" | jq -r '.number')"
|
||||||
BRANCH="bump-trivy-${TRIVY_VERSION}"
|
# echo "Pull Request URL - $(echo "${PR_RESPONSE}" | jq -r '.html_url')"
|
||||||
git checkout -b "${BRANCH}"
|
|
||||||
git add action.yaml README.md test/
|
|
||||||
git commit -m "chore(deps): Update trivy to v${TRIVY_VERSION}"
|
|
||||||
git push origin "${BRANCH}"
|
|
||||||
PR_RESPONSE=$(gh api repos/${REPO}/pulls \
|
|
||||||
--method POST \
|
|
||||||
--field title="chore(deps): Update trivy to v${TRIVY_VERSION}" \
|
|
||||||
--field body="This PR was automatically generated by the bump-trivy workflow." \
|
|
||||||
--field base="${BASE_BRANCH}" \
|
|
||||||
--field head="${BRANCH}")
|
|
||||||
echo "Pull Request Number - $(echo "${PR_RESPONSE}" | jq -r '.number')"
|
|
||||||
echo "Pull Request URL - $(echo "${PR_RESPONSE}" | jq -r '.html_url')"
|
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
name: Sync Trivy Checks
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: ${{ github.repository_owner }}/trivy-checks-act
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sync-trivy-checks:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: setup-oras
|
||||||
|
uses: oras-project/setup-oras@8d34698a59f5ffe24821f0b48ab62a3de8b64b20 # v1.2.3
|
||||||
|
|
||||||
|
- name: Login to GitHub Packages Container registry
|
||||||
|
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Copy Trivy Checks
|
||||||
|
run: |
|
||||||
|
oras cp ghcr.io/aquasecurity/trivy-checks:2 "${REGISTRY}/${IMAGE_NAME}:latest"
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
name: Sync Trivy DB
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: ${{ github.repository_owner }}/trivy-db-act
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sync-trivy-db:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: setup-oras
|
||||||
|
uses: oras-project/setup-oras@8d34698a59f5ffe24821f0b48ab62a3de8b64b20 # v1.2.3
|
||||||
|
|
||||||
|
- name: Login to GitHub Packages Container registry
|
||||||
|
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Copy Trivy DB
|
||||||
|
run: |
|
||||||
|
oras cp ghcr.io/aquasecurity/trivy-db:2 "${REGISTRY}/${IMAGE_NAME}:latest"
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
name: Sync Trivy Java DB
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: ${{ github.repository_owner }}/trivy-java-db-act
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sync-trivy-db:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: setup-oras
|
||||||
|
uses: oras-project/setup-oras@8d34698a59f5ffe24821f0b48ab62a3de8b64b20 # v1.2.3
|
||||||
|
|
||||||
|
- name: Login to GitHub Packages Container registry
|
||||||
|
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Copy Trivy Java DB
|
||||||
|
run: |
|
||||||
|
oras cp ghcr.io/aquasecurity/trivy-java-db:1 "${REGISTRY}/${IMAGE_NAME}:latest"
|
||||||
@@ -14,12 +14,12 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Run zizmor
|
- name: Run zizmor
|
||||||
uses: zizmorcore/zizmor-action@192e21d79ab29983730a13d1382995c2307fbcaa # v0.5.7
|
uses: zizmorcore/zizmor-action@0dce2577a4760a2749d8cfb7a84b7d5585ebcb7d # v0.5.0
|
||||||
with:
|
with:
|
||||||
advanced-security: false
|
advanced-security: false
|
||||||
|
|
||||||
@@ -28,13 +28,13 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Setup Bats and bats libs
|
- name: Setup Bats and bats libs
|
||||||
id: setup-bats
|
id: setup-bats
|
||||||
uses: bats-core/bats-action@77d6fb60505b4d0d1d73e48bd035b55074bbfb43 # 4.0.0
|
uses: bats-core/bats-action@42fcc8700f773c075a16a90eb11674c0318ad507 # 3.0.1
|
||||||
|
|
||||||
- name: Install Trivy
|
- name: Install Trivy
|
||||||
run: make ensure-trivy TRIVY_INSTALL_DIR=/usr/local/bin
|
run: make ensure-trivy TRIVY_INSTALL_DIR=/usr/local/bin
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ ACTION_FILE := action.yaml
|
|||||||
CURRENT_TRIVY_VERSION := $(shell yq '.inputs.version.default' $(ACTION_FILE) 2>/dev/null | tr -d 'v')
|
CURRENT_TRIVY_VERSION := $(shell yq '.inputs.version.default' $(ACTION_FILE) 2>/dev/null | tr -d 'v')
|
||||||
|
|
||||||
BATS_ENV := BATS_LIB_PATH=$(BATS_LIB_PATH) \
|
BATS_ENV := BATS_LIB_PATH=$(BATS_LIB_PATH) \
|
||||||
|
GITHUB_REPOSITORY_OWNER=aquasecurity \
|
||||||
TRIVY_CACHE_DIR=$(CACHE_DIR) \
|
TRIVY_CACHE_DIR=$(CACHE_DIR) \
|
||||||
TRIVY_DEBUG=true
|
TRIVY_DEBUG=true
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ jobs:
|
|||||||
- name: Build an image from Dockerfile
|
- name: Build an image from Dockerfile
|
||||||
run: docker build -t docker.io/my-organization/my-app:${{ github.sha }} .
|
run: docker build -t docker.io/my-organization/my-app:${{ github.sha }} .
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
||||||
format: 'table'
|
format: 'table'
|
||||||
@@ -78,7 +78,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner in fs mode
|
- name: Run Trivy vulnerability scanner in fs mode
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
scan-type: 'fs'
|
scan-type: 'fs'
|
||||||
scan-ref: '.'
|
scan-ref: '.'
|
||||||
@@ -119,7 +119,7 @@ If you want to disable caching, set the `cache` input to `false`, but we recomme
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Run Trivy scanner without cache
|
- name: Run Trivy scanner without cache
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
scan-type: 'fs'
|
scan-type: 'fs'
|
||||||
scan-ref: '.'
|
scan-ref: '.'
|
||||||
@@ -180,7 +180,7 @@ When running a scan, set the environment variables `TRIVY_SKIP_DB_UPDATE` and `T
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Run Trivy scanner without downloading DBs
|
- name: Run Trivy scanner without downloading DBs
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
scan-type: 'image'
|
scan-type: 'image'
|
||||||
scan-ref: 'myimage'
|
scan-ref: 'myimage'
|
||||||
@@ -215,10 +215,10 @@ jobs:
|
|||||||
uses: aquasecurity/setup-trivy@v0.2.0
|
uses: aquasecurity/setup-trivy@v0.2.0
|
||||||
with:
|
with:
|
||||||
cache: true
|
cache: true
|
||||||
version: v0.72.0
|
version: v0.69.3
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner in repo mode
|
- name: Run Trivy vulnerability scanner in repo mode
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@master
|
||||||
with:
|
with:
|
||||||
scan-type: 'fs'
|
scan-type: 'fs'
|
||||||
ignore-unfixed: true
|
ignore-unfixed: true
|
||||||
@@ -252,7 +252,7 @@ jobs:
|
|||||||
|
|
||||||
# The first call to the action will invoke setup-trivy and install trivy
|
# The first call to the action will invoke setup-trivy and install trivy
|
||||||
- name: Generate Trivy Vulnerability Report
|
- name: Generate Trivy Vulnerability Report
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@master
|
||||||
with:
|
with:
|
||||||
scan-type: "fs"
|
scan-type: "fs"
|
||||||
output: trivy-report.json
|
output: trivy-report.json
|
||||||
@@ -268,7 +268,7 @@ jobs:
|
|||||||
retention-days: 30
|
retention-days: 30
|
||||||
|
|
||||||
- name: Fail build on High/Criticial Vulnerabilities
|
- name: Fail build on High/Criticial Vulnerabilities
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@master
|
||||||
with:
|
with:
|
||||||
scan-type: "fs"
|
scan-type: "fs"
|
||||||
format: table
|
format: table
|
||||||
@@ -287,7 +287,7 @@ Therefore, you can't install `Trivy` using the `setup-trivy` action.
|
|||||||
To fix this problem, you need to overwrite the token for `setup-trivy` using `token-setup-trivy` input:
|
To fix this problem, you need to overwrite the token for `setup-trivy` using `token-setup-trivy` input:
|
||||||
```yaml
|
```yaml
|
||||||
- name: Run Trivy scanner without cache
|
- name: Run Trivy scanner without cache
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
scan-type: 'fs'
|
scan-type: 'fs'
|
||||||
scan-ref: '.'
|
scan-ref: '.'
|
||||||
@@ -318,7 +318,7 @@ jobs:
|
|||||||
docker save -o vuln-image.tar <your-docker-image>
|
docker save -o vuln-image.tar <your-docker-image>
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner in tarball mode
|
- name: Run Trivy vulnerability scanner in tarball mode
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
input: /github/workspace/vuln-image.tar
|
input: /github/workspace/vuln-image.tar
|
||||||
severity: 'CRITICAL,HIGH'
|
severity: 'CRITICAL,HIGH'
|
||||||
@@ -345,7 +345,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
scan-type: "fs"
|
scan-type: "fs"
|
||||||
scan-ref: .
|
scan-ref: .
|
||||||
@@ -374,7 +374,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
scan-type: "fs"
|
scan-type: "fs"
|
||||||
scan-ref: .
|
scan-ref: .
|
||||||
@@ -407,7 +407,7 @@ jobs:
|
|||||||
docker build -t docker.io/my-organization/my-app:${{ github.sha }} .
|
docker build -t docker.io/my-organization/my-app:${{ github.sha }} .
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
||||||
format: 'sarif'
|
format: 'sarif'
|
||||||
@@ -445,7 +445,7 @@ jobs:
|
|||||||
docker build -t docker.io/my-organization/my-app:${{ github.sha }} .
|
docker build -t docker.io/my-organization/my-app:${{ github.sha }} .
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
||||||
format: 'sarif'
|
format: 'sarif'
|
||||||
@@ -483,7 +483,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner in repo mode
|
- name: Run Trivy vulnerability scanner in repo mode
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
scan-type: 'fs'
|
scan-type: 'fs'
|
||||||
ignore-unfixed: true
|
ignore-unfixed: true
|
||||||
@@ -520,7 +520,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner with rootfs command
|
- name: Run Trivy vulnerability scanner with rootfs command
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
scan-type: 'rootfs'
|
scan-type: 'rootfs'
|
||||||
scan-ref: 'rootfs-example-binary'
|
scan-ref: 'rootfs-example-binary'
|
||||||
@@ -560,7 +560,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner in IaC mode
|
- name: Run Trivy vulnerability scanner in IaC mode
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
scan-type: 'config'
|
scan-type: 'config'
|
||||||
hide-progress: true
|
hide-progress: true
|
||||||
@@ -617,7 +617,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph
|
- name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
scan-type: 'fs'
|
scan-type: 'fs'
|
||||||
format: 'github'
|
format: 'github'
|
||||||
@@ -647,7 +647,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Scan image in a private registry
|
- name: Scan image in a private registry
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
image-ref: "private_image_registry/image_name:image_tag"
|
image-ref: "private_image_registry/image_name:image_tag"
|
||||||
scan-type: image
|
scan-type: image
|
||||||
@@ -693,7 +693,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
||||||
format: 'sarif'
|
format: 'sarif'
|
||||||
@@ -732,7 +732,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
image-ref: 'aws_account_id.dkr.ecr.region.amazonaws.com/imageName:${{ github.sha }}'
|
image-ref: 'aws_account_id.dkr.ecr.region.amazonaws.com/imageName:${{ github.sha }}'
|
||||||
format: 'sarif'
|
format: 'sarif'
|
||||||
@@ -751,7 +751,7 @@ jobs:
|
|||||||
#### GCR (Google Container Registry)
|
#### GCR (Google Container Registry)
|
||||||
Trivy uses Google Cloud SDK. You don't need to install `gcloud` command.
|
Trivy uses Google Cloud SDK. You don't need to install `gcloud` command.
|
||||||
|
|
||||||
If you want to use target project's repository, you can set it via `GOOGLE_APPLICATION_CREDENTIALS`.
|
If you want to use target project's repository, you can set it via `GOOGLE_APPLICATION_CREDENTIAL`.
|
||||||
```yaml
|
```yaml
|
||||||
name: build
|
name: build
|
||||||
on:
|
on:
|
||||||
@@ -771,13 +771,13 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
||||||
format: 'sarif'
|
format: 'sarif'
|
||||||
output: 'trivy-results.sarif'
|
output: 'trivy-results.sarif'
|
||||||
env:
|
env:
|
||||||
GOOGLE_APPLICATION_CREDENTIALS: /path/to/credential.json
|
GOOGLE_APPLICATION_CREDENTIAL: /path/to/credential.json
|
||||||
|
|
||||||
- name: Upload Trivy scan results to GitHub Security tab
|
- name: Upload Trivy scan results to GitHub Security tab
|
||||||
uses: github/codeql-action/upload-sarif@v4
|
uses: github/codeql-action/upload-sarif@v4
|
||||||
@@ -807,7 +807,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
||||||
format: 'sarif'
|
format: 'sarif'
|
||||||
@@ -830,7 +830,7 @@ This step is especially useful for private repositories without [GitHub Advanced
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Run Trivy scanner
|
- name: Run Trivy scanner
|
||||||
uses: aquasecurity/trivy-action@v0.36.0
|
uses: aquasecurity/trivy-action@0.33.1
|
||||||
with:
|
with:
|
||||||
scan-type: config
|
scan-type: config
|
||||||
hide-progress: true
|
hide-progress: true
|
||||||
@@ -891,7 +891,7 @@ Following inputs can be used as `step.with` keys:
|
|||||||
| `github-pat` | String | | Authentication token to enable sending SBOM scan results to GitHub Dependency Graph. Can be either a GitHub Personal Access Token (PAT) or GITHUB_TOKEN |
|
| `github-pat` | String | | Authentication token to enable sending SBOM scan results to GitHub Dependency Graph. Can be either a GitHub Personal Access Token (PAT) or GITHUB_TOKEN |
|
||||||
| `limit-severities-for-sarif` | Boolean | false | By default *SARIF* format enforces output of all vulnerabilities regardless of configured severities. To override this behavior set this parameter to **true** |
|
| `limit-severities-for-sarif` | Boolean | false | By default *SARIF* format enforces output of all vulnerabilities regardless of configured severities. To override this behavior set this parameter to **true** |
|
||||||
| `docker-host` | String | | By default it is set to `unix://var/run/docker.sock`, but can be updated to help with containerized infrastructure values (`unix:/` or other prefix is required) |
|
| `docker-host` | String | | By default it is set to `unix://var/run/docker.sock`, but can be updated to help with containerized infrastructure values (`unix:/` or other prefix is required) |
|
||||||
| `version` | String | `v0.72.0` | Trivy version to use, e.g. `latest` or `v0.72.0` |
|
| `version` | String | `v0.69.3` | Trivy version to use, e.g. `latest` or `v0.69.3` |
|
||||||
| `skip-setup-trivy` | Boolean | false | Skip calling the `setup-trivy` action to install `trivy` |
|
| `skip-setup-trivy` | Boolean | false | Skip calling the `setup-trivy` action to install `trivy` |
|
||||||
| `token-setup-trivy` | Boolean | | Overwrite `github.token` used by `setup-trivy` to checkout the `trivy` repository |
|
| `token-setup-trivy` | Boolean | | Overwrite `github.token` used by `setup-trivy` to checkout the `trivy` repository |
|
||||||
|
|
||||||
|
|||||||
+4
-5
@@ -98,7 +98,7 @@ inputs:
|
|||||||
version:
|
version:
|
||||||
description: 'Trivy version to use'
|
description: 'Trivy version to use'
|
||||||
required: false
|
required: false
|
||||||
default: 'v0.72.0'
|
default: 'v0.69.3'
|
||||||
cache:
|
cache:
|
||||||
description: 'Used to specify whether caching is needed. Set to false, if you would like to disable caching.'
|
description: 'Used to specify whether caching is needed. Set to false, if you would like to disable caching.'
|
||||||
required: false
|
required: false
|
||||||
@@ -126,10 +126,9 @@ runs:
|
|||||||
# "allowing select actions" feature can be used to whitelist the dependent action by a hash.
|
# "allowing select actions" feature can be used to whitelist the dependent action by a hash.
|
||||||
# This is needed since some organizations have a policy to only allow pinned 3rd party actions to
|
# This is needed since some organizations have a policy to only allow pinned 3rd party actions to
|
||||||
# be used.
|
# be used.
|
||||||
uses: aquasecurity/setup-trivy@81e514348e19b6112ce2a7e3ecbafe19c1e1f567 # v0.3.1
|
uses: aquasecurity/setup-trivy@e6c2c5e321ed9123bda567646e2f96565e34abe1 # equivalent to `v0.2.4`
|
||||||
with:
|
with:
|
||||||
# version is pinned by default; using a floating tag like `latest` is the caller's responsibility
|
version: ${{ inputs.version }}
|
||||||
version: ${{ inputs.version }} # zizmor: ignore[unpinned-tools]
|
|
||||||
cache: ${{ inputs.cache }}
|
cache: ${{ inputs.cache }}
|
||||||
token: ${{ inputs.token-setup-trivy }}
|
token: ${{ inputs.token-setup-trivy }}
|
||||||
|
|
||||||
@@ -140,7 +139,7 @@ runs:
|
|||||||
|
|
||||||
- name: Restore DB from cache
|
- name: Restore DB from cache
|
||||||
if: ${{ inputs.cache == 'true' }}
|
if: ${{ inputs.cache == 'true' }}
|
||||||
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
|
||||||
with:
|
with:
|
||||||
path: ${{ inputs.cache-dir }}
|
path: ${{ inputs.cache-dir }}
|
||||||
key: cache-trivy-${{ steps.date.outputs.date }}
|
key: cache-trivy-${{ steps.date.outputs.date }}
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Allow overriding trivy binary via env
|
# Allow overriding trivy binary via env
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"SchemaVersion": 2,
|
"SchemaVersion": 2,
|
||||||
"Trivy": {
|
"Trivy": {
|
||||||
"Version": "0.72.0"
|
"Version": "0.69.3"
|
||||||
},
|
},
|
||||||
"ArtifactName": "test/data/config-scan",
|
"ArtifactName": "test/data/config-scan",
|
||||||
"ArtifactType": "filesystem",
|
"ArtifactType": "filesystem",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"SchemaVersion": 2,
|
"SchemaVersion": 2,
|
||||||
"Trivy": {
|
"Trivy": {
|
||||||
"Version": "0.72.0"
|
"Version": "0.69.3"
|
||||||
},
|
},
|
||||||
"ArtifactID": "sha256:79ce4c2f8371bef1ce2a321518d3136bc1bd8f3c307ed679944a38e7cbd76c14",
|
"ArtifactID": "sha256:79ce4c2f8371bef1ce2a321518d3136bc1bd8f3c307ed679944a38e7cbd76c14",
|
||||||
"ArtifactName": "https://github.com/krol3/demo-trivy/",
|
"ArtifactName": "https://github.com/krol3/demo-trivy/",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"SchemaVersion": 2,
|
"SchemaVersion": 2,
|
||||||
"Trivy": {
|
"Trivy": {
|
||||||
"Version": "0.72.0"
|
"Version": "0.69.3"
|
||||||
},
|
},
|
||||||
"ArtifactName": "test/data/with-tf-vars/main.tf",
|
"ArtifactName": "test/data/with-tf-vars/main.tf",
|
||||||
"ArtifactType": "filesystem",
|
"ArtifactType": "filesystem",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"SchemaVersion": 2,
|
"SchemaVersion": 2,
|
||||||
"Trivy": {
|
"Trivy": {
|
||||||
"Version": "0.72.0"
|
"Version": "0.69.3"
|
||||||
},
|
},
|
||||||
"ArtifactID": "sha256:aab05ff324c90bb728aa5177b75d7e39d363be13323873de70959d2251edcebc",
|
"ArtifactID": "sha256:aab05ff324c90bb728aa5177b75d7e39d363be13323873de70959d2251edcebc",
|
||||||
"ArtifactName": "alpine:3.10",
|
"ArtifactName": "alpine:3.10",
|
||||||
|
|||||||
+5
-3
@@ -23,9 +23,11 @@ teardown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setup_trivy_env() {
|
setup_trivy_env() {
|
||||||
export TRIVY_DB_REPOSITORY="ghcr.io/aquasecurity/trivy-db@sha256:7f8b879d4c23469b09c874b18d64a7eedea95f0ce08ea1862a783dc8d799be6f"
|
local owner="${GITHUB_REPOSITORY_OWNER:-aquasecurity}"
|
||||||
export TRIVY_JAVA_DB_REPOSITORY="ghcr.io/aquasecurity/trivy-java-db@sha256:f60faf3353edb6556f676c83c8b26d8a60398feab31ab2ec591537707a7354ba"
|
|
||||||
export TRIVY_CHECKS_BUNDLE_REPOSITORY="ghcr.io/aquasecurity/trivy-checks@sha256:b63166ca02aa09e30a5127320384d7bd0d2760dc19bab3ab7041a6070114ba45" # v2.2.0
|
export TRIVY_DB_REPOSITORY="ghcr.io/${owner}/trivy-db-act:latest"
|
||||||
|
export TRIVY_JAVA_DB_REPOSITORY="ghcr.io/${owner}/trivy-java-db-act:latest"
|
||||||
|
export TRIVY_CHECKS_BUNDLE_REPOSITORY="ghcr.io/${owner}/trivy-checks-act:latest"
|
||||||
|
|
||||||
export TRIVY_LIST_ALL_PKGS=false
|
export TRIVY_LIST_ALL_PKGS=false
|
||||||
export TRIVY_DISABLE_VEX_NOTICE=true
|
export TRIVY_DISABLE_VEX_NOTICE=true
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
rules:
|
|
||||||
# GitHub environments are not currently used, so secrets are accessed outside of them.
|
|
||||||
# See: https://docs.zizmor.sh/audits/#secrets-outside-env
|
|
||||||
secrets-outside-env:
|
|
||||||
disable: true
|
|
||||||
Reference in New Issue
Block a user