Skip to content

Commit

Permalink
Merged PR 41167: Temporarily work around '/' in dSAS
Browse files Browse the repository at this point in the history
Temporarily work around '/' in dSAS
When dSAS tokens contain a forward /, helix will incorrectly name the file target for a correlation payload, and then fail to unpack it.

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix to address an issue with SAS tokens containing '/' causing incorrect downloads.

#### PR Summary
This pull request implements a workaround for a Helix issue where SAS tokens with '/' result in incorrect downloads of correlation payloads.
- `eng/common/templates-official/steps/get-delegation-sas.yml`: Added a loop to regenerate SAS tokens until one without '/' is obtained.
  • Loading branch information
mmitche committed Jul 17, 2024
1 parent e7f0165 commit 90d0799
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions eng/common/templates-official/steps/get-delegation-sas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@ steps:
# Calculate the expiration of the SAS token and convert to UTC
$expiry = (Get-Date).AddHours(${{ parameters.expiryInHours }}).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
$sas = az storage container generate-sas --account-name ${{ parameters.storageAccount }} --name ${{ parameters.container }} --permissions ${{ parameters.permissions }} --expiry $expiry --auth-mode login --as-user -o tsv
# Temporarily work around a helix issue where SAS tokens with / in them will cause incorrect downloads
# of correlation payloads.
$sas = ""
do {
$sas = az storage container generate-sas --account-name ${{ parameters.storageAccount }} --name ${{ parameters.container }} --permissions ${{ parameters.permissions }} --expiry $expiry --auth-mode login --as-user -o tsv
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to generate SAS token."
exit 1
}
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to generate SAS token."
exit 1
}
} while($sas.IndexOf('/') -ne -1)
if ('${{ parameters.base64Encode }}' -eq 'true') {
$sas = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($sas))
Expand Down

0 comments on commit 90d0799

Please sign in to comment.