Skip to content

implement nodeDistAuthHeader configuration option - #329

Open
bienzaaron wants to merge 4 commits into
yarnpkg:mainfrom
bienzaaron:feat/node-dist-auth-header
Open

bienzaaron wants to merge 4 commits into
yarnpkg:mainfrom
bienzaaron:feat/node-dist-auth-header

Conversation

@bienzaaron

Copy link
Copy Markdown

Adds nodeDistAuthHeader configuration option to authenticate requests to Node.js distribution mirrors.

This supports corporate environments that block public distribution endpoints in favor of authenticated private mirrors. The header applies to both release index and archive downloads.

@netlify

netlify Bot commented Aug 20, 2026

Copy link
Copy Markdown

Deploy Preview for yarn-v6 ready!

Name Link
🔨 Latest commit ae8a62b
🔍 Latest deploy log https://app.netlify.com/projects/yarn-v6/deploys/6ab183674d0ac30008164633
😎 Deploy Preview https://deploy-preview-329--yarn-v6.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment on lines +1211 to +1230
"nodeDistAuthHeader": {
"_package": "@yarnpkg/core",
"title": "Authorization header to send when downloading Node.js distributions.",
"description": "When specified, the value will be sent as an `Authorization` header when fetching both the release index and distribution archives from `nodeDistUrl`. This is typically paired with a custom `nodeDistUrl` for an internal node.js distribution mirror.",
"type": ["string", "null"],
"_examples": [
{
"description": "Do not pass an `Authorization` header.",
"value": null
},
{
"description": "Pass a Bearer token in the `Authorization` header.",
"value": "Bearer a-token-here"
},
{
"description": "Pass a Bearer token from an environment variable.",
"value": "Bearer ${NODE_DIST_BEARER_TOKEN}"
}
]
},

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also considered a scoped structure similar to npmRegistries -> npmAuthToken :

// .yarnrc.yml
nodeDistAuth:
  "https://mirror-one.example.com/node/dist":
    authorization: "Bearer a-token"

  "https://mirror-two.example.com/node/dist":
    authorization: "Bearer different-token"

though I'm not sure its necessary. My only concern is that with the current scalar nodeDistAuthHeader config is that if a malicious actor could inject a different nodeDistUrl, they could send the request to a malicious url and capture the token.

Comment thread tests/acceptance-tests/pkg-tests-core/sources/utils/tests.ts Outdated
Comment thread tests/acceptance-tests/pkg-tests-core/sources/utils/tests.ts Outdated
@bienzaaron
bienzaaron force-pushed the feat/node-dist-auth-header branch from 6303d62 to ebe61de Compare August 27, 2026 01:28
@github-actions

Copy link
Copy Markdown

⏱️ Benchmark Results

gatsby install-full-cold

Metric Base Head Difference
Mean 4.106s 4.104s -0.05% ✅
Median 4.101s 4.073s -0.67% ✅
Min 3.967s 3.903s
Max 4.297s 4.518s
Std Dev 0.086s 0.124s
📊 Raw benchmark data (gatsby install-full-cold)

Base times: 4.142s, 4.064s, 4.186s, 4.137s, 4.169s, 4.107s, 4.024s, 4.196s, 4.171s, 4.154s, 4.059s, 3.975s, 4.202s, 4.178s, 3.967s, 4.002s, 4.095s, 4.088s, 4.031s, 4.034s, 4.043s, 4.166s, 4.047s, 3.996s, 4.043s, 4.219s, 4.297s, 4.248s, 4.128s, 4.025s

Head times: 4.097s, 4.116s, 4.143s, 3.968s, 4.055s, 4.069s, 4.021s, 4.330s, 4.063s, 4.518s, 4.295s, 4.208s, 4.188s, 4.012s, 4.086s, 4.068s, 4.009s, 4.099s, 3.958s, 4.078s, 4.064s, 4.258s, 4.153s, 4.049s, 4.024s, 4.016s, 3.903s, 4.126s, 4.022s, 4.138s


gatsby install-cache-only

Metric Base Head Difference
Mean 1.360s 1.323s -2.69% ✅
Median 1.291s 1.268s -1.77% ✅
Min 1.209s 1.206s
Max 2.085s 2.126s
Std Dev 0.180s 0.182s
📊 Raw benchmark data (gatsby install-cache-only)

Base times: 2.085s, 1.587s, 1.298s, 1.233s, 1.483s, 1.412s, 1.250s, 1.282s, 1.506s, 1.228s, 1.341s, 1.362s, 1.369s, 1.382s, 1.304s, 1.401s, 1.267s, 1.718s, 1.241s, 1.260s, 1.448s, 1.290s, 1.242s, 1.274s, 1.268s, 1.257s, 1.291s, 1.240s, 1.257s, 1.209s

Head times: 1.371s, 1.208s, 1.334s, 1.394s, 1.294s, 1.291s, 1.215s, 1.242s, 1.238s, 1.228s, 1.310s, 1.255s, 1.206s, 1.223s, 1.284s, 1.250s, 1.208s, 1.681s, 2.126s, 1.525s, 1.226s, 1.248s, 1.394s, 1.321s, 1.252s, 1.266s, 1.270s, 1.258s, 1.274s, 1.299s


gatsby install-cache-and-lock (warm, with lockfile)

Metric Base Head Difference
Mean 0.383s 0.433s +13.17% ⚠️
Median 0.362s 0.416s +15.06% ⚠️
Min 0.336s 0.344s
Max 0.530s 0.680s
Std Dev 0.054s 0.096s
📊 Raw benchmark data (gatsby install-cache-and-lock (warm, with lockfile))

Base times: 0.362s, 0.350s, 0.338s, 0.343s, 0.444s, 0.342s, 0.383s, 0.472s, 0.530s, 0.336s, 0.458s, 0.337s, 0.376s, 0.469s, 0.347s, 0.363s, 0.362s, 0.510s, 0.362s, 0.352s, 0.366s, 0.352s, 0.418s, 0.374s, 0.356s, 0.346s, 0.379s, 0.352s, 0.347s, 0.362s

Head times: 0.367s, 0.456s, 0.433s, 0.416s, 0.540s, 0.456s, 0.502s, 0.550s, 0.416s, 0.660s, 0.637s, 0.378s, 0.348s, 0.680s, 0.376s, 0.437s, 0.399s, 0.360s, 0.434s, 0.425s, 0.480s, 0.423s, 0.353s, 0.346s, 0.344s, 0.349s, 0.347s, 0.349s, 0.393s, 0.345s

This branch was successfully deployed

1 active (outdated) deployment
test-reports 1d926d36 Deployed Sep 19, 2026 by bienzaaron via Reporting test results #1329
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants