Skip to content

Debug log references wrong variable in SP→SP ownership processing #21

@StrongWind1

Description

@StrongWind1

Disclaimer: This issue was identified and written by Claude Code (model: claude-opus-4-6-1m) during an automated code review, and has had a cursory review by a human before submission.

Summary

A debug log message in check_EnterpriseApps.psm1 references $SPOwningApps.count when it should reference $SPOwningSPs.count. The log message is in the SP→SP ownership section but reports the count from the SP→AppReg section.

Affected file

modules/check_EnterpriseApps.psm1

Evidence

Line 1256

# Line 1254-1256
#Process direct App ownerships (SP->SP) (take over Impact, inherit likelihood)
$SPOwningSPs = $AllServicePrincipal | Where-Object { $_.SpOwn -ge 1 }
Write-Log -Level Debug -Message "Number of ownerships SP->SP: $($SPOwningApps.count)"

$SPOwningSPs is defined on line 1255, but the log message references $SPOwningApps which was defined earlier at line 1223 for the SP→AppReg section:

# Line 1223
$SPOwningApps = $AllServicePrincipal | Where-Object { $_.AppOwn -ge 1 }

Impact

When running with -LogLevel Debug, the "Number of ownerships SP->SP" log message shows the count of SPs owning App Registrations instead of the count of SPs owning other SPs. Only affects debug output — no impact on scoring or reports.

Suggested fix

Write-Log -Level Debug -Message "Number of ownerships SP->SP: $($SPOwningSPs.count)"

Version

V20260316

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions