When NuGet installs a PowerShell node, it checks what the current ExecutionPolicy is. If it is not unlimited, RemoteSigned or Bypass, it forces ExcecutionPolicy for RemoteSigned for the current process (devenv.exe).
PowerShell does not see the built-in scripts init.ps1, install.ps1, etc. as downloadable from the Internet, so there is nothing to stop a malicious script from doing anything on your computer so that your account has permissions.
At this point, all the creators of the NuGet package are pretty much part of the honor system. I believe that Ruby Gems has a similar situation.
NuGet really has the ability to use private package sources, so if security is important, I suggest you download and check all packages and allow packages to be installed only from these trusted sources.
source share