Skip to content

Commit 16397d8

Browse files
authored
Validation cleanup (#1179)
* Remove outdated tests * Remove unnecessary function calls * Bump versions
1 parent 5a82359 commit 16397d8

File tree

31 files changed

+8
-394
lines changed

31 files changed

+8
-394
lines changed

Extensions/IISWebAppDeploy/Src/Tasks/IISWebAppDeploy/IISWebAppDeployV1/MsDeployOnTargetMachines.ps1

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,6 @@ function Get-MsDeployLocation
5959
return (Join-Path $path msDeploy.exe)
6060
}
6161

62-
function Get-ValidatedAdditionalArguments([string]$msDeployCmdArgs, [string]$additionalArguments)
63-
{
64-
# Remove content within double quotes
65-
$noQuotesContent = $additionalArguments -replace '"[^"]*"', ''
66-
67-
# Check if forbidden characters exist in the remaining content
68-
if ($noQuotesContent -match "[&;|]") {
69-
$additionalArgumentsValidationErrorMessage = "Additional arguments can't include separator characters '&', ';' and '|'. Please verify input. To learn more about argument validation, please check https://aka.ms/azdo-task-argument-validation"
70-
throw $additionalArgumentsValidationErrorMessage
71-
}
72-
73-
if(-not [string]::IsNullOrWhiteSpace($additionalArguments))
74-
{
75-
return [string]::Format('{0} {1}', $msDeployCmdArgs, $additionalArguments)
76-
}
77-
78-
return $msDeployCmdArgs
79-
}
80-
8162
function Get-MsDeployCmdArgs
8263
{
8364
param(
@@ -159,8 +140,6 @@ function Get-MsDeployCmdArgs
159140
$msDeployCmdArgs = [string]::Format('{0} -skip:Directory="\\App_Data"', $msDeployCmdArgs)
160141
}
161142

162-
$msDeployCmdArgs = Get-ValidatedAdditionalArguments $msDeployCmdArgs $additionalArguments
163-
164143
$msDeployCmdArgs = [string]::Format('{0} -retryAttempts:3 -retryInterval:3000', $msDeployCmdArgs)
165144
Write-Verbose "MsDeploy command line arguments: $msDeployCmdArgs"
166145
return $msDeployCmdArgs

Extensions/IISWebAppDeploy/Src/Tasks/IISWebAppDeploy/IISWebAppDeployV1/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"version": {
88
"Major": 1,
99
"Minor": 5,
10-
"Patch": 1
10+
"Patch": 2
1111
},
1212
"demands": [
1313
],

Extensions/IISWebAppDeploy/Src/Tasks/IISWebAppDeploy/IISWebAppDeployV2/MsDeployOnTargetMachines.ps1

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,6 @@ function Get-MsDeployLocation
5959
return (Join-Path $path msDeploy.exe)
6060
}
6161

62-
function Get-ValidatedAdditionalArguments([string]$msDeployCmdArgs, [string]$additionalArguments)
63-
{
64-
# Remove content within double quotes
65-
$noQuotesContent = $additionalArguments -replace '"[^"]*"', ''
66-
67-
# Check if forbidden characters exist in the remaining content
68-
if ($noQuotesContent -match "[&;|]") {
69-
$additionalArgumentsValidationErrorMessage = "Additional arguments can't include separator characters '&', ';' and '|'. Please verify input. To learn more about argument validation, please check https://aka.ms/azdo-task-argument-validation"
70-
throw $additionalArgumentsValidationErrorMessage
71-
}
72-
73-
if(-not [string]::IsNullOrWhiteSpace($additionalArguments))
74-
{
75-
return [string]::Format('{0} {1}', $msDeployCmdArgs, $additionalArguments)
76-
}
77-
78-
return $msDeployCmdArgs
79-
}
80-
8162
function Get-MsDeployCmdArgs
8263
{
8364
param(
@@ -159,8 +140,6 @@ function Get-MsDeployCmdArgs
159140
$msDeployCmdArgs = [string]::Format('{0} -skip:Directory="\\App_Data"', $msDeployCmdArgs)
160141
}
161142

162-
$msDeployCmdArgs = Get-ValidatedAdditionalArguments $msDeployCmdArgs $additionalArguments
163-
164143
$msDeployCmdArgs = [string]::Format('{0} -retryAttempts:3 -retryInterval:3000', $msDeployCmdArgs)
165144
Write-Verbose "MsDeploy command line arguments: $msDeployCmdArgs"
166145
return $msDeployCmdArgs

Extensions/IISWebAppDeploy/Src/Tasks/IISWebAppDeploy/IISWebAppDeployV2/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 2,
1818
"Minor": 1,
19-
"Patch": 1
19+
"Patch": 2
2020
},
2121
"demands": [
2222
],

Extensions/IISWebAppDeploy/Src/Tasks/IISWebAppMgmt/IISWebAppMgmtV1/ManageIISWebApp.ps1

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,6 @@ function Escape-SpecialChars
8383
return $str.Replace('`', '``').Replace('"', '`"').Replace('$', '`$')
8484
}
8585

86-
function Validate-AdditionalArguments([string]$additionalArguments)
87-
{
88-
# Remove content within double quotes
89-
$noQuotesContent = $additionalArguments -replace '"[^"]*"', ''
90-
91-
# Check if forbidden characters exist in the remaining content
92-
if ($noQuotesContent -match "[&;|]") {
93-
$additionalArgumentsValidationErrorMessage = "Additional arguments can't include separator characters '&', ';' and '|'. Please verify input. To learn more about argument validation, please check https://aka.ms/azdo-task-argument-validation"
94-
throw $additionalArgumentsValidationErrorMessage
95-
}
96-
}
97-
9886
function Get-ScriptToRun
9987
{
10088
param (
@@ -227,7 +215,6 @@ function Main
227215
Trim-Inputs -siteName ([ref]$websiteName) -physicalPath ([ref]$websitePhysicalPath) -poolName ([ref]$appPoolName) -websitePathAuthuser ([ref]$websiteAuthUserName) -appPoolUser ([ref]$appPoolUsername) -adminUser ([ref]$adminUserName) -sslCertThumbPrint ([ref]$sslCertThumbPrint)
228216

229217
Validate-Inputs -createWebsite $createWebsite -websiteName $websiteName -createAppPool $createAppPool -appPoolName $appPoolName -addBinding $addBinding -protocol $protocol -sslCertThumbPrint $sslCertThumbPrint
230-
Validate-AdditionalArguments $appCmdCommands
231218

232219
$script = Get-ScriptToRun -createWebsite $createWebsite -websiteName $websiteName -websitePhysicalPath $websitePhysicalPath -websitePhysicalPathAuth $websitePhysicalPathAuth -websiteAuthUserName $websiteAuthUserName -websiteAuthUserPassword $websiteAuthUserPassword -addBinding $addBinding -protocol $protocol -ipAddress $ipAddress -port $port -hostName $hostName -serverNameIndication $serverNameIndication -sslCertThumbPrint $sslCertThumbPrint -createAppPool $createAppPool -appPoolName $appPoolName -pipeLineMode $pipeLineMode -dotNetVersion $dotNetVersion -appPoolIdentity $appPoolIdentity -appPoolUsername $appPoolUsername -appPoolPassword $appPoolPassword -appCmdCommands $appCmdCommands
233220
Run-RemoteDeployment -machinesList $machinesList -scriptToRun $script -adminUserName $adminUserName -adminPassword $adminPassword -winrmProtocol $winrmProtocol -testCertificate $testCertificate -deployInParallel $deployInParallel -websiteName $websiteName

Extensions/IISWebAppDeploy/Src/Tasks/IISWebAppMgmt/IISWebAppMgmtV1/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 1,
1818
"Minor": 4,
19-
"Patch": 1
19+
"Patch": 2
2020
},
2121
"demands": [
2222
],

Extensions/IISWebAppDeploy/Src/Tasks/IISWebAppMgmt/IISWebAppMgmtV2/Main.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ try {
7979
$appPoolPassword = Escape-SpecialChars -str $appPoolPassword
8080
$websiteAuthUserPassword = Escape-SpecialChars -str $websiteAuthUserPassword
8181
$appCmdCommands = Escape-SpecialChars -str $appCmdCommands
82-
Validate-AdditionalArguments $appCmdCommands
8382

8483
$invokeMain = ""
8584
$invokeMainLog = ""

Extensions/IISWebAppDeploy/Src/Tasks/IISWebAppMgmt/IISWebAppMgmtV2/Utility.ps1

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -321,18 +321,6 @@ function Validate-Bindings {
321321
return $bindingsObj.bindings
322322
}
323323

324-
function Validate-AdditionalArguments([string]$additionalArguments)
325-
{
326-
# Remove content within double quotes
327-
$noQuotesContent = $additionalArguments -replace '"[^"]*"', ''
328-
329-
# Check if forbidden characters exist in the remaining content
330-
if ($noQuotesContent -match "[&;|]") {
331-
$additionalArgumentsValidationErrorMessage = "Additional arguments can't include separator characters '&', ';' and '|'. Please verify input. To learn more about argument validation, please check https://aka.ms/azdo-task-argument-validation"
332-
throw $additionalArgumentsValidationErrorMessage
333-
}
334-
}
335-
336324
function Escape-SpecialChars
337325
{
338326
param(

Extensions/IISWebAppDeploy/Src/Tasks/IISWebAppMgmt/IISWebAppMgmtV2/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 2,
1818
"Minor": 2,
19-
"Patch": 1
19+
"Patch": 2
2020
},
2121
"demands": [
2222
],

Extensions/IISWebAppDeploy/Src/Tasks/IISWebAppMgmt/IISWebAppMgmtV3/Main.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ try {
8484
$appPoolPassword = Escape-SpecialChars -str $appPoolPassword
8585
$websiteAuthUserPassword = Escape-SpecialChars -str $websiteAuthUserPassword
8686
$appCmdCommands = Escape-SpecialChars -str $appCmdCommands
87-
Validate-AdditionalArguments $appCmdCommands
8887

8988
$invokeMain = ""
9089
$invokeMainLog = ""

0 commit comments

Comments
 (0)