-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #923 from Checkmarx/add-trivy-scan
AST-000 | Add trivy-cache and update trivy-scan
- Loading branch information
Showing
3 changed files
with
58 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
name: Checkmarx One Scan | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: '00 7 * * *' # Every day at 07:00 | ||
|
||
jobs: | ||
cx-scan: | ||
name: Checkmarx One Scan | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 #v3.0.0 | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
- name: Checkmarx One CLI Action | ||
uses: checkmarx/ast-github-action@6c56658230f79c227a55120e9b24845d574d5225 # main | ||
uses: checkmarx/ast-github-action@f0869bd1a37fddc06499a096101e6c900e815d81 # v.2.0.36 | ||
with: | ||
base_uri: ${{ secrets.AST_RND_SCANS_BASE_URI }} | ||
cx_tenant: ${{ secrets.AST_RND_SCANS_TENANT }} | ||
cx_client_id: ${{ secrets.AST_RND_SCANS_CLIENT_ID }} | ||
cx_client_secret: ${{ secrets.AST_RND_SCANS_CLIENT_SECRET }} | ||
additional_params: --tags phoenix --threshold "sast-high=1;sast-medium=1;sast-low=1;iac-security-high=1;iac-security-medium=1;iac-security-low=1;sca-high=1;sca-medium=1;sca-low=1" | ||
additional_params: --tags phoenix --threshold "sca-critical=1;sca-high=1;sca-medium=1;sca-low=1;sast-critical=1;sast-high=1;sast-medium=1;sast-low=1;iac-security-critical=1;iac-security-high=1;iac-security-medium=1;iac-security-low=1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Note: This workflow only updates the cache. You should create a separate workflow for your actual Trivy scans. | ||
# In your scan workflow, set TRIVY_SKIP_DB_UPDATE=true and TRIVY_SKIP_JAVA_DB_UPDATE=true. | ||
name: Update Trivy Cache | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' # Run daily at midnight UTC | ||
workflow_dispatch: # Allow manual triggering | ||
|
||
jobs: | ||
update-trivy-db: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup oras | ||
uses: oras-project/setup-oras@9c92598691bfef1424de2f8fae81941568f5889c #v1.2.1 | ||
|
||
- name: Get current date | ||
id: date | ||
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | ||
|
||
- name: Download and extract the vulnerability DB | ||
run: | | ||
mkdir -p $GITHUB_WORKSPACE/.cache/trivy/db | ||
oras pull ghcr.io/aquasecurity/trivy-db:2 | ||
tar -xzf db.tar.gz -C $GITHUB_WORKSPACE/.cache/trivy/db | ||
rm db.tar.gz | ||
#- name: Download and extract the Java DB | ||
# run: | | ||
# mkdir -p $GITHUB_WORKSPACE/.cache/trivy/java-db | ||
# oras pull ghcr.io/aquasecurity/trivy-java-db:1 | ||
# tar -xzf javadb.tar.gz -C $GITHUB_WORKSPACE/.cache/trivy/java-db | ||
# rm javadb.tar.gz | ||
|
||
- name: Cache DBs | ||
uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a #v4.1.2 | ||
with: | ||
path: ${{ github.workspace }}/.cache/trivy | ||
key: cache-trivy-${{ steps.date.outputs.date }} |