mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-16 03:49:26 +00:00
feat(prover): access-control prover, delivery A: path records, Stapler and Jetty entries, Java operation rows, the prover and its scoring arm
Codex delivery under spec access-control-prover. `semantic/obligations/paths.py` builds entry-to-function path records from the cached caller index; `mapping.py` names Stapler web methods and Jetty handlers as entries; `check_obligations` gains the opt-in premise `assume_entries_protected` with the label `unguarded_path`; `hunt/prover.py` proves a change with no model call and states its coverage; `benchmarks/valid/prover_arm.py` scores it with the valid-benchmark metrics. Two fixes after the first smoke run: a product file git holds empty is read, not unread (four changes failed on `__init__.py` and empty assets), and absent-input reasons are counted by name. Smoke on the 23 fix changes of the training pool: 7 pushes caught (30 percent, Wilson 16 to 51), 28 of 93 locations, precision 7 of 8 flagged, no instrument failure; three changes over the 120 second bound. Twelve of the 17 Jenkins fixes reach the fixed method but check no operation because the method is the operation; the spec now carries handler-named operations for delivery B. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
e514551cb6
commit
beb272a5ec
@@ -206,3 +206,34 @@ def test_a_malformed_store_row_is_a_degradation_not_a_crash() -> None:
|
||||
(degradation,) = [d for d in result.degradations if d["reason"] == "obligations_store_row_invalid"]
|
||||
assert degradation["records"] == ["corpus:bad", "corpus:worse"]
|
||||
assert all(f.known_fix is None for f in result.findings)
|
||||
|
||||
|
||||
def test_recognised_entry_premise_is_opt_in_and_never_applies_to_public():
|
||||
from dataclasses import replace
|
||||
|
||||
from openultrasast.semantic.obligations import load_obligation_facts
|
||||
from openultrasast.semantic.obligations.check import check_obligations, findings_to_static
|
||||
from openultrasast.semantic.obligations.dominance import OrderDominance
|
||||
|
||||
text = "def exposed(title):\n return Book.query.filter_by(book_title=title).first()\n"
|
||||
entry = replace(_entry("exposed", 1, 2, "authenticated", ["framework entry"]), access_level="unknown")
|
||||
kwargs = dict(
|
||||
irs={"app.py": (parse_file("app.py", text, "python"), text)},
|
||||
entries=[entry],
|
||||
facts=load_obligation_facts(),
|
||||
flow_facts=load_facts(),
|
||||
policy=None,
|
||||
paths=[_Path((("app.py::exposed", 1),))],
|
||||
dominance=OrderDominance({"app.py": text}),
|
||||
store_shapes=(),
|
||||
min_siblings=3,
|
||||
)
|
||||
assert check_obligations(**kwargs).findings == ()
|
||||
result = check_obligations(**kwargs, assume_entries_protected=True)
|
||||
(finding,) = result.findings
|
||||
assert finding.label == "unguarded_path"
|
||||
assert "no declared policy clause and no sibling norm" in "; ".join(finding.evidence)
|
||||
assert "framework entry" in "; ".join(finding.evidence)
|
||||
assert "unguarded_path" in findings_to_static(result)[0].rationale
|
||||
kwargs["entries"] = [replace(entry, access_level="public")]
|
||||
assert check_obligations(**kwargs, assume_entries_protected=True).findings == ()
|
||||
|
||||
Reference in New Issue
Block a user