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

Aberta
#281 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@FredApps já está trabalhando nisso.

Desde 17/11/2026.

  • #282 de @FredApps — aberto

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
35/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
github-actions, typescript
Domínio
ci-cd, security

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
TypeScript
Estrelas
0
Forks
4
Merge médio
18h 41min
PRs com merge (30d)
48

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de DiffCI/core

Todas as issues de DiffCI/core

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.