From 709ea788c7ae4803ff546313d204fdfe909a9f88 Mon Sep 17 00:00:00 2001 From: Jean-Paul van Ravensberg <14926452+DevSecNinja@users.noreply.github.com> Date: Mon, 16 Nov 2026 15:52:20 +0100 Subject: [PATCH 1/2] fix(renovate): allow npm remote fetches in Renovate lockfile updates (npm/cli#9800) npm 12 (allow-remote=none) refuses registry tarballs under --package-lock-only when a package declares bundleDependencies, so lockfile updates fail with EALLOWREMOTE in every Tailwind CSS 4 repository (@tailwindcss/oxide-wasm32-wasi). allow-remote has no narrower value that covers transitive dependencies, so set allow-remote=all for the npm manager only, merged with the repository's .npmrc. Installs in CI and on developer machines keep npm 12's default. A contract test keeps the override narrow. Closes #535 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .mise.toml | 1 + .renovate/base.json5 | 18 +++++++++++++ docs/architecture.md | 7 +++++ tests/renovate-npm-allow-remote.sh | 42 ++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 tests/renovate-npm-allow-remote.sh diff --git a/.mise.toml b/.mise.toml index d88712e9..60e713ce 100644 --- a/.mise.toml +++ b/.mise.toml @@ -26,6 +26,7 @@ run = [ "bash ./tests/renovate-apm-manager.sh", "bash ./tests/renovate-batching-contract.sh", "bash ./tests/renovate-engines-range.sh", + "bash ./tests/renovate-npm-allow-remote.sh", "bash ./tests/renovate-branch-pin-digests.sh", "bash ./tests/renovate-abandonment-exemptions.sh", "bash ./tests/release-please-auth-contract.sh", diff --git a/.renovate/base.json5 b/.renovate/base.json5 index a7eef1c8..773b797a 100644 --- a/.renovate/base.json5 +++ b/.renovate/base.json5 @@ -92,4 +92,22 @@ "gradleWrapper", "mise", ], + // Temp until npm/cli#9800 is fixed (https://github.com/npm/cli/issues/9800): + // npm 12 (default allow-remote=none) misclassifies registry tarballs as + // "remote" under `--package-lock-only` when a package in the tree declares + // bundleDependencies. Every Tailwind CSS 4 repository has one + // (@tailwindcss/oxide-wasm32-wasi), so Renovate's lockfile updates fail with + // EALLOWREMOTE. npm's allow-remote only takes none, root or all, and `root` + // does not cover transitive dependencies, so `all` is the only value that + // works. It is scoped to Renovate's own npm lockfile updates: Renovate runs + // them with --ignore-scripts, and real installs in CI and on developer + // machines keep npm 12's allow-remote=none, so a URL dependency that slips + // into a lockfile still fails there. allow-git stays at npm 12's `none`. + // npmrcMerge keeps a repository's own .npmrc; its lines come after this + // one, so a repository can still set allow-remote itself. Remove this block + // once Renovate ships an npm release with the fix. + npm: { + npmrc: "allow-remote=all\n", + npmrcMerge: true, + }, } diff --git a/docs/architecture.md b/docs/architecture.md index 654c0ab1..7e003d7f 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1060,6 +1060,13 @@ can still assign Code Owners if an automerge PR cannot merge cleanly. year as abandoned. Known-stable packages that trip this (for example `@testing-library/user-event`) are exempted by name in `packageRules.json5`, not per repository. +- **npm 12 `allow-remote` workaround** — npm 12 refuses registry tarballs in + `--package-lock-only` runs when a package in the tree declares + `bundleDependencies` ([npm/cli#9800](https://github.com/npm/cli/issues/9800)), + which breaks Renovate's lockfile updates in every Tailwind CSS 4 repository. + `base.json5` sets `allow-remote=all` for the npm manager only (merged with the + repository's `.npmrc`). Installs in CI and on developer machines keep npm 12's + `allow-remote=none`. Remove it once Renovate's npm includes the fix. - **npm `engines` are never pinned** — `rangeStrategy: "pin"` applies to dependencies, but `engines` declare the supported range (`node: "^24.0.0"`) and use `rangeStrategy: "replace"`. The exact Node.js version for diff --git a/tests/renovate-npm-allow-remote.sh b/tests/renovate-npm-allow-remote.sh new file mode 100644 index 00000000..2f5d98bf --- /dev/null +++ b/tests/renovate-npm-allow-remote.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# +# Contract test for the npm 12 EALLOWREMOTE workaround (npm/cli#9800) in the +# shared presets. The `npmrc` override must stay as narrow as possible: +# +# - only in the npm manager block, never at the top level or in packageRules, +# so pnpm, yarn and every other manager keep their own settings; +# - only `allow-remote=all`: no allow-git, registry, script or auth settings; +# - with npmrcMerge, so a repository's own .npmrc is kept and can override it. + +set -euo pipefail + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" + +fail() { + echo "error: $*" >&2 + exit 1 +} + +command -v pyjson5 >/dev/null 2>&1 || fail "'pyjson5' not found on PATH. Run via 'mise run test'." + +found=0 +for file in "${repo_root}"/.renovate/*.json5; do + name="$(basename "${file}")" + config="$(pyjson5 --as-json "${file}" | tr -d '\r')" + misplaced="$(jq -r '[paths(objects) as $p | select(getpath($p) | has("npmrc")) | $p | map(tostring) | join(".")] + | map(select(. != "npm")) | join(", ")' <<<"${config}")" + [ -z "${misplaced}" ] || fail "${name}: npmrc is only allowed in the npm manager block, found at: ${misplaced}" + if jq -e 'has("npmrc")' <<<"${config}" >/dev/null; then + fail "${name}: a top-level npmrc would replace every repository's .npmrc for all npm-based managers" + fi + jq -e '.npm.npmrc' <<<"${config}" >/dev/null || continue + found=$((found + 1)) + settings="$(jq -r '.npm.npmrc | split("\n") | map(select(test("^\\s*([#;].*)?$") | not)) | join(" ")' <<<"${config}")" + [ "${settings}" = "allow-remote=all" ] || + fail "${name}: npm.npmrc may only set allow-remote=all (npm/cli#9800 workaround), found: ${settings}" + jq -e '.npm.npmrcMerge == true' <<<"${config}" >/dev/null || + fail "${name}: npm.npmrc needs npmrcMerge: true, otherwise it replaces the repository's own .npmrc" +done +[ "${found}" -le 1 ] || fail "npm.npmrc is set in ${found} presets; keep the workaround in one place" + +echo "Renovate npm allow-remote workaround: OK" From 5e8e6e308faa0212f5fa746d04719dd4bd653a90 Mon Sep 17 00:00:00 2001 From: Jean-Paul van Ravensberg <14926452+DevSecNinja@users.noreply.github.com> Date: Mon, 16 Nov 2026 16:11:14 +0100 Subject: [PATCH 2/2] docs(renovate): state that the npm manager npmrc also reaches pnpm and Yarn runs Renovate's npm manager writes the .npmrc for npm, pnpm and Yarn lockfile updates. Only the npm CLI has an allow-remote setting, so the line is inert for the others. Correct the comment, the test description and the docs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .renovate/base.json5 | 6 ++++-- docs/architecture.md | 5 +++-- tests/renovate-npm-allow-remote.sh | 6 ++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.renovate/base.json5 b/.renovate/base.json5 index 773b797a..df236b3c 100644 --- a/.renovate/base.json5 +++ b/.renovate/base.json5 @@ -99,8 +99,10 @@ // (@tailwindcss/oxide-wasm32-wasi), so Renovate's lockfile updates fail with // EALLOWREMOTE. npm's allow-remote only takes none, root or all, and `root` // does not cover transitive dependencies, so `all` is the only value that - // works. It is scoped to Renovate's own npm lockfile updates: Renovate runs - // them with --ignore-scripts, and real installs in CI and on developer + // works. It is scoped to Renovate's npm manager, which writes this .npmrc for + // its npm, pnpm and Yarn lockfile updates alike; only the npm CLI has an + // allow-remote setting, so pnpm and Yarn ignore the line. Renovate runs these + // updates with --ignore-scripts, and real installs in CI and on developer // machines keep npm 12's allow-remote=none, so a URL dependency that slips // into a lockfile still fails there. allow-git stays at npm 12's `none`. // npmrcMerge keeps a repository's own .npmrc; its lines come after this diff --git a/docs/architecture.md b/docs/architecture.md index 7e003d7f..01574662 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1064,8 +1064,9 @@ can still assign Code Owners if an automerge PR cannot merge cleanly. `--package-lock-only` runs when a package in the tree declares `bundleDependencies` ([npm/cli#9800](https://github.com/npm/cli/issues/9800)), which breaks Renovate's lockfile updates in every Tailwind CSS 4 repository. - `base.json5` sets `allow-remote=all` for the npm manager only (merged with the - repository's `.npmrc`). Installs in CI and on developer machines keep npm 12's + `base.json5` sets `allow-remote=all` for Renovate's npm manager only (merged with + the repository's `.npmrc`). That manager also runs pnpm and Yarn lockfile + updates, which ignore the setting. Installs in CI and on developer machines keep npm 12's `allow-remote=none`. Remove it once Renovate's npm includes the fix. - **npm `engines` are never pinned** — `rangeStrategy: "pin"` applies to dependencies, but `engines` declare the supported range (`node: "^24.0.0"`) diff --git a/tests/renovate-npm-allow-remote.sh b/tests/renovate-npm-allow-remote.sh index 2f5d98bf..205e5522 100644 --- a/tests/renovate-npm-allow-remote.sh +++ b/tests/renovate-npm-allow-remote.sh @@ -4,7 +4,9 @@ # shared presets. The `npmrc` override must stay as narrow as possible: # # - only in the npm manager block, never at the top level or in packageRules, -# so pnpm, yarn and every other manager keep their own settings; +# so no other manager is affected. Renovate's npm manager also writes it for +# pnpm and Yarn lockfile updates; neither has an allow-remote setting, so for +# them the line is inert; # - only `allow-remote=all`: no allow-git, registry, script or auth settings; # - with npmrcMerge, so a repository's own .npmrc is kept and can override it. @@ -27,7 +29,7 @@ for file in "${repo_root}"/.renovate/*.json5; do | map(select(. != "npm")) | join(", ")' <<<"${config}")" [ -z "${misplaced}" ] || fail "${name}: npmrc is only allowed in the npm manager block, found at: ${misplaced}" if jq -e 'has("npmrc")' <<<"${config}" >/dev/null; then - fail "${name}: a top-level npmrc would replace every repository's .npmrc for all npm-based managers" + fail "${name}: a top-level npmrc would reach every manager and, without npmrcMerge, replace repository .npmrc files" fi jq -e '.npm.npmrc' <<<"${config}" >/dev/null || continue found=$((found + 1))