From 78822f6121d69dc9a1fde5212c2af91e9102887e Mon Sep 17 00:00:00 2001 From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Wed, 9 Apr 2025 14:05:26 -0700 Subject: [PATCH] Fix: Adds a warning to the user if their secret file includes a trailing newline (#9601) --- docker/rootfs/etc/s6-overlay/s6-rc.d/init-env-file/run | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/rootfs/etc/s6-overlay/s6-rc.d/init-env-file/run b/docker/rootfs/etc/s6-overlay/s6-rc.d/init-env-file/run index 08b7635f8..9b3e2964f 100755 --- a/docker/rootfs/etc/s6-overlay/s6-rc.d/init-env-file/run +++ b/docker/rootfs/etc/s6-overlay/s6-rc.d/init-env-file/run @@ -17,6 +17,9 @@ if find /run/s6/container_environment/*"_FILE" -maxdepth 1 > /dev/null 2>&1; the if [[ -f ${SECRETFILE} ]]; then # Trim off trailing _FILE FILESTRIP=${FILENAME//_FILE/} + if [[ $(tail -n1 "${SECRETFILE}" | wc -l) != 0 ]]; then + echo "${log_prefix} Your secret: ${FILENAME##*/} contains a trailing newline and may not work as expected" + fi # Set environment variable cat "${SECRETFILE}" > "${FILESTRIP}" echo "${log_prefix} ${FILESTRIP##*/} set from ${FILENAME##*/}"