Skip to content

ci(windows): replace taiki-e/install-action with cargo-binstall (BASH_FUNC_* leak on windows-latest) #137

Open

Description

@utof

Summary

`taiki-e/install-action` fails on `windows-latest` with `::error::bash function injection via BASH_FUNC_ environment variable is not allowed for security reasons` and exits non-zero after 10 retries (their built-in mitigation). The same failure recurred on a manual `gh run rerun --failed`, ruling out "transient flake" as a viable workaround.

Reproduction

Two consecutive failed runs on the same branch + same commit, ~3 hours apart, both hit the identical PowerShell-side defensive check before bash invocation:

Defensive check inside taiki-e/install-action's `action.yml`:

```pwsh
if (Test-Path "Env:BASH_FUNC_*") {
Write-Output "::error::bash function injection via BASH_FUNC_ environment variable is not allowed for security reasons"
exit 1
}
```

Source: https://github.com/taiki-e/install-action/blob/main/action.yml

Root cause analysis

  1. The `windows-latest` GHA runner image leaks a `BASH_FUNC_%%` environment variable into the PowerShell context spawned for each job step. Source unconfirmed (suspect: a bash function exported by Git for Windows / MSYS2 startup profile that the runner's parent shell inherits).
  2. `taiki-e/install-action`'s defensive check is correct security behavior — Shellshock CVE-2014-6271 mitigation. Letting bash inherit attacker-controlled `BASH_FUNC_` env vars would execute arbitrary code at startup. https://nvd.nist.gov/vuln/detail/CVE-2014-6271
  3. The action's 10-iteration retry loop (taiki-e/install-action#1656, PR #1647) was authored to mitigate a SEPARATE `windows-11-arm` zero-output bug (actions/runner-images#14052). Empirically does NOT catch the `windows-latest` env-leak case (2/2 runs failed across 20+ retries each).

Why "scrub before" doesn't work

GHA env vars don't propagate across step boundaries. Each step starts a fresh PowerShell process inheriting from the runner's parent. `Remove-Item Env:` in step N doesn't affect step N+1. `env:` block in YAML can only SET values, not UNSET; can't satisfy a `Test-Path Env:BASH_FUNC_*` wildcard match.

Proposed fix: cargo-binstall on Windows

Replace `taiki-e/install-action@` with `cargo binstall ` on `windows-latest`. cargo-binstall fetches the same prebuilt release binaries (so no native compile cost) but does NOT go through bash, sidestepping the env leak entirely.

Tradeoffs vs alternatives considered:

Option Cost Reliability
A. Accept upstream flake; rerun on hit 0 reactive — and 2/2 reruns failed here
B. cargo-binstall on Windows (chosen) ~15 LoC YAML, +30s first run for binstall fetch 100% (bypasses bash)
C. `cargo install --locked` (no binstall) ~5 LoC, +12-15 min compile (cached subsequently) 100% but slow

Falsifiability

If a future runner image rolls out a fix (no more `BASH_FUNC_*` leak), the workaround becomes redundant.

Replication test (does the leak still happen?): revert the Windows-specific cargo-binstall step + restore the `taiki-e/install-action@*` calls. If Windows CI passes 5+ consecutive runs across a week, the leak is gone and the workaround can be removed.

Inverse replication (does cargo-binstall fix it?): apply the fix; if Windows CI passes 5+ consecutive runs, the workaround is effective.

References

Activity

  1. added
    type/chore
    area/ci
    on Apr 24, 2026
  2. taiki-e commented on May 1, 2026

    @taiki-e

    Two consecutive failed runs on the same branch + same commit, ~3 hours apart, both hit the identical PowerShell-side defensive check before bash invocation:

    I looked through these logs (including those before the retry), but it doesn’t seem like that error occurred anywhere (the error is occurring in an unrelated location). Is the link incorrect? Or is this just an issue reported by AI hallucinations?

  3. utof commented on May 12, 2026

    @utof
    OwnerAuthor

    @taiki-e this is a heavily vibe-coded project for now, disregard this, it's AI generated.
    There were, though, issues with some env vars in windows CI when trying to use install action, but i have no clue what the heck caused it so i just let claude deal with it.

    didn't know github cross-references links, very sorry for the noise!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/citype/chore

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions