[buildbot] buildworker: start: fix leaking BUILDWORKER_TLS env variable

LEDE Commits lede-commits at lists.infradead.org
Fri Oct 11 11:04:34 PDT 2024


ynezz pushed a commit to buildbot.git, branch main:
https://git.openwrt.org/213f6de2afc40e27bf6b773b72db0d6104ffd7fb

commit 213f6de2afc40e27bf6b773b72db0d6104ffd7fb
Author: Petr Štetiar <ynezz at true.cz>
AuthorDate: Sat Sep 28 17:12:55 2024 +0000

    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 <ynezz at true.cz>
---
 docker/buildworker/files/start.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

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




More information about the lede-commits mailing list