mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-11-13 01:48:17 +00:00
style: format release candidate
This commit is contained in:
@@ -323,9 +323,7 @@ def _validate_disclosure(content: bytes) -> None:
|
|||||||
"conflicts": tuple(conflicts),
|
"conflicts": tuple(conflicts),
|
||||||
"resolved": True,
|
"resolved": True,
|
||||||
}
|
}
|
||||||
expected = canonical.canonical_record_bytes(
|
expected = canonical.canonical_record_bytes(canonical_value, known_schema_versions=(AUTHORITY_CONFLICT_DISCLOSURE_SCHEMA,))
|
||||||
canonical_value, known_schema_versions=(AUTHORITY_CONFLICT_DISCLOSURE_SCHEMA,)
|
|
||||||
)
|
|
||||||
if content != expected:
|
if content != expected:
|
||||||
raise EntryFactAuthorityError("authority conflict disclosure bytes are not canonical")
|
raise EntryFactAuthorityError("authority conflict disclosure bytes are not canonical")
|
||||||
|
|
||||||
|
|||||||
@@ -48,9 +48,7 @@ def _build_contract() -> family.FamilyContract:
|
|||||||
(semantics.RelationStatus.INCOMPLETE, semantics.RelationStatus.UNRESOLVED),
|
(semantics.RelationStatus.INCOMPLETE, semantics.RelationStatus.UNRESOLVED),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
residual_questions=(
|
residual_questions=(family.ResidualQuestion("is_path_authorized", required, ("unguarded", "discharged", "indeterminate")),),
|
||||||
family.ResidualQuestion("is_path_authorized", required, ("unguarded", "discharged", "indeterminate")),
|
|
||||||
),
|
|
||||||
indeterminate_reasons=("missing_constraint_relation", "ambiguous_constraint_relation"),
|
indeterminate_reasons=("missing_constraint_relation", "ambiguous_constraint_relation"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -150,16 +150,18 @@ def _function(name: str, calls: tuple[str, ...] = ()) -> FunctionIR:
|
|||||||
start_line=1,
|
start_line=1,
|
||||||
end_line=9,
|
end_line=9,
|
||||||
binds=(),
|
binds=(),
|
||||||
calls=tuple(
|
calls=tuple(CallSite(call_name, 3 + offset, (), (), (), False, offset) for offset, call_name in enumerate(calls)),
|
||||||
CallSite(call_name, 3 + offset, (), (), (), False, offset)
|
|
||||||
for offset, call_name in enumerate(calls)
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _operation() -> Operation:
|
def _operation() -> Operation:
|
||||||
return Operation(
|
return Operation(
|
||||||
"src/C.java", 8, "handle", "protected_read", "f:op", "book",
|
"src/C.java",
|
||||||
|
8,
|
||||||
|
"handle",
|
||||||
|
"protected_read",
|
||||||
|
"f:op",
|
||||||
|
"book",
|
||||||
("path_guard",),
|
("path_guard",),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -169,8 +171,15 @@ def _witness(
|
|||||||
authority: AuthorityRef | None = None,
|
authority: AuthorityRef | None = None,
|
||||||
) -> Discharge:
|
) -> Discharge:
|
||||||
return Discharge(
|
return Discharge(
|
||||||
"src/C.java", 3, "handle", "path_guard", "f:guard", "call",
|
"src/C.java",
|
||||||
"statement", resource=resource, authority=authority,
|
3,
|
||||||
|
"handle",
|
||||||
|
"path_guard",
|
||||||
|
"f:guard",
|
||||||
|
"call",
|
||||||
|
"statement",
|
||||||
|
resource=resource,
|
||||||
|
authority=authority,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -270,10 +279,7 @@ def test_ambiguous_receiver_stays_a_candidate_set() -> None:
|
|||||||
target = resolve_call(call, module="src/A.java", index=index)
|
target = resolve_call(call, module="src/A.java", index=index)
|
||||||
assert not target.completeness.is_complete
|
assert not target.completeness.is_complete
|
||||||
assert len(target.targets) == 2
|
assert len(target.targets) == 2
|
||||||
assert any(
|
assert any(reason.endswith("receiver_type_unknown") for reason in target.completeness.reasons)
|
||||||
reason.endswith("receiver_type_unknown")
|
|
||||||
for reason in target.completeness.reasons
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_recursion_resolves_completely() -> None:
|
def test_recursion_resolves_completely() -> None:
|
||||||
@@ -299,12 +305,8 @@ def test_budget_cutoff_records_its_reason() -> None:
|
|||||||
from openultrasast.semantic.obligations.resolution import SymbolId
|
from openultrasast.semantic.obligations.resolution import SymbolId
|
||||||
|
|
||||||
index = SymbolIndex.build((("src/M.java", MUTUAL_JAVA, "java"),))
|
index = SymbolIndex.build((("src/M.java", MUTUAL_JAVA, "java"),))
|
||||||
functions = {
|
functions = {"src/M.java": (_function("a", ("b",)), _function("b", ("a",)))}
|
||||||
"src/M.java": (_function("a", ("b",)), _function("b", ("a",)))
|
callee = SymbolId(module="src/M.java", enclosing_type="C", name="b", signature=None)
|
||||||
}
|
|
||||||
callee = SymbolId(
|
|
||||||
module="src/M.java", enclosing_type="C", name="b", signature=None
|
|
||||||
)
|
|
||||||
summaries = monotone_summaries(
|
summaries = monotone_summaries(
|
||||||
functions,
|
functions,
|
||||||
index,
|
index,
|
||||||
@@ -312,7 +314,4 @@ def test_budget_cutoff_records_its_reason() -> None:
|
|||||||
budget=ExplorationBudget(depth=1),
|
budget=ExplorationBudget(depth=1),
|
||||||
)
|
)
|
||||||
by_name = {summary.symbol.name: summary for summary in summaries}
|
by_name = {summary.symbol.name: summary for summary in summaries}
|
||||||
assert any(
|
assert any(reason.endswith("depth_cutoff") for reason in by_name["a"].completeness.reasons)
|
||||||
reason.endswith("depth_cutoff")
|
|
||||||
for reason in by_name["a"].completeness.reasons
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -95,9 +95,7 @@ def test_multiple_entries_are_deterministic() -> None:
|
|||||||
first = strategy.recognize(_target(), JAVA_EXACT)
|
first = strategy.recognize(_target(), JAVA_EXACT)
|
||||||
second = strategy.recognize(_target(), JAVA_EXACT)
|
second = strategy.recognize(_target(), JAVA_EXACT)
|
||||||
assert first == second
|
assert first == second
|
||||||
assert [entry.function_name for entry in first] == sorted(
|
assert [entry.function_name for entry in first] == sorted(entry.function_name or "" for entry in first)
|
||||||
entry.function_name or "" for entry in first
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_registry_dispatch_stamps_strategy_provenance() -> None:
|
def test_registry_dispatch_stamps_strategy_provenance() -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user