From 90170380ecbe8fdd457a668696aa6f2b1ccdbfae Mon Sep 17 00:00:00 2001 From: Marius Ciepluch <11855163+norandom@users.noreply.github.com> Date: Tue, 24 Nov 2026 14:25:30 +0100 Subject: [PATCH] fix(docker): keep the reserved populations out of the image (contributor-scan 3.2) The root image copies benchmarks/ (Dockerfile:43), and .dockerignore let benchmarks/valid and benchmarks/unseen through, about 18 MB of reserved-population material. RELEASE_NOTES.md says every version tag is pushed to ghcr.io/norandom/openultrasast. Decided by the maintainer on 2026-11-24: both stay out of the image. The scan path reads neither. The one run-time reader is the hunter's contamination report (hunt/contamination.py), which runs from a checkout: a missing pool contributes nothing to it, and it imports benchmarks.unseen.eligibility late, so inside the image that report has no eligibility module and fails at the import rather than silently. A test pins both patterns and fails if a later negation lets either back in. The built image is checked for their absence in task 3.2 part 2, when it is rebuilt. --- .dockerignore | 5 +++++ tests/test_task_images.py | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/.dockerignore b/.dockerignore index 0db9b552..fae825ab 100644 --- a/.dockerignore +++ b/.dockerignore @@ -25,3 +25,8 @@ benchmarks/measurements/* !benchmarks/measurements/2026-09-13-admission-policy-smoke.json # A label source of `ousast learn` (src/openultrasast/learn/sources.toml). !benchmarks/measurements/2026-09-30-harnessx-removal-baseline/pairs.json + +# The image is published on every tag, so the reserved populations stay out of it. The scan path reads neither; +# the hunter's contamination report reads them from a checkout, not from the image. +benchmarks/valid +benchmarks/unseen diff --git a/tests/test_task_images.py b/tests/test_task_images.py index 714bc138..20e9ab8f 100644 --- a/tests/test_task_images.py +++ b/tests/test_task_images.py @@ -197,3 +197,11 @@ def test_base_preserves_executor_build_toolchains(): for directory in ("doc", "man", "info"): assert f"path-exclude=/usr/share/{directory}/*" in common assert f" /usr/share/{directory}/*" in common + + +def test_reserved_populations_stay_out_of_the_image(): + patterns = [line.strip() for line in read(".dockerignore").splitlines()] + patterns = [line for line in patterns if line and not line.startswith("#")] + for population in ("benchmarks/valid", "benchmarks/unseen"): + assert population in patterns, f"{population} is not excluded from the build context" + assert not any(line.startswith(f"!{population}") for line in patterns), f"{population} is let back in"