Disallow dotnet.exe to load standalone apps and sxs hostfxr
Steps to reproduce
md app & cd app
dotnet new
:: edit to make standalone
dotnet restore
dotnet publish
:: replace app.exe with dotnet.exe, i.e., copy /y dotnet.exe app.exe
app.exe
Expected behavior
Using dotnet.exe should produce an error that it cannot load standalone app. Apphost.exe must be used.
Also make sure dotnet.exe doesn't load sxs hostfxr.dll
Actual behavior
dotnet.exe can still load executables under own name.
Environment data
dotnet --info output:
See PR dotnet/core-setup#212 and related to https://github.com/dotnet/cli/issues/3850
https://github.com/dotnet/core-setup/blob/cc564bd08a1f76be06b5d4a9bfc6dc0eb593d613/src/corehost/cli/fxr/fx_muxer.cpp#L832
Remove the is_dotnet_host
@gkhanna79
@ramarag Assigning this to you as part of you looking into the host signing work.
Please see https://github.com/dotnet/core-setup/pull/711 for links to the proposal of the work and outstanding issues.
@ramarag Was this completed as part of the host-split work?
CC @eerhardt
I don't think this was completed. I just tried it with the latest core-setup build 2.0.0-beta-001820-00, and I was able to use the muxer to invoke a published self-contained app.
For my education - are we sure we want to limit this? What is the reasoning/background/priority of this take-away?
Yes, we need to do this. The plan is that, post the host split work, dotnet.exe will be signed and while apphost.exe won't be. As a result, we do not want dotnet.exe to be copied over, renamed to app.exe and be executed with our signature.
But what about using the muxer located at %PROGRAMFILES%\dotnet\dotnet.exe? We want it to fail for invoking self-contained apps as well?
That muxer is the dotnet.exe which is going to be signed and will only support activation of portable apps. For standalone apps, apphost.exe is going to be published in the app that will be unsigned and can only activate standalone apps.
We want it to fail for invoking self-contained apps as well?
This is the change that host-split work is all about.
I don't think dotnet/core-setup#215 is fully fixed. See the expected behavior section in the
bug description. dotnet.exe should not load sxs hostfxr, otherwise
someone can simply copy over the exe.
Basically, remove this code:
https://github.com/dotnet/core-setup/blob/master/src/corehost/corehost.cpp#L131
This wasn't removed earlier because CLI didn't start using apphost.
On Friday, March 24, 2017, Rama krishnan Raghupathy < [email protected]> wrote:
Closed dotnet/core-setup#215 https://github.com/dotnet/core-setup/issues/215.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/dotnet/core-setup/issues/215#event-1015183334, or mute the thread https://github.com/notifications/unsubscribe-auth/AKJrs4pCUdv4PkcQFZsbpDgXpimUHiXyks5rpGfIgaJpZM4JN9hn .
@schellap did you mean that we should move the check for sxs hostfxr to the start of resolve_fxr_path(const pal::string_t& own_dir) ?
@ramarag I believe @schellap is requesting that the error is more appropriate:
Using dotnet.exe should produce an error that it cannot load standalone app.
Based upon the current implementation, it will also give the error at https://github.com/dotnet/core-setup/blob/master/src/corehost/corehost.cpp#L164, which is incorrect interms of the expected experience.