Skip to content

fix(images): restore pinned Python source integrity verification - #460

Open
LukeSheard wants to merge 1 commit into
luke/python-315-vmifrom
fix/python-source-integrity
Open

LukeSheard wants to merge 1 commit into
luke/python-315-vmifrom
fix/python-source-integrity

Conversation

@LukeSheard

Copy link
Copy Markdown
Collaborator

Why

The shared Python builder introduced in #418 removed the repository-pinned source checksum. A substituted upstream archive could therefore be extracted and execute build scripts as root, with its installed files copied into published images.

Fixes the Vercel security finding: Shared Python builder removes pinned source integrity verification.

This PR targets luke/python-315-vmi, the affected branch of #418; the shared source builder is not on main yet.

Changes

  • Pin the XZ source SHA-256 alongside each configured Python version (3.14.8 and 3.15.0), with links to the official release checksum sources. The 3.15.0 digest also matches the pre-refactor repository pin.
  • Require a nonempty PYTHON_SHA256 and verify the downloaded bytes with sha256sum --check --strict before extraction or compilation. Missing, malformed, or mismatched digests fail closed; there is no default digest or network-fetched checksum.
  • Include a patch changeset for sandbox-image-python.

Validation

A focused local reproduction exercised the actual Dockerfile source-download shell chain through extraction with a harmless XZ archive, a local curl fixture, and a tar-backed bsdtar shim:

  • The original builder accepted a mismatched digest and extracted the archive, reproducing the issue.
  • The fixed builder extracted an archive with a matching digest.
  • Wrong, empty, unset, and malformed digests, plus a tampered archive, all returned nonzero without extraction. Missing digests also stopped the download.
  • Configuration assertions confirmed both Python targets supply their version-specific published digest and the 3.15.0 pin matches Git history.
  • Changeset formatting (prettier@3.5.3 --check) and git diff --check passed.

Full Docker image builds and runtime checks were not run because Docker is not installed in this environment. No images were published.

Co-authored-by: LukePS <9877376+LukeSheard@users.noreply.github.com>
@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sandbox Ready Ready Preview, v0 Nov 9, 2026 6:05pm UTC
sandbox-cli Ready Ready Preview Nov 9, 2026 6:05pm UTC
sandbox-sdk-ai-example Ready Ready Preview Nov 9, 2026 6:05pm UTC
workflow-code-runner Ready Ready Preview Nov 9, 2026 6:05pm UTC

Request Review

@mangeshraut712 mangeshraut712 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked both pins: I downloaded Python-3.14.8.tar.xz and Python-3.15.0.tar.xz from python.org/ftp and ran sha256sum, and they match the values in docker-bake.hcl. Verifying before bsdtar and before any build script runs is the right place for the check.

Outside this diff, the same class of issue is still open in the Node builds. images/node/Dockerfile and images/universal/Dockerfile (line ~12) pipe nodejs.org/dist/.../node-v${NODE_VERSION}-linux-x64.tar.xz straight into bsdtar with no digest. The fx step in universal checks a .sha256 fetched from the same release as the tarball, so it doesn't protect against a substituted upstream either. If the security finding is meant to cover image source integrity generally, a pinned NODE_SHA256 next to NODE_VERSION in the bake file would close it the same way. That could be a follow-up.

Comment thread images/python/Dockerfile
# Build separately so compilers and headers are not shipped in the runtime image.
RUN curl -fsSL "https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz" -o /tmp/python.tar.xz && \
# Require a repository-pinned digest before downloading or extracting sources.
RUN test -n "${PYTHON_SHA256}" && \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: when the arg is missing, test -n fails the RUN with a bare exit status 1, which is hard to diagnose in a bake log. : "${PYTHON_SHA256:?PYTHON_SHA256 must be set for Python ${PYTHON_VERSION}}" && \ fails closed the same way and says why.

This branch was successfully deployed

4 active deployments
Preview – sandbox-sdk-ai-example — a90e1cd2 Deployed Nov 9, 2026 by vercel[bot]
Preview – sandbox — a90e1cd2 Deployed Nov 9, 2026 by vercel[bot]
Preview – workflow-code-runner — a90e1cd2 Deployed Nov 9, 2026 by vercel[bot]
Preview – sandbox-cli — a90e1cd2 Deployed Nov 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants