Skip to content

Commit

Permalink
Parser: Support new "taint_origins" field in json
Browse files Browse the repository at this point in the history
Summary:
Parse the new "taint_origins" field. This assumes "origins" is the key in the json, which is not currently the case (but will be in the next MT diff).

TODO: Populate "taint_origins" correctly for CRTEX leaves, and remove some special-handling around CRTEX. Note that `normalize_crtex_conditions` still needs to happen (unfortunately)

Reviewed By: anwesht

Differential Revision: D50046193

fbshipit-source-id: 9962964d1e7f3f16fd276fca934985a3512e9091
  • Loading branch information
Yuh Shin Ong authored and facebook-github-bot committed Oct 10, 2023
1 parent 237aefd commit 690c272
Show file tree
Hide file tree
Showing 2 changed files with 188 additions and 40 deletions.
17 changes: 16 additions & 1 deletion sapp/pipeline/mariana_trench_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,14 +678,29 @@ def _parse_issue_conditions(

for kind in normalized_condition["kinds"]:
for origin in kind.get("origins", []):
if isinstance(origin, str):
# TODO(T163918472): Deprecate legacy origins json.
leaf_name = Method.from_json(origin)
elif "method" in origin:
# Methods may be strings, or a json object.
leaf_name = Method.from_json(origin["method"])
elif "field" in origin:
# Fields are always just strings.
leaf_name = Method(origin["field"])
else:
# TODO(T163918472): Deprecate legacy origins json.
# For non-legacy json, this could be a newly added
# key that the parser does not yet support.
leaf_name = Method.from_json(origin)
leaves.add(
Leaf(
method=Method.from_json(origin),
method=leaf_name,
kind=kind["kind"],
distance=kind.get("distance", 0),
)
)
for field_origin in kind.get("field_origins", []):
# TODO(T163918472): Deprecate legacy field origins json.
leaves.add(
Leaf(
method=Method(field_origin),
Expand Down

0 comments on commit 690c272

Please sign in to comment.