Stop persisting git credentials in CI workflow checkouts - #6255
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6255 +/- ##
==========================================
- Coverage 72.72% 72.71% -0.02%
==========================================
Files 742 742
Lines 77299 77299
==========================================
- Hits 56217 56206 -11
- Misses 17117 17130 +13
+ Partials 3965 3963 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rdimitrov
previously approved these changes
Aug 10, 2026
actions/checkout writes the job token into .git/config and leaves it there for the rest of the job unless told otherwise. None of these jobs push, so the credential is available to every subsequent step and every tool they invoke for no reason. Covers the CI workflows only. Excluded: the release workflows, which no pull request can exercise; the three running claude-code-action, which has broad shell access and may need to push; api-compat.yml, which does a `git fetch` and is the repository's only required status check; and security-scan.yml, whose checkout is handled in the zizmor PR. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The Grype and govulncheck jobs only read the tree — anchore/scan-action scans the filesystem and govulncheck-action runs with repo-checkout false — so neither needs the token left in .git/config. These were held back from the previous commit only because #6251 also edits this file. A trial merge of the two branches is clean, so there is no reason to defer them further. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ChrisJBurns
force-pushed
the
harden-checkout-credentials
branch
from
August 10, 2026 16:31
b0ca65b to
12331f6
Compare
rdimitrov
approved these changes
Aug 10, 2026
10 tasks
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
actions/checkoutstores the job token in.git/configand leaves it there. Every subsequent step in the job — and every tool those steps invoke, including build scripts and test suites pulling in third-party code — can read it.persist-credentials: falsescopes the credential to the checkout itself.git diff/git status/git ls-tree, all of which are local operations that need no credential. This is 20 checkouts across 12 CI workflows.artipackedgoes 37 → 17. The 17 that remain are excluded deliberately, not missed:create-release-pr,create-release-tag,helm-publish,releaserimage-build-and-publish,skills-build-and-publishclaude.yml,issue-triage.yml,release-notes.ymlclaude-code-action, which has broad shell access and may legitimately need to pushapi-compat.ymlgit fetch origin refs/tags/..., and is the repo's only required status check — breaking it blocks every PRsecurity-scan.yml's two checkouts (Grype and govulncheck) were initially held back because #6251 also edits that file, but a trial merge of the two branches is clean, so they are included here. Note #6251 does not fix them — it adds a third checkout that is already clean.Part of #6253
Type of change
Test plan
Unit tests (
task test)E2E tests (
task test-e2e)Linting (
task lint-fix)Manual testing (describe below)
Audited every touched workflow for operations that need the credential:
git push,git commit, PR-creating actions, and submodules. The onlygit pushin the repo is increate-release-tag.yml, which is excluded; there are no submodules anywhere.All workflows still parse as YAML, including the two distinct checkout forms (bare
- uses:and- name:+uses:with an existingwith:block such asfetch-depth: 0).actionlintoutput is byte-identical before and after apart from line-number shifts — 12 findings both ways, all pre-existing.zizmorartipacked37 → 17, with the remainder matching the exclusion table above exactly.Trial-merged this branch with Add zizmor to CI and stop double-running the security scan #6251's to confirm the overlapping
security-scan.ymledits do not conflict.Every one of the 12 workflows runs on pull requests, either directly or via
run-on-pr.yml, so this PR exercises all of them. If a credential were actually needed somewhere, it fails here rather than after merge.Does this introduce a user-facing change?
No.
Special notes for reviewers
operator-ci.ymlchanges are the same edit repeated per job.helm-charts-test.yml: its checkout already had awith: fetch-depth: 0, so the new key is appended to the existing block rather than introducing a new one.Generated with Claude Code