mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-12-03 18:28:19 +00:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user