[英]How can I hide a secret password from being printed to the command line?
When I run a gradle command, it outputs JAVA_TOOL_OPTIONS
values to the command line:当我运行 gradle 命令时,它JAVA_TOOL_OPTIONS
值输出到命令行:
./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.如果我与同事共享屏幕,则存在安全风险,尤其是在记录 session 的情况下。 How can I solve for this?我该如何解决这个问题?
note: these values are picked up from global gradle.properties
注意:这些值取自全局gradle.properties
Write the password into a file, let it name proxyPassword.txt
.将密码写入文件,命名为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
如果您担心您的文件不正确,可能包含更多行,您可以使用head -1 proxyPassword.txt
代替cat
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.