Skip to content

Commit 7849acf

Browse files
Copilotigaw
andcommitted
ci: use temp file for sftp batch commands instead of stdin pipe
sshpass works by forking the child with a PTY so it can intercept SSH's password prompt. Piping commands into sshpass via | replaces its stdin, breaking the PTY-based password injection. Instead, write the sftp batch commands to a mktemp file and pass it with -b "$SFTP_BATCH". This leaves sshpass's stdin untouched so the PTY works correctly, while sftp reads its commands from the temp file. Co-authored-by: igaw <[email protected]>
1 parent 40ff69c commit 7849acf

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

.github/workflows/upload.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,14 @@ jobs:
8282
echo " PreferredAuthentications password"
8383
} > ~/.ssh/config
8484
chmod 600 ~/.ssh/config
85-
(
86-
echo "cd /upload"
87-
for f in upload/nvme-cli-*; do
88-
[ -f "$f" ] || continue
89-
echo "put $f $(basename "$f")"
90-
done
91-
) | sshpass -e sftp -b - "${SFTP_USERNAME}@${SFTP_SERVER}"
85+
SFTP_BATCH=$(mktemp)
86+
echo "cd /upload" > "$SFTP_BATCH"
87+
for f in upload/nvme-cli-*; do
88+
[ -f "$f" ] || continue
89+
echo "put $f $(basename "$f")" >> "$SFTP_BATCH"
90+
done
91+
sshpass -e sftp -b "$SFTP_BATCH" "${SFTP_USERNAME}@${SFTP_SERVER}"
92+
rm -f "$SFTP_BATCH"
9293
9394
upload-release-assets:
9495
name: upload GitHub release assets

0 commit comments

Comments
 (0)