Add SARIF output support via --sarif-ui option#8835
Add SARIF output support via --sarif-ui option#8835tautschnig wants to merge 1 commit intodiffblue:developfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new --sarif-ui user-interface mode intended to emit SARIF 2.1.0 JSON, extending existing JSON UI plumbing to output verification results as SARIF “results” entries.
Changes:
- Extend
ui_message_handlertwith a newSARIF_UImode and streaming helpersarif_output(...). - Convert goto-checker property reporting to emit SARIF result objects.
- Add a new regression suite (
regression/cbmc-sarif-ui) to validate SARIF JSON structure.
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| src/util/ui_message.h | Adds SARIF_UI enum value, sarif_output(...), and tracking state. |
| src/util/ui_message.cpp | Emits SARIF log wrapper on stdout; routes general messages to stderr in SARIF mode. |
| src/pointer-analysis/show_value_sets.cpp | Treats SARIF like JSON for value-set output. |
| src/json/json_interface.h | Registers --sarif-ui in option/help macros. |
| src/goto-symex/show_vcc.cpp | Treats SARIF like JSON for --show-vcc output. |
| src/goto-symex/show_program.cpp | Treats SARIF like JSON for --show-byte-ops output. |
| src/goto-programs/show_symbol_table.cpp | Treats SARIF like JSON UI for symbol table output. |
| src/goto-programs/show_properties.cpp | Adds SARIF case (currently UNREACHABLE) in property printing. |
| src/goto-programs/show_goto_functions.cpp | Adds SARIF case for showing goto functions (JSON-like output). |
| src/goto-programs/loop_ids.cpp | Adds SARIF case for loop IDs (falls back to PLAIN). |
| src/goto-programs/class_hierarchy.cpp | Marks SARIF as unimplemented for class hierarchy output. |
| src/goto-instrument/show_locations.cpp | Marks SARIF as unreachable in locations output. |
| src/goto-diff/goto_diff_base.cpp | Adds SARIF “not supported” error path. |
| src/goto-checker/report_util.cpp | Emits SARIF results for properties via sarif_result(...) + sarif_output(...). |
| src/goto-checker/properties.h | Declares sarif_result(...). |
| src/goto-checker/properties.cpp | Implements SARIF result object construction (ruleId/level/message/locations). |
| src/goto-checker/cover_goals_report_util.cpp | Routes SARIF case through existing JSON goal output. |
| src/goto-checker/bmc_util.cpp | Emits SARIF result for error trace (last step). |
| src/cbmc/cbmc_parse_options.cpp | Allows --sarif-ui for some JSON-only modes; updates help text for array constraints. |
| src/cbmc/c_test_input_generator.cpp | Adds SARIF case (prints test suite text). |
| jbmc/src/jbmc/jbmc_parse_options.cpp | Adds SARIF case for dumping options as JSON object. |
| regression/CMakeLists.txt | Adds cbmc-sarif-ui regression subdirectory. |
| regression/cbmc-sarif-ui/Makefile | Adds regression make target and SARIF validation invocation. |
| regression/cbmc-sarif-ui/CMakeLists.txt | Adds CTest entries for SARIF regression + validation script. |
| regression/cbmc-sarif-ui/validate_sarif.py | Validates SARIF top-level schema/runs/results structure. |
| regression/cbmc-sarif-ui/test_sarif_valid.sh | Runs CBMC with --sarif-ui on test cases and validates output. |
| regression/cbmc-sarif-ui/success/success.desc | Adds expected-output checks for SARIF success case. |
| regression/cbmc-sarif-ui/success/success.c | Test input for success case. |
| regression/cbmc-sarif-ui/failure/failure.desc | Adds expected-output checks for SARIF failure case. |
| regression/cbmc-sarif-ui/failure/failure.c | Test input for failure case. |
| regression/cbmc-sarif-ui/bounds/bounds.desc | Adds expected-output checks for SARIF bounds failures. |
| regression/cbmc-sarif-ui/bounds/bounds.c | Test input for bounds failures. |
| regression/cbmc-sarif-ui/mixed/mixed.desc | Adds expected-output checks for mixed pass/fail SARIF output. |
| regression/cbmc-sarif-ui/mixed/mixed.c | Test input for mixed case. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #8835 +/- ##
===========================================
- Coverage 80.00% 79.98% -0.03%
===========================================
Files 1700 1700
Lines 188271 188450 +179
Branches 73 73
===========================================
+ Hits 150632 150728 +96
- Misses 37639 37722 +83 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Implements Static Analysis Results Interchange Format (SARIF) support as an extension of the existing json-ui option. Fixes: diffblue#6851 Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
|
The class It may make sense to use an artefact-specific case-split instead. |
Implements Static Analysis Results Interchange Format (SARIF) support as an extension of the existing json-ui option.
Fixes: #6851