ci: fix snyk security scans in bake_targets.yml (#329)

Closes #327

Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
This commit is contained in:
Niccolò Fei
2025-09-26 15:49:06 +02:00
committed by GitHub
parent 517f68f972
commit f7e28cab0e
2 changed files with 16 additions and 1 deletions

View File

@@ -51,6 +51,8 @@ jobs:
with: with:
environment: ${{ github.event.inputs.environment }} environment: ${{ github.event.inputs.environment }}
postgresql_version: ${{ matrix.version }} postgresql_version: ${{ matrix.version }}
secrets:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
Catalogs: Catalogs:
name: Update Catalogs name: Update Catalogs

View File

@@ -29,6 +29,9 @@ on:
`source` directory. `source` directory.
required: false required: false
type: string type: string
secrets:
SNYK_TOKEN:
required: false
permissions: {} permissions: {}
@@ -158,6 +161,10 @@ jobs:
- name: Snyk - name: Snyk
uses: snyk/actions/docker@master uses: snyk/actions/docker@master
id: snyk
if: ${{ env.SNYK_TOKEN != '' }}
# Snyk can be used to break the build when it detects vulnerabilities.
# In this case we want to upload the issues to GitHub Code Scanning.
continue-on-error: true continue-on-error: true
env: env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
@@ -165,9 +172,15 @@ jobs:
image: "${{ matrix.image }}" image: "${{ matrix.image }}"
args: --severity-threshold=high --file=Dockerfile args: --severity-threshold=high --file=Dockerfile
- name: Replace sarif security-severity invalid values
if: ${{ steps.snyk.conclusion == 'success' }}
run: |
sed -i 's/"security-severity": "null"/"security-severity": "0"/g' snyk.sarif
sed -i 's/"security-severity": "undefined"/"security-severity": "0"/g' snyk.sarif
- name: Upload result to GitHub Code Scanning - name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@192325c86100d080feab897ff886c34abd4c83a3 # v3 uses: github/codeql-action/upload-sarif@192325c86100d080feab897ff886c34abd4c83a3 # v3
continue-on-error: true if: ${{ steps.snyk.conclusion == 'success' }}
with: with:
sarif_file: snyk.sarif sarif_file: snyk.sarif