mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-12-03 10:18:18 +00:00
feat(contributor-scan): a scan writes its run to the user cache, and the ledger only when it learns (3.1, part A)
Where a scan writes. A native scan now creates its run under the user cache, ~/.cache/openultrasast/runs/<scan-id>/ by default ($XDG_CACHE_HOME when it is set and absolute), prints run_dir=<path> once, and no longer writes anything under the analysed tree. OPENULTRASAST_RUNS_DIR still wins: an absolute value is used as given, a relative one resolves against the working directory. Pre-push storage is unchanged. The calibration ledger, by maintainer decision: .openultrasast/calibration/ stays the store, and a scan writes the false-positive ledger into the tree only when its content would change. On a read-only tree the scan records ledger_not_written, with a sentence in the report, and completes; before, a read-only target with one rejected finding crashed before report.md existed. benchmarks/repos/measure.py follows the printed run directory. It read the run from under the scanned copy, which would have recorded every repository as failed, and it also read a stale run left in a copy. Tests: tests/test_scan_output_location.py drives the real CLI and compares the whole tree before and after; tests/test_repo_measure.py pins the measurement script; an autouse fixture keeps every test's scan runs out of the developer's cache; fourteen test files follow the run to its new place. README, docs/examples.md and the scan skill name the ledger as the one write a scan makes. _run_scan is touched by one line and stays over the complexity cap. Task 3.1 stays open for part B, the readable summary.
This commit is contained in:
+13
-3
@@ -1,13 +1,23 @@
|
||||
# End-to-end examples
|
||||
|
||||
Each example stands on its own. Artifacts land under `<target>/.openultrasast/runs/<scan-id>/`.
|
||||
`.openultrasast/` is gitignored.
|
||||
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
|
||||
the current working directory, never against the target.
|
||||
|
||||
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.
|
||||
|
||||
## 1. Quick scan a local repo (deterministic, no keys)
|
||||
|
||||
```bash
|
||||
uv run ousast scan /path/to/code --mode quick
|
||||
run=/path/to/code/.openultrasast/runs/<scan-id>
|
||||
# the scan prints: run_dir=/home/you/.cache/openultrasast/runs/<scan-id>
|
||||
run=/home/you/.cache/openultrasast/runs/<scan-id>
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user