Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore(security): fix snyk code scanning (#13158)

Nimar02abecaaebad
diff --git a/.github/workflows/snyk-web.yml b/.github/workflows/snyk-web.yml
index 8be1ff37b8..10c03dd2dd 100644
--- a/.github/workflows/snyk-web.yml
+++ b/.github/workflows/snyk-web.yml
@@ -15,28 +15,33 @@ jobs:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
+ - name: Set up Snyk CLI
+ uses: snyk/actions/setup@9adf32b1121593767fc3c057af55b55db032dc04 # master
+ with:
+ snyk-version: v1.1304.0
- name: Run Snyk to check Docker image for vulnerabilities
# 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
- uses: snyk/actions/docker@9adf32b1121593767fc3c057af55b55db032dc04 # master
env:
# In order to use the Snyk Action you will need to have a Snyk API token.
# See https://docs.snyk.io/integrations/ci-cd-integrations/github-actions-integration#getting-your-snyk-token
# or you can sign up for free at https://snyk.io/login
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
- with:
- image: langfuse/langfuse
- args: --sarif-file-output=snyk.sarif
- - name: Fix SARIF file
+ run: |
+ snyk container test langfuse/langfuse \
+ --file=web/Dockerfile \
+ --sarif-file-output=snyk.sarif
+ - name: Normalize SARIF file
if: always()
run: |
if [ -f snyk.sarif ]; then
- # Snyk emits invalid security-severity values ("undefined", "null").
- # codeql-action/upload-sarif requires a numeric string.
- # See: https://github.com/github/codeql-action/issues/2187#issuecomment-3708019503
- sed -i 's/"security-severity": "undefined"/"security-severity": "0"/g' snyk.sarif
- sed -i 's/"security-severity": "null"/"security-severity": "0"/g' snyk.sarif
+ # Snyk emits invalid security-severity values. upload-sarif requires a numeric string.
+ sed -i \
+ -e 's/"security-severity": "undefined"/"security-severity": "0"/g' \
+ -e 's/"security-severity": "null"/"security-severity": "0"/g' \
+ -e 's/"security-severity": null/"security-severity": "0"/g' \
+ snyk.sarif
echo "SARIF file fixed"
else
echo "No SARIF file found"
@@ -46,6 +51,7 @@ jobs:
if: always()
with:
sarif_file: snyk.sarif
+ category: snyk-container-web
- name: Echo SARIF file for debugging
- if: failure()
+ if: failure() && hashFiles('snyk.sarif') != ''
run: cat snyk.sarif
diff --git a/.github/workflows/snyk-worker.yml b/.github/workflows/snyk-worker.yml
index 5721e5e41f..0bb497a679 100644
--- a/.github/workflows/snyk-worker.yml
+++ b/.github/workflows/snyk-worker.yml
@@ -15,28 +15,33 @@ jobs:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
+ - name: Set up Snyk CLI
+ uses: snyk/actions/setup@9adf32b1121593767fc3c057af55b55db032dc04 # master
+ with:
+ snyk-version: v1.1304.0
- name: Run Snyk to check Docker image for vulnerabilities
# 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
- uses: snyk/actions/docker@9adf32b1121593767fc3c057af55b55db032dc04 # master
env:
# In order to use the Snyk Action you will need to have a Snyk API token.
# See https://docs.snyk.io/integrations/ci-cd-integrations/github-actions-integration#getting-your-snyk-token
# or you can sign up for free at https://snyk.io/login
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
- with:
- image: langfuse/langfuse-worker
- args: --sarif-file-output=snyk.sarif
- - name: Fix SARIF file
+ run: |
+ snyk container test langfuse/langfuse-worker \
+ --file=worker/Dockerfile \
+ --sarif-file-output=snyk.sarif
+ - name: Normalize SARIF file
if: always()
run: |
if [ -f snyk.sarif ]; then
- # Snyk emits invalid security-severity values ("undefined", "null").
- # codeql-action/upload-sarif requires a numeric string.
- # See: https://github.com/github/codeql-action/issues/2187#issuecomment-3708019503
- sed -i 's/"security-severity": "undefined"/"security-severity": "0"/g' snyk.sarif
- sed -i 's/"security-severity": "null"/"security-severity": "0"/g' snyk.sarif
+ # Snyk emits invalid security-severity values. upload-sarif requires a numeric string.
+ sed -i \
+ -e 's/"security-severity": "undefined"/"security-severity": "0"/g' \
+ -e 's/"security-severity": "null"/"security-severity": "0"/g' \
+ -e 's/"security-severity": null/"security-severity": "0"/g' \
+ snyk.sarif
echo "SARIF file fixed"
else
echo "No SARIF file found"
@@ -46,6 +51,7 @@ jobs:
if: always()
with:
sarif_file: snyk.sarif
+ category: snyk-container-worker
- name: Echo SARIF file for debugging
- if: failure()
+ if: failure() && hashFiles('snyk.sarif') != ''
run: cat snyk.sarif