Skip to content

Commit c345e63

Browse files
bumahkib7claude
andcommitted
fix: limit SARIF results to stay under GitHub's 5000 alert cap
Raise severity floor to warning, exclude external/ and rules/ dirs (third-party code and intentional vuln patterns), and add a safety truncation to 5000 results if the limit is still exceeded. Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 0f63765 commit c345e63

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/rma-scan.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,29 @@ jobs:
5959
id: scan
6060
run: |
6161
# Note: Excluding crypto/secret rules because rule definition files
62-
# intentionally contain vulnerable patterns as examples
62+
# intentionally contain vulnerable patterns as examples.
63+
# Excluding external/ and rules/ dirs which contain third-party code
64+
# and intentional vulnerable-pattern examples.
65+
# Severity warning+ to stay under GitHub's 5000 alert SARIF limit.
6366
./rma scan . \
6467
--format sarif \
6568
--output rma-results.sarif \
66-
--severity info \
69+
--severity warning \
6770
--skip-tests-all \
6871
--exclude-rules "generic/hardcoded-secret,generic/insecure-crypto,generic/crypto-typestate" \
72+
--exclude "external/**,crates/rules/rules/**,target/**" \
6973
2>&1 || true
7074
7175
echo "Scan complete."
7276
7377
if [ -f rma-results.sarif ]; then
78+
RESULT_COUNT=$(jq '[.runs[].results[]] | length' rma-results.sarif 2>/dev/null || echo "unknown")
79+
echo "SARIF results: ${RESULT_COUNT}"
80+
if [ "${RESULT_COUNT}" != "unknown" ] && [ "${RESULT_COUNT}" -gt 5000 ]; then
81+
echo "::warning::SARIF has ${RESULT_COUNT} results (GitHub limit is 5000). Truncating."
82+
jq '.runs[0].results = (.runs[0].results[:5000])' rma-results.sarif > rma-results-truncated.sarif
83+
mv rma-results-truncated.sarif rma-results.sarif
84+
fi
7485
echo "sarif-file=rma-results.sarif" >> "$GITHUB_OUTPUT"
7586
jq -r '.runs[0].invocations[0].properties.metrics // "No metrics"' rma-results.sarif || true
7687
fi

0 commit comments

Comments
 (0)