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.

ci: fail loudly when Bearer/Semgrep produce no SARIF instead of faking one (#4818)

LearningCircuit5a0d579050c1
diff --git a/.github/workflows/bearer.yml b/.github/workflows/bearer.yml
index aa60025637..dc7c137588 100644
--- a/.github/workflows/bearer.yml
+++ b/.github/workflows/bearer.yml
@@ -41,39 +41,33 @@ jobs:
# Failing here would break CI without adding security value.
exit-code: 0
+ # Fail loudly if Bearer produced no SARIF — never fabricate an empty one.
+ # An empty-results SARIF uploaded under the bearer-security category would
+ # make GitHub mark every previously-open Bearer alert as fixed, silently
+ # clearing real findings. Mirror the Grype/Trivy jobs: error + exit 1, skip
+ # upload. bearer-action writes a SARIF even with zero findings, so a missing
+ # file means a real scan failure, not a clean run.
- name: Ensure SARIF file exists
+ id: check-sarif
if: always()
run: |
- if [ ! -f bearer-results.sarif ]; then
- echo "::warning::Bearer did not produce a SARIF file - creating empty placeholder"
- cat > bearer-results.sarif << 'SARIF'
- {
- "version": "2.1.0",
- "$schema": "https://json.schemastore.org/sarif-2.1.0.json",
- "runs": [{
- "tool": {
- "driver": {
- "name": "Bearer",
- "informationUri": "https://bearer.com",
- "rules": []
- }
- },
- "results": []
- }]
- }
- SARIF
+ if [ -f bearer-results.sarif ]; then
+ echo "exists=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "::error::Bearer did not produce a SARIF file — scan needs to be rerun"
+ exit 1
fi
- name: Upload Bearer results to GitHub Security tab
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
- if: always()
+ if: always() && steps.check-sarif.outputs.exists == 'true'
with:
sarif_file: bearer-results.sarif
category: bearer-security
- name: Upload Bearer results as artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
- if: always()
+ if: always() && steps.check-sarif.outputs.exists == 'true'
with:
name: bearer-scan-results
path: bearer-results.sarif
diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml
index 500fb54b2b..93f21b371f 100644
--- a/.github/workflows/semgrep.yml
+++ b/.github/workflows/semgrep.yml
@@ -174,32 +174,26 @@ jobs:
print(f'Converted {len(sarif[\"runs\"][0][\"results\"])} findings to SARIF format')
"
+ # Fail loudly if the SARIF conversion produced no file — never fabricate an
+ # empty one. An empty-results SARIF uploaded under the semgrep-security
+ # category would make GitHub mark every previously-open Semgrep alert as
+ # fixed, silently clearing real findings. The "Convert to SARIF" step above
+ # always writes the file (results:[] on a clean scan), so a missing file
+ # means a real conversion failure. Mirror the Grype/Trivy jobs.
- name: Ensure SARIF file exists
+ id: check-sarif
if: always()
run: |
- if [ ! -f semgrep-results.sarif ]; then
- echo "::warning::Semgrep SARIF conversion did not produce a file - creating empty placeholder"
- cat > semgrep-results.sarif << 'SARIF'
- {
- "version": "2.1.0",
- "$schema": "https://json.schemastore.org/sarif-2.1.0.json",
- "runs": [{
- "tool": {
- "driver": {
- "name": "Semgrep",
- "informationUri": "https://semgrep.dev",
- "rules": []
- }
- },
- "results": []
- }]
- }
- SARIF
+ if [ -f semgrep-results.sarif ]; then
+ echo "exists=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "::error::Semgrep SARIF conversion did not produce a file — scan needs to be rerun"
+ exit 1
fi
- name: Upload Semgrep results to GitHub Security tab
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
- if: always()
+ if: always() && steps.check-sarif.outputs.exists == 'true'
with:
sarif_file: 'semgrep-results.sarif'
category: semgrep-security