set +x around sensitive code docker login code 47/8747/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 8 Feb 2018 04:19:43 +0000 (23:19 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 8 Feb 2018 04:19:47 +0000 (23:19 -0500)
Call `set +x` as a guard just in case a script elsewhere is calling
`set -x` which could cause the credentials to print to console.

Change-Id: I6802887c7a3c9809d9d13d6b3cc90e3570f120fc
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
shell/docker-login.sh

index 6613118..92da7e0 100644 (file)
@@ -35,6 +35,7 @@ set -eu -o pipefail
 
 # Execute the credential lookup and login to the registry
 do_login() {
+    set +x  # Ensure that no other scripts add `set -x` and print passwords
     echo "$1"
     CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
         -t -m "/x:settings/x:servers/x:server[starts-with(x:id, '${1}')]" \