`mirror-token` is sent to GitHub instead of `token` when `mirror` is set
Maintainer antworten meist innerhalb von 7 Tagen
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 82/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- github-actions, node.js, typescript
Rechercherichtung
Beginne in src/distributions/official_builds/official_builds.ts bei getManifest und setupNodeJs, wo der Issue die Auswahl der Zugangsdaten für die Manifestanfrage und den Binärdownload benennt. Lies tests/official-installer.test.ts und die vorhandenen Mirror-Token-Fälle und ergänze Tests für GitHub- und Mirror-Zugangsdaten. Fertig ist es, wenn GitHub-Anfragen das GitHub-Token verwenden und Mirror-Anfragen weiterhin mirror-token verwenden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 5k
- Forks
- 1.7k
- Ø Merge
- 5 T. 1 Std.
- Gemergte PRs (30 T.)
- 1
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus actions/setup-node
-
feature request
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
actions/setup-node#1531 · 1 Kommentar · 4 Reaktionen ·
Maintainer antworten meist innerhalb von 7 Tagen
-
bug: pnpm cache hits provide little install speedup because lockfile verification is not cachedOffenbug needs triage
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 52/100
actions/setup-node#1672 ·
Maintainer antworten meist innerhalb von 7 Tagen
-
enhancement
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 58/100
actions/setup-node#1670 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 7 Tagen
-
Provide `allow-prereleases` (or similar) option for Node.js 27 AlphaEvtl. vergeben @v-priyagupta108 hat das vor 7 Tagen übernommen. Offenfeature request
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 62/100
actions/setup-node#1657 · 5 Kommentare · 4 Reaktionen · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 7 Tagen
-
Improved error message when a required os lib is missingEvtl. vergeben @OKAN-SOFTWARE hat das vor 20 Tagen übernommen. Offenfeature request
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
actions/setup-node#1651 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 7 Tagen
Alle Issues in actions/setup-node
Ähnliche Issues
-
type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
db-ux-design-system/core-web#8856 ·
Maintainer antworten meist innerhalb von 1 Tag
-
'!' breaking change is lost when the commit also has an empty BREAKING CHANGE footerEvtl. vergeben @wittdennis hat das heute übernommen. Offenpriority: p3 type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
googleapis/release-please#2971 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 87/100
Maintainer antworten meist innerhalb von 1 Tag
-
🛠️ dette technique
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 61/100
betagouv/mon-entreprise#4752 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 5 Tagen