Skip to content

Commit cbdcd0e

Browse files
committed
Install Node from the official node image
Alpine's nodejs package is still 24.18.1, which trusts the compromised eMudhra intermediates. node:24-alpine3.24 ships Node 24.22.1, which rejects them, so copy Node, npm, corepack and yarn from it and fail the build below 24.22.1. That makes the NODE_OPTIONS=--use-openssl-ca workaround and its entrypoint handling unnecessary, so drop both.
1 parent 02ddcc2 commit cbdcd0e

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
- The CLI and every tool in the Docker image now reject certificates issued
88
from the compromised eMudhra intermediate CAs.
99
- Bumped `certifi` to `2026.10.19` and the image's bundled `uv` to `0.13.4`.
10+
- The image now takes Node.js from the official `node:24-alpine` image (`24.22.1`)
11+
instead of Alpine's `nodejs` package, which hasn't shipped Node's fix.
1012

1113
### Changed: bump pinned Coana CLI to 15.12.11
1214

‎Dockerfile‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Node.js from the official Alpine image instead of Alpine's nodejs package, which
2+
# lags Node's security releases. Match the major version to what reachability needs
3+
# and the Alpine release to the python:3-alpine base below.
4+
FROM node:24-alpine3.24 AS node
5+
16
FROM python:3-alpine
27
LABEL org.opencontainers.image.authors="socket.dev"
38

@@ -18,11 +23,24 @@ ARG USE_LOCAL_INSTALL=false
1823
# compromised eMudhra intermediates chain to. The base image ships an older
1924
# one, and `apk add` does not upgrade installed packages, so upgrade it here.
2025
RUN apk update && apk add --no-cache \
21-
git nodejs npm yarn curl wget \
26+
git curl wget \
2227
ruby ruby-dev build-base strace && \
2328
apk upgrade --no-cache ca-certificates && \
2429
[ "$(apk version -t "$(apk list -I ca-certificates | awk '{print $1}' | sed 's/^ca-certificates-//')" 20261020-r0)" != "<" ]
2530

31+
# npm, npx and yarn are symlinks in the node image. COPY would dereference them
32+
# into flat files and break their relative requires, so recreate the links.
33+
COPY --from=node /usr/local/bin/node /usr/local/bin/node
34+
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
35+
COPY --from=node /opt /opt
36+
# Node rejects the compromised eMudhra intermediates from 24.22.1.
37+
RUN ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
38+
ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx && \
39+
ln -s ../lib/node_modules/corepack/dist/corepack.js /usr/local/bin/corepack && \
40+
ln -s /opt/yarn-v*/bin/yarn /usr/local/bin/yarn && \
41+
ln -s /opt/yarn-v*/bin/yarnpkg /usr/local/bin/yarnpkg && \
42+
node -e 'const [a,b,c]=process.versions.node.split(".").map(Number); process.exit(a>24||(a===24&&(b>22||(b===22&&c>=1)))?0:1)'
43+
2644
# Install Go with version control
2745
RUN if [ "$GO_VERSION" = "system" ]; then \
2846
apk add --no-cache go && \
@@ -89,10 +107,6 @@ RUN npm install socket -g && \
89107
# Set environment paths
90108
ENV PATH="/usr/local/go/bin:/usr/lib/go/bin:/root/.cargo/bin:${PATH}"
91109
ENV GOPATH="/go"
92-
# Node only rejects the compromised eMudhra intermediates from 22.23.4 / 24.22.1,
93-
# and Alpine's nodejs package is older. Use the system store, which ca-certificates
94-
# above already fixed. Drop this once Alpine's nodejs includes Node's fix.
95-
ENV NODE_OPTIONS="--use-openssl-ca"
96110

97111
# Install uv (0.13.4+ ships the patched webpki-roots)
98112
COPY --from=ghcr.io/astral-sh/uv:0.13.4 /uv /usr/local/bin/uv

0 commit comments

Comments
 (0)