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): address AI code review feedback for security gate

LearningCircuit68221d267f00
diff --git a/.github/workflows/security-release-gate.yml b/.github/workflows/security-release-gate.yml
index 54442b9ad6..018eb17521 100644
--- a/.github/workflows/security-release-gate.yml
+++ b/.github/workflows/security-release-gate.yml
@@ -1,7 +1,10 @@
name: Security Release Gate
# This workflow checks that daily security scans have passed before allowing releases.
-# It verifies the most recent runs of security workflows are successful.
+# It verifies:
+# 1. All security workflows have completed runs
+# 2. The most recent runs were successful
+# 3. The scans are not stale (ran within the last 48 hours)
on:
workflow_call:
@@ -37,8 +40,14 @@ jobs:
REPO="${{ github.repository }}"
FAILED_WORKFLOWS=""
+ MISSING_WORKFLOWS=""
+ STALE_WORKFLOWS=""
+
+ # Maximum age for security scans (48 hours in seconds)
+ MAX_AGE_SECONDS=$((48 * 60 * 60))
echo "Checking security workflow statuses for $REPO..."
+ echo "Maximum scan age: 48 hours"
echo ""
# List of security workflows to check
@@ -53,22 +62,41 @@ jobs:
for workflow in "${WORKFLOWS[@]}"; do
echo "Checking $workflow..."
- # Get the most recent completed run for this workflow
+ # Get the most recent completed run for this workflow on main branch
RESULT=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
- "/repos/$REPO/actions/workflows/$workflow/runs?status=completed&per_page=1" \
- --jq '.workflow_runs[0] | {conclusion: .conclusion, created_at: .created_at, html_url: .html_url}' \
+ "/repos/$REPO/actions/workflows/$workflow/runs?status=completed&branch=main&per_page=1" \
+ --jq '.workflow_runs[0] | {conclusion: .conclusion, created_at: .created_at, html_url: .html_url, head_sha: .head_sha}' \
2>/dev/null || echo '{"conclusion": "not_found"}')
CONCLUSION=$(echo "$RESULT" | jq -r '.conclusion // "not_found"')
CREATED_AT=$(echo "$RESULT" | jq -r '.created_at // "N/A"')
URL=$(echo "$RESULT" | jq -r '.html_url // "N/A"')
+ HEAD_SHA=$(echo "$RESULT" | jq -r '.head_sha // "N/A"')
+
+ if [ "$CONCLUSION" = "not_found" ] || [ "$CONCLUSION" = "null" ]; then
+ echo " ❌ $workflow: No completed runs found on main branch"
+ MISSING_WORKFLOWS="$MISSING_WORKFLOWS $workflow"
+ elif [ "$CONCLUSION" = "success" ]; then
+ # Check staleness
+ if [ "$CREATED_AT" != "N/A" ]; then
+ SCAN_TIMESTAMP=$(date -d "$CREATED_AT" +%s 2>/dev/null || echo "0")
+ NOW_TIMESTAMP=$(date +%s)
+ AGE_SECONDS=$((NOW_TIMESTAMP - SCAN_TIMESTAMP))
- if [ "$CONCLUSION" = "success" ]; then
- echo " ✅ $workflow: PASSED (last run: $CREATED_AT)"
- elif [ "$CONCLUSION" = "not_found" ]; then
- echo " ⚠️ $workflow: No completed runs found (may be new workflow)"
+ if [ "$AGE_SECONDS" -gt "$MAX_AGE_SECONDS" ]; then
+ AGE_HOURS=$((AGE_SECONDS / 3600))
+ echo " ⚠️ $workflow: STALE - Last run was ${AGE_HOURS}h ago (max: 48h)"
+ echo " Last run: $URL"
+ STALE_WORKFLOWS="$STALE_WORKFLOWS $workflow"
+ else
+ AGE_HOURS=$((AGE_SECONDS / 3600))
+ echo " ✅ $workflow: PASSED (${AGE_HOURS}h ago, sha: ${HEAD_SHA:0:7})"
+ fi
+ else
+ echo " ✅ $workflow: PASSED (last run: $CREATED_AT)"
+ fi
else
echo " ❌ $workflow: FAILED (conclusion: $CONCLUSION)"
echo " Last run: $URL"
@@ -78,12 +106,28 @@ jobs:
done
# Determine overall status
+ HAS_ISSUES=""
+
+ if [ -n "$MISSING_WORKFLOWS" ]; then
+ echo "::error::Security workflows with no completed runs:$MISSING_WORKFLOWS"
+ HAS_ISSUES="true"
+ fi
+
if [ -n "$FAILED_WORKFLOWS" ]; then
echo "::error::Security checks failed for:$FAILED_WORKFLOWS"
+ HAS_ISSUES="true"
+ fi
+
+ if [ -n "$STALE_WORKFLOWS" ]; then
+ echo "::error::Security scans are stale (>48h) for:$STALE_WORKFLOWS"
+ HAS_ISSUES="true"
+ fi
+
+ if [ -n "$HAS_ISSUES" ]; then
echo "status=failed" >> "$GITHUB_OUTPUT"
exit 1
else
- echo "✅ All security checks passed!"
+ echo "✅ All security checks passed and are up-to-date!"
echo "status=passed" >> "$GITHUB_OUTPUT"
fi
@@ -95,8 +139,18 @@ jobs:
echo ""
if [ "${{ steps.check.outputs.status }}" = "passed" ]; then
echo "✅ **All security scans passed** - Release is approved from a security perspective."
+ echo ""
+ echo "All checks verified:"
+ echo "- All required security workflows have completed runs"
+ echo "- All runs were successful"
+ echo "- All scans ran within the last 48 hours"
else
- echo "❌ **Security scans failed** - Please fix security issues before releasing."
+ echo "❌ **Security gate failed** - Release is blocked."
+ echo ""
+ echo "Possible issues:"
+ echo "- Security workflow failed (fix the issues and re-run)"
+ echo "- Security workflow missing runs (trigger manually)"
+ echo "- Security scans are stale >48h (trigger daily scans manually)"
echo ""
echo "Review the failed workflows and address any issues before proceeding."
fi