Skip to content

Commit 620179f

Browse files
authored
Merge pull request DeusData#959 from DeusData/fix/smoke-defender-engine-error
ci(smoke): fail soft when the Windows Defender scan engine can't run
2 parents 20b1153 + 1015dd2 commit 620179f

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

‎.github/workflows/_smoke.yml‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,20 @@ jobs:
248248
run: |
249249
& "C:\Program Files\Windows Defender\MpCmdRun.exe" -SignatureUpdate 2>$null
250250
$result = & "C:\Program Files\Windows Defender\MpCmdRun.exe" -Scan -ScanType 3 -File "$PWD\codebase-memory-mcp.exe" -DisableRemediation
251+
$code = $LASTEXITCODE
251252
Write-Host $result
252-
if ($LASTEXITCODE -ne 0) { Write-Host "BLOCKED: Windows Defender flagged binary!"; exit 1 }
253-
Write-Host "=== Windows Defender: clean ==="
253+
# MpCmdRun -Scan exit codes: 0 = clean, 2 = threat found. Any OTHER non-zero
254+
# means the scan engine could not run at all (e.g. hr=0x800106ba: the Defender
255+
# antimalware service is unavailable on the runner) — that is NOT a detection.
256+
# Fail soft on an engine failure so a transient runner-side AV outage can't
257+
# false-fail a release; only a real detection (exit 2) hard-blocks.
258+
if ($code -eq 2) {
259+
Write-Host "BLOCKED: Windows Defender flagged binary!"; exit 1
260+
} elseif ($code -ne 0) {
261+
Write-Host "::warning::Windows Defender scan could not run (exit $code) - skipping AV gate on this runner"
262+
} else {
263+
Write-Host "=== Windows Defender: clean ==="
264+
}
254265
255266
smoke-linux-portable:
256267
needs: setup-matrix

0 commit comments

Comments
 (0)