Skip to content

fix(format-result): skip empty issue arrays to prevent ESC3 null index error - #312

Merged
jakehildreth merged 2 commits into
mainfrom
fix/format-result-empty-array
Nov 6, 2026
Merged

jakehildreth merged 2 commits into
mainfrom
fix/format-result-empty-array

Conversation

@jakehildreth

Copy link
Copy Markdown
Owner

Summary

Fix Format-Result throwing Index operation failed; the array index evaluated to null. when a scan finds nothing.

The ESC3 scan builds its result as @(C1) + @(C2), which is an empty array when there are no findings. Other scans return ``. Format-Result only checked ` -ne `, so the empty array got through and the title lookup used a null key.

Introduced by the array-optimization change in 4031b89. The guard now skips both `` and empty arrays.

Type of change

  • Bug fix

Validation

  • Pester tests: Tests/Format-Result.Tests.ps1 (4 tests). Before the fix, 3 failed with the reported error. After the fix, all pass (Pester 6.2.0).
  • Manual validation: single-issue and multi-issue output still renders.
  • PSScriptAnalyzer

Security impact

None.

Documentation impact

None.

PowerShell compatibility

No new syntax. Works on Windows PowerShell 5.1 and PowerShell 7.

jakehildreth and others added 2 commits November 6, 2026 08:16
…x error

- Guard Private/Format-Result.ps1 against empty arrays as well as $null
- The ESC3 scan returns @() when nothing is found, which threw "Index operation failed; the array index evaluated to null."
- Add Tests/Format-Result.Tests.ps1 covering $null and empty arrays in Mode 0 and Mode 1
@jakehildreth
jakehildreth merged commit 4f1e7c0 into main Nov 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant