fix: remove hardcoded bearer#1467
Conversation
8088193 to
0e2c5c9
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes an inconsistency in how the mirror-token is used across the codebase. Previously, the token was hardcoded with a "Bearer" prefix in one location (getNodeJsVersions method) but used as-is in all other locations (downloadTool calls). This inconsistency made the mirror feature unusable because users had to choose between making one call work or the others. The fix removes the hardcoded "Bearer" prefix, requiring users to explicitly include the authentication scheme in their token if needed.
Changes:
- Removed hardcoded "Bearer" prefix from Authorization header in
getNodeJsVersionsmethod - Updated compiled distribution file to reflect source changes
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/distributions/base-distribution.ts | Removes "Bearer" prefix from Authorization header to make token usage consistent |
| dist/setup/index.js | Compiled distribution reflecting the source change |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @aparnajyothi-y, @priyagupta108 can you please take a look |
|
friendly ping |
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4.4.0 to 6.3.0. Release notes *Sourced from [actions/setup-node's releases](https://github.com/actions/setup-node/releases).* > v6.3.0 > ------ > > What's Changed > -------------- > > ### Enhancements: > > * Support parsing `devEngines` field by [`@susnux`](https://github.com/susnux) in [actions/setup-node#1283](https://redirect.github.com/actions/setup-node/pull/1283) > > > When using node-version-file: package.json, setup-node now prefers devEngines.runtime over engines.node. > > ### Dependency updates: > > * Fix npm audit issues by [`@gowridurgad`](https://github.com/gowridurgad) in [actions/setup-node#1491](https://redirect.github.com/actions/setup-node/pull/1491) > * Replace uuid with crypto.randomUUID() by [`@trivikr`](https://github.com/trivikr) in [actions/setup-node#1378](https://redirect.github.com/actions/setup-node/pull/1378) > * Upgrade minimatch from 3.1.2 to 3.1.5 by [`@dependabot`](https://github.com/dependabot) in [actions/setup-node#1498](https://redirect.github.com/actions/setup-node/pull/1498) > > ### Bug fixes: > > * Remove hardcoded bearer for mirror-url [`@marco-ippolito`](https://github.com/marco-ippolito) in [actions/setup-node#1467](https://redirect.github.com/actions/setup-node/pull/1467) > * Scope test lockfiles by package manager and update cache tests by [`@gowridurgad`](https://github.com/gowridurgad) in [actions/setup-node#1495](https://redirect.github.com/actions/setup-node/pull/1495) > > New Contributors > ---------------- > > * [`@susnux`](https://github.com/susnux) made their first contribution in [actions/setup-node#1283](https://redirect.github.com/actions/setup-node/pull/1283) > > **Full Changelog**: <actions/setup-node@v6...v6.3.0> > > v6.2.0 > ------ > > What's Changed > -------------- > > ### Documentation > > * Documentation update related to absence of Lockfile by [`@mahabaleshwars`](https://github.com/mahabaleshwars) in [actions/setup-node#1454](https://redirect.github.com/actions/setup-node/pull/1454) > * Correct mirror option typos by [`@MikeMcC399`](https://github.com/MikeMcC399) in [actions/setup-node#1442](https://redirect.github.com/actions/setup-node/pull/1442) > * Readme update on checkout version v6 by [`@deining`](https://github.com/deining) in [actions/setup-node#1446](https://redirect.github.com/actions/setup-node/pull/1446) > * Readme typo fixes [`@munyari`](https://github.com/munyari) in [actions/setup-node#1226](https://redirect.github.com/actions/setup-node/pull/1226) > * Advanced document update on checkout version v6 by [`@aparnajyothi-y`](https://github.com/aparnajyothi-y) in [actions/setup-node#1468](https://redirect.github.com/actions/setup-node/pull/1468) > > ### Dependency updates: > > * Upgrade `@actions/cache` to v5.0.1 by [`@salmanmkc`](https://github.com/salmanmkc) in [actions/setup-node#1449](https://redirect.github.com/actions/setup-node/pull/1449) > > New Contributors > ---------------- > > * [`@mahabaleshwars`](https://github.com/mahabaleshwars) made their first contribution in [actions/setup-node#1454](https://redirect.github.com/actions/setup-node/pull/1454) > * [`@MikeMcC399`](https://github.com/MikeMcC399) made their first contribution in [actions/setup-node#1442](https://redirect.github.com/actions/setup-node/pull/1442) > * [`@deining`](https://github.com/deining) made their first contribution in [actions/setup-node#1446](https://redirect.github.com/actions/setup-node/pull/1446) > * [`@munyari`](https://github.com/munyari) made their first contribution in [actions/setup-node#1226](https://redirect.github.com/actions/setup-node/pull/1226) > > **Full Changelog**: <actions/setup-node@v6...v6.2.0> > > v6.1.0 > ------ > > What's Changed > -------------- > > ### Enhancement: > > * Remove always-auth configuration handling by [`@priyagupta108`](https://github.com/priyagupta108) in [actions/setup-node#1436](https://redirect.github.com/actions/setup-node/pull/1436) > > ### Dependency updates: > > * Upgrade `@actions/cache` from 4.0.3 to 4.1.0 by [`@dependabot`](https://github.com/dependabot)[bot] in [actions/setup-node#1384](https://redirect.github.com/actions/setup-node/pull/1384) > * Upgrade actions/checkout from 5 to 6 by [`@dependabot`](https://github.com/dependabot)[bot] in [actions/setup-node#1439](https://redirect.github.com/actions/setup-node/pull/1439) ... (truncated) Commits * [`53b8394`](actions/setup-node@53b8394) Bump minimatch from 3.1.2 to 3.1.5 ([#1498](https://redirect.github.com/actions/setup-node/issues/1498)) * [`54045ab`](actions/setup-node@54045ab) Scope test lockfiles by package manager and update cache tests ([#1495](https://redirect.github.com/actions/setup-node/issues/1495)) * [`c882bff`](actions/setup-node@c882bff) Replace uuid with crypto.randomUUID() ([#1378](https://redirect.github.com/actions/setup-node/issues/1378)) * [`774c1d6`](actions/setup-node@774c1d6) feat(node-version-file): support parsing `devEngines` field ([#1283](https://redirect.github.com/actions/setup-node/issues/1283)) * [`efcb663`](actions/setup-node@efcb663) fix: remove hardcoded bearer ([#1467](https://redirect.github.com/actions/setup-node/issues/1467)) * [`d02c89d`](actions/setup-node@d02c89d) Fix npm audit issues ([#1491](https://redirect.github.com/actions/setup-node/issues/1491)) * [`6044e13`](actions/setup-node@6044e13) Docs: bump actions/checkout from v5 to v6 ([#1468](https://redirect.github.com/actions/setup-node/issues/1468)) * [`8e49463`](actions/setup-node@8e49463) Fix README typo ([#1226](https://redirect.github.com/actions/setup-node/issues/1226)) * [`621ac41`](actions/setup-node@621ac41) README.md: bump to latest released checkout version v6 ([#1446](https://redirect.github.com/actions/setup-node/issues/1446)) * [`2951748`](actions/setup-node@2951748) Bump `@actions/cache` to v5.0.1 ([#1449](https://redirect.github.com/actions/setup-node/issues/1449)) * Additional commits viewable in [compare view](actions/setup-node@49933ea...53b8394) [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
| datasource | package | from | to | | ----------- | ------------------ | ------ | ------ | | github-tags | actions/setup-node | v4.0.3 | v6.3.0 | ## [vv6.3.0](https://github.com/actions/setup-node/releases/tag/v6.3.0) #### What's Changed ##### Enhancements: - Support parsing `devEngines` field by [@susnux](https://github.com/susnux) in [#1283](actions/setup-node#1283) > When using node-version-file: package.json, setup-node now prefers devEngines.runtime over engines.node. ##### Dependency updates: - Fix npm audit issues by [@gowridurgad](https://github.com/gowridurgad) in [#1491](actions/setup-node#1491) - Replace uuid with crypto.randomUUID() by [@trivikr](https://github.com/trivikr) in [#1378](actions/setup-node#1378) - Upgrade minimatch from 3.1.2 to 3.1.5 by [@dependabot](https://github.com/dependabot) in [#1498](actions/setup-node#1498) ##### Bug fixes: - Remove hardcoded bearer for mirror-url [@marco-ippolito](https://github.com/marco-ippolito) in [#1467](actions/setup-node#1467) - Scope test lockfiles by package manager and update cache tests by [@gowridurgad](https://github.com/gowridurgad) in [#1495](actions/setup-node#1495) #### New Contributors - [@susnux](https://github.com/susnux) made their first contribution in [#1283](actions/setup-node#1283) **Full Changelog**: <actions/setup-node@v6...v6.3.0> ## [vv6.2.0](actions/setup-node@v6.1.0...v6.2.0) ## [vv6.1.0](https://github.com/actions/setup-node/releases/tag/v6.1.0) #### What's Changed ##### Enhancement: - Remove always-auth configuration handling by [@priyagupta108](https://github.com/priyagupta108) in [#1436](actions/setup-node#1436) ##### Dependency updates: - Upgrade [@actions/cache](https://github.com/actions/cache) from 4.0.3 to 4.1.0 by [@dependabot](https://github.com/dependabot)\[bot] in [#1384](actions/setup-node#1384) - Upgrade actions/checkout from 5 to 6 by [@dependabot](https://github.com/dependabot)\[bot] in [#1439](actions/setup-node#1439) - Upgrade js-yaml from 3.14.1 to 3.14.2 by [@dependabot](https://github.com/dependabot)\[bot] in [#1435](actions/setup-node#1435) ##### Documentation update: - Add example for restore-only cache in documentation by [@aparnajyothi-y](https://github.com/aparnajyothi-y) in [#1419](actions/setup-node#1419) **Full Changelog**: <actions/setup-node@v6...v6.1.0> ## [vv6.0.0](https://github.com/actions/setup-node/releases/tag/v6.0.0) ##### What's Changed **Breaking Changes** - Limit automatic caching to npm, update workflows and documentation by [@priyagupta108](https://github.com/priyagupta108) in [#1374](actions/setup-node#1374) **Dependency Upgrades** - Upgrade ts-jest from 29.1.2 to 29.4.1 and document breaking changes in v5 by [@dependabot](https://github.com/dependabot)\[bot] in [#1336](actions/setup-node#1336) - Upgrade prettier from 2.8.8 to 3.6.2 by [@dependabot](https://github.com/dependabot)\[bot] in [#1334](actions/setup-node#1334) - Upgrade actions/publish-action from 0.3.0 to 0.4.0 by [@dependabot](https://github.com/dependabot)\[bot] in [#1362](actions/setup-node#1362) **Full Changelog**: <actions/setup-node@v5...v6.0.0> ## [vv5.0.0](https://github.com/actions/setup-node/releases/tag/v5.0.0) ##### What's Changed ##### Breaking Changes - Enhance caching in setup-node with automatic package manager detection by [@priya-kinthali](https://github.com/priya-kinthali) in [#1348](actions/setup-node#1348) This update, introduces automatic caching when a valid `packageManager` field is present in your `package.json`. This aims to improve workflow performance and make dependency management more seamless. To disable this automatic caching, set `package-manager-cache: false` ```yaml steps: - uses: actions/checkout@v5 - uses: actions/setup-node@v5 with: package-manager-cache: false ``` - Upgrade action to use node24 by [@salmanmkc](https://github.com/salmanmkc) in [#1325](actions/setup-node#1325) Make sure your runner is on version v2.327.1 or later to ensure compatibility with this release. [See Release Notes](https://github.com/actions/runner/releases/tag/v2.327.1) ##### Dependency Upgrades - Upgrade [@octokit/request-error](https://github.com/octokit/request-error) and [@actions/github](https://github.com/actions/github) by [@dependabot](https://github.com/dependabot)\[bot] in [#1227](actions/setup-node#1227) - Upgrade uuid from 9.0.1 to 11.1.0 by [@dependabot](https://github.com/dependabot)\[bot] in [#1273](actions/setup-node#1273) - Upgrade undici from 5.28.5 to 5.29.0 by [@dependabot](https://github.com/dependabot)\[bot] in [#1295](actions/setup-node#1295) - Upgrade form-data to bring in fix for critical vulnerability by [@gowridurgad](https://github.com/gowridurgad) in [#1332](actions/setup-node#1332) - Upgrade actions/checkout from 4 to 5 by [@dependabot](https://github.com/dependabot)\[bot] in [#1345](actions/setup-node#1345) ##### New Contributors - [@priya-kinthali](https://github.com/priya-kinthali) made their first contribution in [#1348](actions/setup-node#1348) - [@salmanmkc](https://github.com/salmanmkc) made their first contribution in [#1325](actions/setup-node#1325) **Full Changelog**: <actions/setup-node@v4...v5.0.0> ## [vv4.4.0](https://github.com/actions/setup-node/releases/tag/v4.4.0) ##### What's Changed ##### Bug fixes: - Make eslint-compact matcher compatible with Stylelint by [@FloEdelmann](https://github.com/FloEdelmann) in [#98](actions/setup-node#98) - Add support for indented eslint output by [@fregante](https://github.com/fregante) in [#1245](actions/setup-node#1245) ##### Enhancement: - Support private mirrors by [@marco-ippolito](https://github.com/marco-ippolito) in [#1240](actions/setup-node#1240) ##### Dependency update: - Upgrade [@action/cache](https://github.com/action/cache) from 4.0.2 to 4.0.3 by [@aparnajyothi-y](https://github.com/aparnajyothi-y) in [#1262](actions/setup-node#1262) ##### New Contributors - [@FloEdelmann](https://github.com/FloEdelmann) made their first contribution in [#98](actions/setup-node#98) - [@fregante](https://github.com/fregante) made their first contribution in [#1245](actions/setup-node#1245) - [@marco-ippolito](https://github.com/marco-ippolito) made their first contribution in [#1240](actions/setup-node#1240) **Full Changelog**: <actions/setup-node@v4...v4.4.0> ## [vv4.3.0](https://github.com/actions/setup-node/releases/tag/v4.3.0) ##### What's Changed ##### Dependency updates - Upgrade [@actions/glob](https://github.com/actions/glob) from 0.4.0 to 0.5.0 by [@dependabot](https://github.com/dependabot) in [#1200](actions/setup-node#1200) - Upgrade [@action/cache](https://github.com/action/cache) from 4.0.0 to 4.0.2 by [@gowridurgad](https://github.com/gowridurgad) in [#1251](actions/setup-node#1251) - Upgrade [@vercel/ncc](https://github.com/vercel/ncc) from 0.38.1 to 0.38.3 by [@dependabot](https://github.com/dependabot) in [#1203](actions/setup-node#1203) - Upgrade [@actions/tool-cache](https://github.com/actions/tool-cache) from 2.0.1 to 2.0.2 by [@dependabot](https://github.com/dependabot) in [#1220](actions/setup-node#1220) ##### New Contributors - [@gowridurgad](https://github.com/gowridurgad) made their first contribution in [#1251](actions/setup-node#1251) **Full Changelog**: <actions/setup-node@v4...v4.3.0> ## [vv4.2.0](https://github.com/actions/setup-node/releases/tag/v4.2.0) ##### What's Changed - Enhance workflows and upgrade publish-actions from 0.2.2 to 0.3.0 by [@aparnajyothi-y](https://github.com/aparnajyothi-y) in [#1174](actions/setup-node#1174) - Add recommended permissions section to readme by [@benwells](https://github.com/benwells) in [#1193](actions/setup-node#1193) - Configure Dependabot settings by [@HarithaVattikuti](https://github.com/HarithaVattikuti) in [#1192](actions/setup-node#1192) - Upgrade `@actions/cache` to `^4.0.0` by [@priyagupta108](https://github.com/priyagupta108) in [#1191](actions/setup-node#1191) - Upgrade pnpm/action-setup from 2 to 4 by [@dependabot](https://github.com/dependabot) in [#1194](actions/setup-node#1194) - Upgrade actions/publish-immutable-action from 0.0.3 to 0.0.4 by [@dependabot](https://github.com/dependabot) in [#1195](actions/setup-node#1195) - Upgrade semver from 7.6.0 to 7.6.3 by [@dependabot](https://github.com/dependabot) in [#1196](actions/setup-node#1196) - Upgrade [@types/jest](https://github.com/types/jest) from 29.5.12 to 29.5.14 by [@dependabot](https://github.com/dependabot) in [#1201](actions/setup-node#1201) - Upgrade undici from 5.28.4 to 5.28.5 by [@dependabot](https://github.com/dependabot) in [#1205](actions/setup-node#1205) ##### New Contributors - [@benwells](https://github.com/benwells) made their first contribution in [#1193](actions/setup-node#1193) **Full Changelog**: <actions/setup-node@v4...v4.2.0> ## [vv4.1.0](https://github.com/actions/setup-node/releases/tag/v4.1.0) ##### What's Changed - Resolve High Security Alerts by upgrading Dependencies by [@aparnajyothi-y](https://github.com/aparnajyothi-y) in [#1132](actions/setup-node#1132) - Upgrade IA Publish by [@Jcambass](https://github.com/Jcambass) in [#1134](actions/setup-node#1134) - Revise `isGhes` logic by [@jww3](https://github.com/jww3) in [#1148](actions/setup-node#1148) - Add architecture to cache key by [@pengx17](https://github.com/pengx17) in [#843](actions/setup-node#843) This addresses issues with caching by adding the architecture (arch) to the cache key, ensuring that cache keys are accurate to prevent conflicts. Note: This change may break previous cache keys as they will no longer be compatible with the new format. ##### New Contributors - [@jww3](https://github.com/jww3) made their first contribution in [#1148](actions/setup-node#1148) - [@pengx17](https://github.com/pengx17) made their first contribution in [#843](actions/setup-node#843) **Full Changelog**: <actions/setup-node@v4...v4.1.0> ## [vv4.0.4](https://github.com/actions/setup-node/releases/tag/v4.0.4) ##### What's Changed - Add workflow file for publishing releases to immutable action package by [@Jcambass](https://github.com/Jcambass) in [#1125](actions/setup-node#1125) - Enhance Windows ARM64 Setup and Update micromatch Dependency by [@priyagupta108](https://github.com/priyagupta108) in [#1126](actions/setup-node#1126) ##### Documentation changes: - Documentation update in the README file by [@suyashgaonkar](https://github.com/suyashgaonkar) in [#1106](actions/setup-node#1106) - Correct invalid 'lts' version string reference by [@fulldecent](https://github.com/fulldecent) in [#1124](actions/setup-node#1124) ##### New Contributors - [@suyashgaonkar](https://github.com/suyashgaonkar) made their first contribution in [#1106](actions/setup-node#1106) - [@priyagupta108](https://github.com/priyagupta108) made their first contribution in [#1126](actions/setup-node#1126) - [@Jcambass](https://github.com/Jcambass) made their first contribution in [#1125](actions/setup-node#1125) - [@fulldecent](https://github.com/fulldecent) made their first contribution in [#1124](actions/setup-node#1124) **Full Changelog**: <actions/setup-node@v4...v4.0.4>
Followup of #1240
Description:
This change makes the mirror usable.
Right now Immagine we setup the value of
mirror-tokentofoo.In this line the value is used as
setup-node/src/distributions/base-distribution.ts
Line 106 in 2951748
Bearer foobut in other places such as:setup-node/src/distributions/base-distribution.ts
Line 149 in 2951748
setup-node/src/distributions/base-distribution.ts
Line 210 in 2951748
its used as is.
But if we change the value to
Bearer foo,setup-node/src/distributions/base-distribution.ts
Line 106 in 2951748
here it becomes
Bearer Bearer foowhich is incorrect, but works everywhere else.So this PR makes it that if its a
Bearer, the user needs to be explicit.Related issue:
Add link to the related issue.
Check list: