Skip to content

Commit 52a17f9

Browse files
hyperpolymathclaude
andcommitted
fix(ci): scan-and-report — dispatch payload via file, not argv (fixes downstream 'Argument list too long')
On large repos the scan JSON inlined into curl's -d argument overflows the kernel argv limit — curl exits 126 and every consumer's Security Scan goes red (e.g. echidna run 28736074871). Build the payload with jq into a file and send with --data @file. Also handle GitHub's ~64KB repository_dispatch client_payload cap: oversized reports (the same repos that hit the argv limit) now fall back to a counts-only summary (statistics + severity histogram, truncated: true) instead of a hard 422. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 5f45330 commit 52a17f9

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

.github/workflows/scan-and-report.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,35 @@ jobs:
4747
DISPATCH_TOKEN: ${{ secrets.VERISIMDB_PAT || secrets.GITHUB_TOKEN }}
4848
run: |
4949
REPO_NAME=$(basename $(pwd))
50-
SCAN_DATA=$(cat scan-result.json)
50+
51+
# Build the payload in a file: inlining the scan JSON on argv
52+
# overflows the kernel arg-length limit on large repos (curl
53+
# exits 126 "Argument list too long").
54+
jq -c --arg repo_name "$REPO_NAME" \
55+
'{event_type: "scan_result", client_payload: {repo_name: $repo_name, scan_data: .}}' \
56+
scan-result.json > dispatch-payload.json
57+
58+
# repository_dispatch caps client_payload at ~64KB. When the full
59+
# report is too big, dispatch a counts-only summary instead of
60+
# letting the API reject the whole run with a 422.
61+
if [ "$(wc -c < dispatch-payload.json)" -gt 60000 ]; then
62+
echo "Full report $(wc -c < scan-result.json) bytes exceeds dispatch cap; sending summary"
63+
jq -c --arg repo_name "$REPO_NAME" \
64+
'{event_type: "scan_result", client_payload: {repo_name: $repo_name, scan_data: {
65+
schema_version: .schema_version,
66+
program_path: .program_path,
67+
language: .language,
68+
statistics: .statistics,
69+
suppressed_count: (.suppressed_count // 0),
70+
weak_point_count: (.weak_points | length),
71+
weak_points_by_severity: (.weak_points | map(.severity | tostring) | group_by(.) | map({key: .[0], value: length}) | from_entries),
72+
truncated: true
73+
}}}' scan-result.json > dispatch-payload.json
74+
fi
5175
5276
curl -sf -X POST \
5377
-H "Authorization: Bearer ${DISPATCH_TOKEN}" \
5478
-H "Accept: application/vnd.github+json" \
5579
"https://api.github.com/repos/hyperpolymath/verisimdb-data/dispatches" \
56-
-d "{\"event_type\":\"scan_result\",\"client_payload\":{\"repo_name\":\"$REPO_NAME\",\"scan_data\":$SCAN_DATA}}"
80+
--data @dispatch-payload.json
5781
echo "Dispatched scan results for ${REPO_NAME} to verisimdb-data"

0 commit comments

Comments
 (0)