How can I hide a secret password from being printed to the command line?

Viewed 113

When I run a gradle command, it outputs JAVA_TOOL_OPTIONS values to the command line:

./gradlew :app:assemble
Picked up JAVA_TOOL_OPTIONS: -Dhttps.proxyUser=ME -Dhttps.proxyPassword=PASSWORD123

If I am screen sharing with a co-worker, this is a security risk, especially if the session is recorded. How can I solve for this?

note: these values are picked up from global gradle.properties

1 Answers

Write the password into a file, let it name proxyPassword.txt.

Then use

./gradlew :app:assemble
Picked up JAVA_TOOL_OPTIONS: 
-Dhttps.proxyUser=ME 
-Dhttps.proxyPassword=`cat proxyPassword.txt`

Watch the ` command substitution

If you fear that your file is not proper, may contain some more lines, you can use head -1 proxyPassword.txt instead of cat

Related