Skip to content

Fix SARIF parser crash on empty extensions#14898

Open
kleomartiny wants to merge 2 commits into
DefectDojo:bugfixfrom
kleomartiny:kleomartiny-patch-1
Open

Fix SARIF parser crash on empty extensions#14898
kleomartiny wants to merge 2 commits into
DefectDojo:bugfixfrom
kleomartiny:kleomartiny-patch-1

Conversation

@kleomartiny
Copy link
Copy Markdown

Fixes #14897

This PR fixes a SARIF parser crash when importing valid SARIF 2.1.0 reports with empty results, empty driver.rules, and missing or empty tool.extensions.

Previously the parser assumed that extensions[0] always exists when driver.rules is empty:

rules_array = run["tool"]["extensions"][0].get("rules", [])

This could lead to:

IndexError: list index out of range

The fix safely iterates through available extensions and collects rules only if they are present, avoiding unsafe indexing and correctly handling spec-compliant SARIF files with no findings.

Tested with the minimal SARIF sample attached in issue #14897.

Handle empty or missing tool.extensions in SARIF parser.
@Maffooch Maffooch changed the base branch from master to bugfix May 20, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error 500 load sarif with empty runs[].tool.extensions

1 participant