ci: disable persisted credentials in checkout steps#445
Conversation
Set `persist-credentials: false` on every `actions/checkout` step in the CD, CI and dependency-check workflows, so the GitHub token is not left behind in the local Git config while repository-controlled npm commands run. This shortens the window in which the workflow token is available to build and packaging steps. All affected jobs are read-only: none push, tag, or otherwise use the persisted credentials, and both `permissions:` blocks are already `contents: read`. The qlty job keeps `fetch-depth: 0` (credentials are only dropped after the fetch), and the drift check's `git diff` is a purely local operation, so checkout behaviour is otherwise unchanged. `.github/workflows/e2e.yml` already set the flag and is left untouched. Closes #444 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01129DHTrr8BrrnBCaiLVzYv
|
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 (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe CI, dependency, and package workflows update every affected Estimated code review effort: 1 (Trivial) | ~3 minutes 🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8).github/workflows/cd.ymlTraceback (most recent call last): .github/workflows/ci.ymlTraceback (most recent call last): .github/workflows/deps.ymlTraceback (most recent call last): Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #445 +/- ##
===========================
===========================
🚀 New features to boost your workflow:
|
m1so
left a comment
There was a problem hiding this comment.
LGTM ✅
(although there are now merge conflicts)
Closes #444
Summary
Sets
persist-credentials: falseon everyactions/checkoutstep incd.yml,ci.ymlanddeps.yml, so the GitHub token is not written into the local Git config while repository-controlled npm commands (npm ci,npm install,npm run package,npx better-npm-audit, …) run in those jobs.Follow-up to the review comment on #422 (discussion_r3613084710).
Changes
.github/workflows/cd.ymlpackage).github/workflows/ci.ymllint,typecheck,qlty,build,check_licenses,spell-check,package-lock-drift-check,audit-prod,audit-all).github/workflows/deps.ymlaudit,check-deps).github/workflows/e2e.ymlWhy this is safe
Every affected job is read-only — none pushes, tags, or otherwise consumes the persisted credentials, and each workflow's
permissions:block is alreadycontents: read. Two jobs touch git and were checked specifically:qltykeeps itsfetch-depth: 0.persist-credentials: falseonly strips the auth header after the fetch completes, so full history is still cloned.package-lock-drift-checkrunsgit diff --exit-code HEAD, a purely local operation that needs no credentials.Verification
persist-credentials: false(12 changed here + 1 pre-existing ine2e.yml).prettier --check '.github/**/*.yml'passes —.github/**/*.ymlis covered bynpm run formatin CI.Acceptance criteria
actions/checkoutstep in the affected workflows setspersist-credentials: false..github/workflows/e2e.ymlremains unchanged.🤖 Generated with Claude Code
https://claude.ai/code/session_01129DHTrr8BrrnBCaiLVzYv
Summary by CodeRabbit