Files
WELA/tests/AuditNotifications.Windows.Tests.ps1
T
田中ザック Isaac Mathis 35aca8f494 Add OneSettings auditing and Security warning controls (#408)
* Add explicit OneSettings auditing and Security warning controls

* Reference PR 408 in notification changelogs

* Handle expected child CLI failure under Windows PowerShell 5.1

* Block dependent Privacy channel changes when OneSettings policy drifts

* Recheck notification producer prerequisites at channel write boundaries
2026-09-20 13:55:24 +09:00

19 lines
1.3 KiB
PowerShell

$ErrorActionPreference='Stop'
$root=Split-Path $PSScriptRoot -Parent
. (Join-Path $root 'scripts/Configuration.ps1')
. (Join-Path $root 'scripts/NativeChannelConfiguration.ps1')
. (Join-Path $root 'scripts/AuditNotifications.ps1')
Import-Module (Join-Path $root 'modules/NativeProviders.psm1')
$before=@(Get-WelaNotificationDefinitions | ForEach-Object { Get-WelaRegistryState -Path $_.Path -Name $_.Name }) | ConvertTo-Json -Depth 8
$report=Invoke-WelaNotificationCommand -Action Audit
if ($report.Current.Count -ne 2) { throw 'Audit omitted a control.' }
$hostState=Get-WelaNotificationHost
if ($hostState.Status -ne 'Supported') { throw "Unexpected native host state: $($hostState.Diagnostic)" }
$warning=@($report.Current | Where-Object {$_.Definition.Id -eq 'SecurityWarning'})[0]
if ($warning.Before.Channel.Name -ne 'Security' -or $warning.Before.Status -ne 'Supported') { throw 'Native Security policy/channel observation failed.' }
$after=@(Get-WelaNotificationDefinitions | ForEach-Object { Get-WelaRegistryState -Path $_.Path -Name $_.Name }) | ConvertTo-Json -Depth 8
if ($before -cne $after) { throw 'Read-only audit changed policy.' }
$report | ConvertTo-Json -Depth 18 | Write-Host
Write-Host 'PASS: native read-only policy/channel observations; event generation not tested.'
$global:LASTEXITCODE=0