Skip to content

Resolve junctions in the elevated WinGet TEMP folder - #5526

Merged
Gabriel Dufresne (GabrielDuf) merged 3 commits into
mainfrom
fix-5518-elevated-temp-junction
Oct 16, 2026
Merged

Gabriel Dufresne (GabrielDuf) merged 3 commits into
mainfrom
fix-5518-elevated-temp-junction

Conversation

@GabrielDuf

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

Copy link
Copy Markdown
Contributor

Problem

Since #5343, portable mode hands elevated WinGet a %TEMP% of <install dir>\Settings\Temp\ElevatedWinGetTemp. Scoop installs UniGetUI as portable, and both apps\unigetui\current and the persisted Settings folder are junctions created by a non-admin user.

Inno Setup 6.7+ and 7.x installers turn on RedirectionGuard in enforcing mode in their own setup process. That makes them refuse to traverse an untrusted mount point, so creating their is-*.tmp working folder fails with:

Error 448: The path cannot be traversed because it contains an untrusted mount point.

Fix

  • AppPaths.ElevatedTempDirectory opens the deepest existing folder on the path and asks GetFinalPathNameByHandleW for its final path. That resolves every junction and symlink in one call, keeps the not-yet-created tail, and strips \\?\ / \\?\UNC\ the same way ShortcutFileRemover already does. If the folder can't be opened, it logs a warning and falls back to the unresolved path.
  • The result is cached per unresolved path, since it can't change while the process runs.
  • The ten call sites that each set TEMP/TMP by hand now call AppPaths.RedirectTempToElevatedDirectory(startInfo), so the elevated environment can't drift between them.

Testing

  • I reproduced the failure with real installers: elevated Inno Setup 7.1.0 and 6.7.3 installers, with TEMP pointed through Scoop-style mklink /J junctions. Both show the reporter's exact Error 448, and their /LOG reports RedirectionGuard status for current process: Enabled in enforcing mode. With the resolved path, both reach the license page. Fort Firewall itself couldn't be run past its OS check because the test machine is ARM64.
  • I didn't rerun that installer test after the review switched the resolver to GetFinalPathNameByHandleW. The new junction test shows it resolves to the same persist\... path that worked.
  • New AppPathsTests cover junctions, symlinks, the missing-tail case and the TEMP/TMP helper. All 16 tests in UniGetUI.Core.Logging.Tests pass.
  • Build is clean with no new warnings, and dotnet format whitespace and style both pass.

Not tested end to end with a Scoop-installed UniGetUI build.


Closes #5518

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

Cache synchronization and test portability need correction, and published NativeAOT validation of the elevated Scoop installation flow remains outstanding.

2 open findings
What changed in this PR

Resolves linked directories in elevated WinGet’s temporary path to address Scoop installations failing with Error 448 while preserving portable storage.

Changes:

  • Resolves Windows junctions and symlinks while preserving missing path segments.
  • Centralizes TEMP/TMP redirection across ten call sites.
  • Adds resolver and environment-variable tests.
File Description
src/​UniGetUI.PackageEngine.Operations/​AbstractProcessOperation.cs Uses shared TEMP redirection.
src/​UniGetUI.PackageEngine.Managers.WinGet/​WinGet.cs Centralizes elevated WinGet environment setup.
src/​UniGetUI.PackageEngine.Managers.WinGet/​ClientHelpers/​WinGetCliHelper.cs Redirects CLI calls through the shared helper.
src/​UniGetUI.PackageEngine.Managers.WinGet/​ClientHelpers/​PingetPackageDetailsProvider.cs Updates elevated package-details TEMP handling.
src/​UniGetUI.PackageEngine.Managers.WinGet/​ClientHelpers/​PingetCliHelper.cs Updates elevated Pinget TEMP handling.
src/​UniGetUI.Core.Logging.Tests/​AppPathsTests.cs Adds linked-path and TEMP/TMP tests.
src/​UniGetUI.Core.Logger/​AppPaths.cs Adds Windows path resolution, caching, and redirection.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/UniGetUI.Core.Logger/AppPaths.cs Resolved

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

The final Windows-native resolver still needs end-to-end validation with Scoop-installed UniGetUI and a published NativeAOT build.

0 open findings

2 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": "991b93f0-c964-11f1-9fe9-bb5fd8a8613a",
	"headSha": "64f655500fd04e77ef26a63aedeb7c52b747d1ed",
	"reviewer": "copilot-pull-request-reviewer[bot]"
}

@GabrielDuf
Gabriel Dufresne (GabrielDuf) merged commit 402385f into main Oct 16, 2026
6 checks passed
@GabrielDuf
Gabriel Dufresne (GabrielDuf) deleted the fix-5518-elevated-temp-junction branch October 16, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Cannot install Fort Firewall – Error 448: Untrusted mount point

2 participants