chore: Set persist-credentials false on pull-request workflows - #2003
Conversation
actions/checkout stores GITHUB_TOKEN in the local Git config by default, so any repository script or test a pull-request workflow runs from the PR branch can read it. dead-code.yml already disabled credential persistence; the remaining pull-request workflows that execute repository code did not. - Set persist-credentials: false on every actions/checkout step in build-and-test, code-complexity, security-scan, pr-title, and unity-compile-check-and-test-runner. None of them use Git authentication after checkout, so nothing depends on the persisted token. - Add TestPullRequestWorkflowsDisableCredentialPersistence so a future pull-request workflow cannot reintroduce the leak. - Document the rule in docs/github-actions-security.md. Closes #1998
|
Warning Review limit reached
Next review available in: 35 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Summary
GITHUB_TOKENwhere code from the pull-request branch can read it.User Impact
Before:
actions/checkoutdefaults to writingGITHUB_TOKENinto the local Git config(
http.<host>.extraheader). Every pull-request workflow that then executes repository-controlledcode — tests, linters,
go run ./cmd/..., shell scripts — gave that code a readable path to thetoken.
dead-code.ymlwas hardened in #1995, but the other pull-request workflows were not.After: no pull-request workflow persists credentials, so a malicious or compromised change on a
pull-request branch cannot read the workflow token out of Git config. Nothing else changes for
contributors — CI behaves exactly as before.
Changes
persist-credentials: falseon everyactions/checkoutstep inbuild-and-test.yml,code-complexity.yml,security-scan.yml,unity-compile-check-and-test-runner.yml, andpr-title.yml.pr-title.ymlwas not listed in the issue, but it is triggered bypull_requestand runsrepository code (
go run ./cmd/check-pr-title), so it meets the same condition and is fixed here.git push/git fetch/git tagafter checkout, so nothingdepended on the persisted token.
github/codeql-action/*authenticates through the API token inthe environment, not through Git config.
TestPullRequestWorkflowsDisableCredentialPersistence, mirroring the existing setup-go cacheand Unity cache guards, so the rule is enforced instead of remembered.
docs/github-actions-security.md.Release workflows that genuinely push back to the repository are deliberately left untouched.
Verification
Written test-first: the new test initially failed with all 8 offending checkout steps listed, and
passes after the workflow changes.
The workflows touched here all run on this pull request, so their green status is the end-to-end
check that nothing after checkout depends on the removed credentials.
Closes #1998