Skip to content

Add WinCompat deny list support using a setting in powershell.config.json - #11726

Merged
Travis Plunk (TravisEz13) merged 10 commits into
PowerShell:masterfrom
anmenaga:WinCompatModuleDenyList
Feb 5, 2020
Merged

Travis Plunk (TravisEz13) merged 10 commits into
PowerShell:masterfrom
anmenaga:WinCompatModuleDenyList

Conversation

@anmenaga

@anmenaga Andrew (anmenaga) commented Jan 29, 2020 •

Copy link
Copy Markdown

PR Summary

Some Windows PowerShell modules don't work well with de/serialized objects, so they can not be used with WinCompat.
This PR adds support for an optional WindowsPowerShellCompatibilityModuleDenyList setting (a string array) in powershell.config.json so that a user can prevent specified modules from being loaded using WinCompat.
If WinCompat feature is enabled and it tries to load a module mentioned in the DenyList, then an error is generated.
Module name comparison is case-insensitive.
By default, in PowerShell packages for Windows OS, this setting will contain PSScheduledJob,BestPractices and UpdateServices modules (this list most likely will be extended in future).

Fix #11687

PR Checklist

@anmenaga Andrew (anmenaga) added WG-Engine core PowerShell engine, interpreter, and runtime CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log labels Jan 29, 2020
Comment thread build.psm1 Resolved
@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Jan 30, 2020
@TravisEz13

Copy link
Copy Markdown
Member

Is this needed for GA?

@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Jan 30, 2020
Andrew Menagarishvili added 2 commits January 30, 2020 13:47
@SteveL-MSFT Steve Lee (SteveL-MSFT) added this to the GA-consider milestone Jan 30, 2020
Comment thread build.psm1 Resolved
@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Jan 31, 2020
@TravisEz13

Copy link
Copy Markdown
Member

PoshChan-Bot (@PoshChan) Please remind me in 1 day

@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Jan 31, 2020
@anmenaga

Copy link
Copy Markdown
Author

Codacy issue Make 'IsModuleInDenyList' a static method is wrong as it doesn't detect a call to non-static WriteError.

@TravisEz13

Copy link
Copy Markdown
Member

Paul Higinbotham (@PaulHigin) Can you update your review?

@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Jan 31, 2020
@PoshChan

Copy link
Copy Markdown
Collaborator

Travis Plunk (@TravisEz13), this is the reminder you requested 1 day ago

@doctordns

Copy link
Copy Markdown
Collaborator

My earlier comment may have gotten buried - the WSUS module should be added to the WInCompat deny list.

@SteveL-MSFT Steve Lee (SteveL-MSFT) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Pending adding UpdateServices module to the list

@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Feb 3, 2020
@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Feb 4, 2020
@TravisEz13

Copy link
Copy Markdown
Member

Steve Lee (@SteveL-MSFT) Please update your review?

@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Feb 4, 2020
@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Feb 4, 2020
@TravisEz13

Copy link
Copy Markdown
Member

PoshChan-Bot (@PoshChan) Please remind me in 1 hour

@SteveL-MSFT Steve Lee (SteveL-MSFT) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One NIT

@PoshChan

Copy link
Copy Markdown
Collaborator

Travis Plunk (@TravisEz13), this is the reminder you requested 1 hour ago

@TravisEz13

Copy link
Copy Markdown
Member

PoshChan-Bot (@PoshChan) Please remind me in 1 hour

@PoshChan

Copy link
Copy Markdown
Collaborator

Travis Plunk (@TravisEz13), this is the reminder you requested 1 hour ago

@TravisEz13
Travis Plunk (TravisEz13) merged commit 43c88a4 into PowerShell:master Feb 5, 2020
Aditya Patwardhan (adityapatwardhan) pushed a commit to adityapatwardhan/PowerShell that referenced this pull request Feb 18, 2020
…rShell#11726)

# Conflicts:
#	build.psm1
#	src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs
@ghost

Copy link
Copy Markdown

🎉v7.0.0-rc.3 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log WG-Engine core PowerShell engine, interpreter, and runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in 7.0.0-rc.2: Register-ScheduledJob ScriptBlock parameter doesn't work

9 participants