Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
898b2cd
AzurePowerShellV2: sanitize ScriptArguments via Common/Sanitizer
wawanawna1984 May 11, 2026
08eee43
AzurePowerShellV3: sanitize ScriptArguments via Common/Sanitizer
wawanawna1984 May 11, 2026
ee12bf3
AzurePowerShellV4: sanitize ScriptArguments via Common/Sanitizer
wawanawna1984 May 11, 2026
4ff6fd0
AzurePowerShellV5: sanitize ScriptArguments via Common/Sanitizer
wawanawna1984 May 11, 2026
73fc7ae
ServiceFabricPowerShellV1: sanitize ScriptArguments via Common/Sanitizer
wawanawna1984 May 11, 2026
c1f3f85
Common/Sanitizer: add Invoke-ScriptArgumentSanitization helper
wawanawna1984 May 11, 2026
c62ddd4
AzurePowerShellV2: use shared Invoke-ScriptArgumentSanitization + per…
wawanawna1984 May 11, 2026
b1d028e
AzurePowerShellV3: use shared Invoke-ScriptArgumentSanitization + per…
wawanawna1984 May 11, 2026
82208cd
AzurePowerShellV4: use shared Invoke-ScriptArgumentSanitization + per…
wawanawna1984 May 11, 2026
5657b15
AzurePowerShellV5: use shared Invoke-ScriptArgumentSanitization + per…
wawanawna1984 May 11, 2026
b12e413
ServiceFabricPowerShellV1: use shared Invoke-ScriptArgumentSanitizati…
wawanawna1984 May 11, 2026
761b762
Common/Sanitizer: add L0 tests for Invoke-ScriptArgumentSanitization …
wawanawna1984 May 12, 2026
7b6762c
Common/Sanitizer: dispatcher fails closed instead of message-comparin…
wawanawna1984 May 12, 2026
fe60811
Fix stray comma on its own line in V5 resjson files (PR review feedback)
wawanawna1984 May 13, 2026
75bacf8
Bump versions of 12 Common/Sanitizer-dependent tasks (CI policy)
wawanawna1984 May 13, 2026
9af9b96
Roll forward minor to sprint 274 for 4 stale-minor tasks (CI downgrad…
wawanawna1984 May 13, 2026
3559d85
Add ScriptArgsSanitized to task.json messages for all 5 sanitizer tasks
wawanawna1984 May 13, 2026
475156d
Sanitizer dispatcher: throw module's own PS_ScriptArgsSanitized key
wawanawna1984 May 13, 2026
4e43912
Remove dead ScriptArgsSanitized loc entries from the 5 sanitizer-adop…
wawanawna1984 May 13, 2026
d4ae229
Sanitizer dispatcher: don't say 'Get-VstsLocString' in a comment (L0 …
wawanawna1984 May 13, 2026
ace8751
Regenerate _generated/AzurePowerShellV{4,5}{,_Node24} loc files after…
wawanawna1984 May 13, 2026
24d91ad
Clean stale ScriptArgsSanitized from V4/V5 source task.loc.json + en-…
wawanawna1984 May 13, 2026
1615be2
Mock Invoke-ScriptArgumentSanitization in per-task L0 tests
wawanawna1984 May 13, 2026
1b8da2d
Merge branch 'master' into users/wawanawna/msrc-115118-azurepowershel…
wawanawna May 18, 2026
60c771c
Roll forward all PR-touched task versions to sprint 275
wawanawna May 18, 2026
48c7775
Bump ServiceFabricPowerShellV1 SDK to 0.21.0 + fix L0 test PR ref
wawanawna May 18, 2026
ab92be5
Merge branch 'master' into users/wawanawna/msrc-115118-azurepowershel…
wawanawna May 19, 2026
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
2 changes: 1 addition & 1 deletion Tasks/AzureFileCopyV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 274,
"Minor": 275,
"Patch": 0
},
"demands": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzureFileCopyV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 274,
"Minor": 275,
"Patch": 0
},
"demands": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzureFileCopyV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 274,
"Minor": 275,
"Patch": 0
},
"demands": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzureFileCopyV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 274,
"Minor": 275,
"Patch": 0
},
"demands": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzureFileCopyV3/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 3,
"Minor": 274,
"Minor": 275,
"Patch": 0
},
"demands": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzureFileCopyV3/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 3,
"Minor": 274,
"Minor": 275,
"Patch": 0
},
"demands": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzureFileCopyV4/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 4,
"Minor": 274,
"Minor": 275,
"Patch": 0
},
"demands": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzureFileCopyV4/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 4,
"Minor": 274,
"Minor": 275,
"Patch": 0
},
"demands": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzureFileCopyV5/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 5,
"Minor": 274,
"Minor": 275,
"Patch": 0
},
"demands": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzureFileCopyV5/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 5,
"Minor": 274,
"Minor": 275,
"Patch": 0
},
"demands": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzureFileCopyV6/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 6,
"Minor": 274,
"Minor": 275,
"Patch": 2
},
"demands": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzureFileCopyV6/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 6,
"Minor": 274,
"Minor": 275,
"Patch": 2
},
"demands": [
Expand Down
13 changes: 13 additions & 0 deletions Tasks/AzurePowerShellV2/AzurePowerShell.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Trace-VstsEnteringInvocation $MyInvocation
Import-VstsLocStrings "$PSScriptRoot\Task.json"

Import-Module $PSScriptRoot\ps_modules\Sanitizer

# Get inputs.
$scriptType = Get-VstsInput -Name ScriptType -Require
$scriptPath = Get-VstsInput -Name ScriptPath
Expand All @@ -21,6 +23,17 @@ if ($scriptArguments -match '[\r\n]') {
throw (Get-VstsLocString -Key InvalidScriptArguments0 -ArgumentList $scriptArguments)
}

# Sanitize script arguments to prevent PowerShell command injection.
# No-op unless BOTH the org-level "Enable shell tasks arguments validation"
# toggle and the per-task pipeline feature flag are enabled.
# See https://aka.ms/ado/75787 and Tasks/Common/Sanitizer/Invoke-ScriptArgumentSanitization.ps1.
if ($scriptType -ne "InlineScript") {
Invoke-ScriptArgumentSanitization `
-InputArgs $scriptArguments `
-TaskName 'AzurePowerShellV2' `
-PipelineFeatureFlagName 'EnableAzurePowerShellArgumentsSanitization'
}

# string constants
$otherVersion = "OtherVersion"
$latestVersion = "LatestVersion"
Expand Down
1 change: 1 addition & 0 deletions Tasks/AzurePowerShellV2/Tests/DoesNotUnravelOutput.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization
$targetAzurePs = "4.1.0"
Register-Mock Get-VstsInput { "FilePath" } -- -Name ScriptType -Require
Register-Mock Get-VstsInput { "$PSScriptRoot/DoesNotUnravelOutput_TargetScript.ps1" } -- -Name ScriptPath
Expand Down
1 change: 1 addition & 0 deletions Tasks/AzurePowerShellV2/Tests/PerformsBasicFlow.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization
$targetAzurePs = "4.1.0"
Register-Mock Get-VstsInput { "FilePath" } -- -Name ScriptType -Require
Register-Mock Get-VstsInput { "$PSScriptRoot/PerformsBasicFlow_TargetScript.ps1" } -- -Name ScriptPath
Expand Down
1 change: 1 addition & 0 deletions Tasks/AzurePowerShellV2/Tests/RedirectsErrors.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization
$targetAzurePs = "4.1.0"
Register-Mock Get-VstsInput { "FilePath" } -- -Name ScriptType -Require
Register-Mock Get-VstsInput { "$PSScriptRoot/RedirectsErrors_TargetScript.ps1" } -- -Name ScriptPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization

# Arrange the task inputs.
$targetAzurePs = "4.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization

Register-Mock Get-VstsInput { "FilePath" } -- -Name ScriptType -Require
Register-Mock Get-VstsInput { "foobar.ps1" } -- -Name ScriptPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization
foreach ($arguments in @( "script`rarguments", "script`narguments" )) {
Unregister-Mock Get-VstsInput
Register-Mock Get-VstsInput { $arguments } -- -Name ScriptArguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization
foreach ($path in @( "script`rpath", "script`npath" )) {
Unregister-Mock Get-VstsInput
Register-Mock Get-VstsInput { "FilePath" } -- -Name ScriptType -Require
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization
Unregister-Mock Get-VstsInput
$targetAzurePs = "4.1.0"
Register-Mock Get-VstsInput { "InlineScript" } -- -Name ScriptType -Require
Expand Down
4 changes: 4 additions & 0 deletions Tasks/AzurePowerShellV2/make.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
{
"module": "../Common/TlsHelper_",
"type": "ps"
},
{
"module": "../Common/Sanitizer",
"type": "ps"
}
],
"externals": {
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzurePowerShellV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 274,
"Minor": 275,
"Patch": 0
},
"demands": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzurePowerShellV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 274,
"Minor": 275,
"Patch": 0
},
"demands": [
Expand Down
13 changes: 13 additions & 0 deletions Tasks/AzurePowerShellV3/AzurePowerShell.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Trace-VstsEnteringInvocation $MyInvocation
Import-VstsLocStrings "$PSScriptRoot\Task.json"

Import-Module $PSScriptRoot\ps_modules\Sanitizer

# Get inputs.
$scriptType = Get-VstsInput -Name ScriptType -Require
$scriptPath = Get-VstsInput -Name ScriptPath
Expand All @@ -25,6 +27,17 @@ if ($scriptArguments -match '[\r\n]') {
throw (Get-VstsLocString -Key InvalidScriptArguments0 -ArgumentList $scriptArguments)
}

# Sanitize script arguments to prevent PowerShell command injection.
# No-op unless BOTH the org-level "Enable shell tasks arguments validation"
# toggle and the per-task pipeline feature flag are enabled.
# See https://aka.ms/ado/75787 and Tasks/Common/Sanitizer/Invoke-ScriptArgumentSanitization.ps1.
if ($scriptType -ne "InlineScript") {
Invoke-ScriptArgumentSanitization `
-InputArgs $scriptArguments `
-TaskName 'AzurePowerShellV3' `
-PipelineFeatureFlagName 'EnableAzurePowerShellArgumentsSanitization'
}

# string constants
$otherVersion = "OtherVersion"
$latestVersion = "LatestVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization
$targetAzurePs = "4.1.0"
Register-Mock Get-VstsInput { "FilePath" } -- -Name ScriptType -Require
Register-Mock Get-VstsInput { "$PSScriptRoot/RedirectsErrors_TargetScript.ps1" } -- -Name ScriptPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization
$targetAzurePs = "4.1.0"
Register-Mock Get-VstsInput { "FilePath" } -- -Name ScriptType -Require
Register-Mock Get-VstsInput { "$PSScriptRoot/NativeCommandError_TargetScript.ps1" } -- -Name ScriptPath
Expand Down
1 change: 1 addition & 0 deletions Tasks/AzurePowerShellV3/Tests/DoesNotUnravelOutput.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization
$targetAzurePs = "4.1.0"
Register-Mock Get-VstsInput { "FilePath" } -- -Name ScriptType -Require
Register-Mock Get-VstsInput { "$PSScriptRoot/DoesNotUnravelOutput_TargetScript.ps1" } -- -Name ScriptPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization
$targetAzurePs = "4.1.0"
Register-Mock Get-VstsInput { "FilePath" } -- -Name ScriptType -Require
Register-Mock Get-VstsInput { "$PSScriptRoot/NativeCommandError_TargetScript.ps1" } -- -Name ScriptPath
Expand Down
1 change: 1 addition & 0 deletions Tasks/AzurePowerShellV3/Tests/PerformsBasicFlow.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization
$targetAzurePs = "4.1.0"
Register-Mock Get-VstsInput { "FilePath" } -- -Name ScriptType -Require
Register-Mock Get-VstsInput { "$PSScriptRoot/PerformsBasicFlow_TargetScript.ps1" } -- -Name ScriptPath
Expand Down
1 change: 1 addition & 0 deletions Tasks/AzurePowerShellV3/Tests/RedirectsErrors.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization
$targetAzurePs = "4.1.0"
Register-Mock Get-VstsInput { "FilePath" } -- -Name ScriptType -Require
Register-Mock Get-VstsInput { "$PSScriptRoot/RedirectsErrors_TargetScript.ps1" } -- -Name ScriptPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization

# Arrange the task inputs.
$targetAzurePs = "4.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization

Register-Mock Get-VstsInput { "FilePath" } -- -Name ScriptType -Require
Register-Mock Get-VstsInput { "foobar.ps1" } -- -Name ScriptPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization
foreach ($arguments in @( "script`rarguments", "script`narguments" )) {
Unregister-Mock Get-VstsInput
Register-Mock Get-VstsInput { $arguments } -- -Name ScriptArguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization
foreach ($path in @( "script`rpath", "script`npath" )) {
Unregister-Mock Get-VstsInput
Register-Mock Get-VstsInput { "FilePath" } -- -Name ScriptType -Require
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
Register-Mock Invoke-ScriptArgumentSanitization
Unregister-Mock Get-VstsInput
$targetAzurePs = "4.1.0"
if([string]::IsNullOrEmpty($env:Agent_TempDirectory)) {
Expand Down
4 changes: 4 additions & 0 deletions Tasks/AzurePowerShellV3/make.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
{
"module": "../Common/TlsHelper_",
"type": "ps"
},
{
"module": "../Common/Sanitizer",
"type": "ps"
}
],
"externals": {
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzurePowerShellV3/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 3,
"Minor": 274,
"Minor": 275,
"Patch": 0
},
"releaseNotes": "Added support for Fail on standard error and ErrorActionPreference",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzurePowerShellV3/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 3,
"Minor": 274,
"Minor": 275,
"Patch": 0
},
"releaseNotes": "ms-resource:loc.releaseNotes",
Expand Down
13 changes: 13 additions & 0 deletions Tasks/AzurePowerShellV4/AzurePowerShell.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Trace-VstsEnteringInvocation $MyInvocation
Import-VstsLocStrings "$PSScriptRoot\Task.json"

Import-Module $PSScriptRoot\ps_modules\Sanitizer

# Get inputs.
$scriptType = Get-VstsInput -Name ScriptType -Require
$scriptPath = Get-VstsInput -Name ScriptPath
Expand Down Expand Up @@ -28,6 +30,17 @@ if ($scriptArguments -match '[\r\n]') {
throw (Get-VstsLocString -Key InvalidScriptArguments0 -ArgumentList $scriptArguments)
}

# Sanitize script arguments to prevent PowerShell command injection.
# No-op unless BOTH the org-level "Enable shell tasks arguments validation"
# toggle and the per-task pipeline feature flag are enabled.
# See https://aka.ms/ado/75787 and Tasks/Common/Sanitizer/Invoke-ScriptArgumentSanitization.ps1.
if ($scriptType -ne "InlineScript") {
Invoke-ScriptArgumentSanitization `
-InputArgs $scriptArguments `
-TaskName 'AzurePowerShellV4' `
-PipelineFeatureFlagName 'EnableAzurePowerShellArgumentsSanitization'
}

# string constants
$otherVersion = "OtherVersion"
$latestVersion = "LatestVersion"
Expand Down
Loading