test: add N13 selector verifier
This commit is contained in:
37
scripts/verify-n13-uia-selectors.ps1
Normal file
37
scripts/verify-n13-uia-selectors.ps1
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
Set-StrictMode -Version Latest
|
||||||
|
|
||||||
|
$repo = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot "..")).Path
|
||||||
|
Set-Location -LiteralPath $repo
|
||||||
|
|
||||||
|
if (-not (Get-Command go -ErrorAction SilentlyContinue)) {
|
||||||
|
throw "go was not found. Run this verifier in a Go 1.23.x environment."
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "## go test ./internal/uiaselector"
|
||||||
|
go test ./internal/uiaselector -count=1
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "go test ./internal/uiaselector failed with exit code $LASTEXITCODE"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "## boundary grep"
|
||||||
|
$forbidden = @(
|
||||||
|
"send_after_approval",
|
||||||
|
"send_file_after_approval",
|
||||||
|
"receive_file_after_approval",
|
||||||
|
"open_conversation",
|
||||||
|
"ValuePattern.SetValue",
|
||||||
|
"InvokePattern"
|
||||||
|
)
|
||||||
|
$files = @(
|
||||||
|
"internal\uiaselector\catalog.go",
|
||||||
|
"internal\uiaselector\matcher.go"
|
||||||
|
)
|
||||||
|
foreach ($term in $forbidden) {
|
||||||
|
$hit = Select-String -LiteralPath $files -Pattern $term -SimpleMatch -ErrorAction SilentlyContinue
|
||||||
|
if ($hit) {
|
||||||
|
throw "forbidden action term found in selector implementation: $term"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "N13 UIA selector verification passed."
|
||||||
Reference in New Issue
Block a user