Skip to content

A comprehensive Windows security auditing and threat detection toolkit. Features 58 production-ready PowerShell functions organized into 14 modules for enterprise-grade security assessment, compliance validation, and incident response.

PowerShell

Fix RID-edge test on Windows: neutralize CIM fallback so the real RID-500 account cannot leak into the mocked assertion

Okan YILDIZ627e74632a2b
diff --git a/tests/Locale.Regression.Tests.ps1 b/tests/Locale.Regression.Tests.ps1
index 8bd1795..39983b8 100644
--- a/tests/Locale.Regression.Tests.ps1
+++ b/tests/Locale.Regression.Tests.ps1
@@ -535,6 +535,12 @@ Describe 'Private helper contract and degradation' {
}
)
}
+ # On Windows the CIM fallback would find the REAL RID-500 account
+ # (e.g. the CI runner's administrator) when the mocked Get-LocalUser
+ # returns no match — neutralize the fallback inside this test.
+ if (Get-Command Get-CimInstance -ErrorAction SilentlyContinue) {
+ Mock Get-CimInstance { @() }
+ }
Get-LocalUserByRid -Rid 500 | Should -BeNullOrEmpty -Because 'SID ...-1500 must not match RID 500 (suffix match includes the dash)'
$hit = Get-LocalUserByRid -Rid 1500
$hit.Name | Should -Be 'Rid1500User' -Because 'the mock wiring must actually be exercised (positive control)'