Block getting help from network locations in restricted remoting sessions (#20593)

This commit is contained in:
Travis Plunk
2023-10-31 16:06:15 -07:00
committed by GitHub
parent edfc3bd992
commit 687383bcc1
9 changed files with 166 additions and 35 deletions
@@ -1,6 +1,8 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
Import-Module HelpersCommon
Describe 'Online help tests for PowerShell Cmdlets' -Tags "Feature" {
# The csv files (V2Cmdlets.csv and V3Cmdlets.csv) contain a list of cmdlets and expected HelpURIs.
@@ -61,3 +63,18 @@ Describe 'Get-Help -Online is not supported on Nano Server and IoT' -Tags "CI" {
{ Get-Help Get-Help -Online } | Should -Throw -ErrorId "InvalidOperation,Microsoft.PowerShell.Commands.GetHelpCommand"
}
}
Describe 'Get-Help should throw on network paths' -Tags "CI" {
BeforeAll {
$script:skipTest = -not $IsWindows
}
It "Get-Help should throw not on <command>" -Skip:$skipTest -TestCases (Get-HelpNetworkTestCases -PositiveCases) {
param(
$Command,
$ExpectedError
)
{ Get-Help -Name $Command } | Should -Not -Throw
}
}