Skip to content

Add auto-elevate package updates through Devolutions Agent - #5898

Draft
Marc-André Moreau (mamoreau-devolutions) wants to merge 1 commit into
mainfrom
copilot/auto-elevate-updates-agent-broker
Draft

Marc-André Moreau (mamoreau-devolutions) wants to merge 1 commit into
mainfrom
copilot/auto-elevate-updates-agent-broker

Conversation

@mamoreau-devolutions

Copy link
Copy Markdown
Contributor
  • I have read the contributing guidelines, and I agree with the Code of Conduct.
  • Have you checked that there aren't other open pull requests for the same changes?
  • Have you tested that the committed code can be executed without errors?
  • Have you confirmed that this issue is caused by UniGetUI itself, and not by the package manager or the package involved?
    If the same issue can be reproduced outside UniGetUI with the relevant package manager or with the package itself, please report it there first. UniGetUI should only be used to track issues that are specific to UniGetUI's behavior or integration.

Summary

Adds an opt-in Windows Administrator setting to automatically elevate updates of already-installed packages through Devolutions Agent without repeated UAC prompts, while keeping new package installations and uninstallations on the normal local UAC flow.

Dependency: This PR depends on the companion broker enforcement PR in Devolutions/devolutions-gateway (ensuring elevated updates are enforced only for already-installed packages on the broker side).

Changes

  • Setting: Added Settings.K.UseAgentBrokerForUpdates ("UseAgentBrokerForUpdates", default false) in src/UniGetUI.Core.Settings/SettingsEngine_Names.cs.
  • Operation-aware broker routing:
    • Exposed BrokerRequestValidator.ManagerRejectsElevation / ManagerRejectsMachineScope and added shared routing helpers (IsStrictlyBrokered, IsBrokerEligible, CanRouteToBroker, RequestsBrokerElevation) in BrokerRequestBuilder.
    • Updated PackageOperations.cs so strict UseAgentBroker behavior is unchanged, while UseAgentBrokerForUpdates calls ApplyElevationRequirements before deciding eligibility and routes only elevated or machine-scope Update operations for elevation-capable non-virtual managers (Install, Uninstall, reinstall-on-update steps, non-elevated updates, global non-admin .NET Tool updates, and user-only managers stay on the local path; explicit policy Deny fails closed).
    • Made WinGetPkgOperationHelper.OperationIsBrokered and InstallOptionsViewModel.IsBrokered operation- and elevation-aware while keeping NativeWinGetHelper reinstall suppression scoped to strict UseAgentBroker.
  • Managed policy rule service:
    • Added AutoElevateUpdatesPolicyService (InspectAsync, EnableAsync, DisableAsync) over IBrokerPolicyManagementService, IPolicyWriteElevator, and IPolicyWriteElevationEligibility.
    • Manages canonical Format 1.0.0 rules (Priority: 1000, Decision: Allow, Operations: [Update], ExecutionElevation: [Elevated], strict PolicyConstraints with all Allow* flags false): unigetui.auto-elevate-updates.winget, unigetui.auto-elevate-updates.chocolatey, unigetui.auto-elevate-updates.powershell, unigetui.auto-elevate-updates.powershell7 (split because PolicySerializer requires Managers.Count == 1 when SourceNames is set), and unigetui.auto-elevate-updates.dotnet.
    • Creates a fail-closed DefaultDecision: Deny policy when missing, idempotently upserts/removes only unigetui.auto-elevate-updates.* rules while preserving existing rules, and handles UAC cancellation, stale store tokens, read-only/invalid/ineligible states, and unavailable/unsupported Agents.
  • Administrator Settings UI, Search, Localization & TUI:
    • Added Windows-only AutoElevateUpdatesCard toggle with inline status/error feedback and async UAC rollback in Administrator.axaml, Administrator.axaml.cs, and AdministratorViewModel.cs.
    • Updated SettingsSearchIndex.cs, src/Languages/lang_en.json, and TUI fake-data reset guards (FakeDataEnvironment.cs, SettingsPage.cs).
  • Tests: Added AutoElevateUpdatesRoutingTests, AutoElevateUpdatesPolicyServiceTests, and AdministratorViewModelTests.

Validation

  • dotnet format whitespace src --folder --verify-no-changes --verbosity minimal — passed (exit 0)
  • dotnet format style src\UniGetUI.Windows.slnx --no-restore --verify-no-changes --verbosity minimal — passed (exit 0)
  • dotnet build src\UniGetUI.Windows.slnx /p:Platform=x64 -v q --nologo — passed (exit 0)
  • dotnet build src\UniGetUI.Avalonia.slnx -v q --nologo — passed (exit 0)
  • dotnet test src\UniGetUI.PackageEngine.Tests\UniGetUI.PackageEngine.Tests.csproj --no-build /p:Platform=x64 --filter "FullyQualifiedName~AutoElevateUpdates|FullyQualifiedName~BrokerRequestBuilderTests|FullyQualifiedName~BrokerPolicyManagementServiceTests|FullyQualifiedName~PackageOperationsTests|FullyQualifiedName~WinGetManagerTests|FullyQualifiedName~CargoManagedOperationRoutingTests" --verbosity minimal --nologo — passed (465/465 on net10.0, 847/847 on net10.0-windows10.0.26100.0)
  • dotnet test src\UniGetUI.Tests\UniGetUI.Tests.csproj --no-build /p:Platform=x64 --filter "FullyQualifiedName~AdministratorViewModelTests|FullyQualifiedName~SettingsSearchIndexTests|FullyQualifiedName~AgentPolicyInspectorViewModelTests|FullyQualifiedName~InstallOptions" --verbosity minimal --nologo — passed (64/64)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the winget label Dec 1, 2026

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

Development

Successfully merging this pull request may close these issues.

1 participant