Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move trust for ProductBinaries to Unrestricted. #5511

Merged
merged 4 commits into from
Nov 29, 2017

Conversation

TravisEz13
Copy link
Member

fixes #5485

  • Causes Restricted and AllSigned execution policies to no longer trust PSHome by default.
  • To prevent behavior changes to Unrestricted, the trust for PShome was added here.
  • Update the description of Unrestricted to indicate that it requires the shell (an existing requirement.)

@TravisEz13 TravisEz13 changed the base branch from 6.0.0 to master November 21, 2017 00:03
@@ -189,6 +185,10 @@ private bool CheckPolicy(ExternalScriptInfo script, PSHost host, out Exception r
#endif
if (_executionPolicy == ExecutionPolicy.Unrestricted)
{
// Product binaries are always trusted
if (SecuritySupport.IsProductBinary(path))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the execution policy is unrestricted, then I think we don't need this check anymore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chatted with Travis offline. This check is needed to bypass files downloaded from the internet to $PSHome\Module when it's Unrestricted.
Need to add a comment about this.

@@ -189,6 +185,10 @@ private bool CheckPolicy(ExternalScriptInfo script, PSHost host, out Exception r
#endif
if (_executionPolicy == ExecutionPolicy.Unrestricted)
{
// Product binaries are always trusted
if (SecuritySupport.IsProductBinary(path))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chatted with Travis offline. This check is needed to bypass files downloaded from the internet to $PSHome\Module when it's Unrestricted.
Need to add a comment about this.

@SteveL-MSFT
Copy link
Member

Can we add a test?

}
)

It "$TestTypePrefix Running <testScript> Module should return <error>" -TestCases $testDate {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: should be $testData

)

It "$TestTypePrefix Running <testScript> Module should return <error>" -TestCases $testDate {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing param block

}
catch
{
$exception = $_
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to use ShouldBeErrorId?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I accidentally pushed an incomplete commit. I have updated the PR.

)
foreach($testScript in $testScripts) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, $testScripts was not defined in this scope, so nothing was being run.

@TravisEz13
Copy link
Member Author

Note, issue #5559 was filed when adding tests due to an issue with the tests. I have marked the affected tests to be skipped.

error = $null
}
)
It "$TestTypePrefix Running <testScript> Script should throw '<error>'" -TestCases $skipTestData -Skip {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be Pending and not Skipped?

@TravisEz13 TravisEz13 added this to the 6.0.0-GA milestone Nov 28, 2017
@daxian-dbw daxian-dbw merged commit f67844e into PowerShell:master Nov 29, 2017
@TravisEz13 TravisEz13 deleted the fix_allSigned branch November 29, 2017 01:56
TravisEz13 added a commit to TravisEz13/PowerShell that referenced this pull request Nov 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unsigned modules should not load with AllSigned policy
3 participants