2026-06-22 20:00:42 +02:00
|
|
|
|
# End-to-end examples
|
|
|
|
|
|
|
2026-11-24 15:33:35 +01:00
|
|
|
|
Each example stands on its own. A scan writes its run under
|
|
|
|
|
|
`~/.cache/openultrasast/runs/<scan-id>/`, or under `$XDG_CACHE_HOME/openultrasast/runs/` when
|
|
|
|
|
|
that variable is set to an absolute path, and prints that path. `OPENULTRASAST_RUNS_DIR`
|
|
|
|
|
|
overrides the location: an absolute path is used as given, and a relative one is resolved against
|
2026-11-24 17:51:37 +01:00
|
|
|
|
the current working directory, never against the target. Once a scan has written its run to the
|
|
|
|
|
|
default location, with no `OPENULTRASAST_RUNS_DIR` set, the runs there that are older than 30 days
|
|
|
|
|
|
are removed, and `ousast` prints one `notice:` line when it removes any;
|
|
|
|
|
|
`OPENULTRASAST_RUNS_RETENTION_DAYS` sets the number of days (`0` keeps every run), and nothing is
|
2026-11-25 17:44:42 +01:00
|
|
|
|
ever removed from a location chosen with `OPENULTRASAST_RUNS_DIR`. A scan does not read the files
|
|
|
|
|
|
under its runs directory when that directory lies inside the scanned path; when this leaves source
|
|
|
|
|
|
files out of the scan, `ousast` prints one `notice:` line naming the directory and how many.
|
|
|
|
|
|
`ousast benchmark` writes its run to the same directory, as `<runs_dir>/<benchmark-run-id>/` beside
|
|
|
|
|
|
the scan runs, and prints that path (`benchmark_run_dir=<path>`); run retention removes it like a
|
|
|
|
|
|
scan run.
|
2026-11-24 15:33:35 +01:00
|
|
|
|
|
|
|
|
|
|
A scan that rejects or holds a finding writes one file into the scanned tree, and only when that
|
|
|
|
|
|
file's content would change:
|
|
|
|
|
|
`<target>/.openultrasast/calibration/false_positive_learnings.json` (`.openultrasast/` is
|
|
|
|
|
|
gitignored in this repository, not in one of your own); on a read-only tree the scan records
|
|
|
|
|
|
`ledger_not_written` instead and keeps the learnings in the run directory.
|
2026-06-22 20:00:42 +02:00
|
|
|
|
|
|
|
|
|
|
## 1. Quick scan a local repo (deterministic, no keys)
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
uv run ousast scan /path/to/code --mode quick
|
2026-11-24 15:33:35 +01:00
|
|
|
|
# the scan prints: run_dir=/home/you/.cache/openultrasast/runs/<scan-id>
|
|
|
|
|
|
run=/home/you/.cache/openultrasast/runs/<scan-id>
|
2026-06-22 20:00:42 +02:00
|
|
|
|
cat "$run/report.md" # findings + evidence (secrets redacted)
|
|
|
|
|
|
jq . "$run/score.json" # 0–100 project score + gate verdict
|
|
|
|
|
|
"$run/report.sarif" # SARIF for code-scanning / IDEs
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-10-02 07:08:44 +02:00
|
|
|
|
## 2. Standard scan with the engine (Docker)
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
source ops/shell/ousast.sh # once per shell; builds the image on first use
|
|
|
|
|
|
ousast scan . --mode standard # Joern model layer, container network off: no model calls
|
|
|
|
|
|
ousast-with-judge scan . --mode standard # network on, so the model is asked (needs DEEPSEEK_API_KEY)
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-10-02 21:01:10 +02:00
|
|
|
|
Without a key, the graph still decides. Its entailed findings are reported. The LLM's residual
|
2026-10-02 16:03:46 +02:00
|
|
|
|
and suspicion questions go unasked.
|
2026-10-02 07:08:44 +02:00
|
|
|
|
|
|
|
|
|
|
## 3. CI gate
|
2026-06-22 20:00:42 +02:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
# Fail the build on any evidence-verified finding:
|
|
|
|
|
|
uv run ousast scan . --mode quick --fail-on verified
|
|
|
|
|
|
|
|
|
|
|
|
# The hard detection gate (>=90% recall, <10% FP), score-independent:
|
|
|
|
|
|
uv run python -m openultrasast.gate
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-10-02 07:08:44 +02:00
|
|
|
|
## 4. Benchmark a known-vulnerable corpus
|
2026-06-22 20:00:42 +02:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
uv run ousast benchmark benchmarks/manifests/python-vulnerable.toml --mode quick
|
|
|
|
|
|
# -> expected / matched / missed counts + a per-rule recommendation delta
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-10-02 07:08:44 +02:00
|
|
|
|
## 5. Vuln vs fixed pair eval (efficiency, not cheat-sheet recall)
|
2026-09-04 13:57:33 +02:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
uv run ousast pairs # local fixtures + vendored GitHub VFCs
|
|
|
|
|
|
uv run ousast pairs --slice github --json # honesty dashboard as JSON
|
|
|
|
|
|
uv run ousast pairs --slice sast # OWASP Benchmark + Juliet Youden (TPR-FPR)
|
2026-09-05 10:37:53 +02:00
|
|
|
|
uv run ousast pairs --slice vibe-py --pointers # nightly: pointer pairs via the local cache (network)
|
2026-10-02 07:08:44 +02:00
|
|
|
|
uv run ousast pairs --split holdout --profile human # filter by declared split and provenance profile
|
2026-09-04 13:57:33 +02:00
|
|
|
|
uv run python -m openultrasast.pair_gate # CI: local pairs must all pass
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-10-02 21:01:10 +02:00
|
|
|
|
Each case is two isolated trees: the vuln file and the patched file, at the same relative path.
|
|
|
|
|
|
|
|
|
|
|
|
- `pair_correct` means the harness fired on the vuln side and stayed silent on the fix.
|
2026-10-13 10:34:57 +02:00
|
|
|
|
- Misses become `miss` signals and fix-side leaks become `fp` signals in the pair report.
|
2026-10-02 21:01:10 +02:00
|
|
|
|
- The catalog and public dataset pointers live in `benchmarks/pairs/`.
|
2026-09-04 13:57:33 +02:00
|
|
|
|
|
2026-10-13 10:34:57 +02:00
|
|
|
|
## 6. Running the agentic plane
|
2026-09-30 12:45:29 +02:00
|
|
|
|
|
2026-10-02 21:01:10 +02:00
|
|
|
|
Model work over whole repositories runs as a Run manifest on ax. Each task gets one isolated
|
|
|
|
|
|
actor. Bring-up is in [ops/ax/README.md](ops/ax/README.md).
|
|
|
|
|
|
|
|
|
|
|
|
`ousast` reads the provider key from the environment, or from `.env`. `.env` never overrides an
|
|
|
|
|
|
exported variable. The key is sent only in each task's start request.
|
2026-06-22 20:00:42 +02:00
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-09-30 12:45:29 +02:00
|
|
|
|
uv run ousast plane doctor # kind, Agent Substrate, ax controller, runner image
|
2026-10-02 07:08:44 +02:00
|
|
|
|
uv run ousast plane run plane/runs/validation-46.yaml # per case: repo-facts, verify a/b/c, agree, final, features, remember
|
2026-09-30 12:45:29 +02:00
|
|
|
|
uv run ousast plane status validation-46 # per-task status and token attribution
|
|
|
|
|
|
uv run ousast plane remember validation-46 # re-ingest the run's memory rows (OUSAST_MEMORY)
|
2026-06-22 20:00:42 +02:00
|
|
|
|
```
|
|
|
|
|
|
|
2026-10-02 21:01:10 +02:00
|
|
|
|
Each task in the Run carries its own Model and `budget: {usd, calls}`.
|
|
|
|
|
|
|
|
|
|
|
|
- A task that reaches its ceiling stops as `unfinished`. It resumes on a rerun with a larger
|
|
|
|
|
|
budget.
|
|
|
|
|
|
- `ousast plane status` prints the token attribution table. It shows calls, prompt, cache-hit and
|
|
|
|
|
|
output tokens, and USD per task.
|
2026-09-30 12:45:29 +02:00
|
|
|
|
|
2026-10-13 10:34:57 +02:00
|
|
|
|
## 7. Drive it from an MCP client (OpenCode / IDE)
|
2026-06-22 20:00:42 +02:00
|
|
|
|
|
2026-10-02 21:01:10 +02:00
|
|
|
|
MCP (Model Context Protocol) lets an editor or agent call the tool's functions.
|
|
|
|
|
|
|
2026-06-22 20:00:42 +02:00
|
|
|
|
```jsonc
|
|
|
|
|
|
{ "command": "uv", "args": ["run", "ousast", "mcp"] }
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-10-02 21:01:10 +02:00
|
|
|
|
Then call the tools in this order:
|
|
|
|
|
|
|
|
|
|
|
|
1. `openultrasast.scan {path}` returns a `run_dir`.
|
|
|
|
|
|
2. `openultrasast.findings {run_dir}` lists the findings.
|
|
|
|
|
|
3. `openultrasast.explain {run_dir, finding_id}` explains one.
|
|
|
|
|
|
|
|
|
|
|
|
See the README section "Agent integrations".
|