Skip to content

Commit e8e4d55

Browse files
committed
Pass LabAuth secret via env var to avoid bash command substitution on undefined variable
1 parent 7f60411 commit e8e4d55

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.Pipelines/template-pipeline-stages.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,17 @@ stages:
152152

153153
- bash: |
154154
set -euo pipefail
155+
if [ -z "${LAB_AUTH_B64:-}" ]; then
156+
echo "##vso[task.logissue type=error]LabAuth secret is empty or was not injected — Key Vault retrieval may have failed."
157+
exit 1
158+
fi
155159
CERT_PATH="$(Agent.TempDirectory)/lab-auth.pfx"
156-
printf '%s' "$(LabAuth)" | base64 -d > "$CERT_PATH"
160+
printf '%s' "$LAB_AUTH_B64" | base64 -d > "$CERT_PATH"
157161
echo "##vso[task.setvariable variable=LAB_APP_CLIENT_CERT_PFX_PATH]$CERT_PATH"
158162
echo "Lab cert written to: $CERT_PATH ($(wc -c < "$CERT_PATH") bytes)"
159163
displayName: 'Write lab certificate to disk'
164+
env:
165+
LAB_AUTH_B64: $(LabAuth)
160166
161167
- task: UsePythonVersion@0
162168
inputs:

0 commit comments

Comments
 (0)