Skip to content

fix(action): strip store paths and stdenv machinery from the env forward - #1361

Merged
c-vigo merged 2 commits into
devfrom
bugfix/1358-env-forward-nix-host-leaks
Aug 7, 2026
Merged

c-vigo merged 2 commits into
devfrom
bugfix/1358-env-forward-nix-host-leaks

Conversation

@c-vigo

@c-vigo c-vigo commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to the #1353 denylist audit: the shellHook env forward (#1180) still shipped Nix-host state to GITHUB_ENV. Three leaks closed:

  • PYTHONPATH store components are stripped, not blanket-denied. The nixpkgs python setup hook fills PYTHONPATH with store site-packages dirs; forwarded to CI they land on the sys.path of the downloaded manylinux CPython — same ABI tag, importable, exactly the mixed-loader shape behind fix(action): shellHook env forward ships UV_PYTHON to CI, defeating the bare-CPython exclusion #1353's ImportError: libstdc++.so.6. The forward loop now splits the value on :, drops /nix/store/* components, forwards the remainder, and skips the var when nothing is left — so the legitimate export PYTHONPATH=$PWD/src shellHook use case survives verbatim. PYTHONPATH only, by design; the pattern is noted as reusable.
  • stdenv machinery the denylist missed: _PYTHON_HOST_PLATFORM, _PYTHON_SYSCONFIGDATA_NAME, DETERMINISTIC_BUILD, CONFIG_SHELL, do[A-Z]* (the symmetric partner of the existing dont*), and the cc/binutils hook names AR AS CC CXX LD NM OBJCOPY OBJDUMP RANLIB READELF SIZE STRINGS STRIP. stdenv sets those in every dev shell as bare names (CC=gcc); inside dev-shell context the wrapped toolchain already wins via PATH (fix(action): setup-devkit-toolchain GITHUB_PATH export reverses dev-shell PATH order #1351), while for steps running outside it a forwarded CC recreates the mixed-toolchain hazard. Two known collisions, both assessed and accepted: the pre-fix(action): setup-devkit-toolchain GITHUB_PATH export reverses dev-shell PATH order #1351 h5v CC/CXX shellHook workaround (superseded — fix(action): setup-devkit-toolchain GITHUB_PATH export reverses dev-shell PATH order #1351 removed the need) and the native capability module's CC=cc/CXX=c++ exports (those generic names exist precisely so build backends fall back to PATH discovery, which GITHUB_PATH already provides on CI).
  • IN_NIX_SHELL — no CI step should claim to run inside a nix shell. The .githooks guard that reads it is local-only (no scaffold workflow commits through it).

The NixOS-self-hosted PATH-filter gap found in the same audit is split out as #1360 and untouched here, as are the UV_PYTHON* entries (#1353) and the GITHUB_PATH write (#1351).

Test plan

  • 8 new parametrized denylist cases + 3 PYTHONPATH value tests (store-only → dropped; mixed → forwarded as exactly the consumer components; consumer-only → verbatim, the direnv-mode CI: setup-devkit-toolchain forwards only PATH, shellHook env is silently dropped #1180 regression guard). RED before the fix: 10 failed, 29 passed, each var visibly landing in GITHUB_ENV.
  • Test-harness hardening that the RED run itself justified: pytest runs inside nix develop, where stdenv exports CC, CONFIG_SHELL, PYTHONPATH, IN_NIX_SHELL, … ambiently — the step's unchanged-var filter would have masked the denylist under test. The subprocess env scrub is now derived from the fixture list instead of a hand-kept 3-var set.
  • Full tests/test_setup_toolchain_env.py + test_renovate_preset_managed_exclusion.py: 42/42 green (verified independently by reviewer); rendered-workflow actionlint bats 5/5; prek run --all-files green.

Follow-up candidate

docs/MIGRATION.md enumerates the denylist in prose and is now stale for both #1353 and #1358 — left untouched per minimal-diff scope; happy to file a docs issue.

Refs: #1358

@c-vigo
c-vigo merged commit bde1a40 into dev Aug 7, 2026
13 checks passed
@c-vigo
c-vigo deleted the bugfix/1358-env-forward-nix-host-leaks branch August 7, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant