In some cases message doesn't have "text" attribute and result_to_record call fails with exception:
File "C:\Python\lib\site-packages\sarif\sarif_file.py", line 550, in result_to_record
message = result["message"]["text"]
KeyError: 'text'
Example - binskim scan results from Defender for DevOps
In some cases message doesn't have "text" attribute and result_to_record call fails with exception: File "C:\Python\lib\site-packages\sarif\sarif_file.py", line 550, in result_to_record message = result["message"]["text"] KeyError: 'text'
Example - binskim scan results from Defender for DevOps
Per RFC3629 At least one of the text (§3.11.8) or id (§3.11.10) properties SHALL be present https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/sarif-v2.1.0-os.html#RFC3629 Proposed change checks if message have text or id attribute and use corresponding key to get message.
Sample sarif data: { "ruleId": "BA2015", "ruleIndex": 2, "level": "error", "message": { "id": "Error_NoHighEntropyVA", "arguments": [ "clipboard_x86_64.exe" ] },