From: Petr Štetiar Date: Sat, 28 Sep 2024 17:12:55 +0000 (+0000) Subject: buildworker: start: fix leaking BUILDWORKER_TLS env variable X-Git-Tag: v19~4 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=213f6de2afc40e27bf6b773b72db0d6104ffd7fb;p=buildbot.git buildworker: start: fix leaking BUILDWORKER_TLS env variable I've noticed leakage of BUILDWORKER_TLS environment variable in build logs, so lets fix it in a generic way via new `cleanup_buildworker_env_variables()` by using Bash's parameter expansion and unset all environment variables starting with BUILDWORKER_ prefix. Signed-off-by: Petr Štetiar --- diff --git a/docker/buildworker/files/start.sh b/docker/buildworker/files/start.sh index 1034407..5e0147a 100644 --- a/docker/buildworker/files/start.sh +++ b/docker/buildworker/files/start.sh @@ -1,5 +1,11 @@ #!/usr/bin/env bash +cleanup_buildworker_env_variables() { + for var in "${!BUILDWORKER_@}"; do + unset "$var" + done +} + [ -n "$BUILDWORKER_NAME" ] || { echo "Please supply a name via --env BUILDWORKER_NAME=XXX" >&2 exit 1 @@ -24,7 +30,6 @@ rm -f /builder/buildbot.tac echo "$BUILDWORKER_ADMIN" > /builder/info/admin echo "$BUILDWORKER_DESCRIPTION" > /builder/info/host -unset BUILDWORKER_ADMIN BUILDWORKER_DESCRIPTION BUILDWORKER_MASTER BUILDWORKER_NAME BUILDWORKER_PASSWORD - +cleanup_buildworker_env_variables rm -f /builder/twistd.pid exec /opt/venv/bin/buildbot-worker start --nodaemon /builder