Skip to content

Commit

Permalink
buildworker: start: fix leaking BUILDWORKER_TLS env variable
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ynezz committed Sep 28, 2024
1 parent 75930d3 commit 213f6de
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docker/buildworker/files/start.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

0 comments on commit 213f6de

Please sign in to comment.