* fix(ci-policy): close review leftovers from #7485/#7486
Follow-ups from maintainer review on the host-tool exec/shell policy
tests and the bazel.yml integration gate:
- host_tool_shell_policy_test.go: recognize indented function headers
and `function name {` forms when finding a function's closing brace,
so scripts/test.sh's indented cleanup_shared_server() no longer
mis-attributes its trailing lines to the wrong function; classify
same-line `command -v gofmt && gofmt` (and `go`) as the guarded
presence-check idiom instead of flagging it.
- host_tool_exec_policy_test.go: make condPolarity reject mixed-polarity
&& / || compounds (one recognized side, one not) instead of guessing
at the recognized side's polarity, which was unsound in both
directions; add pinning tests documenting the exec-before-gate and
function-value-helper cases as known, safety-conservative limitations
rather than bugs. Fixing this exposed a real ungated fallback in
cmd/bd/scripttest_test.go (a `go build` that could still run under
Bazel on a prebuilt-binary basename mismatch); fixed by symlinking the
prebuilt binary under the expected name instead of rebuilding it.
- bazel.yml: bazel-server-storage now honors the `integration` input
like bazel-integration/bazel-cmd-dolt do, so an explicit "off" skips
it too (latent today: no caller passes "off"). Updated
ci_workflow_test.go's policy tests to match.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ci-policy): close should-fix B (go command -v guard evasion) on #7491
shellCommandVGuard previously excused go the same as gofmt, but under an
exit-127 host-tool stub `command -v` finds the stub and the guarded exec
still runs, and on a worker genuinely lacking go the exec was silently
skipped -- the worker-dependent behavior this policy exists to ban. Drop
go from the guard entirely, require the guarded exec to sit directly after
the guard's own `&&` (no intervening `;`, `||`, `|`, or leading `!`), and
require an exact gofmt match so a same-prefixed sibling like `gofmt-foo`/
`go-junit-report` can't borrow the guard. Add every should-fix B shape as
a fixture that must still be flagged, plus the generalized gofmt-side
cases (leading `!`, exact-name, post-`;` exec).
Also: correct host_tool_exec_policy_test.go's doc claim that a
function-value helper call site is "not a soundness hole" -- mixed with
one gated direct call site, the invisible function-value call site's
ungated-ness is silently lost and the combined verdict flips to gated;
pinned as review M22. And recognize a function closed by `} >&2` as
ended, so abort-style safety computed inside it does not leak into the
rest of the file (no scoped script has this shape today, but a bare `}`
equality check would silently miss it the moment one does).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>