Repository navigation
AI-Net-Guard v5.9.3
AI-Net-Guard v5.9.3 发布说明 (Release Notes)
维护修复版 (Maintenance Patch Release):在 v5.9.2 功能冻结基线之上,修复本机实机排查中确认的 2 项脚本维护缺陷与回归门禁盲区,保持单 EXE + 零常驻静态 WFP + 三公共库轻量架构不变,不新增功能与架构改动。
一、相较 v5.9.2 的修复内容
-
修复 Windows PowerShell 5.1 下
auto-disabled-outbound-allow.json递归嵌套并实现自愈(lib-guard-common.ps1/07-mode.ps1/09-rollback.ps1/14-apply-policy.ps1)- 根因:此前
07-mode.ps1使用@(Get-Content ... | ConvertFrom-Json)读取并写回隔离清单时,PowerShell 5.1 会把 JSON 数组当作单个元素包入外层数组并序列化为{ "value": [...], "Count": N }嵌套包装对象,导致后续读取无法识别.Name、重复写入同一规则,且在回滚或关闭QuarantineRogueAllow时无法重新启用被隔离规则。 - 修复:在
lib-guard-common.ps1新增单一收口函数Read-GuardQuarantineList(递归展开嵌套数组与{ value, Count }包装对象、过滤无效空项、按Name忽略大小写去重,并兼容 PowerShell 7 下'[]'空数组解析)与Write-GuardQuarantineList(基于ConvertTo-Json -InputObject [object[]]与 UTF-8 无 BOM 原子落盘,0/1/多项均保证输出标准扁平 JSON 数组)。 - 自愈与全入口接入:
07-mode.ps1每次运行均可通过NeedsRewrite自动将历史上已被 PS 5.1 写坏的auto-disabled-outbound-allow.json原地重写为干净扁平数组;09-rollback.ps1与14-apply-policy.ps1同步改用Read-GuardQuarantineList,确保历史嵌套规则也可被完整恢复。
- 根因:此前
-
修复
scripts\子目录直接运行时的默认$Root解析与回归 Check 7 缺失文件守卫(07-mode.ps1/12-regression.ps1/13-harden-acl.ps1/14-apply-policy.ps1)- 当不传
-Root直接执行C:\AI-Net-Guard\scripts\12-regression.ps1等位于scripts\子目录下的入口脚本时,默认$Root过去误取为C:\AI-Net-Guard\scripts,导致找不到cn-ipv4.txt并在scripts\下生成多余backup\/logs\子目录。现统一检测若$PSScriptRoot末级目录为scripts,则自动回退到上一级安装根目录。 12-regression.ps1第 7 项(corrupt geoip rejected without altering CN allowlist)新增cn-ipv4.txt存在性及最小行数(>= 1000)断言,防止路径错误时以before=0, after=0静默误判PASS。
- 当不传
二、验证范围与未验证事项
- 已执行并通过(非提权工作区 + 双引擎测试):
- 全仓
.ps1脚本 100% 纯 ASCII、0 AST 解析错误; tests\test-stun-ports.ps1(Windows PowerShell 5.1):58/58 条断言 PASS(含 PS 5.1 嵌套{ value, Count }恢复、去重与0/1/2/3项扁平往返实测);- PowerShell 7(
pwsh)下Read/Write-GuardQuarantineList0/1/2/3项及畸形嵌套自愈直测通过; gui\build.ps1 -RunSmokeTest:WPF Release 0 警告 0 错误,8 项 UI 冒烟 PASS。
- 全仓
- 尚未由本会话直接修改/执行(因非提权会话无法写入受 ACL 保护的
C:\AI-Net-Guard及卸载SYSTEM计划任务):- 需在 管理员 PowerShell 中运行下方同步与清理命令,将
C:\AI-Net-Guard\scripts\更新至v5.9.3、清除残留的AI-Guard-Test-Rollback任务与根目录旧07-mode.ps1、自愈backup\auto-disabled-outbound-allow.json并运行提权回归12-regression.ps1。
- 需在 管理员 PowerShell 中运行下方同步与清理命令,将
三、同步本机生产目录、清理历史残留并验收(管理员 PowerShell 执行)
在 管理员 PowerShell 中执行以下一行命令完成同步、清理、自愈与验收:
$ws = "C:\path\to\AI-Net-Guard"; $root = "C:\AI-Net-Guard"; Unregister-ScheduledTask -TaskName "AI-Guard-Test-Rollback" -Confirm:$false -ErrorAction SilentlyContinue; Remove-Item "$root\07-mode.ps1", "$root\scripts\backup", "$root\scripts\logs" -Recurse -Force -ErrorAction SilentlyContinue; 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"