Skip to content

Stop repeating the installer-host warning after an accepted update - #5649

Open
Gabriel Dufresne (GabrielDuf) wants to merge 3 commits into
mainfrom
fix/5606-trusted-installer-hosts
Open

Gabriel Dufresne (GabrielDuf) wants to merge 3 commits into
mainfrom
fix/5606-trusted-installer-hosts

Conversation

@GabrielDuf

@GabrielDuf Gabriel Dufresne (GabrielDuf) commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

The installer-host warning compared the hosts in the installed version's manifest against the new version's, both as they read today. Some publishers rewrite a release's manifest once it is superseded. For example, every LibreOffice manifest moves from download.documentfoundation.org to downloadarchive.documentfoundation.org when the next release ships. By the time an update is offered, the installed version's manifest has already moved, so the two sets never overlap and the warning showed on every update.

A successful WinGet install or update now remembers the host of the installer that was used, in WinGetTrustedInstallerHosts. The update row skips the warning when the new version's hosts overlap that remembered host, so the warning returns only when the publisher actually changes hosts.

  • Only Pinget's selected installer for this machine is recorded, not every architecture's. If there is no selected installer, nothing is recorded and the warning behaves as before.
  • A custom-version install records the version it requested.
  • Entries are keyed by the lowercased package id and written under a lock, so parallel installs keep each other's entries.
  • The lookup runs in the background, and only once the manager is loaded. The setting is machine-local and excluded from settings export.

Tests cover update, install and custom-version install; ignoring hosts from other architectures' installers; the case-insensitive lookup; and 40 packages saving at the same time. Temporarily undoing each fix makes at least one of them fail.


Closes #5606

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Installer-host trust can be recorded for the wrong scope, architecture, or version, or when no installer runs, potentially suppressing future warnings for hosts the user never accepted.

3 open issues
What changed in this PR

This PR addresses #5606 by remembering accepted WinGet installer hosts so publisher manifest rewrites do not repeatedly trigger host-change warnings.

Changes:

  • Adds background host recording after successful install/update results and checks remembered hosts when displaying warnings.
  • Stores host trust locally, with locked writes and exclusion from settings export.
  • Adds tests for selected-installer hosts, custom versions, case-insensitive lookup, and concurrent writes.
File Description
src/​UniGetUI.PackageEngine.Tests/​WinGetManagerTests.cs Tests host persistence and operation-version selection.
src/​UniGetUI.PackageEngine.Managers.WinGet/​WinGet.cs Exposes the trusted-host lookup.
src/​UniGetUI.PackageEngine.Managers.WinGet/​Helpers/​WinGetPkgOperationHelper.cs Records and retrieves trusted hosts after operation results.
src/​UniGetUI.PackageEngine.Managers.WinGet/​ClientHelpers/​PingetPackageDetailsProvider.cs Adds selected-installer-only host lookup.
src/​UniGetUI.Core.Settings/​SettingsEngine_Names.cs Defines the trusted-host setting.
src/​UniGetUI.Core.Settings/​SettingsEngine_ImportExport.cs Excludes host trust from settings export.
src/​UniGetUI.Avalonia/​Models/​PackageCollections.cs Suppresses warnings when new hosts overlap remembered hosts.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Previewing installation options can overwrite a running operation’s pending trust data, causing a successful result to record the previewed installer’s host instead of the installed one’s.

1 open issue
3 resolved since last review

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Installer-host trust tracking can save stale or incorrect hosts, share trust across sources, and miss brokered operations, causing repeated or incorrectly suppressed host-change warnings.

No open issues 🎉

4 previously missed issues

In code that hasn't changed since last review

Medium severity Brokered installs do not record package trust

src/​UniGetUI.PackageEngine.Managers.WinGet/​Helpers/​WinGetPkgOperationHelper.cs:231

With UseAgentBroker enabled, PackageOperation.PerformBrokerOperation bypasses GetParameters, leaving successful brokered installs and updates without pending trust and therefore without a saved host. The repeated warning remains on that execution path. Capture the effective request's version, scope, and architecture during broker execution too, while keeping preview and request-validation calls side-effect-free.

Medium severity Trust records may not match the installed version

src/​UniGetUI.PackageEngine.Managers.WinGet/​Helpers/​WinGetPkgOperationHelper.cs:551

Normal installs and updates do not pass --version, so a release published after discovery can be installed while this code records the older listed version's host. If that older manifest has moved to an archive host, subsequent updates still warn despite the successful installation. Resolve the version/installer actually used by the operation, or pin execution to the captured version before using it as trust evidence.

Medium severity Trust keys collide across package sources

src/​UniGetUI.PackageEngine.Managers.WinGet/​Helpers/​WinGetPkgOperationHelper.cs:563

Both the command builder and CreateQuery select a source, but this key uses only the package ID, so equal IDs from different sources overwrite and consume each other's trust. An accepted installation from one source can then suppress a host-change warning for another source's package. Include source identity in both recording and lookup keys, and test equal IDs from different sources.

Medium severity Stale lookups can overwrite newer package trust

src/​UniGetUI.PackageEngine.Managers.WinGet/​Helpers/​WinGetPkgOperationHelper.cs:590

Background lookups can overwrite a newer successful install's trust for the same package: lookup A can stall, let install B record host B, then replace it with host A. The write lock preserves different packages' entries but does not prevent this reversal, so subsequent updates from B warn again. Capture a per-package success sequence before scheduling each lookup and reject stale writes under this lock; test lookups completing in reverse order.

1 resolved since last review

Review effort: Balanced

@randy-but-a-ro randy-but-a-ro Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉

Integration Details
{
	"deliveryId": "49d2d3a0-d4a2-11f1-8ca8-b7d2e8c74702",
	"headSha": "9d510c7373f3ab191b455d04ddb277f91b783a51",
	"reviewer": "copilot-pull-request-reviewer[bot]"
}

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement An improvement to WingetUI winget

Development

Successfully merging this pull request may close these issues.

[IMPROVEMENT] Persistently acknowledge installer host change warnings

2 participants