mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-12-06 04:56:15 +08:00
LLVM archives were downloaded without a checksum in CI, in the release jobs and in the LLVM distribution workflow; Node and Zig for the Sandbox image were checked against a checksum list fetched from the same origin as the archive. - scripts/toolchain.sha256 holds the SHA-256 of every toolchain archive that CI, the release jobs and the Sandbox image download (LLVM for Linux x64 and arm64 and for Windows, the LLVM sources, Node, Zig, the LLVM apt key), and scripts/verify-toolchain.sh checks a file against it. Every download runs the check before the file is unpacked; a different digest or a file with no pin fails. - The Linux LLVM cache key is the hash of the pin file, so a cache never outlives the digest its archive was checked against. - Every action is referenced by commit with its version in a comment, and Dependabot proposes the updates once a month. - ci.yml and release.yml get top-level permissions (contents: read); the jobs that publish, read other runs' artifacts or write the GitHub release already declare what they need. - tests/harness/ci-supply-chain.test.ts enforces the three rules. - .dockerignore lets the Sandbox image build see the three scripts its Dockerfile copies. Co-Authored-By: Claude Code <noreply@anthropic.com>
67 lines
2.4 KiB
Docker
67 lines
2.4 KiB
Docker
ARG NODE_VERSION=24.22.1
|
|
FROM ubuntu:24.04
|
|
|
|
ARG NODE_VERSION
|
|
ARG PNPM_VERSION=11.1.3
|
|
ARG ZIG_VERSION=0.16.0
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Every download below is checked against the pinned digests before it is used.
|
|
COPY scripts/toolchain.sha256 scripts/verify-toolchain.sh scripts/install-zig.sh /tmp/toolchain/
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install --yes --no-install-recommends \
|
|
ca-certificates curl gnupg \
|
|
&& curl --fail --silent --show-error --location https://apt.llvm.org/llvm-snapshot.gpg.key \
|
|
--output /tmp/llvm-snapshot.gpg.key \
|
|
&& sh /tmp/toolchain/verify-toolchain.sh /tmp/llvm-snapshot.gpg.key \
|
|
&& gpg --dearmor --output /usr/share/keyrings/llvm-snapshot.gpg /tmp/llvm-snapshot.gpg.key \
|
|
&& rm /tmp/llvm-snapshot.gpg.key \
|
|
&& echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg] https://apt.llvm.org/noble/ llvm-toolchain-noble-22 main" \
|
|
> /etc/apt/sources.list.d/llvm22.list \
|
|
&& apt-get update \
|
|
&& apt-get install --yes --no-install-recommends \
|
|
build-essential \
|
|
ca-certificates \
|
|
ccache \
|
|
clang-22 \
|
|
cmake \
|
|
curl \
|
|
git \
|
|
libclang-rt-22-dev \
|
|
libpolly-22-dev \
|
|
libzstd-dev \
|
|
lld-22 \
|
|
llvm-22-dev \
|
|
ninja-build \
|
|
xz-utils \
|
|
zlib1g-dev \
|
|
&& ln -sf clang-22 /usr/bin/clang \
|
|
&& ln -sf clang++-22 /usr/bin/clang++ \
|
|
&& test "$(llvm-config-22 --version)" = 22.1.8 \
|
|
&& test -x "$(dirname "$(readlink -f /usr/bin/clang)")/ld.lld" \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN curl --fail --silent --show-error --location \
|
|
--output /tmp/node.tar.xz \
|
|
"https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz" \
|
|
&& sh /tmp/toolchain/verify-toolchain.sh /tmp/node.tar.xz "node-v${NODE_VERSION}-linux-x64.tar.xz" \
|
|
&& tar -xJf /tmp/node.tar.xz --directory /usr/local --strip-components=1 \
|
|
&& rm /tmp/node.tar.xz
|
|
|
|
RUN sh /tmp/toolchain/install-zig.sh "$ZIG_VERSION" \
|
|
&& rm -r /tmp/toolchain
|
|
|
|
RUN npm install --global "pnpm@${PNPM_VERSION}"
|
|
|
|
WORKDIR /workspace
|
|
|
|
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
|
COPY packages/cli/package.json packages/cli/package.json
|
|
COPY packages/compiler/package.json packages/compiler/package.json
|
|
COPY packages/runtime/package.json packages/runtime/package.json
|
|
|
|
RUN pnpm install --frozen-lockfile \
|
|
&& chmod -R a+rwX /workspace
|