Skip to content

Commit 6693e01

Browse files
fix(ci): scan-and-report — skip verisimdb dispatch when VERISIMDB_PAT is absent (#156)
## Summary `VERISIMDB_PAT` is declared **optional** in `scan-and-report.yml`, but consumers without it fall back to `GITHUB_TOKEN` — which is scoped to the calling repo and can never fire a `repository_dispatch` at `verisimdb-data`. Result: every consumer without the PAT gets a red Security Scan at the dispatch step (bare `curl` exit 22), even though the scan itself passed. Seen on echidna run 28842498410 immediately after #155 removed the argv overflow that had been masking it. - **No PAT** → `::notice` + skip the dispatch step; the scan result still gates the job. - **With PAT** → capture `%{http_code}` and print the API response body on rejection, so a real dispatch failure is diagnosable. ## Verification - `actionlint` clean. - Skip path exercised locally (empty `DISPATCH_TOKEN` → notice + exit 0). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 906781f commit 6693e01

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

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

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,17 @@ jobs:
4444
- name: Send to verisimdb-data
4545
if: steps.scan.outputs.scan_complete == 'true'
4646
env:
47-
DISPATCH_TOKEN: ${{ secrets.VERISIMDB_PAT || secrets.GITHUB_TOKEN }}
47+
DISPATCH_TOKEN: ${{ secrets.VERISIMDB_PAT }}
4848
run: |
49+
# VERISIMDB_PAT is declared optional. Cross-repo dispatch is
50+
# impossible with the workflow's own GITHUB_TOKEN (it is scoped
51+
# to the calling repo), so without the PAT we skip rather than
52+
# fail every consumer's Security Scan.
53+
if [ -z "${DISPATCH_TOKEN}" ]; then
54+
echo "::notice::VERISIMDB_PAT not configured; scan passed, skipping cross-repo dispatch to verisimdb-data"
55+
exit 0
56+
fi
57+
4958
REPO_NAME=$(basename $(pwd))
5059
5160
# Build the payload in a file: inlining the scan JSON on argv
@@ -73,9 +82,15 @@ jobs:
7382
}}}' scan-result.json > dispatch-payload.json
7483
fi
7584
76-
curl -sf -X POST \
85+
# Capture the HTTP status so a rejected dispatch says *why*
86+
# instead of a bare curl exit 22.
87+
HTTP_STATUS=$(curl -s -o dispatch-response.json -w "%{http_code}" -X POST \
7788
-H "Authorization: Bearer ${DISPATCH_TOKEN}" \
7889
-H "Accept: application/vnd.github+json" \
7990
"https://api.github.com/repos/hyperpolymath/verisimdb-data/dispatches" \
80-
--data @dispatch-payload.json
81-
echo "Dispatched scan results for ${REPO_NAME} to verisimdb-data"
91+
--data @dispatch-payload.json)
92+
if [ "${HTTP_STATUS}" -ge 300 ]; then
93+
echo "::error::verisimdb-data dispatch failed with HTTP ${HTTP_STATUS}: $(cat dispatch-response.json)"
94+
exit 1
95+
fi
96+
echo "Dispatched scan results for ${REPO_NAME} to verisimdb-data (HTTP ${HTTP_STATUS})"

0 commit comments

Comments
 (0)