Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ internal class RunspacePoolInternal
/// The explicit PSHost implementation.
/// </param>
/// <exception cref="ArgumentNullException">
/// RunspaceConfiguration is null.
/// Host is null.
/// </exception>
/// <exception cref="ArgumentException">
Expand Down
11 changes: 6 additions & 5 deletions src/System.Management.Automation/security/SecurityManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace Microsoft.PowerShell
/// Unrestricted - No files must be signed. If a file originates from the
/// internet, Monad provides a warning prompt to alert the user. To
/// suppress this warning message, right-click on the file in File Explorer,
/// select "Properties," and then "Unblock."
/// select "Properties," and then "Unblock." Requires Shell.
/// Bypass - No files must be signed, and internet origin is not verified
///
/// </summary>
Expand Down Expand Up @@ -136,10 +136,6 @@ private bool CheckPolicy(ExternalScriptInfo script, PSHost host, out Exception r
if (!IsSupportedExtension(fi.Extension))
return true;

// Product binaries are always trusted
if (SecuritySupport.IsProductBinary(path))
return true;

// Get the execution policy
_executionPolicy = SecuritySupport.GetExecutionPolicy(_shellId);

Expand Down Expand Up @@ -189,6 +185,11 @@ private bool CheckPolicy(ExternalScriptInfo script, PSHost host, out Exception r
#endif
if (_executionPolicy == ExecutionPolicy.Unrestricted)
{
// Product binaries are always trusted
// This avoids signature and security zone checks
if (SecuritySupport.IsProductBinary(path))
return true;

// We need to give the "Remote File" warning
// if the file originated from the internet
if (!IsLocalFile(fi.FullName))
Expand Down
3 changes: 1 addition & 2 deletions test/csharp/test_FileSystemProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ private ExecutionContext GetExecutionContext()
{
CultureInfo currentCulture = CultureInfo.CurrentCulture;
PSHost hostInterface = new DefaultHost(currentCulture,currentCulture);
RunspaceConfiguration runspaceConfiguration = RunspaceConfiguration.Create();
InitialSessionState iss = InitialSessionState.CreateDefault2();
AutomationEngine engine = new AutomationEngine(hostInterface, runspaceConfiguration, iss);
AutomationEngine engine = new AutomationEngine(hostInterface, iss);
ExecutionContext executionContext = new ExecutionContext(engine, hostInterface, iss);
return executionContext;
}
Expand Down
3 changes: 1 addition & 2 deletions test/csharp/test_SessionState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ public void TestDrives()
{
CultureInfo currentCulture = CultureInfo.CurrentCulture;
PSHost hostInterface = new DefaultHost(currentCulture,currentCulture);
RunspaceConfiguration runspaceConfiguration = RunspaceConfiguration.Create();
InitialSessionState iss = InitialSessionState.CreateDefault2();
AutomationEngine engine = new AutomationEngine(hostInterface, runspaceConfiguration, iss);
AutomationEngine engine = new AutomationEngine(hostInterface, iss);
ExecutionContext executionContext = new ExecutionContext(engine, hostInterface, iss);
SessionStateInternal sessionState = new SessionStateInternal(executionContext);
Collection<PSDriveInfo> drives = sessionState.Drives(null);
Expand Down
4 changes: 2 additions & 2 deletions test/powershell/Installer/WindowsInstaller.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ Describe "Windows Installer" -Tags "Scenario" {
@{ Name = "WMF 5.1"; Url = "https://www.microsoft.com/download/details.aspx?id=54616" }
)
}

It "WiX (Windows Installer XML) file contains pre-requisites link $preRequisitesLink" {
$wixProductFile = Join-Path -Path $PSScriptRoot -ChildPath "..\..\..\assets\Product.wxs"
(Get-Content $wixProductFile -Raw).Contains($preRequisitesLink) | Should Be $true
}

It "Pre-Requisistes link for '<Name>' is reachable" -TestCases $linkCheckTestCases -Test {
It "Pre-Requisistes link for '<Name>' is reachable: <url>" -TestCases $linkCheckTestCases -Test {
param ($Url)

# Because an outdated link 'https://www.microsoft.com/download/details.aspx?id=504100000' would still return a 200 reponse (due to a redirection to an error page), it only checks that it returns something
Expand Down
Loading