Repository navigation
fix: fall back to Yarn-published key and pin Yarn signer - #2693
LittleGnome wants to merge 1 commit into
Conversation
|
@nschonni re your note on #2692 that the Docker Hub build "will stall the same there": this PR should cover that case. With it, all 12 Node.js 22/24 variants build here while |
keys.openpgp.org serves the Yarn v1 key without a user ID, so keyserver.ubuntu.com is the only working key source for the Node.js 22 and 24 images. When it is unavailable, every Yarn install step fails. - fall back to https://dl.yarnpkg.com/debian/pubkey.gpg if both keyservers fail - require a valid signature by the Yarn primary key 72ECF46A56B4AD39C907BBB71646B01B86E50310 (VALIDSIG), so that only the pinned key is trusted regardless of where it was imported from Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Marco Knol <littlegnomenv@gmail.com>
5a870aa to
58ab465
Compare
|
@tianon the official-images build for docker-library/official-images#22729 fails for all Node.js 22/24 variants on exactly this step ( |
|
The keyserver is now up and running and the builds succeed. |
|
Thanks @MikeMcC399, great to see docker-library/official-images#22729 merged. For what it's worth, this change should be harmless to keep regardless: the keyserver path is unchanged and still tried first, so with working keyservers the build behaves exactly as before. The That said, if you feel it isn't worth carrying, feel free to close it — no problem at all. |
|
Thank you very much for your suggestion! Any change that affects security would however need careful review from the team, including the representatives from the official Docker images program. Avoiding a single point of failure would certainly be beneficial. The Yarn maintainers stated that they plan to deprecate v1, so there may be other plans to be considered later this year. |
Description
Make the Yarn v1 Classic install step (Node.js 22 and 24 images) resilient to keyserver outages, and pin the expected signer of the Yarn tarball.
keys.openpgp.orgnorkeyserver.ubuntu.comyields the key, fall back to the key that Yarn itself publishes athttps://dl.yarnpkg.com/debian/pubkey.gpg.gpg --verifyis replaced bygpg --status-fd 1 --verify … | grep VALIDSIG … 72ECF46A56B4AD39C907BBB71646B01B86E50310$. The Yarn 1.22.22 tarball is signed by primary key72ECF46A56B4AD39C907BBB71646B01B86E50310(Yarn Packaging <yarn@dan.cx>), so the build now only succeeds for a valid signature by that exact key, whichever source the key came from. This keeps a fingerprint embedded in theDockerfile, as the Docker Official Images security guidance requires.The keyserver path is unchanged and still tried first. The change is applied to the three templates and to the existing
22/*and24/*Dockerfiles (Node.js 26+ images do not include Yarn).Motivation and Context
PR #2692 (Node.js v22.23.5 / v24.22.3) is blocked: during the Canonical outage of 2026-11-11, all Node.js 22 and 24 builds fail while all Node.js 26 builds pass. The failing step is the Yarn key fetch:
keys.openpgp.orgreturns key6A010C5166006599AA17F08146C2130DFD2497F5without a user ID (it was superseded there by the 2026 key for the same e-mail address, see New PGP signing key for Yarn v1 Classic #2364), sogpgcannot import it;keyserver.ubuntu.comis then the only source, which makes it a single point of failure, as noted in feat: Node.js v22.23.5, v24.22.3, v26.13.1 #2692 (comment)Why the explicit signer check matters with the new fallback:
pubkey.gpgcontains two primary keys (72ECF46A…and the 2026 key4EF8150F…), and a plaingpg --verifyaccepts a valid signature from any key in the keyring. PinningVALIDSIGto the expected fingerprint makes the trust anchor the fingerprint in the Dockerfile rather than the contents of the downloaded key file.Testing Details
Tested on macOS (Apple Silicon), Docker Desktop,
--platform linux/amd64, whilekeyserver.ubuntu.comwas unreachable (so the new fallback path was exercised):node -v/npm -v/yarn --version22/trixie22/bookworm-slim22/alpine3.23Yarn step log (
22/trixie):The keyserver path (when
keyserver.ubuntu.comis reachable) is unchanged; the signature is made by the primary key72ECF46A…in both cases, so theVALIDSIGpin applies equally to it.Negative test of the signer pin (Alpine 3.23, GnuPG from apk), with
pubkey.gpgplus a locally generated, ultimately-trusted "attacker" key in the keyring:gpg --verifyyarn-v1.22.22.tar.gz.ascnpm run lint(doctoc, prettier, eslint) passes.Types of changes
Checklist
🤖 Generated with Claude Code