Skip to content

Commit c43fbc3

Browse files
committed
Suppress RHSM credential exposure in build logs
Remove -x (xtrace) from the global set flags and explicitly suppress xtrace around the subscription-manager register call to prevent plaintext RHSM_PASSWORD from being expanded to stderr and captured in the build log. Quote all variable expansions to prevent word splitting. Jira: OSPRH-32782
1 parent a66cddc commit c43fbc3

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

bootc/rhsm.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
set -eux
3+
set -eu
44

55
# Edit RHSM_ values for the subscription configuration
66
RHSM_USER=unset
@@ -13,8 +13,11 @@ RHSM_REPOS=${RHSM_REPOS:-"--enable=rhoso-18.0-for-rhel-${RHEL_MAJOR}-x86_64-rpms
1313
RHSM_POOL=""
1414

1515
rm -f /etc/yum.repos.d/*.repo
16-
subscription-manager register --username=$RHSM_USER --password=$RHSM_PASSWORD
16+
# Suppress xtrace to avoid leaking credentials to the build log
17+
set +x
18+
subscription-manager register --username="$RHSM_USER" --password="$RHSM_PASSWORD"
19+
set -x
1720
if [ -n "${RHSM_POOL}" ]; then
18-
subscription-manager attach --pool=$RHSM_POOL
21+
subscription-manager attach --pool="$RHSM_POOL"
1922
fi
2023
subscription-manager repos $RHSM_REPOS

0 commit comments

Comments
 (0)