Workflows: publish and merge-gate leave a write-scoped token in .git/config while npm install scripts run

Open
#281 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@FredApps is already working on this.

Since Nov 17, 2026.

  • #282 by @FredApps — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
github-actions, typescript
Domain
ci-cd, security

Research direction

Read .github/workflows/release-cli.yml and .github/workflows/ci.yml, focusing on the publish and merge-gate checkouts and the later npm ci steps. Set persist-credentials: false for both checkouts, then verify neither job relies on the stored credential for a Git operation; pull request #282 is already open against this issue.

Written by the indexing model from the issue text.

Description

Two jobs check out the repository with the default persist-credentials: true while their GITHUB_TOKEN has a write scope, then run npm ci with install scripts enabled:

Workflow Job Token scopes Later step that runs third-party code
release-cli.yml publish contents: write, id-token: write npm ci --no-audit --fund=false in packages/diffci-cli (scripts on)
ci.yml merge-gate checks: write npm ci --no-audit --fund=false in packages/diffci-cli (scripts on)

actions/checkout writes the job token into .git/config as an http.https://github.com/.extraheader entry, where every later step in the job can read it, including a dependency's preinstall/postinstall script. In publish that token can push to main, move tags and edit releases.

Neither job needs the stored credential:

  • publish creates the GitHub Release, the action-v tag and the release assets through gh/the API with GH_TOKEN, and GIT_SSH_COMMAND is already /bin/false. Its only git commands read history (rev-parse), and its checkout has fetch-depth: 0, so the Action smoke never fetches.
  • merge-gate posts its check run with the Action's github-token input. The Action's --unshallow fetch of a public repository works without credentials.

scorecard.yml, codeql.yml and rust-replay.yml already set persist-credentials: false. credit-contributors.yml needs the stored token because it runs git push.

Reproduce

grep -n -A3 'actions/checkout' .github/workflows/release-cli.yml: the publish job's checkout sets only fetch-depth: 0, and the job has contents: write. The same is true for merge-gate in ci.yml, with checks: write.

Expected: a job whose token can write, and that does not git push, checks out with persist-credentials: false.

Dominant language
TypeScript
Stars
0
Forks
4
Avg merge
18h 41m
Merged PRs (30d)
48

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DiffCI/core

All issues in DiffCI/core

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.