Skip to content

Commit da04879

Browse files
fix(ci): Phase-2 fleet submission must not fail the security gate (#10)
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 734b043 commit da04879

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
@@ -84,25 +84,73 @@ jobs:
8484

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

0 commit comments

Comments
 (0)