mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-19 04:59:28 +00:00
feat(model): first repository measurement, and the four things it found
contributor-scan 2.2. VAmPI at a pinned commit, scanned whole rather than as excerpts, with benchmarks/repos/measure.py recording build time, query time, arbitration time, peak memory, cost, unjudged regions, and whether each known vulnerability was found and at which rung. The corpus could not have found any of this. Every defect below needs a repository to become visible, and three of them were invisible behind a passing test suite. **The batch path was unreachable.** query_batch was implemented, tested and committed while CpgResult exposed only `run`, so the driver's capability check found nothing and fell back to one JVM per region-family: the first attempt at this measurement ran eighteen minutes on 520 lines, issuing `--param function=` one at a time. Every test called query_batch directly, so none of them noticed. CpgResult now carries run_batch and a test asserts the capability is reachable through the object the driver is handed. The earlier 275s->106s improvement attributed to batching came from region deduplication alone. **The budget stopped free work.** It bounds model calls, but was enforced by breaking the region loop -- spending a paid limit to stop unpaid CPG arbitration. 6 of 22 regions were examined and VAmPI's BOLA, which the graph entails for nothing, was never reached. It now withholds the judge only. 22 of 22 regions arbitrated, 17 counted as regions_unasked (silent because unaffordable is not silent because decided), and the BOLA is entailed by the model layer. **A region with no function asked about the whole repository.** Sending function="" matched every hit in the tree and the driver attributed that answer to whoever asked: one `host='0.0.0.0'` in app.py became eight identical entailed findings in eight files that do not contain it. Queries now carry the region's file. Entailed findings 14 -> 7, query time 70.9s -> 40.9s. The single-request form stays unscoped so the committed pair measurements remain reproducible. **The JVM had no heap bound.** Joern claimed a quarter of physical RAM and runs were killed under memory pressure at different points, so the numbers described the host rather than the engine. -J-Xmx2048m by default, OPENULTRASAST_CPG_HEAP_MB to raise it. Also: arbitrated findings carried `function:line` where the report layer read `path:line`, so every entailed finding reached a contributor with a function name where its file belonged; and the witness line was parsed by splitting on a comma, which produced sites like `config.py:17): permissive literal '0.0.0.0':?`. Reading: GO on one CPG per repository -- 6.2s to build, 177s end to end, 869MB, $0.0067, nothing infeasible. NO-GO on region-scoped taint as the only shape: VAmPI's SQL injection runs from a handler parameter into a function in another module, and a per-function region sees neither end. That is the ordinary shape of a real injection bug, so it is recorded as task 2.4 along with three smaller defects this run exposed. Gates byte-identical. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01T7XD7x5KonMdmGRkp63EQG
This commit is contained in:
co-authored by
Claude Opus 5
parent
8c387306be
commit
177c7f3719
@@ -79,6 +79,22 @@ def test_an_entailed_site_becomes_a_finding_with_no_model_call() -> None:
|
||||
assert client.calls == 0
|
||||
|
||||
|
||||
def test_an_arbitrated_finding_names_its_file_the_way_a_candidate_does() -> None:
|
||||
"""One consumer parses both shapes, so both must be ``path:line:function``.
|
||||
|
||||
An arbitrated finding was ``function:line``, which the report layer read as ``path:line``: every entailed
|
||||
finding reached a contributor with a function name where its file belonged and no line at all. A whole
|
||||
repository scan is what made it visible -- `model:access_control:get_all_books:?`, path `get_all_books`.
|
||||
"""
|
||||
from openultrasast.model.pipeline import scan_region
|
||||
|
||||
findings = scan_region(_cpg(ENTAILING), _spec(), path="models/user_model.py", function="get_user", client=_Client(), model="m")
|
||||
|
||||
path, _, rest = findings[0].site.partition(":")
|
||||
assert path == "models/user_model.py", "the file, not the function"
|
||||
assert rest.endswith(":get_user")
|
||||
|
||||
|
||||
def test_a_sanitized_flow_the_judge_confirms_becomes_corroborated() -> None:
|
||||
from openultrasast.model.ladder import Rung
|
||||
from openultrasast.model.pipeline import scan_region
|
||||
@@ -244,3 +260,16 @@ def test_the_dominance_question_describes_the_evidence_the_model_actually_has()
|
||||
assert "siblings have" not in q, "the corroborated case has no guarded siblings to appeal to"
|
||||
assert "sibling handlers are guarded" not in q
|
||||
assert "guard" in q.lower() and "public" in q.lower(), "it must still ask whether the operation needs a guard"
|
||||
|
||||
|
||||
def test_a_witness_line_is_read_whatever_follows_the_number() -> None:
|
||||
"""The delimiter after the line number differs by family: `(line 17,` in one, `(line 17):` in another.
|
||||
|
||||
Splitting on the comma produced sites like `config.py:17): permissive literal '0.0.0.0':?` -- a line
|
||||
number no editor can open and no consumer can compare.
|
||||
"""
|
||||
from openultrasast.model.pipeline import _site
|
||||
|
||||
assert _site("config.py", "", "permissive literal '0.0.0.0' (line 17): permissive") == "config.py:17:?"
|
||||
assert _site("a.py", "run", "flow reaches os.system (line 9, via x)") == "a.py:9:run"
|
||||
assert _site("a.py", "run", "no line at all") == "a.py:?:run"
|
||||
|
||||
Reference in New Issue
Block a user