Skip to content
Merged
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions eng/scripts/Invoke-GenerateAndBuildV2.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ $repoHttpsUrl = $inputJson.repoHttpsUrl
$downloadUrlPrefix = $inputJson.installInstructionInput.downloadUrlPrefix
$autorestConfig = $inputJson.autorestConfig
$relatedTypeSpecProjectFolder = $inputJson.relatedTypeSpecProjectFolder
$apiVersion = $inputJson.apiVersion
$sdkReleaseType = $inputJson.sdkReleaseType

if ($sdkReleaseType) {
Write-Warning "sdkReleaseType is not supported by .NET and user will need to update the package version manually"
}

$autorestConfigYaml = ""
if ($autorestConfig) {
Expand Down Expand Up @@ -150,6 +156,14 @@ if ($relatedTypeSpecProjectFolder) {
if ($swaggerDir) {
$tspclientCommand += " --local-spec-repo $typespecFolder"
}
if ($apiVersion) {
# Validate apiVersion format to prevent command injection - allow alphanumeric, dots, and dashes
if ($apiVersion -match '^[a-zA-Z0-9.-]+$') {
$tspclientCommand += " --emitter-options `"api-version=$apiVersion`""
} else {
Write-Warning "apiVersion '$apiVersion' contains invalid characters and will be skipped. Only alphanumeric characters, dots, and dashes are allowed."
}
}
Write-Host $tspclientCommand
Invoke-Expression $tspclientCommand

Expand Down