Skip to content

Commit e825b8b

Browse files
hyperpolymathclaude
andcommitted
fix(ci): Phase-2 fleet submission must not fail the security gate
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 f8cd78f commit e825b8b

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
@@ -85,25 +85,73 @@ jobs:
8585

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

0 commit comments

Comments
 (0)