Rob Galante
Rob Galante

Reputation: 21

Signed WPF app installed from signed MSIX still running from untrusted location

I have a valid code signing certificate. I use it to sign a WPF application. This app will run as an administrator. It has a valid app.manifest.

  <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
    <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
  </requestedPrivileges>

The MSIX file was built with the MSIX Packaging Tool. I signed the MSIX application package with the same certificate. The appx manifest has these capabilities.

<Capabilities>
    <Capability Name="internetClient" />
    <rescap:Capability Name="runFullTrust" />
    <rescap:Capability Name="allowElevation" />
</Capabilities>

I install the MSIX file on a Windows 10 Pro machine running version 1903. It installs correctly, and indicates that it's a trusted application. When I launch the app, I see the yellow warning, "this file is running from an untrusted location." I expect to see the blue UAC elevation warning because the application is signed.

I unpacked the MSIX file and verified that the EXE is signed with the code signing certificate. It is. I launched the EXE file and I see the correct, blue, UAC elevation warning with the company name from the certificate.

Why does Windows 10 think the WPF application is launching from an untrusted source?

Upvotes: 2

Views: 651

Answers (1)

Bogdan Mitrache
Bogdan Mitrache

Reputation: 11023

First of all, if you are developing the app from scratch, you should use the Windows Application Packaging Project from Visual Studio to generate the package. The MSIX packaging tool is intended only for converting to MSIX apps for which you don't have the source code.

Stefan Wick from MSFT worked in thiw are and he wrote some very useful tutorials on the topic: https://stefanwick.com/tag/allowelevation/

Ping me on Twitter (if he didn't noticed thies question yet), he might have more details.

My suspicion is that you get this warning because the app is sideloaded (i.e. not installed from the MS Store) and it is also using allowElevation.

Just for testing. Can you remove the allowElevation capability from the package and reinstall it, using the same certificate? (You will probably need to manually launch it as and admin, otherwise it will silently crash).

Upvotes: 0

Related Questions