Skip to content

AI-Net-Guard v5.9.4

Choose a tag to compare

@github-actions github-actions released this 24 Nov 11:43
· 20 commits to main since this release

AI-Net-Guard v5.9.4 发布说明 (Release Notes)

双引擎热修维护版 (Hotfix Patch Release):在 v5.9.3 基础上修复 PowerShell 7.x(.NET Core / .NET 5+)下 Enter-GuardWriteLock 无法调用 4 参数 System.Threading.Mutex 构造函数的问题,完整打通 Windows PowerShell 5.1 与 PowerShell 7.x 双引擎本地与提权执行路径。


一、相较 v5.9.3 的修复内容

  1. 修复 PowerShell 7.x 下 Enter-GuardWriteLock 写锁创建兼容(lib-guard-common.ps1)

    • 根因:Windows PowerShell 5.1(.NET Framework)支持 New-Object System.Threading.Mutex($false, $LockName, [ref]$createdNew, $mtxSec) 四参数构造,而 PowerShell 7.x(.NET Core)已将该安全描述符构造迁至 [System.Threading.MutexAcl]::Create;因此在 PowerShell 7.x(如 pwsh 7.7)中直接运行 07-mode.ps1、12-regression.ps1、14-apply-policy.ps1 或 09-rollback.ps1 时,会在获取 Global\AI-Net-Guard-PolicyEngine 写锁阶段报错退出。
    • 修复:运行时按是否存在 System.Threading.MutexAcl, System.Threading.AccessControl 自动分流至 [System.Threading.MutexAcl]::Create(...) 或传统 4 参数构造,并在异常捕获后补全 if (-not $mtx) 空句柄保护,保留 Global\ 命名空间与 Administrators/SYSTEM ACL 约束不变。
  2. 新增双引擎门禁断言(test-stun-ports.ps1)

    • 门禁断言扩至 59 项,覆盖 MutexAcl 分支与空句柄保护,并在 Windows PowerShell 5.1 与 PowerShell 7.7 双引擎下分别全量跑通(含跨引擎 pwsh 与 powershell.exe 真实双进程 Global\ 写锁争用)。

二、验证范围与未验证事项

  • 已执行并通过(非提权工作区 + 双引擎门禁):
    • 全仓 .ps1 脚本 100% 纯 ASCII、0 AST 解析错误;
    • tests\test-stun-ports.ps1(Windows PowerShell 5.1):59/59 条断言 PASS;
    • tests\test-stun-ports.ps1(PowerShell 7.7):59/59 条断言 PASS;
    • gui\build.ps1 -RunSmokeTest:WPF Release 0 警告 0 错误,8 项 UI 冒烟 PASS。
  • 尚未由本会话直接执行(需在本机管理员 PowerShell 运行同步与现网回归):
    • 同步 C:\AI-Net-Guard\scripts\ 至 v5.9.4,确认 07-mode.ps1 完成 backup\auto-disabled-outbound-allow.json 自愈并通过 12-regression.ps1。

三、同步本机 C:\AI-Net-Guard 并完成验收(管理员 PowerShell 执行)

在 管理员 PowerShell 中执行以下命令同步 v5.9.4 并完成自愈与回归验收:

$ws = "C:\path\to\AI-Net-Guard"; $root = "C:\AI-Net-Guard"; powershell -ExecutionPolicy Bypass -File "$ws\scripts\13-harden-acl.ps1" -Root $root -SyncWorkspace -WorkspaceRoot $ws -SkipVerification; & "$root\scripts\07-mode.ps1"; Get-Content "$root\backup\auto-disabled-outbound-allow.json"; Get-ScheduledTask -TaskName "AI-Guard*" | Select-Object TaskName, State; & "$root\scripts\12-regression.ps1"