Skip to content

Commit 5b272d2

Browse files
fix(ci): Phase-2 fleet submission must not fail the security gate (#7)
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 bac490d commit 5b272d2

1 file changed

Lines changed: 55 additions & 7 deletions

File tree

.github/workflows/hypatia-scan.yml

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,73 @@ jobs:
8181

8282
- name: Submit findings to gitbot-fleet (Phase 2)
8383
if: steps.scan.outputs.findings_count > 0
84+
# Phase 2 is the collaborative LEARNING side-channel ("bots share
85+
# findings via gitbot-fleet"), not the security gate. The gate is
86+
# the baseline-aware "Check for critical or high-severity issues"
87+
# step below. A fleet-side regression (e.g. the submit script being
88+
# moved/removed) must NEVER hard-fail every consuming repo's scan.
89+
# Same reasoning as the "Comment on PR with findings" step.
90+
# See hyperpolymath/hypatia#213 (gate decoupling) and the exit-127
91+
# estate-wide breakage when gitbot-fleet/scripts/submit-finding.sh
92+
# no longer existed on the default branch.
93+
continue-on-error: true
8494
env:
95+
# All GitHub context values surface as env vars so the run
96+
# block never interpolates `${{ … }}` inline (closes the
97+
# workflow_audit/unsafe_curl_payload + actions_expression_injection
98+
# findings).
8599
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100+
FLEET_PUSH_TOKEN: ${{ secrets.HYPATIA_DISPATCH_PAT }}
101+
FLEET_DISPATCH_TOKEN: ${{ secrets.HYPATIA_DISPATCH_PAT }}
86102
GITHUB_REPOSITORY: ${{ github.repository }}
87103
GITHUB_SHA: ${{ github.sha }}
104+
FINDINGS_COUNT: ${{ steps.scan.outputs.findings_count }}
88105
run: |
89-
echo "📤 Submitting ${{ steps.scan.outputs.findings_count }} findings to gitbot-fleet..."
106+
echo "📤 Submitting $FINDINGS_COUNT findings to gitbot-fleet..."
90107
91-
# Clone gitbot-fleet to temp directory
108+
# Clone gitbot-fleet to temp directory. A clone failure (network,
109+
# repo gone) is non-fatal: learning submission is best-effort.
92110
FLEET_DIR="/tmp/gitbot-fleet-$$"
93-
git clone https://github.com/hyperpolymath/gitbot-fleet.git "$FLEET_DIR"
111+
if ! git clone --depth 1 https://github.com/hyperpolymath/gitbot-fleet.git "$FLEET_DIR"; then
112+
echo "::warning::Could not clone gitbot-fleet — skipping Phase 2 learning submission (non-fatal)."
113+
exit 0
114+
fi
94115
95-
# Run submission script
96-
bash "$FLEET_DIR/scripts/submit-finding.sh" hypatia-findings.json
116+
# The submission script's location in gitbot-fleet has drifted
117+
# before (it was absent from the default branch, which exit-127'd
118+
# every consuming repo's scan). Probe known locations rather than
119+
# hard-coding one path, and skip gracefully if none is present.
120+
SUBMIT_SCRIPT=""
121+
for cand in \
122+
"$FLEET_DIR/scripts/submit-finding.sh" \
123+
"$FLEET_DIR/scripts/submit_finding.sh" \
124+
"$FLEET_DIR/bin/submit-finding.sh" \
125+
"$FLEET_DIR/submit-finding.sh"; do
126+
if [ -f "$cand" ]; then
127+
SUBMIT_SCRIPT="$cand"
128+
break
129+
fi
130+
done
131+
132+
if [ -z "$SUBMIT_SCRIPT" ]; then
133+
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."
134+
rm -rf "$FLEET_DIR"
135+
exit 0
136+
fi
137+
138+
# Run submission script. Pass the findings path as ABSOLUTE —
139+
# the script cd's into its own working dir before reading the
140+
# file, so a relative path would resolve to the wrong place.
141+
# A submission-script failure is logged but non-fatal.
142+
if bash "$SUBMIT_SCRIPT" "$GITHUB_WORKSPACE/hypatia-findings.json"; then
143+
echo "✅ Finding submission complete"
144+
else
145+
echo "::warning::gitbot-fleet submission script exited non-zero — Phase 2 learning submission skipped (non-fatal)."
146+
fi
97147
98148
# Cleanup
99149
rm -rf "$FLEET_DIR"
100150
101-
echo "✅ Finding submission complete"
102-
103151
- name: Check for critical issues
104152
if: steps.scan.outputs.critical > 0
105153
run: |

0 commit comments

Comments
 (0)