Skip to content

Commit 7776387

Browse files
perf(ci): apply PR token hardening to linux pin step
The Linux native build's `pin-nix-deps` step invokes `nix build` and `nix eval` to root the static-build deps. On PR runs from forks the preceding build step uses `NIX_CONFIG="access-tokens ="` so Nix cannot use the GitHub token for fetches; the pin step inherited the default config and bypassed that hardening. Forward the same gate via an `env:` on the composite step so the pin's Nix invocations honor the caller's `nix-github-token` input. Co-authored-by: Codesmith <[email protected]>
1 parent 5b7c773 commit 7776387

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎.github/actions/build-linux-native-package/action.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ runs:
2626
nix build .#ccusage-static --print-build-logs
2727
fi
2828
29+
# Mirror the PR-token hardening from the build step above: on
30+
# `pull_request` runs (nix-github-token == 'false') the pin's `nix build`
31+
# and `nix eval` calls must also disable access tokens.
2932
- uses: ./.github/actions/pin-nix-deps
33+
env:
34+
NIX_CONFIG: ${{ inputs.nix-github-token == 'false' && 'access-tokens =' || '' }}
3035
with:
3136
attr: .#ccusage-static.cargoArtifacts
3237

0 commit comments

Comments
 (0)