From 19d05fe3c9bd5327b47930fd61bfe339a9808122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E5=A4=B4?= <3301352378@qq.com> Date: Thu, 9 Jul 2026 14:45:14 +0800 Subject: [PATCH] fix: avoid N12R process-list boundary false positive --- scripts/test-validate-n12r-return-package.ps1 | 10 ++++++++++ scripts/validate-n12r-return-package.ps1 | 3 +++ 2 files changed, 13 insertions(+) diff --git a/scripts/test-validate-n12r-return-package.ps1 b/scripts/test-validate-n12r-return-package.ps1 index eb889a9..92b7848 100644 --- a/scripts/test-validate-n12r-return-package.ps1 +++ b/scripts/test-validate-n12r-return-package.ps1 @@ -162,6 +162,16 @@ try { Assert-Contains $result.Output "Decision: REJECT" "Expected reject decision in output." } + Run-Test "accepts harmless process names that contain hook as a substring" { + $pkg = Join-Path $tempRoot "harmless-hook-substring" + $report = Join-Path $tempRoot "harmless-hook-substring-report.md" + New-GoodPackage $pkg + Write-Utf8Text (Join-Path $pkg "metadata\process-list.txt") "zfhookupdat 3240" + $result = Invoke-Validator -PackageRoot $pkg -ReportPath $report + Assert-True ($result.ExitCode -eq 0) "Expected validator success for harmless process-name substring, got exit $($result.ExitCode): $($result.Output)" + Assert-Contains $result.Output "Decision: ACCEPT" "Expected accept decision in output." + } + Run-Test "rejects report paths inside the evidence package" { $pkg = Join-Path $tempRoot "report-inside-package" New-GoodPackage $pkg diff --git a/scripts/validate-n12r-return-package.ps1 b/scripts/validate-n12r-return-package.ps1 index f6f72b2..42a8279 100644 --- a/scripts/validate-n12r-return-package.ps1 +++ b/scripts/validate-n12r-return-package.ps1 @@ -318,6 +318,9 @@ try { } foreach ($relative in ($requiredFiles + $optionalFiles)) { + if ($relative -eq "metadata/process-list.txt") { + continue + } $path = Join-PackagePath $packageFullPath $relative if (Test-Path -LiteralPath $path -PathType Leaf) { $text = if ($rawFiles.ContainsKey($relative)) { $rawFiles[$relative] } else { Read-TextFile $packageFullPath $relative }