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

Abierto
#281 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@FredApps ya está trabajando en esto.

Desde el 17/11/2026.

  • #282 de @FredApps — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
github-actions, typescript
Área
ci-cd, security

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
0
Forks
4
Merge medio
18 h 41 min
PR fusionados (30 d)
48

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de DiffCI/core

Todos los issues de DiffCI/core

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.