Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(ci): fail loudly when Grype produces no SARIF instead of uploading an empty one (#4796)

LearningCircuit5420659f834c
diff --git a/.github/workflows/grype.yml b/.github/workflows/grype.yml
index d478d5ba78..31c41ff5d2 100644
--- a/.github/workflows/grype.yml
+++ b/.github/workflows/grype.yml
@@ -44,33 +44,25 @@ jobs:
output-format: sarif
severity-cutoff: medium
+ # Fail loudly if Grype produced no SARIF — never fabricate an empty one.
+ # An empty-results SARIF uploaded under the grype-filesystem category would
+ # make GitHub mark every previously-open Grype alert as fixed, silently
+ # clearing real findings. Mirror the Trivy job: error + exit 1, skip upload.
- name: Ensure SARIF file exists
+ id: check-fs-sarif
if: always()
run: |
SARIF_FILE="${{ steps.grype-fs.outputs.sarif }}"
- if [ ! -f "$SARIF_FILE" ]; then
- echo "::warning::Grype filesystem scan did not produce a SARIF file - creating empty placeholder"
- cat > "$SARIF_FILE" << 'SARIF'
- {
- "version": "2.1.0",
- "$schema": "https://json.schemastore.org/sarif-2.1.0.json",
- "runs": [{
- "tool": {
- "driver": {
- "name": "Grype",
- "informationUri": "https://github.com/anchore/grype",
- "rules": []
- }
- },
- "results": []
- }]
- }
- SARIF
+ if [ -f "$SARIF_FILE" ]; then
+ echo "exists=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "::error::Grype filesystem scan did not produce a SARIF file — scan needs to be rerun"
+ exit 1
fi
- name: Upload Grype filesystem SARIF to GitHub Security tab
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
- if: always()
+ if: always() && steps.check-fs-sarif.outputs.exists == 'true'
with:
sarif_file: ${{ steps.grype-fs.outputs.sarif }}
category: grype-filesystem
@@ -129,33 +121,25 @@ jobs:
output-format: sarif
severity-cutoff: medium
+ # Fail loudly if Grype produced no SARIF — never fabricate an empty one.
+ # An empty-results SARIF uploaded under the grype-container category would
+ # make GitHub mark every previously-open Grype alert as fixed, silently
+ # clearing real findings. Mirror the Trivy job: error + exit 1, skip upload.
- name: Ensure SARIF file exists
+ id: check-container-sarif
if: always()
run: |
SARIF_FILE="${{ steps.grype-container.outputs.sarif }}"
- if [ ! -f "$SARIF_FILE" ]; then
- echo "::warning::Grype container scan did not produce a SARIF file - creating empty placeholder"
- cat > "$SARIF_FILE" << 'SARIF'
- {
- "version": "2.1.0",
- "$schema": "https://json.schemastore.org/sarif-2.1.0.json",
- "runs": [{
- "tool": {
- "driver": {
- "name": "Grype",
- "informationUri": "https://github.com/anchore/grype",
- "rules": []
- }
- },
- "results": []
- }]
- }
- SARIF
+ if [ -f "$SARIF_FILE" ]; then
+ echo "exists=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "::error::Grype container scan did not produce a SARIF file — scan needs to be rerun"
+ exit 1
fi
- name: Upload Grype container SARIF to GitHub Security tab
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
- if: always()
+ if: always() && steps.check-container-sarif.outputs.exists == 'true'
with:
sarif_file: ${{ steps.grype-container.outputs.sarif }}
category: grype-container
@@ -166,5 +150,9 @@ jobs:
{
echo "## Grype Container Vulnerability Scan"
echo ""
- echo "✅ Grype scan completed - Results available in Security tab"
+ if [ "${{ steps.check-container-sarif.outputs.exists }}" = "true" ]; then
+ echo "✅ Grype scan completed - Results available in Security tab"
+ else
+ echo "❌ Grype scan failed - no SARIF produced (see error above); rerun required"
+ fi
} >> "$GITHUB_STEP_SUMMARY"