mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-12-03 18:28:19 +00:00
A mistyped TARGET read as a clean scan. The `/target` mount was in the short syntax, so
Docker created a path that does not exist as an empty directory owned by 0:0, and the
scan ended with exit 0 and no findings (the eighth session, 2026-11-26: file_targets=0,
findings=0, exit=0).
The mount is now in the long syntax with `create_host_path: false`, as `/reports` is
since 9d53c32. The source is still `${TARGET:-.}` and the mount is still read-only. A
path that does not exist is refused by the daemon before the container starts ("bind
source path does not exist"), and nothing is created. Measured on 2026-11-26 with the
new file alone in a scratch directory, Docker 29.8.1 and Compose v5.5.1, image
openultrasast:dev (3f959b31f2f2), both API keys unset: a TARGET that does not exist
gives exit 1 in one second and no directory; the documented command with `--mode quick`
on a copy of libpng's contrib/examples gives file_targets=4, findings=4, exit 0;
`touch /target/x` ends with "Read-only file system", exit 1; with TARGET unset the
default source mounts (exit 0).
Tests: the new
`tests/test_task_images.py::test_compose_refuses_a_target_that_does_not_exist` fails on
the short syntax (1 failed, 22 deselected) and passes after; with
`tests/test_search_image.py`, 24 passed. ruff format, ruff check, mypy, the three gates
and compileall pass, and the gates print what they printed before the change. An
independent reviewer approved the change in one round; its remarks on two wordings are
applied.
Left as they are: `docs/detection-techniques.md` cites `docker-compose.yml` by line
numbers that were already off before this change; that is the next docs commit of item
5a. An empty directory that exists still scans clean, natively and in the image; the
menu did not choose to fail that.
53 lines
2.5 KiB
YAML
53 lines
2.5 KiB
YAML
# OpenUltraSAST as a contributor runs it: nothing installed on the host but Docker.
|
|
#
|
|
# docker compose build
|
|
# mkdir -p reports
|
|
# TARGET=/path/to/repo docker compose run --rm ousast scan /target
|
|
#
|
|
# The target is mounted READ-ONLY. A tool that reads your source to tell you about it has no business being
|
|
# able to write to it, and a contributor evaluating an unfamiliar analyser should not have to take that on
|
|
# trust.
|
|
|
|
services:
|
|
ousast:
|
|
build:
|
|
context: .
|
|
args:
|
|
JOERN_VERSION: ${JOERN_VERSION:-v4.0.625}
|
|
# The base is pinned by digest, the same pin CI builds from (plane/task-base.digest): a bare tag can move.
|
|
TASK_BASE_TAG: ${TASK_BASE_TAG:-base-b696c08}
|
|
TASK_BASE_DIGEST: ${TASK_BASE_DIGEST:-sha256:0f374138fcb49fef41609d323cc80b6c2324b1e798d3a2aee5c8038b8c7ac3aa}
|
|
image: openultrasast:${OUSAST_VERSION:-dev}
|
|
volumes:
|
|
# The repository under analysis, read-only. In the long syntax, like /reports below: in the short syntax Docker
|
|
# creates a TARGET that does not exist, as an empty directory, and an empty target scans clean.
|
|
- type: bind
|
|
source: ${TARGET:-.}
|
|
target: /target
|
|
read_only: true
|
|
bind:
|
|
create_host_path: false
|
|
# Where findings land, the one writable mount. Long syntax on purpose: the short syntax lets Docker create a
|
|
# missing source, as root, and the image runs as uid 1000. Create the directory first; the wrapper does.
|
|
- type: bind
|
|
source: ${OUSAST_REPORTS:-./reports}
|
|
target: /reports
|
|
bind:
|
|
create_host_path: false
|
|
working_dir: /work
|
|
tmpfs:
|
|
# CPG construction is scratch-heavy and none of it should outlive the run or touch the host.
|
|
- /work:size=${WORK_SIZE:-4g}
|
|
environment:
|
|
# The LLM endpoint is optional: without it the model layer still entails, and the suspicion band simply
|
|
# goes unasked. Passed through rather than baked in, so no key is ever in an image layer.
|
|
DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY:-}
|
|
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY:-}
|
|
# A scan's run directory would otherwise land in the container's home and be lost when the container exits.
|
|
OPENULTRASAST_RUNS_DIR: /reports/runs
|
|
TMPDIR: /work
|
|
# A CPG build is memory-hungry, and two Joern JVMs at once is what triggered an out-of-memory kill on a
|
|
# 7.7 GB machine during this project's measurements.
|
|
mem_limit: ${OUSAST_MEM_LIMIT:-6g}
|
|
network_mode: ${OUSAST_NETWORK:-none} # `bridge` only when the LLM judge is wanted
|