Skip to content

release-desktop: skip the Defender scan when Defender is unavailable - #8059

Merged
danielhanchen merged 1 commit into
mainfrom
defender-skip-when-unavailable
Aug 7, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
defender-skip-when-unavailable

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Treat an unavailable Defender as "no scan happened" and skip, instead of failing the release. A Defender that is present but misconfigured still fails closed, and an actual detection still fails the job. Nothing about the detection path changes.

Why

Two consecutive Build Windows (x64) attempts on run 31117717223 failed at Scan Windows bundles with Defender during the 2026-08-06 Actions incident. Neither failure was a detection. The runners came up with the Defender WMI provider dead and the service RPC endpoint down:

Update-MpSignature: The remote procedure call failed.
Get-MpComputerStatus: Provider load failure
Get-MpPreference:    Provider load failure
ERROR: ValidateMapsConnection failed (0x800106ba)
[Failed][0x800106ba] The RPC server is unavailable.
##[error]Defender cannot give an authoritative verdict here
  (RealTimeProtectionEnabled=false (AMRunningMode=); MAPSReporting=, expected 2 (Advanced))

Get-MpComputerStatus and Get-MpPreference threw, so $status and $pref were null. Every downstream check then read a null as a misconfiguration (RealTimeProtectionEnabled=false, MAPSReporting=<empty>) and the gate failed closed. The Windows app itself built and signed successfully both times.

The gate was doing the right thing with the information it had, but it could not tell "Defender says this is bad" from "there is no Defender here". Those deserve different outcomes.

What changed

Get-MpComputerStatus / Get-MpPreference are now read through try/catch with -ErrorAction Stop. If either throws or yields nothing, the step emits a warning naming the failure and exits 0 without scanning.

The trigger is deliberately narrow: only the cmdlets themselves failing, which means the engine is not answering at all. Anything that can still produce a verdict keeps the old behaviour.

The warning states plainly that the bundles were not scanned, so a skip is never mistaken for a clean result in the log.

Behaviour matrix

Defender state Before After
Cmdlets throw / return nothing (engine unavailable) fail skip with warning
Present but misconfigured (RTP off, MAPS not Advanced, ...) fail fail (unchanged)
Present, configured, bundle flagged fail fail (unchanged)
Present, configured, bundle clean scan and pass scan and pass (unchanged)

Checks

  • release-desktop.yml parses as YAML.
  • The step's run: script parses with 0 errors via [System.Management.Automation.Language.Parser].
  • The branch logic was exercised against stubbed cmdlets for all four rows above and produced skip / fail / fail / proceed respectively.

Tradeoff

This accepts an unscanned Windows bundle when the runner's scanner is broken, rather than blocking the release. That is a deliberate loosening of a supply-chain gate. The alternative, waiting for a healthy runner, is unbounded when the degradation is fleet-wide, as it was here. The signing path is untouched, so bundles remain signed and Verify every executable in the Windows bundles is signed still runs.

@danielhanchen
danielhanchen merged commit dbd5a9f into main Aug 7, 2026
7 checks passed
@danielhanchen
danielhanchen deleted the defender-skip-when-unavailable branch August 7, 2026 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant