Skip to content

Commit dcf11d9

Browse files
amir-at-bunnyclaude
andcommitted
fix(sandbox): pin and verify Node/Bun installs in agent image
Replace unverified curl | bash installers. Node now comes from a pinned NodeSource apt repo whose packages apt verifies against a signed-by key; Bun is downloaded as a version-pinned release artifact checked against its SHA256 (x64 + arm64). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 2adbe42 commit dcf11d9

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

sandbox/Dockerfile

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,31 @@ RUN apt-get update && apt-get install -y \
2222
&& sed -i 's|#\?PermitRootLogin.*|PermitRootLogin yes|' /etc/ssh/sshd_config \
2323
&& sed -i 's|#\?PasswordAuthentication.*|PasswordAuthentication yes|' /etc/ssh/sshd_config
2424

25-
# Node.js (LTS)
26-
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
27-
&& apt-get install -y nodejs \
25+
# Node.js (pinned NodeSource apt repo with a verified signing key — no curl | bash).
26+
# apt then cryptographically verifies the nodejs package against the pinned key.
27+
ARG NODE_MAJOR=22
28+
RUN install -d -m 0755 /etc/apt/keyrings \
29+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
30+
-o /etc/apt/keyrings/nodesource.asc \
31+
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.asc] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" \
32+
> /etc/apt/sources.list.d/nodesource.list \
33+
&& apt-get update && apt-get install -y nodejs \
2834
&& rm -rf /var/lib/apt/lists/*
2935

30-
# Bun
31-
RUN curl -fsSL https://bun.sh/install | bash
36+
# Bun (pinned version, checksum-verified release artifact — no curl | bash).
37+
ARG BUN_VERSION=1.3.14
38+
ARG TARGETARCH
39+
RUN set -eux; \
40+
case "${TARGETARCH:-amd64}" in \
41+
amd64) BUN_ARCH=x64; BUN_SHA256=951ee2aee855f08595aeec6225226a298d3fea83a3dcd6465c09cbccdf7e848f ;; \
42+
arm64) BUN_ARCH=aarch64; BUN_SHA256=a27ffb63a8310375836e0d6f668ae17fa8d8d18b88c37c821c65331973a19a3b ;; \
43+
*) echo "unsupported architecture: ${TARGETARCH}" >&2; exit 1 ;; \
44+
esac; \
45+
curl -fsSL "https://github.com/oven-sh/bun/releases/download/bun-v${BUN_VERSION}/bun-linux-${BUN_ARCH}.zip" -o /tmp/bun.zip; \
46+
echo "${BUN_SHA256} /tmp/bun.zip" | sha256sum -c -; \
47+
unzip -q /tmp/bun.zip -d /tmp/bun; \
48+
install -Dm755 "/tmp/bun/bun-linux-${BUN_ARCH}/bun" /root/.bun/bin/bun; \
49+
rm -rf /tmp/bun.zip /tmp/bun
3250
ENV PATH="/root/.bun/bin:$PATH"
3351

3452
# Claude Code

0 commit comments

Comments
 (0)