From d074092abd3062d68e39f09aa449962c9dc78635 Mon Sep 17 00:00:00 2001 From: Nasim Sadat Date: Sat, 24 Oct 2026 00:37:38 +0200 Subject: [PATCH] secrets-init: store a piped secret without a final newline `pbpaste | ssh petrolyst /root/secrets-init.sh keycloak-secret` sends the secret without a trailing newline. read then sets the value but returns non-zero, and set -e ended the script silently before storing it. Co-Authored-By: Claude Opus 5.5 --- host/secrets-init.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/host/secrets-init.sh b/host/secrets-init.sh index c11ce53..bc2743c 100755 --- a/host/secrets-init.sh +++ b/host/secrets-init.sh @@ -44,7 +44,9 @@ case ${1:-all} in IFS= read -rs value echo >&2 else - IFS= read -r value + # `pbpaste | ...` sends no final newline: read then still sets value but + # fails, which set -e would turn into a silent exit. + IFS= read -r value || true fi value=$(printf '%s' "$value" | tr -d '[:space:]') [ -n "$value" ] || die "empty secret"