Skip to content

Commit c45d0e2

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

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
@@ -83,25 +83,73 @@ jobs:
8383

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

0 commit comments

Comments
 (0)