test(android): capture read-only acceptance evidence
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$projectRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot)
|
||||
$scriptPath = Join-Path $projectRoot 'scripts\capture-android-acceptance.ps1'
|
||||
$source = Get-Content -Raw -Encoding UTF8 -LiteralPath $scriptPath
|
||||
|
||||
$requiredFragments = @(
|
||||
"'get-state'",
|
||||
"'dumpsys', 'package'",
|
||||
"'dumpsys', 'activity', 'activities'",
|
||||
"'dumpsys', 'activity', 'exit-info'",
|
||||
"'uiautomator', 'dump', '/dev/tty'",
|
||||
"'exec-out', 'screencap', '-p'",
|
||||
"'android.permission.CAMERA'",
|
||||
"'android.permission.RECORD_AUDIO'",
|
||||
"'android.permission.READ_MEDIA_IMAGES'",
|
||||
"'android.permission.READ_MEDIA_VIDEO'",
|
||||
"'read-only-current-state'",
|
||||
"Join-Path `$projectRoot 'output'"
|
||||
)
|
||||
foreach ($fragment in $requiredFragments) {
|
||||
if (-not $source.Contains($fragment)) {
|
||||
throw "Android acceptance capture is missing required fragment: $fragment"
|
||||
}
|
||||
}
|
||||
|
||||
$forbiddenPatterns = @(
|
||||
'(?i)\bshell\s+input\b',
|
||||
'(?i)\bpm\s+(?:clear|grant|revoke)\b',
|
||||
'(?i)\binstall(?:-multiple)?\b',
|
||||
'(?i)\buninstall\b',
|
||||
'(?i)\bforce-stop\b',
|
||||
'(?i)\bam\s+start\b',
|
||||
'(?i)\bmonkey\b'
|
||||
)
|
||||
foreach ($pattern in $forbiddenPatterns) {
|
||||
if ($source -match $pattern) {
|
||||
throw "Android acceptance capture contains a state-changing adb pattern: $pattern"
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output 'PASS: Android acceptance capture is scoped to read-only current-state evidence'
|
||||
Reference in New Issue
Block a user