mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-18 20:49:28 +00:00
feat(prover): delivery B: handler-named operations, Symfony, Livewire, Remix and Tornado entries, enforcement witnesses, memoised path walk
Codex delivery under spec access-control-prover plus one fix of mine. Operation rows may now name a handler by name pattern and framework (Jenkins form validation and list filling, Tornado request methods, Remix actions); the mapper recognises Symfony, Livewire and Laravel controllers, Remix exports and Tornado handlers; `obligations/enforcement.py` turns Laravel route middleware, Symfony attributes and security.yaml rules and Tornado's authenticated decorator into router and decorator witnesses. The path walk looks each node's callers up once per change and does not walk a tree with no recognised entry: one seatunnel change fell from 670 s to 35 s. One name Codex could not source (Tornado get_current_user) is left out and said so in the facts header. Smoke on the 23 fix changes: 15 pushes caught (65 percent, Wilson 45 to 81), 55 of 93 locations, precision 15 of 15 flagged, no instrument failure, no change over 120 s. Delivery A caught 7. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
7f1b820d5a
commit
17e07b36c4
@@ -115,3 +115,30 @@ def test_delivery_a_java_operations_and_dischargers_resolve():
|
||||
assert "path_guard" in operations[call].requires
|
||||
assert dischargers["checkPermission"].kind == dischargers["checkAnyPermission"].kind == "path_guard"
|
||||
assert dischargers["hasPermission"].kind == "ownership_check"
|
||||
|
||||
|
||||
def test_handler_rows_and_validation(tmp_path):
|
||||
from openultrasast.semantic.obligations.facts import ObligationFactsError, load_obligation_facts
|
||||
|
||||
text = """version = "1"
|
||||
language = "python"
|
||||
[[operation]]
|
||||
id = "handler"
|
||||
kind = "privileged_action"
|
||||
handlers = ["^open$"]
|
||||
framework = "tornado"
|
||||
requires = ["path_guard"]
|
||||
sensitivity = "high"
|
||||
"""
|
||||
path = tmp_path / "python.toml"
|
||||
path.write_text(text)
|
||||
(row,) = load_obligation_facts(tmp_path).operations
|
||||
assert row.handlers == ("^open$",) and row.framework == "tornado" and row.calls == ()
|
||||
for invalid in [
|
||||
text.replace('framework = "tornado"', ""),
|
||||
text.replace('"^open$"', '"["'),
|
||||
text.replace('framework = "tornado"', "framework = 12"),
|
||||
]:
|
||||
path.write_text(invalid)
|
||||
with pytest.raises(ObligationFactsError):
|
||||
load_obligation_facts(tmp_path)
|
||||
|
||||
Reference in New Issue
Block a user