Skip to content

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

fix(ci): handle invalid security-severity in Snyk SARIF output (#13163)

Tobias Wochingeraa76b348e876
diff --git a/.github/workflows/snyk-web.yml b/.github/workflows/snyk-web.yml
index 27d2617cf1..8be1ff37b8 100644
--- a/.github/workflows/snyk-web.yml
+++ b/.github/workflows/snyk-web.yml
@@ -32,24 +32,20 @@ jobs:
if: always()
run: |
if [ -f snyk.sarif ]; then
- # Fix undefined security severity values in SARIF file
+ # 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
echo "SARIF file fixed"
else
echo "No SARIF file found"
fi
- - name: Echo SARIF file for debugging
- if: always()
- run: |
- if [ -f snyk.sarif ]; then
- echo "=== SARIF File Contents ==="
- cat snyk.sarif
- echo "=== End of SARIF File ==="
- else
- echo "No SARIF file found to display"
- fi
- name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v4
if: always()
with:
sarif_file: snyk.sarif
+ - name: Echo SARIF file for debugging
+ if: failure()
+ run: cat snyk.sarif
diff --git a/.github/workflows/snyk-worker.yml b/.github/workflows/snyk-worker.yml
index 83677cde2d..5721e5e41f 100644
--- a/.github/workflows/snyk-worker.yml
+++ b/.github/workflows/snyk-worker.yml
@@ -32,24 +32,20 @@ jobs:
if: always()
run: |
if [ -f snyk.sarif ]; then
- # Fix undefined security severity values in SARIF file
+ # 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
echo "SARIF file fixed"
else
echo "No SARIF file found"
fi
- - name: Echo SARIF file for debugging
- if: always()
- run: |
- if [ -f snyk.sarif ]; then
- echo "=== SARIF File Contents ==="
- cat snyk.sarif
- echo "=== End of SARIF File ==="
- else
- echo "No SARIF file found to display"
- fi
- name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v4
if: always()
with:
sarif_file: snyk.sarif
+ - name: Echo SARIF file for debugging
+ if: failure()
+ run: cat snyk.sarif