Skip to content

Commit 8ac79f7

Browse files
committed
improve ssh key handling in e2e workflow
- use trap to ensure temp key file cleanup on exit - use printf instead of echo for safer secret handling Signed-off-by: luojiyin <[email protected]>
1 parent c748619 commit 8ac79f7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

.github/workflows/e2e.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ jobs:
9393
E2E_SSH_HOST: ${{ steps.holodeck_public_dns_name.outputs.result }}
9494
run: |
9595
e2e_ssh_key=$(mktemp)
96-
echo "${{ secrets.AWS_SSH_KEY }}" > "$e2e_ssh_key"
96+
trap 'rm -f "$e2e_ssh_key"' EXIT
97+
printf '%s' "${{ secrets.AWS_SSH_KEY }}" > "$e2e_ssh_key"
9798
chmod 600 "$e2e_ssh_key"
9899
export E2E_SSH_KEY="$e2e_ssh_key"
99100

0 commit comments

Comments
 (0)