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

v1.6.1 hotfix: UTF-8 BOM for PS 5.1 parse safety + BOM regression guard

Okan YILDIZ35869be4e25e
diff --git a/CloudSecurity/Test-M365SecurityPosture.ps1 b/CloudSecurity/Test-M365SecurityPosture.ps1
index b967bda..9ce9dde 100644
--- a/CloudSecurity/Test-M365SecurityPosture.ps1
+++ b/CloudSecurity/Test-M365SecurityPosture.ps1
@@ -1,4 +1,4 @@
-function Add-M365Finding {
+function Add-M365Finding {
<#
.SYNOPSIS
Records a single M365 posture finding and updates summary counters.
diff --git a/Compliance/Test-CISBenchmark.ps1 b/Compliance/Test-CISBenchmark.ps1
index 058f08b..32025ba 100644
--- a/Compliance/Test-CISBenchmark.ps1
+++ b/Compliance/Test-CISBenchmark.ps1
@@ -1,4 +1,4 @@
-function Test-CISBenchmark {
+function Test-CISBenchmark {
<#
.SYNOPSIS
Tests system compliance against CIS Benchmark controls
diff --git a/Compliance/Test-NISTCompliance.ps1 b/Compliance/Test-NISTCompliance.ps1
index a776a99..8aaba2e 100644
--- a/Compliance/Test-NISTCompliance.ps1
+++ b/Compliance/Test-NISTCompliance.ps1
@@ -1,4 +1,4 @@
-function Test-NISTCompliance {
+function Test-NISTCompliance {
<#
.SYNOPSIS
Tests system compliance against NIST 800-53 security controls
diff --git a/Compliance/Test-PCI-DSS.ps1 b/Compliance/Test-PCI-DSS.ps1
index 9dd2fb3..3c0874e 100644
--- a/Compliance/Test-PCI-DSS.ps1
+++ b/Compliance/Test-PCI-DSS.ps1
@@ -1,4 +1,4 @@
-function Test-PCI-DSS {
+function Test-PCI-DSS {
<#
.SYNOPSIS
Tests system compliance against PCI-DSS requirements
diff --git a/tests/Locale.Regression.Tests.ps1 b/tests/Locale.Regression.Tests.ps1
index 39983b8..f6b0b99 100644
--- a/tests/Locale.Regression.Tests.ps1
+++ b/tests/Locale.Regression.Tests.ps1
@@ -1,4 +1,4 @@
-#Requires -Modules @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' }
+#Requires -Modules @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' }
<#
.SYNOPSIS
@@ -595,3 +595,24 @@ Describe 'Private helper contract and degradation' {
}
}
}
+
+Describe 'PS 5.1 encoding safety (BOM guard)' {
+ # Windows PowerShell 5.1 reads BOM-less files as ANSI: any non-ASCII content
+ # (em dashes, accented chars) corrupts parsing. Every script with non-ASCII
+ # bytes must be UTF-8 with BOM.
+ It 'every .ps1/.psm1/.psd1 with non-ASCII content is UTF-8 with BOM' {
+ $offenders = @(
+ Get-ChildItem -Path $script:ModuleRoot -Include '*.ps1','*.psm1','*.psd1' -Recurse -File |
+ Where-Object { $_.FullName -notmatch '[\\/]\.git[\\/]' } |
+ Where-Object {
+ $bytes = [System.IO.File]::ReadAllBytes($_.FullName)
+ $hasBom = ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF)
+ $hasNonAscii = $false
+ foreach ($byte in $bytes) { if ($byte -gt 0x7F) { $hasNonAscii = $true; break } }
+ $hasNonAscii -and -not $hasBom
+ } |
+ ForEach-Object { $_.FullName.Substring($script:ModuleRoot.Length) }
+ )
+ $offenders.Count | Should -Be 0 -Because ("PS 5.1 misreads BOM-less non-ASCII files as ANSI: {0}" -f ($offenders -join ', '))
+ }
+}