mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-12-03 02:08:18 +00:00
`ousast scan .` through ops/shell/ousast.sh with a native install scanned the wrong tree. The native path changed into the checkout before it passed the arguments on, so `.` was the OpenUltraSAST checkout and a relative file name was looked up there. The eighth session showed it with a stub interpreter in place of `.venv/bin/python` (`cwd=/tmp/opencode/s8_fakehome args=-m openultrasast.cli scan .`). The check also looked for `joern-parse` only, while the batch queries run `joern`: with `joern-parse` alone on PATH every batch query failed and a standard scan still exited 0 (2026-11-26, 14 findings where the working launcher gives 15). The native path now runs the checkout's interpreter by its absolute path, in the caller's directory, as the container path does, and it is taken only when `joern` is on PATH as well. So `.`, relative names and relative options mean the caller's files. The reviewer found, and a run confirmed, what dropping the `cd` brings: `-m` alone puts the working directory first on the interpreter's path, so a file of the scanned tree could stand in for a module the CLI imports (a `json.py` in the caller's directory: `ousast --help` printed SHADOW-EXECUTED and exited 3). The interpreter is started with `-P`, which keeps that directory off the path; the flag needs Python 3.11, the project's floor (pyproject.toml). Changes a caller sees, beyond the one the decision named: - The checkout's .env is no longer read on the native path; the CLI reads .env from the working directory, which is now the caller's. ops/README.md says so. - `ousast pairs` and `ousast repos` no longer find their defaults outside the checkout, because `benchmarks/` is read relative to the working directory. Measured for `pairs`: through the wrapper natively, and on the container path, `pairs --slice vibe-py` ends with "pair catalog is not a file: benchmarks/pairs/catalog.toml", exit 1, so the container path already behaved this way. `repos` by reading. Run from the checkout root they find their defaults again (by reading; not run). The header's `ousast pairs --slice vibe-py` example is removed. This is a reading the maintainer may correct. - The message for a machine without Docker names both executables. Tests: the new tests/test_shell_wrapper.py runs the wrapper by bash with a stub of the interpreter, `joern`, `joern-parse` and `docker` ahead of /usr/bin and /bin on PATH. Its two tests failed before the change (2 failed: the interpreter ran in the fake checkout, and the native path was taken without `joern`), and the first failed again until `-P` was passed (1 failed). With the real venv and Joern 4.0.625 on PATH, from a directory without .env: `ousast scan examples --mode quick` on a fresh copy of libpng's contrib/examples gives file_targets=4, findings=4, exit 0, before and after the flag, the figures of the eighth session. The eight tests of tests/test_docs_site.py and tests/test_removed_plane_references.py pass, `mkdocs build --strict` exits 0, 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 the second round; its two findings of the first round led to the `-P` flag and to the removal of the header example. Found by the reviewer and left alone, outside this decision: the background child of `ousast pre-push` (src/openultrasast/push/background.py) starts the CLI with `-m` and without `-P`, from the pushed repository.