Skip to content

Commit

Permalink
Emit encoded token as secret.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchdenny authored and azure-sdk committed Apr 20, 2021
1 parent 4b17a90 commit 8cb1f1c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions eng/common/scripts/Add-RetentionLease.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ $unencodedAuthToken = "nobody:$AccessToken"
$unencodedAuthTokenBytes = [System.Text.Encoding]::UTF8.GetBytes($unencodedAuthToken)
$encodedAuthToken = [System.Convert]::ToBase64String($unencodedAuthTokenBytes)

# We are doing this here so that there is zero chance that this token is emitted in Azure Pipelines
# build logs. Azure Pipelines will see this text and register the secret as a value it should *** out
# before being transmitted to the server (and shown in logs). It means if the value is accidentally
# leaked anywhere else that it won't be visible. The downside is that when the script is executed
# on a local development box, it will be visible.
Write-Host "##vso[task.setvariable variable=_throwawayencodedaccesstoken;issecret=true;]$($encodedAuthToken)"

. (Join-Path $PSScriptRoot common.ps1)

LogDebug "Checking for existing leases on run: $RunId"
Expand Down

0 comments on commit 8cb1f1c

Please sign in to comment.