Skip to content

Commit a542ecf

Browse files
fix(ci): Phase-2 fleet submission must not fail the security gate (#6)
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 39facd9 commit a542ecf

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
@@ -94,25 +94,73 @@ jobs:
9494

9595
- name: Submit findings to gitbot-fleet (Phase 2)
9696
if: steps.scan.outputs.findings_count > 0
97+
# Phase 2 is the collaborative LEARNING side-channel ("bots share
98+
# findings via gitbot-fleet"), not the security gate. The gate is
99+
# the baseline-aware "Check for critical or high-severity issues"
100+
# step below. A fleet-side regression (e.g. the submit script being
101+
# moved/removed) must NEVER hard-fail every consuming repo's scan.
102+
# Same reasoning as the "Comment on PR with findings" step.
103+
# See hyperpolymath/hypatia#213 (gate decoupling) and the exit-127
104+
# estate-wide breakage when gitbot-fleet/scripts/submit-finding.sh
105+
# no longer existed on the default branch.
106+
continue-on-error: true
97107
env:
108+
# All GitHub context values surface as env vars so the run
109+
# block never interpolates `${{ … }}` inline (closes the
110+
# workflow_audit/unsafe_curl_payload + actions_expression_injection
111+
# findings).
98112
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
FLEET_PUSH_TOKEN: ${{ secrets.HYPATIA_DISPATCH_PAT }}
114+
FLEET_DISPATCH_TOKEN: ${{ secrets.HYPATIA_DISPATCH_PAT }}
99115
GITHUB_REPOSITORY: ${{ github.repository }}
100116
GITHUB_SHA: ${{ github.sha }}
117+
FINDINGS_COUNT: ${{ steps.scan.outputs.findings_count }}
101118
run: |
102-
echo "📤 Submitting ${{ steps.scan.outputs.findings_count }} findings to gitbot-fleet..."
119+
echo "📤 Submitting $FINDINGS_COUNT findings to gitbot-fleet..."
103120
104-
# Clone gitbot-fleet to temp directory
121+
# Clone gitbot-fleet to temp directory. A clone failure (network,
122+
# repo gone) is non-fatal: learning submission is best-effort.
105123
FLEET_DIR="/tmp/gitbot-fleet-$$"
106-
git clone https://github.com/hyperpolymath/gitbot-fleet.git "$FLEET_DIR"
124+
if ! git clone --depth 1 https://github.com/hyperpolymath/gitbot-fleet.git "$FLEET_DIR"; then
125+
echo "::warning::Could not clone gitbot-fleet — skipping Phase 2 learning submission (non-fatal)."
126+
exit 0
127+
fi
107128
108-
# Run submission script
109-
bash "$FLEET_DIR/scripts/submit-finding.sh" hypatia-findings.json
129+
# The submission script's location in gitbot-fleet has drifted
130+
# before (it was absent from the default branch, which exit-127'd
131+
# every consuming repo's scan). Probe known locations rather than
132+
# hard-coding one path, and skip gracefully if none is present.
133+
SUBMIT_SCRIPT=""
134+
for cand in \
135+
"$FLEET_DIR/scripts/submit-finding.sh" \
136+
"$FLEET_DIR/scripts/submit_finding.sh" \
137+
"$FLEET_DIR/bin/submit-finding.sh" \
138+
"$FLEET_DIR/submit-finding.sh"; do
139+
if [ -f "$cand" ]; then
140+
SUBMIT_SCRIPT="$cand"
141+
break
142+
fi
143+
done
144+
145+
if [ -z "$SUBMIT_SCRIPT" ]; then
146+
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."
147+
rm -rf "$FLEET_DIR"
148+
exit 0
149+
fi
150+
151+
# Run submission script. Pass the findings path as ABSOLUTE —
152+
# the script cd's into its own working dir before reading the
153+
# file, so a relative path would resolve to the wrong place.
154+
# A submission-script failure is logged but non-fatal.
155+
if bash "$SUBMIT_SCRIPT" "$GITHUB_WORKSPACE/hypatia-findings.json"; then
156+
echo "✅ Finding submission complete"
157+
else
158+
echo "::warning::gitbot-fleet submission script exited non-zero — Phase 2 learning submission skipped (non-fatal)."
159+
fi
110160
111161
# Cleanup
112162
rm -rf "$FLEET_DIR"
113163
114-
echo "✅ Finding submission complete"
115-
116164
- name: Check for critical issues
117165
if: steps.scan.outputs.critical > 0
118166
run: |

0 commit comments

Comments
 (0)