`mirror-token` is sent to GitHub instead of `token` when `mirror` is set
Mantenedores costumam responder em até 7 dias
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 82/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- github-actions, node.js, typescript
Direção de pesquisa
Comece em src/distributions/official_builds/official_builds.ts, em getManifest e setupNodeJs, onde o issue identifica a seleção das credenciais para a solicitação do manifesto e o download do binário. Leia tests/official-installer.test.ts e os casos existentes de mirror-token, depois adicione cobertura para as credenciais do GitHub e do mirror. O trabalho está concluído quando as solicitações ao GitHub usam o token do GitHub e as solicitações ao mirror continuam usando mirror-token.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Description:
When both mirror and mirror-token are set, setup-node sends the mirror token to GitHub. It goes to two places in official_builds.ts:
- The
actions/node-versionsmanifest request throughtc.getManifestFromRepo, ingetManifest. - The binary download through
tc.downloadTool, insetupNodeJs. This URL comes from the manifest'sdownload_url, so it always points togithub.com/actions/node-versions/releases/....
Both use this pattern:
this.nodeInfo.mirror && this.nodeInfo.mirrorToken
? this.nodeInfo.mirrorToken
: this.nodeInfo.auth
This causes two problems:
- Security: A credential meant for a private mirror, such as an Artifactory token, gets sent to a third-party host. Mirror tokens should only go to the mirror.
- Rate limits: Because the mirror token replaces the GitHub
token, manifest calls are made without the GitHub token. That makes them more likely to hit GitHub API rate limits. #1548 fixed this only for the case wheremirror-tokenis empty.
The calls that do go to the mirror already use mirrorToken correctly: getNodeJsVersions, downloadNodejs, and the Windows fallback in base-distribution.ts.
Related: #1412, #1467, #1548, #1661
Action version:
actions/setup-node@v7 (current main, 7.1.0). This happens in every version that sends mirror-token to the manifest request.
Platform:
- Ubuntu
- macOS
- Windows
Runner type:
- Hosted
- Self-hosted
Tools version:
Any Node.js version that is in the actions/node-versions manifest. This doesn't depend on the package manager.
Repro steps:
- Use this step:
- uses: actions/setup-node@v7
with:
node-version: '24.9.0'
mirror: 'https://my-mirror.example.com'
mirror-token: ${{ secrets.MIRROR_TOKEN }}
- Pick a
node-versionthat is in theactions/node-versionsmanifest and not already in the runner's tool cache. - Watch the outgoing requests, for example with a proxy. The manifest request to the GitHub API and the binary download from
github.com/actions/node-versions/releases/...both sendAuthorization: <MIRROR_TOKEN>.
Expected behavior:
Requests to GitHub always use token, sent as token <token> (this.nodeInfo.auth). mirror-token is only sent to URLs built from mirror.
Actual behavior:
mirror-token is sent to the GitHub API and to github.com release downloads instead of the GitHub token. This sends the mirror credential to GitHub, and the manifest call is made without the GitHub token.
Proposed fix:
- In
official_builds.ts, passthis.nodeInfo.authto bothtc.getManifestFromRepoand the manifest-basedtc.downloadToolcall. Remove themirror && mirrorTokenternary. - Add tests to
__tests__/official-installer.test.ts. No current test checks this case. The existingmirror-tokentests only check log messages and that a download happened. With bothmirrorandmirror-tokenset, the new tests should check that:getManifestFromRepois called with'token <token>', not the mirror token.downloadToolgets'token <token>'for thegithub.com/actions/node-versions/releases/...URL.- Requests to the mirror still use
mirror-token.
- Linguagem predominante
- TypeScript
- Estrelas
- 5k
- Forks
- 1.7k
- Merge médio
- 5d 1h
- PRs com merge (30d)
- 1
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Sem guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de actions/setup-node
-
feature request
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
actions/setup-node#1531 · 1 comentário · 4 reações ·
Mantenedores costumam responder em até 7 dias
-
bug: pnpm cache hits provide little install speedup because lockfile verification is not cachedAbertabug needs triage
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 52/100
actions/setup-node#1672 ·
Mantenedores costumam responder em até 7 dias
-
enhancement
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 58/100
actions/setup-node#1670 · 1 comentário ·
Mantenedores costumam responder em até 7 dias
-
Provide `allow-prereleases` (or similar) option for Node.js 27 AlphaTalvez já em andamento @v-priyagupta108 assumiu há 7 dias. Abertafeature request
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 62/100
actions/setup-node#1657 · 5 comentários · 4 reações · 1 responsável ·
Mantenedores costumam responder em até 7 dias
-
Improved error message when a required os lib is missingTalvez já em andamento @OKAN-SOFTWARE assumiu há 20 dias. Abertafeature request
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
actions/setup-node#1651 · 1 comentário ·
Mantenedores costumam responder em até 7 dias
Todas as issues de actions/setup-node
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
solidjs/solid-docs#1716 ·
Mantenedores costumam responder em até 1 dia
-
bug needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
Progress indicated by console logs is off by oneTalvez já em andamento @marceliwac assumiu hoje. Abertabug needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
aws-samples/aws-cdk-examples#1336 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
melgarafael/DeskcommCRM#4999 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
type: bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 2 dias