microsoft / microsoft/WindowsAppSDK

File Pickers lack access to User folder in PartialTrust applications

Open
#6,327 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-File access needs-triage
Dominant language
C++
Stars
4.7k
Forks
471
Avg merge
3d 13h
Merged PRs (30d)
28

Description

Partial trust applications are still not able to complete a user file pick (and likely) save operation. The changes in win app sdk 1.8.4 seem to have moved the issue forward quite a bit. The application is now able to open the picker but it seems the broker being used mostly doesn't have permissions to access/browse any user folder. Interestingly, it does seem to allow to browse and access the System32 folder.

Of note, this issue itself seems to be resolved https://github.com/microsoft/WindowsAppSDK/issues/3536 but this doesn't fully resolve the problem

I have followed this issue for a while and am looking for guidance. There seems to be a lot of discussion around abandoning the partial trust model. However, after migrating to the win app sdk from UWP this is the only outstanding issue with using the partial trust model with our application. If this could be resolved we can continue forward without the full trust requirement. Primarily, the windows store still requires a reason given to eschew the partial trust model and it feels like a better practice to restrict the access of the application to only needed permissions.

With all that in mind, are there plans to fix this final permission issue or is the only way to get a function file picker for the foreseeable future to go full trust? This isn't a integral feature of our application but it's rather difficult to explain to end users why our application that allowed them to pick files to upload that used to work on UWP doesn't work with win app sdk.

Steps to reproduce the issue

Create a sample application project
Add File Open/Save picker following the Documentation for WinUI3/Win App SDK on Interop
Run the application and verify it works
Go into Package Manifest and change Entrypoint to => Windows.PartialTrustApplication and remove the runFullTrust restricted capability.
Build and Run the application again
File picker will throw Access is Denied when attempting to open to any of the user's directories
Image

Expected behavior

Application is not able to pick files from user folder in partial trust mode.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with a WinUI 3/Windows App SDK file picker and the Package Manifest changes described in the steps. Compare the partial-trust behavior with the related issue 3536 and inspect how the picker broker handles user-folder access; done means file open and save operations work from user directories without runFullTrust.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
authorization, desktop, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.