Skip to content

build: install locked, hash-checked dependencies #125

Closed

Description

@uniqueg

Why?

The image installs the app's dependencies from the version ranges in requirements.txt (which are also the package's dependencies, via pyproject.toml), including their own dependencies, unpinned. Two builds of the same commit can therefore get different versions, and a compromised or broken release of a dependency gets into the image without a review. #121 pinned the base image by digest, but not the Python packages installed on top of it.

This was deferred from the low-severity review findings in #117.

How?

  1. Generate a lock file with exact versions and hashes for the image (e.g. pip-compile --generate-hashes or uv pip compile --generate-hashes), for the Python version of the base image.
  2. Install it in the Dockerfile with pip install --require-hashes, instead of requirements.txt. The app itself is already installed with --no-deps.
  3. Keep the version ranges in requirements.txt for installs as a package.
  4. Let Dependabot update the lock file, and check in CI that it matches requirements.txt.
  5. Docs: how to update the lock file (README, contributing section).

Acceptance criteria

  • The image build installs only locked, hash-checked packages.
  • CI fails if the lock file is out of date.
  • Dependabot opens PRs for the locked packages.

Activity

  1. added
    type: security
    type: dependencies
    priority: medium
    workload: hours
    status: on hold
    on Oct 21, 2026
  2. added this to the v1.0.0-rc1 milestone on Oct 28, 2026
  3. added
    status: in progress
    and removed
    status: on hold
    on Oct 28, 2026
  4. uniqueg commented on Oct 28, 2026

    @uniqueg
    MemberAuthor

    Update on the premise: requirements.txt is gone. The dependencies (with their version ranges) are now in pyproject.toml (project.dependencies), and the image build installs them via scripts/image_requirements.py, which also leaves out a temporary FOCA commit reference (foca @ git+...@<sha>) and checks the base image's FOCA instead.

    The plan in the issue (a lock compiled with pip-compile/uv pip compile --generate-hashes, updated by Dependabot's pip ecosystem) doesn't work well with Dependabot: for a pyproject.toml source it bumps pins one by one without re-resolving, and not together with the ranges. So the implementation instead uses:

    1. uv.lock (exact versions and hashes for all dependencies and extras), checked in CI with uv lock --check (lint job; uv comes with the dev extra).
    2. In the image build: uv export --frozen --no-dev --no-emit-project (uv mounted from a digest-pinned uv image, not kept in the image), the FOCA commit reference filtered out as before (it has no hash), then pip install --require-hashes --only-binary :all: --no-deps.
    3. Dependabot: the root entry moves from pip to uv, which updates pyproject.toml and uv.lock together; the docker entry also updates the uv image.
    4. Docs: "Dependencies" in the development guide, and the packaging guideline in the contributing guide.

    The acceptance criteria stay as they are; the Dependabot criterion can only be verified once dev reaches main (Dependabot reads its config from the default branch).

  5. removed
    status: in progress
    on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: mediumtype: dependenciestype: securityworkload: hours

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions