Skip to content

Commit 3fb6b5d

Browse files
fix(ci): Phase-2 fleet submission must not fail the security gate (#12)
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 53b9931 commit 3fb6b5d

1 file changed

Lines changed: 55 additions & 8 deletions

File tree

.github/workflows/hypatia-scan.yml

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,26 +107,73 @@ jobs:
107107

108108
- name: Submit findings to gitbot-fleet (Phase 2)
109109
if: steps.scan.outputs.findings_count > 0
110-
continue-on-error: true # external service; never block on its outage
110+
# Phase 2 is the collaborative LEARNING side-channel ("bots share
111+
# findings via gitbot-fleet"), not the security gate. The gate is
112+
# the baseline-aware "Check for critical or high-severity issues"
113+
# step below. A fleet-side regression (e.g. the submit script being
114+
# moved/removed) must NEVER hard-fail every consuming repo's scan.
115+
# Same reasoning as the "Comment on PR with findings" step.
116+
# See hyperpolymath/hypatia#213 (gate decoupling) and the exit-127
117+
# estate-wide breakage when gitbot-fleet/scripts/submit-finding.sh
118+
# no longer existed on the default branch.
119+
continue-on-error: true
111120
env:
121+
# All GitHub context values surface as env vars so the run
122+
# block never interpolates `${{ … }}` inline (closes the
123+
# workflow_audit/unsafe_curl_payload + actions_expression_injection
124+
# findings).
112125
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126+
FLEET_PUSH_TOKEN: ${{ secrets.HYPATIA_DISPATCH_PAT }}
127+
FLEET_DISPATCH_TOKEN: ${{ secrets.HYPATIA_DISPATCH_PAT }}
113128
GITHUB_REPOSITORY: ${{ github.repository }}
114129
GITHUB_SHA: ${{ github.sha }}
130+
FINDINGS_COUNT: ${{ steps.scan.outputs.findings_count }}
115131
run: |
116-
echo "📤 Submitting ${{ steps.scan.outputs.findings_count }} findings to gitbot-fleet..."
132+
echo "📤 Submitting $FINDINGS_COUNT findings to gitbot-fleet..."
117133
118-
# Clone gitbot-fleet to temp directory
134+
# Clone gitbot-fleet to temp directory. A clone failure (network,
135+
# repo gone) is non-fatal: learning submission is best-effort.
119136
FLEET_DIR="/tmp/gitbot-fleet-$$"
120-
git clone https://github.com/hyperpolymath/gitbot-fleet.git "$FLEET_DIR"
137+
if ! git clone --depth 1 https://github.com/hyperpolymath/gitbot-fleet.git "$FLEET_DIR"; then
138+
echo "::warning::Could not clone gitbot-fleet — skipping Phase 2 learning submission (non-fatal)."
139+
exit 0
140+
fi
121141
122-
# Run submission script
123-
bash "$FLEET_DIR/scripts/submit-finding.sh" hypatia-findings.json
142+
# The submission script's location in gitbot-fleet has drifted
143+
# before (it was absent from the default branch, which exit-127'd
144+
# every consuming repo's scan). Probe known locations rather than
145+
# hard-coding one path, and skip gracefully if none is present.
146+
SUBMIT_SCRIPT=""
147+
for cand in \
148+
"$FLEET_DIR/scripts/submit-finding.sh" \
149+
"$FLEET_DIR/scripts/submit_finding.sh" \
150+
"$FLEET_DIR/bin/submit-finding.sh" \
151+
"$FLEET_DIR/submit-finding.sh"; do
152+
if [ -f "$cand" ]; then
153+
SUBMIT_SCRIPT="$cand"
154+
break
155+
fi
156+
done
157+
158+
if [ -z "$SUBMIT_SCRIPT" ]; then
159+
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."
160+
rm -rf "$FLEET_DIR"
161+
exit 0
162+
fi
163+
164+
# Run submission script. Pass the findings path as ABSOLUTE —
165+
# the script cd's into its own working dir before reading the
166+
# file, so a relative path would resolve to the wrong place.
167+
# A submission-script failure is logged but non-fatal.
168+
if bash "$SUBMIT_SCRIPT" "$GITHUB_WORKSPACE/hypatia-findings.json"; then
169+
echo "✅ Finding submission complete"
170+
else
171+
echo "::warning::gitbot-fleet submission script exited non-zero — Phase 2 learning submission skipped (non-fatal)."
172+
fi
124173
125174
# Cleanup
126175
rm -rf "$FLEET_DIR"
127176
128-
echo "✅ Finding submission complete"
129-
130177
- name: Check for critical issues
131178
if: steps.scan.outputs.critical > 0
132179
run: |

0 commit comments

Comments
 (0)