Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix SARIF parser crash on empty extensions#14898

Merged
rossops merged 2 commits into
DefectDojo:bugfixfrom
kleomartiny:kleomartiny-patch-1
Jun 1, 2026
Merged

Fix SARIF parser crash on empty extensions#14898
rossops merged 2 commits into
DefectDojo:bugfixfrom
kleomartiny:kleomartiny-patch-1

Conversation

@kleomartiny
Copy link
Copy Markdown
Contributor

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
@valentijnscholten valentijnscholten added this to the 2.59.0 milestone May 31, 2026
Copy link
Copy Markdown
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@mtesauro mtesauro requested review from Jino-T and rossops June 1, 2026 01:58
@paulOsinski paulOsinski self-requested a review June 1, 2026 15:11
@rossops rossops merged commit 153ea42 into DefectDojo:bugfix Jun 1, 2026
158 checks passed
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

7 participants