mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-12-05 11:18:19 +00:00
The maintainer's answer of 2026-11-27 to question 2 of the ninth session's menu, "Record and stop
asking", as offered: "a failed judge call adds a degradation to the manifest, with the count; the
report says those questions went unasked; after one transport failure the remaining questions are
not asked." Measured by the ninth session: with a key in the environment and no network, 16 judge
calls failed in one scan of a four-file subject, three attempts each, and each dropped its claim
as a "no" would (model/pipeline.py); the manifest counted model_calls 16 and recorded no failure,
and the report said less than that of a run without an endpoint.
What changed:
- model/scan.py, `_CountingClient`: a call that raises is counted in `failed` and ends the asking.
The calls left in the question being put are refused without reaching the client (`refused`),
and the driver withholds the judge from every question after it, as it does when the budget runs
out. An answer with no decision in it (empty, not JSON, no boolean `vulnerable`) is counted in
`failed` as well and does not end the asking. The graph still arbitrates every region.
- Two degradations, each with a sentence under "What could not be analysed" (reports.py) and a
line in the scan skill's list:
- `judge_calls_failed`, `count`: the judge calls that gave no decision.
- `judge_withheld`, `questions`: the judge calls refused after the failure in the question
being put. Of the questions after it the report says that none was put to the judge; they are
not counted, because some of them would have put nothing to the judge.
- model/pipeline.py: the parsing half of `_ask` is moved as it was into `judge_decision`, so the
driver reads a decision the way `_ask` does. `_ask` returns what it returned.
- The claim of every such question is still dropped, as before: "Keep the claim" was not chosen.
The session's two readings of the decision, open to correction:
- A transport failure is read as a judge call that raised, whatever the exception. The transport
has already made its three attempts for what is transient (provider/openrouter.py), so one
raised call ends the asking for the whole scan. That holds for a connection failure and for a
timeout, and also for a request the endpoint refuses with an error status, where the transport
makes one attempt: there the scan withholds every later question, where before it dropped that
claim alone and went on. The judge_withheld line says so in the report.
- A failed judge call is read as a call that raised or a call whose answer gave no decision. Both
are counted.
Measured on fresh copies of the four C files the ninth session used, with a placeholder key and
the network off (the scratch is /tmp/opencode/s10_c2_* and is not kept):
- Native, in a network namespace without routes: one "judge call failed" line, file_targets=4,
findings=15, exit 0, 45 s (s10_c2_native_key3.out). The ninth session's run of the same bytes:
16 lines, 68 s.
- In a probe image built from openultrasast:dev 3f959b31f2f2 with src copied over, network none:
one line, file_targets=4, findings=15, exit 0, 43 s (s10_c2_image_key3.out). The ninth
session's run: 16 lines, 65 s. The probe image is removed.
- Both manifests: model_calls 1, judge_calls_failed with count 1, judge_withheld with questions
7; report.md carries the two sentences (s10_c2_native_inspect3.out, s10_c2_image_inspect3.out).
The findings are the 15 the ninth session recorded with a key and without one.
Tests, one at a time, each red before its code:
- test_a_judge_that_cannot_be_reached_is_recorded_and_asked_no_further: on a git archive of
HEAD, assert 120 == 1; after, one call, model_calls 1, ten regions arbitrated, the two
degradations with count 1 and questions 5.
- test_a_judge_answer_with_no_decision_in_it_is_counted_and_the_rest_are_still_asked: red with
no degradation; after, count 120 and no judge_withheld.
- test_a_failed_judge_call_is_reported_as_unasked_and_not_as_a_no: red with the two bare
reasons; after, the two sentences. The three red runs, with the package imported from the
archive, are in s10_c2_red8.out: 3 failed, 1 passed.
- GREEN: 657 passed over the 39 test files that name degradations, scan_repository, model_calls
or write_markdown_report (s10_c2_green9.out); 214 passed over ten model, report and skill files
(s10_c2_green8.out). ruff, mypy, the three gates and compileall pass, and the gates print what
they printed before (s10_c2c_exits.txt). `git diff --check` exits 0. No whole-suite run: that is
step 9.
- The review took three rounds on one reviewer. Round one approved a first shape that counted the
withheld regions, and remarked that a region with several families was counted as withheld while
its first family had been put to the judge; its other remarks changed the second sentence,
`__all__` and a docstring. Round two blocked the sum that replaced that count: it added judge
calls to region-and-family questions under one name. The count is of judge calls now. Round
three approved this diff, on the condition that this message carry the measured numbers.
By reading, not measured: a pre-push run makes no judge call (push/runner.py and push/policy.py
pass no client and an execution budget), so the two reasons cannot arise there.
Found and not fixed, for the maintainer:
- .agents/skills/openultrasast-scan/SKILL.md:68-70 and docs/where-we-stand.md:349-350 say that
`learning_endpoint_unavailable` has no line in report.md. It has had one since f555dee
(2026-10-02).
- The citations of scan.py in docs/detection-techniques.md: of 24, 19 sit one, two or seven lines
further down after this commit (5 do not move, 9 move by one line, 1 by two, 9 by seven).
143 lines
8.9 KiB
Markdown
143 lines
8.9 KiB
Markdown
---
|
|
name: openultrasast-scan
|
|
description: OpenUltraSAST scan workflows - `ousast scan` in quick, standard or deep mode, the evidence ladder, `--fail-on` exit codes, recorded degradations, the run directory and `ousast mcp`. Use when running or planning a scan, reading a run directory, or wiring OpenUltraSAST into an agent.
|
|
---
|
|
|
|
# OpenUltraSAST Scan
|
|
|
|
Use this skill to run `ousast scan PATH --mode quick|standard|deep` from an agent and to read what
|
|
it wrote.
|
|
|
|
## Workflow
|
|
|
|
1. Confirm the target is a local checkout (a path, not a URL).
|
|
2. Run through the project entry point: `uv run ousast ...` inside the repository, or `ousast` from an
|
|
environment where it is installed. Never activate a virtualenv by hand.
|
|
3. Start with `--mode quick` unless the task needs the Joern model layer (`standard`) or sandboxed
|
|
regression snippets (`deep`). Check the prerequisites below first; a mode whose engine is missing
|
|
still exits 0 and records a degradation.
|
|
4. Read the printed `scan_id=` and `run_dir=` lines; the run directory is `~/.cache/openultrasast/runs/<scan-id>/`
|
|
(`$XDG_CACHE_HOME/openultrasast/runs/` when that variable is set to an absolute path; `OPENULTRASAST_RUNS_DIR`
|
|
overrides it). After a scan, with no `OPENULTRASAST_RUNS_DIR` set, the runs in that default location older than
|
|
30 days are removed (`OPENULTRASAST_RUNS_RETENTION_DAYS` sets the number of days and `0` keeps every run), and
|
|
nothing is removed from a location chosen with `OPENULTRASAST_RUNS_DIR`.
|
|
5. Report the finding count, how many the verifier accepted, and **every** recorded degradation
|
|
(`manifest.json`, key `degradations`). No findings plus a degradation is not a clean scan: the scan
|
|
answered a smaller question than it was asked.
|
|
6. Never call a finding verified from its title or severity. `verification.json` holds the status.
|
|
|
|
## Commands
|
|
|
|
```bash
|
|
uv run ousast scan <repo> --mode quick
|
|
uv run ousast scan <repo> --mode standard --fail-on verified
|
|
uv run ousast scan <repo> --mode deep --fail-on worth-fixing
|
|
uv run ousast scan <repo> --mode quick --config openultrasast.toml
|
|
uv run ousast mcp # the MCP server over stdio, for agent hosts
|
|
```
|
|
|
|
## Modes and prerequisites
|
|
|
|
| Mode | Adds | Needs | Without it |
|
|
| --- | --- | --- | --- |
|
|
| `quick` | language-scoped pattern rules, entry-point hints, ranking, verification, score; deterministic | nothing | - |
|
|
| `standard` | the MAP stage: complexity map, semantic overlay, authorization obligations, the Joern model layer (one code property graph per repository; taint, guard-dominance and configuration questions), deterministic fusion | Joern (shipped in the Docker image, with `php-cli` for PHP); a provider key for the residual LLM question | `cpg_unavailable`; without a key the LLM question is not asked and only the graph's entailed findings are reported |
|
|
| `deep` | nothing today: REGRESS was retired on 2026-10-13 (degradation `regress_retired`); execution proof belongs to the search-with-proof arm | - | - |
|
|
|
|
Model stages read `DEEPSEEK_API_KEY` (every LLM call); with only `OPENROUTER_API_KEY` set, chat
|
|
calls fall back to OpenRouter. An exported shell variable wins over `.env` silently. `[models]
|
|
hunter` in the config enables the tool hunter in `standard`; it is off by default.
|
|
|
|
## Exit code: `--fail-on`
|
|
|
|
| Policy | Exit 1 when |
|
|
| --- | --- |
|
|
| `never` (default) | never |
|
|
| `findings` | any finding was reported |
|
|
| `verified` | any verification result is `verified` (accepted at `static_corroboration` or above) |
|
|
| `worth-fixing` | a deep-mode sandbox verdict is marked `worth_fixing` |
|
|
|
|
A degradation never changes the exit code. Read `manifest.json` for it.
|
|
|
|
## Recorded degradations
|
|
|
|
Each entry in `manifest.json` `degradations` is `{"stage": ..., "reason": ...}`. The ones to expect:
|
|
|
|
- `cpg_unavailable` (stage `model`): no Joern on the host; the model layer ran nothing.
|
|
- `regress_retired` (stage `regress`): deep mode requested the retired snippet stage; the scan equals standard.
|
|
- `learning_endpoint_unavailable` (stage `model`): no provider key resolved. The graph's entailed
|
|
findings are still reported; the residual question is skipped. This is recorded in `manifest.json`
|
|
but has no line in `report.md`'s "What could not be analysed" section.
|
|
- `judge_calls_failed` (stage `model`): `count` judge calls gave no decision, because the endpoint sent no
|
|
answer or nothing the scan can read as one. Each dropped its claim as a `no` would, so its finding is not
|
|
in the report; that is not a refutation. The first call that gets no answer from the endpoint ends the
|
|
asking, and `judge_withheld` (stage `model`) follows it: `questions` counts the judge calls refused after
|
|
that failure in the question being put; no question after it was put to the judge either. Both have a line
|
|
under "What could not be analysed".
|
|
- `hunter_model_unavailable` (stage `map`): `[models] hunter` is unset, so the tool hunter did not run.
|
|
Recorded on every standard scan without that setting; it is expected, not an error.
|
|
- `ledger_not_written` (stage `record_calibration`): the scan rejected or held a finding and could not write the
|
|
false-positive ledger into the analysed tree, as on a read-only mount. Recorded whenever such a scan has a
|
|
learning the tree's ledger does not already hold; the learnings are in this run's
|
|
`calibration/false_positive_learnings.json`, and the next scan starts without them.
|
|
- coverage facts from the graph, rendered in `report.md` under "What could not be analysed":
|
|
`cpg_empty`, `cpg_build_failed`, `cpg_sharded`, `files_unparsed`, `query_failed`,
|
|
`query_budget_reserved`, `query_too_expensive`, `budget_exhausted`, `regions_truncated`,
|
|
`region_failed`; plus `max_findings_exceeded` and `facts_unavailable` (overlay, obligations).
|
|
|
|
Prove the instrument read its input before believing a zero: `manifest.json` names the stages that
|
|
ran and the files the preprocess step kept (`preprocess/file_targets.json`).
|
|
|
|
## Evidence ladder
|
|
|
|
`src/openultrasast/verification.py` defines the levels in this order. A level moves one rung at a
|
|
time and never backward.
|
|
|
|
| Level | Meaning | Produced today by |
|
|
| --- | --- | --- |
|
|
| `suspicion` | a rule, model or weak signal raised a hypothesis | the Joern model layer (its rung, `model_entailed` or `suspicion`, travels in the finding's tags), the tool hunter, authorization-obligation checks |
|
|
| `static_corroboration` | deterministic code evidence at the line | quick rules, the semantic overlay |
|
|
| `crash_reproduced` | an artifact-backed reproducer | nothing: there is no crash reproducer. Deep-mode sandbox verdicts (`verdicts.json`, `worth_fixing`) do not raise the level |
|
|
| `root_cause_explained` | independent verifier reasoning | nothing: the LLM judge was retired in v2.0.0 |
|
|
| `exploit_demonstrated` | a demonstrated exploit | nothing |
|
|
| `patch_validated` | relevant checks re-run after a patch | nothing: there is no patch stage |
|
|
|
|
The verifier's status per finding (`verification.json`): below `static_corroboration` is
|
|
`needs_evidence`; `static_corroboration` with reachability `unknown` is `rejected` (the tie-breaker
|
|
asks for call-graph, route, CLI, parser or dynamic evidence); `static_corroboration` with
|
|
function-level reachability is `accepted`. `verified` means accepted at `static_corroboration` or
|
|
above, and that is what `--fail-on verified` counts. There is no configurable report threshold: the
|
|
`[evidence]` config section was retired in v2.0.0 and is ignored.
|
|
|
|
## Run artifacts
|
|
|
|
Under `~/.cache/openultrasast/runs/<scan-id>/`:
|
|
|
|
- `report.md`, `report.sarif` (SARIF 2.1.0 for code hosts and IDEs), `manifest.json` (stages, degradations, model payload)
|
|
- `findings.json`, `verification.json`, `score.json`, `shadow_findings.json` (rules shipped as `shadow`)
|
|
- `harness.json`: the resolved harness configuration the run used
|
|
- standard: `fusion.json`, `complexity_map.json`, `overlay.json`; deep: `verdicts.json`
|
|
- `calibration/false_positive_learnings.json`, `rank/ranking.json`, `mapping/`, `preprocess/`, `trace/events.jsonl`
|
|
|
|
The only write a scan makes into the scanned tree is the ledger
|
|
`<target>/.openultrasast/calibration/false_positive_learnings.json`: a scan that rejects or holds a finding
|
|
writes it only when that file's content would change; on a read-only tree the scan records `ledger_not_written`
|
|
instead and keeps the learnings in this run directory's `calibration/false_positive_learnings.json`.
|
|
|
|
## Changed code only
|
|
|
|
`ousast pre-push --base <rev> --head <rev> --artifact <file> <repo>` replays a revision pair and
|
|
reports only new or worsened defects (experimental; `--mode advisory` is the default and never
|
|
blocks). The capability registry is empty, so every candidate is diagnostic.
|
|
|
|
## MCP
|
|
|
|
`ousast mcp` serves a narrow MCP server over stdio (newline-delimited JSON-RPC) with ten tools:
|
|
`openultrasast.scan`, `status`, `findings`, `get_finding`, `evidence`, `artifacts`, `benchmark`,
|
|
`explain`, `propose_patch` (degrades visibly) and `export_report`. No tool runs a shell, Docker or a
|
|
free-form command.
|
|
|
|
```jsonc
|
|
{ "command": "uv", "args": ["run", "ousast", "mcp"] }
|
|
```
|