Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

docs: update gosec script with realistic performance expectations

Mariof2ef4b6af67c
diff --git a/scripts/README.md b/scripts/README.md
index 3772b36d..ec1da66c 100644
--- a/scripts/README.md
+++ b/scripts/README.md
@@ -17,15 +17,24 @@ Run the gosec security scanner locally with the same configuration as CI.
- G112 (Slowloris vulnerability)
- G204 (Command injection)
-**Notes:**
-- First run will install gosec to `~/go/bin/gosec`
-- Scan takes 1-2 minutes (same as CI)
-- Results saved to `gosec-results.json`
-- Exits with code 1 if critical issues found (same as CI)
+**Performance notes:**
+- CI runs in ~1-2 minutes (GitHub runners)
+- Local runs may take 3-5+ minutes depending on your machine
+- **Tip:** If it's too slow, just push and let CI run it (with conditional execution, it only runs when Go files change)
**CI behavior:**
-- Only runs when Go files (`.go`, `go.mod`, `go.sum`) change
-- Skipped when only docs/workflows change (path filtering)
+- ✅ Only runs when Go files (`.go`, `go.mod`, `go.sum`) change
+- ⏭️ Skipped when only docs/workflows change (path filtering)
- Same exclusions as local scan
+- Faster on GitHub runners (optimized VMs)
+
+**First run:**
+- Installs gosec to `~/go/bin/gosec`
+- Results saved to `gosec-results.json`
+- Exits with code 1 if critical issues found (same as CI)
-**Tip:** Run this before pushing to catch security issues early!
+**Alternative:**
+If gosec is too slow locally, you can:
+1. Just push your changes - CI will run it (only on Go changes)
+2. Use our conditional workflow - it skips when no Go files changed
+3. Trust the CI check - it's fast and runs on every PR
diff --git a/scripts/run-gosec.sh b/scripts/run-gosec.sh
index 4648d048..2625cfb5 100755
--- a/scripts/run-gosec.sh
+++ b/scripts/run-gosec.sh
@@ -11,30 +11,49 @@ if ! command -v gosec &> /dev/null; then
go install github.com/securego/gosec/v2/cmd/gosec@latest
fi
-echo "Running gosec (this may take 1-2 minutes)..."
+echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
+echo "Running gosec security scan..."
+echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
+echo "⏱️ This may take 3-5 minutes on local machines"
+echo " (CI runs faster on optimized GitHub runners)"
+echo ""
+
+START_TIME=$(date +%s)
# Run gosec with the same config as CI
# Note: This scans all Go code, same as the CI does
gosec -exclude=G301,G302,G304,G306,G404,G107,G115,G703,G704,G705,G706 \
-fmt=json \
-out=gosec-results.json \
- ./... || true
+ ./... 2>&1 | grep -E "Checking (file|package)" | tail -10 || true
-# Check for critical findings (same as CI)
-ISSUES=$(cat gosec-results.json | jq '[.Issues[] | select(.rule_id == "G112" or .rule_id == "G204")] | length')
+END_TIME=$(date +%s)
+DURATION=$((END_TIME - START_TIME))
+echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
-echo "Security Scan Results"
+echo "Security Scan Results (${DURATION}s)"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
+
+# Check if results file exists
+if [ ! -f gosec-results.json ]; then
+ echo "❌ No results file generated (scan may have failed)"
+ exit 1
+fi
+
cat gosec-results.json | jq -r '.Stats'
echo ""
+
+# Check for critical findings (same as CI)
+ISSUES=$(cat gosec-results.json | jq '[.Issues[] | select(.rule_id == "G112" or .rule_id == "G204")] | length')
echo "Critical issues (G112, G204): $ISSUES"
if [ "$ISSUES" -gt 0 ]; then
echo ""
echo "❌ CRITICAL ISSUES FOUND (will fail CI):"
cat gosec-results.json | jq -r '.Issues[] | select(.rule_id == "G112" or .rule_id == "G204")'
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
exit 1
else
echo "✅ No critical issues (CI will pass)"