Bugfix signature subset superset mismatch

when the template signature portion contains
codeflows it was previously possible that a valid sarif
problem portion that contains extra fields
would be misdiagnosed as not parsable
This commit is contained in:
Kristen Newbury
2022-12-15 18:46:32 -05:00
parent dae6c50d5b
commit d602efd3f0

View File

@@ -196,9 +196,14 @@ def _destructure_dict(typegraph: Typegraph, node, tree):
) )
else: else:
status_writer.unknown_sarif_parsing_shape["extra_info"] = "type fields {} do not match tree fields {}.".format(type_fields, tree_fields) # possibly looks like: (Struct9699)type_fields: [codeflows...] vs tree_fields: [...extra_properties]
status_writer.csv_write(status_writer.unknown_sarif_parsing_shape) # in that case we need to also try the Struct4055 signature here
raise Exception("typegraph: unhandled case reached: cannot match type " if "codeFlows" in type_fields:
_destructure_dict(typegraph, "Struct4055", tree)
else:
status_writer.unknown_sarif_parsing_shape["extra_info"] = "type fields {} do not match tree fields {}.".format(type_fields, tree_fields)
status_writer.csv_write(status_writer.unknown_sarif_parsing_shape)
raise Exception("typegraph: unhandled case reached: cannot match type "
"fields {} to tree fields {}. Data is invalid." "fields {} to tree fields {}. Data is invalid."
.format(type_fields, tree_fields)) .format(type_fields, tree_fields))