Repository navigation
fix(desktop): Windows updates wait out a signature check slowed by antivirus - #37461
Sharad-Patel1 wants to merge 1 commit into
Conversation
…tivirus electron-updater kills its PowerShell Get-AuthenticodeSignature check after a hard-coded 20 s. On-access antivirus can hold the first check of a freshly downloaded installer for 51-56 s, so the update never becomes ready. Raise the limit to 120 s in the existing electron-updater patch. Refs pingdotgg#20345 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — Windows updates will allow signature verification 120 seconds instead of 20, accommodating slow antivirus scans. This changes the updater's default waiting behavior; a human must accept the longer delay when verification stalls. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Problem
On a managed Windows machine with on-access endpoint security, an in-app update downloads to 100% and then never becomes ready to install (#20345). electron-updater checks the installer's signature with
powershell.exe Get-AuthenticodeSignatureand gives up after a hard-coded 20 s. The reporter in #20345 ran the same check with no limit on three fresh copies of the installer. Each took 54.4 to 56.0 s and then returned a valid signature.Change
The electron-updater patch we already carry raises that limit to 120 s, about twice the slowest check the reporter measured. The lockfile picks up the new patch hash. No app code changes.
This is a smaller alternative to #25945, which keeps the 20 s limit and makes up to five attempts. I went with one longer check because of how the 20 s timeout plays out:
cmd.exe(shell: true), and Node's timeout kills only that process. On Windows 11 the PowerShell under it keeps running (Windows item 1 below). The reporter saw the same in their timeline for the one-retry build (fix(desktop): retry a timed-out Windows update signature check once #21273): the first check was still running when the retry started, and both timed out.execFileSync, 10 s cap) on Electron's main process before it rejects. Each extra attempt adds one. The probe took about 0.4 s on a stock Windows 11 box. In the reporter's timelines, the gap after each kill, which includes the probe, was 2.0 to 7.7 s.A hung check now times out at 120 s instead of 20 s, the probe runs, and the download fails. #25945 instead runs five 20 s attempts plus five probes. If the probe fails too, electron-updater skips validation, as it does on main. #25945 behaves the same on its first attempt and never accepts a skipped check on later attempts. With a single check there are no later ones.
Upstream still hard-codes 20 s in 6.8.11 (
latest) and 6.8.12 (v26). Its 7.0.0-alpha.13 rewrite of this verifier uses 60 s and fails closed. The reporter found that anything under about 60 s fails on their machine, so on a move to 7.x I'd keep a longer limit.Scope
Refs #20345, where a maintainer accepted the bug and named retrying after a timeout or verifying in-process as possible fix directions. A longer timeout is a third option. The reporter diagnosed the 20 s kill there, and their timelines are the basis for the numbers here. #25945 builds on that diagnosis and on the earlier retry in #21273. I'd keep the issue open until someone confirms this on a machine like the reporter's.
Verification
Windows 11, without a real antivirus hold. I ran electron-updater 6.8.9's real verifier on Windows 11 Pro with real
cmd.exeand PowerShell, once as published and once with this PR's patch file applied bygit apply(its hash matches the lockfile). The box runs only Windows Defender. The verifier accepted a local copy of the installed T3 Code exe in about 3 s, so this run did not reproduce the hold in #20345. To stand in for the hold, I injectedStart-Sleep -Seconds 55ahead ofGet-AuthenticodeSignaturein the command the verifier builds. That stand-in can't model #25945, since each of its retries would get its own 55 s sleep, so I ran only the published and patched verifiers. A real antivirus hold and a full in-app update are still unverified. The reporter offered in #20345 to test a candidate build.killed: true.cmd.exewas gone, and its PowerShell kept running until it finished at 15.3 s.cmd.exe. The verifier ran its probe in 372 ms and threwCommand failed, the error NsisUpdater turns into a failed download. The killed check's PowerShell ran to the end of its injected sleep, 37 s later. The patched verifier accepted the same file at 56.9 s.ConvertTo-Json test) took 307, 373 and 408 ms.On macOS, comparing this branch (on
mainat6b7027b1f4) with #25945's head1d57f68aa8:{ timeout: 120000, shell: true }toexecFileon this branch and20000at fix(desktop): Windows updates survive a signature check slowed by antivirus #25945's head. I captured both by interceptingchild_process.execFile.git apply --check.vp i --frozen-lockfileandvp run check:changedpass on this branch.ElectronUpdater.downloadUpdateruns over electron-updater's real installed verifier. Electron, the verifier wiring, electron-updater's download step,execFileandexecFileSyncare stubbed. Time runs 20× faster. Every probe succeeds and blocks for 2.0 s, the shortest gap between a 20 s kill and the next logged step in the reporter's timelines (2.0, 6.8 and 7.7 s).The second model ends the scan at 55.8 s, the reporter's first uncapped trial. A check then returns a valid signature unless its timeout fires first. The model has a retry finish as soon as the scan ends, but in the reporter's #21273 run the overlapping retry finished about 10 s after the first check, so the model favours retrying. Both approaches get the signature accepted, and the retry path pays two main-process probes on the way.
No unit test. The change is one constant in vendored code, and
docs/internals/testing.mdsays not to ask for one assertion per constant. The checks above exercise the value the installed verifier actually uses.Scripts and output: Windows windows-verifier-proof.cjs and windows-evidence.txt. macOS repro.sh, signature-probe-count.mjs, verifier-timeout-and-orphan.cjs and evidence-logs.txt.
Council review
Rounds: 7
Rounds 5 to 7 reviewed the Windows evidence added after rounds 1 to 4.
Created with Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code