Repository navigation
ci: pass the Cachix signing key only to the jobs that push - #71
Conversation
|
Thanks, looks good. Since this comes from a fork, CI here runs without the secret, so we'll confirm on the first A note for future PRs: if AI tooling helps with a change, AGENTS.md ("AI-assisted contributions") asks for an |
`CACHIX_SIGNING_KEY` was set at workflow level, so every job had it, including `check_flake` and `release_tooling`, which run repository scripts but never push to the cache. Scope it to `build_test_drivers` and `test_scenario`, the two jobs whose scripts call `cachix push` or `cachix watch-exec`, and set the workflow's token permissions to `contents: read`.
fb85a41 to
230b5e8
Compare
|
Sorry, I rebased this branch onto For future PRs: are you OK with me rebasing your branches when they fall behind |
|
Yes, rebase my branches whenever they fall behind and merge without waiting. Losing the signature on the rebased commits is fine. Thanks for the note on the trailer. I'll add it to the open PRs you've asked on. |
test/nixos-search/ci-test.sh pushed its flake-info build to Cachix when CACHIX_SIGNING_KEY was set. Since #71 scoped the key to build_test_drivers and test_scenario, check_flake no longer has it, so nothing pushes flake-info. The cached build stopped matching when #125 bumped the nixos-search input, and since then every check_flake run builds flake-info and a patched Nix from source, including Nix's test suites: 28-29 min instead of about 1 min on master. check_flake now builds flake-info in its own step and pushes it from a separate step that runs only on pushes to master and is the only step that gets the key. Both run before ci-test.sh, so flake-info, which ci-test.sh runs outside the Nix build sandbox, runs only after the key step. ci-test.sh no longer pushes. Assisted-by: Claude Code (claude-opus-5-5)
test/nixos-search/ci-test.sh pushed its flake-info build to Cachix when CACHIX_SIGNING_KEY was set. Since bitcoinix#71 scoped the key to build_test_drivers and test_scenario, check_flake no longer has it, so nothing pushes flake-info. The cached build stopped matching when bitcoinix#125 bumped the nixos-search input, and since then every check_flake run builds flake-info and a patched Nix from source, including Nix's test suites: 28-29 min instead of about 1 min on master. check_flake now builds flake-info in its own step and pushes it from a separate step that runs only on pushes to master and is the only step that gets the key. Both run before ci-test.sh, so flake-info, which ci-test.sh runs outside the Nix build sandbox, runs only after the key step. ci-test.sh no longer pushes. Assisted-by: Claude Code (claude-opus-5-5)
Problem
test.ymlsetsCACHIX_SIGNING_KEYat workflow level. Every job gets it, includingcheck_flakeandrelease_tooling. Those jobs run repository scripts but never push to the cache. A script that runs in those jobs could sign and upload store paths that every bitcoinix user trusts.Change
CACHIX_SIGNING_KEYonly tobuild_test_driversandtest_scenario. Their scripts callcachix pushandcachix watch-exec.permissions: contents: readat workflow level. No job in this file needs more.Pull requests from forks never receive the secret. That doesn't change. The scripts already handle an empty key.
One side effect:
test/nixos-search/ci-test.shskips its optionalflake-infocache upload incheck_flake. It still builds and runs the test.What this doesn't fix
Job scoping isn't a trust boundary against a contributor with push access to this repository. Such a contributor can edit
test.ymlin a pull request branch and read the key from the two build jobs. GitHub resolves that with a protected environment (key only in an environment thatmastercan use) or by pushing to the cache only onmaster, not on pull requests. That's a repository settings change for the maintainers. This PR only narrows the exposure to the two jobs that need the key.Testing
CI on this PR is the test. The two build jobs must still push to Cachix. The other jobs must still pass.