ci: don't persist credentials for read-only nixpkgs checkout#42
Conversation
The nixpkgs-update workflow checks out NixOS/nixpkgs only to read it and compute a version bump locally; the resulting PR is pushed to the smorin/nixpkgs fork via peter-evans/create-pull-request using its own NIXPKGS_UPDATE_TOKEN, never via the checkout's persisted credentials. Set persist-credentials: false so the default GITHUB_TOKEN is used for the initial clone only and stripped from .git/config afterward, preventing later steps from reading or misusing it.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA single line, Changesnixpkgs-update Workflow Hardening
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR hardens the nixpkgs update workflow by ensuring the GitHub token used for the read-only NixOS/nixpkgs checkout is not persisted into the local git config, reducing the risk of later steps accessing credentials unnecessarily.
Changes:
- Add
persist-credentials: falseto theactions/checkoutstep that clonesNixOS/nixpkgsfor local diff/version computation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
What
Add
persist-credentials: falseto theNixOS/nixpkgscheckout in.github/workflows/nixpkgs-update.yml.Why
That step checks out
NixOS/nixpkgsonly to read it and compute a version bump locally. The resulting PR is pushed to thesmorin/nixpkgsfork bypeter-evans/create-pull-requestusing its ownNIXPKGS_UPDATE_TOKEN(push-to-fork) — never the checkout's persisted credentials. The only other git use isgit diff(read-only).By default
actions/checkoutpersists the token into.git/configafter cloning. Since no later step needs it, persisting it only widens the window for a later step to read or misuse the credential.persist-credentials: falseuses the token for the initial clone only, then strips it.Scope notes
release-please.ymlwas deliberately left unchanged: its checkout uses a write token and a later step runsgit push, which requires the persisted credentials.Validation
nixpkgs-update.ymlisworkflow_dispatch-only, so this change does not affect PR/push CI.uses:pin was not touched.https://claude.ai/code/session_016wuFKi9GQvDfT6kARKn36F
Generated by Claude Code
Summary by CodeRabbit