Skip to content

Commit 1ebb314

Browse files
hyperpolymathclaude
andcommitted
fix(ci): Phase-2 fleet submission must not fail the security gate
Layer-1 propagation of hyperpolymath/hypatia#252. This repo's own copy of hypatia-scan.yml hard-failed (exit 127) for any commit with >=1 finding: the "Submit findings to gitbot-fleet (Phase 2)" step cloned gitbot-fleet and exec'd scripts/submit-finding.sh, which no longer exists on gitbot-fleet's default branch. Phase 2 is the collaborative LEARNING side-channel, not the security gate. Fix: continue-on-error + self-healing body (non-fatal clone, probe known script paths, graceful ::warning:: skip). Security enforcement (the baseline-aware critical/high step) is unchanged. Refs hyperpolymath/hypatia#252 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f580fb8 commit 1ebb314

1 file changed

Lines changed: 53 additions & 15 deletions

File tree

.github/workflows/hypatia-scan.yml

Lines changed: 53 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,30 +91,68 @@ jobs:
9191

9292
- name: Submit findings to gitbot-fleet (Phase 2)
9393
if: steps.scan.outputs.findings_count > 0
94+
# Phase 2 is the collaborative LEARNING side-channel ("bots share
95+
# findings via gitbot-fleet"), not the security gate. The gate is
96+
# the baseline-aware "Check for critical or high-severity issues"
97+
# step below. A fleet-side regression (e.g. the submit script being
98+
# moved/removed) must NEVER hard-fail every consuming repo's scan.
99+
# Same reasoning as the "Comment on PR with findings" step.
100+
# See hyperpolymath/hypatia#213 (gate decoupling) and the exit-127
101+
# estate-wide breakage when gitbot-fleet/scripts/submit-finding.sh
102+
# no longer existed on the default branch.
103+
continue-on-error: true
94104
env:
105+
# All GitHub context values surface as env vars so the run
106+
# block never interpolates `${{ … }}` inline (closes the
107+
# workflow_audit/unsafe_curl_payload + actions_expression_injection
108+
# findings).
95109
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110+
FLEET_PUSH_TOKEN: ${{ secrets.HYPATIA_DISPATCH_PAT }}
111+
FLEET_DISPATCH_TOKEN: ${{ secrets.HYPATIA_DISPATCH_PAT }}
96112
GITHUB_REPOSITORY: ${{ github.repository }}
97113
GITHUB_SHA: ${{ github.sha }}
114+
FINDINGS_COUNT: ${{ steps.scan.outputs.findings_count }}
98115
run: |
99-
echo "📤 Submitting ${{ steps.scan.outputs.findings_count }} findings to gitbot-fleet..."
116+
echo "📤 Submitting $FINDINGS_COUNT findings to gitbot-fleet..."
100117
101-
# Clone gitbot-fleet to temp directory
118+
# Clone gitbot-fleet to temp directory. A clone failure (network,
119+
# repo gone) is non-fatal: learning submission is best-effort.
102120
FLEET_DIR="/tmp/gitbot-fleet-$$"
103-
git clone --depth 1 https://github.com/hyperpolymath/gitbot-fleet.git "$FLEET_DIR"
104-
105-
# Run submission script if it exists. The fleet repository is the
106-
# planned destination for Phase 2 -- the script is not authored
107-
# yet (`scripts/` is empty in hyperpolymath/gitbot-fleet), so guard
108-
# the call instead of hard-failing. When the script lands this
109-
# step starts submitting automatically; until then the Phase 1
110-
# artifact (`hypatia-findings.json`) is still uploaded above and
111-
# the PR comment below still posts.
112-
SUBMIT_SCRIPT="$FLEET_DIR/scripts/submit-finding.sh"
113-
if [ -f "$SUBMIT_SCRIPT" ]; then
114-
bash "$SUBMIT_SCRIPT" hypatia-findings.json
121+
if ! git clone --depth 1 https://github.com/hyperpolymath/gitbot-fleet.git "$FLEET_DIR"; then
122+
echo "::warning::Could not clone gitbot-fleet — skipping Phase 2 learning submission (non-fatal)."
123+
exit 0
124+
fi
125+
126+
# The submission script's location in gitbot-fleet has drifted
127+
# before (it was absent from the default branch, which exit-127'd
128+
# every consuming repo's scan). Probe known locations rather than
129+
# hard-coding one path, and skip gracefully if none is present.
130+
SUBMIT_SCRIPT=""
131+
for cand in \
132+
"$FLEET_DIR/scripts/submit-finding.sh" \
133+
"$FLEET_DIR/scripts/submit_finding.sh" \
134+
"$FLEET_DIR/bin/submit-finding.sh" \
135+
"$FLEET_DIR/submit-finding.sh"; do
136+
if [ -f "$cand" ]; then
137+
SUBMIT_SCRIPT="$cand"
138+
break
139+
fi
140+
done
141+
142+
if [ -z "$SUBMIT_SCRIPT" ]; then
143+
echo "::warning::gitbot-fleet submit-finding script not found at any known path — skipping Phase 2 learning submission (non-fatal). Findings are still uploaded as an artifact and gated below."
144+
rm -rf "$FLEET_DIR"
145+
exit 0
146+
fi
147+
148+
# Run submission script. Pass the findings path as ABSOLUTE —
149+
# the script cd's into its own working dir before reading the
150+
# file, so a relative path would resolve to the wrong place.
151+
# A submission-script failure is logged but non-fatal.
152+
if bash "$SUBMIT_SCRIPT" "$GITHUB_WORKSPACE/hypatia-findings.json"; then
115153
echo "✅ Finding submission complete"
116154
else
117-
echo "::warning::gitbot-fleet/scripts/submit-finding.sh is not yet authored; skipping Phase 2 submission. Findings remain available as the hypatia-findings artifact."
155+
echo "::warning::gitbot-fleet submission script exited non-zero — Phase 2 learning submission skipped (non-fatal)."
118156
fi
119157
120158
# Cleanup

0 commit comments

Comments
 (0)