Merge SARIF 2.1.0 logs from several scanners into one de-duplicated log and mark results new, unchanged or absent versus a baseline. Use when the user has several .sarif files or asks what a scan newly introduced.
97%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Low
Low-risk findings worth noting
Reference for scripts/sarif_merge.py. Behaviour is the same as the sarif_merge Python package.
load_sarif)| Check | Error code |
|---|---|
| Text larger than 50 MiB (52,428,800 bytes) | input_too_large |
| Not valid JSON or nested too deeply | invalid_json |
Top level is not an object, runs is not a list, a run/tool/driver is not an object, tool.driver.name is empty, results is not a list | invalid_sarif |
version missing | invalid_sarif |
version is not 2.1.0 | unsupported_version |
| More than 100,000 results across all runs | too_many_results |
(tool.driver.name, semanticVersion or version or "").ruleId, else rule.id, else tool.driver.rules[ruleIndex].id.
A result without any rule id is an error.ruleIndex is recomputed against the merged rule list (removed if the rule has no definition).artifacts arrays are dropped and every artifactLocation.index is removed.properties.sarifMerge = {inputResults, duplicates} added. Output runs are sorted by (name, version).runs: [].SHA-256 of one of these strings:
partialFingerprints.primaryLocationLineHash: ruleId|fp|<hash>ruleId|uriBaseId|uri|startLine|message.text, where the uri has backslashes turned
into / and a leading ./ removed.Consequence: two scanners that report the same rule id at the same place with the same message are duplicates; different rule ids never collapse, even for the same line.
compare_baseline)Both logs are merged first. For each tool group present in the current log:
baselineState = "unchanged""new""absent" and their rule definitions are copied into the
rule list."new".--fail-on-new makes the command exit 1 if any result is new; absent and unchanged never
fail the run.
JSON with two-space indentation, UTF-8, written to the --output path. The output path is
overwritten if it exists.