Skip to content

Commit bab0051

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

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
@@ -95,25 +95,73 @@ jobs:
9595

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

0 commit comments

Comments
 (0)