mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-12-03 02:08:18 +00:00
fix(contributor-scan): build the image from the pinned base and keep runs on the writable mount (3.2, part 1)
`docker compose build` has failed since 1b9d1ca (2026-10-05): the Dockerfile requires the task
base's tag and digest and deliberately has no floating fallback, but the compose file passed
neither argument. Compose now defaults both from plane/task-base.digest, the pin CI builds
from, and a test fails when the two drift apart or an argument goes missing.
The service also sets OPENULTRASAST_RUNS_DIR=/reports/runs, so a scan's run directory lands on
the one writable mount (Req 6.3) whatever the default location is.
Built and verified once, with no scan (2026-11-24, 11:02Z to 11:10Z): `docker compose build`
exit 0 in 8m03s, the Joern zip passing its sha512 check, and inside the image the CLI usage,
native PHP 8.4.26, lib/io.joern.joern-cli-4.0.625.jar, the installed package, and the pinned
base's 12 layers and 24 history entries as the image's prefix. That image held HEAD's source
and was removed from the build machine by a Docker prune at 12:56Z.
Task 3.2 stays open: the image must be rebuilt after task 3.1 lands, and part 2 (a real scan
through the image and the shell wrapper, parity with a native run) is not done. Known for part
2: on a fresh checkout Docker creates ./reports root-owned and the image runs as uid 1000, so
the first run cannot write its output.
This commit is contained in:
@@ -47,6 +47,17 @@ def test_digest_required_and_code_last(name, variant):
|
||||
assert not any("venv /venv" in line for line in lines)
|
||||
|
||||
|
||||
def test_compose_builds_from_the_pinned_base():
|
||||
"""`docker compose build` takes no arguments, so the base it resolves is whatever these defaults say."""
|
||||
ref = json.loads(read("plane/task-base.digest"))["base"]
|
||||
tag, digest = re.fullmatch(r"ghcr.io/norandom/ousast-task-base:(base-[a-z0-9-]+)@(sha256:[0-9a-f]{64})", ref).groups()
|
||||
service = yaml.load(read("docker-compose.yml"), Loader=yaml.BaseLoader)["services"]["ousast"]
|
||||
for name, default in (("TASK_BASE_TAG", tag), ("TASK_BASE_DIGEST", digest)):
|
||||
default_ref = f"${{{name}:-{default}}}"
|
||||
assert service["build"]["args"].get(name) == default_ref, f"{name} does not default to {default} (plane/task-base.digest)"
|
||||
assert service["environment"]["OPENULTRASAST_RUNS_DIR"].startswith("/reports/")
|
||||
|
||||
|
||||
def test_shared_ancestry_and_replay_exact_engine():
|
||||
base = read("plane/Dockerfile.base")
|
||||
assert "FROM ghcr.io/norandom/ax-task-runner:v0.3.1 AS base" in base
|
||||
|
||||
Reference in New Issue
Block a user