Use partial trust by default for all WinUI 3 apps #1900
Replies: 9 comments 31 replies
-
A common misconception. Today WinUI 3 apps can choose to use full trust (MediumIL) or partial trust (AppContainer). You absolutely can choose to make a packaged app using WinUI3 and run in an AppContainer, if you choose. See this thread and especially this sub-thread for more information.
That would be removing choice. We've heard from (many) developers that full trust (MediumIL) is a very strong need for their scenarios. We also heard from many how partial trust (AppContainer) is central to their needs. Some even use, need and like both.
Not every app needs elevation, but it's an important feature many apps require so we're supporting it. Windows App SDK is all about choice. In particular, your choice. Your freedom to choose the functionality you need. If you don't need MediumIL then by all means, don't use it. Ditto for AppContainer. And elevation. And WinUI 3. We also love ReactNative, and WinForms, and WPF, and Gtk and the myriad other UI technologies out there. WinUI 3 is a great choice for many, but if you have other needs or desires that's great too. Now while removing MediumIL (and elevation) support wouldn't be helpful to many, if you find difficulties using WinAppSDK with AppContainer please share your feedback. Be it APIs, documentation, tools, samples or otherwise, developers should find AppContainer no more or less a viable an option than MediumIL (or elevation) - they're tools in your toolchest you should be able to reach for, when you desire. If there are gaps or weak spots please let us know. We highly value community feedback to help guide our work. Rome wasn't built in a day, but it was built. Knowing where to lay those bricks sooner than later will help us bring to you more bang for the buck sooner. |
Beta Was this translation helpful? Give feedback.
-
Partial trust should be the default from the principle of least privilege. Also, apps with full trust are more difficult to get into the Microsoft Store. So the current approach eases the developer experience at the beginning, but just transfers the annoyance to the deployment stage. And anyways, developer convenience should almost never come before the needs of users. Encouraging secure coding practices, even if it is more annoying for developers, is best. |
Beta Was this translation helpful? Give feedback.
-
All these newer packaging technologies make a mess of what was once simple at worked fine with all win32 api's. Seems MS changes its mind all the time and deliver crazy win32 api level functions that do not function practically and/or consistently. Seems they absolutely do not like others to manage global application windows using API calls (you can't even manage modern Windows features like virtual desktops because.. uhm lack of a public API). UWP and WinUI3 are convoluted complex things with bad terminology and hacks (ie AppUserModelID which also does even not function consistently depending on how you look it up (api or window property)). You simply can't make efficient small apps anymore because of all bloat and layers. And they do not supply decent dev tools, documentation, examples and tooling. What happened since the Delphi & VB6 days... the heyday of native app development. MS does not even have a set of long lived and maintained modern UI controls. Apple does... Cocoa is a structured, consistent flashy dream compared to what modern Windows has become. On Windows, anything that can't be used from plain C is a no go IMHO. Which is the whole new WinUI3 too sadly. Reflection madness and lack of tools like designers. UWP was limited trust, then MS accepted full-trust because no vision and support and tools, then WinUI3 continues that. Meanwhile the GUI of Windows itself was and is a mixed bag of different ideas from different ages and the real native UI toolset never got updated past 2000. If anything I would think that Flutter/Dart is the better alternative for modern looking Windows apps. |
Beta Was this translation helpful? Give feedback.
-
@DrusTheAxe et. al. I think less important than the default selection would be that the choice is supported by the tooling. It shouldn't be required to do long research through GitHub issues and discussions to find out how to choose between full and partial trust when packaging a WinUI3 application. |
Beta Was this translation helpful? Give feedback.
-
I'm very new to WinUI and have never dealt with UWP. And the full trust in WinUI template confuses me. The rumors are that windows store is not accepting fullTrust apps. And I can't find clear documentation that it is not the case with WinUI apps. And what if developers didn't ever think about fullTrust when developing their app and use some features which are only work with fullTrust (such as accessing any file by path) and after several months of development they discover that such app will not be accepted by the store and should be completely reimagioned? Is this an intentional trap in the WinUI template? Or should we not worry about? Perhaps a one comment in the appxmanifest near the fullTrust element could explain all of this (or contain a link that explains). |
Beta Was this translation helpful? Give feedback.
-
I don't think that all these permission concepts have ever been made and intended for desktop apps. They were needed for mobile platforms, Xbox and maybe some other devices. For mobile, it was about paralleling Android permission concepts and for Xbox it was about making sure that it won't get hacked (like the first one), to ensure monetization. The idea of having "universal" app that can run everywhere, required to introduce the same permission and containerization mechanisms including all the restrictions which apps need to deal with on mobile and xbox platforms. These things weren't created for desktop Windows. There's one "treasure" remaining which they are holding on to protect: XBOX. |
Beta Was this translation helpful? Give feedback.
-
I didn't mean to say that there is no use or no benefit from leveraging those concepts for desktop apps. I said that they weren't designed and created for those applications. This is clearly evident when looking at the APIs and rules and how they have been changed over the years. This documents pretty well how much desktop application had been ignored in the beginning and how it has been successively attempted to fill all those gaps after realizing that no developer wants to develop desktop apps using UWP (except they had to develop for xbox or mobile and then published the app for Windows desktop as a bonus).
There are subtle differences between all those cases. You even get a different runtime behavior between WinAppSDK and UWP when both are containerized, packaged and declare runFullTrust, so I said "kind-of", as these things are nowhere documented (to my knowledge at least) and there are new surprises just around every corner...
Sorry for being unclear, that's a misunderstanding. By "desktop-only apps" I meant to say that WinAppSDK/WinUI cannot target xbox or other "devices".
The reason for this confusion is that there's no good documentation available for all those use cases (detail subjects are documented spread over many places, but a comprehensive and complete overview is nowhere available. Instead you need to collect countless pieces of information from GitHub posts by yours and others and try to put them together like a puzzle. Also, these things are not appropriately reflected in the tooling: The appxmanifest designer is still almost at the same state like it was 6-8 years ago and it doesn't properly and clearly support all the different possible execution modes. Documentation is sparse as well. |
Beta Was this translation helpful? Give feedback.
-
"runFullTrust" doesn't make an app run elevated/with admin rights. Do you want to know why our application needs to declare runFullTrust? It's because in cases it is required to access a local server (ours, but non-store) via local loopback, which is - of course - restricted. Also nice: you don't realize this during development because Visual Studio automatically removes this restriction locally - which makes a great surprise at a later time when you realize that it doesn't work once installed on other machines. Once again - YAY! And that's a good example for what I mentioned earlier: so many work days are getting burned for stuff like this. |
Beta Was this translation helpful? Give feedback.
-
It's good that you mention this, because it's exactly that way of thinking in "scenarios" being a primary source source of evil, negatively affecting design and architecture of platform and framework strategies (see "hybris and ignorance" above).
I don't think it's a matter of agreement or disagreement, it's about how this kind of "thinking in scenarios" is leading to misconceptions and lack of understanding developers' needs when developing for a certain platform, which is why I think this is actually a matter of substantial importance. To set the records straight: Our software is known by Millions. A single release of the server comprises more than 70 (sic!) installation packages for all the supported platforms and I don't even have the figures for all the client apps (no synced release cycle) which we have for any platform you can think of (plus those you wouldn't think of). Hence, I do not only have a history in Windows development over decades but also a pretty good picture of appplication development on various platforms and UWP is ranging at the very low end of favorable platforms from my point of view, surpassed only by things like Roku Scenegraph/Brightscript for example. In fact, our core application is html/js based, but that doesn't mean that the native part of the application is "just a shell". There's a range of tasks which need to be done at the native side in order to make the application work as expected and designed on each platform. In case of Windows/Xbox platforms this includes: application info, settings storage, logging, diagnostic features, UDP network discovery, exit handling, window management, theme awareness/synchronization, full-screen switching, link execution , shellopen handling, volume control, remote control, plugin management, http redirection/mapping, local loopback exemption, splash/startup coordination, WakeOnLan control, app restart, system sleep and reboot control, system events interaction for sleep and suspend, background audio playback, refresh rate switching, HDR mode activation, webview/video overlay and finally the most involved part: video playback (html video is too limited and Windows.Media is still too limited, so there are custom solutions in place, even different ones for Xbox and desktop windows). So, "shell" => yes, "just" => no
I know, and if you can show me a way to avoid it, I'd gladly ditch it right away. 😉
Thanks a lot for the idea. I'll try this in a moment and report back. |
Beta Was this translation helpful? Give feedback.
-
Today WinUI 3 apps use full trust. This is rather concerning since, in my opinion, not all apps need full trust but now every app needs it because of WindowsAppSDK. Use partial trust for all WinUI 3 apps and eventually deprecate full trust by making everything work under partial trust.
Beta Was this translation helpful? Give feedback.
All reactions