File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed
modules/run/artifacts/opt/jboss/container/java/run Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -199,6 +199,27 @@ get_classpath() {
199
199
echo " ${cp_path} "
200
200
}
201
201
202
+ # Mask secrets before printing
203
+ mask_passwords () {
204
+ local content=" $1 "
205
+ local result=" "
206
+
207
+ IFS=' ' read -r -a key_value_pairs <<< " $content"
208
+
209
+ for pair in " ${key_value_pairs[@]} " ; do
210
+ key=$( echo " $pair " | cut -d ' =' -f 1)
211
+ value=$( echo " $pair " | cut -d ' =' -f 2-)
212
+
213
+ if [[ $key =~ [Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd] ]]; then
214
+ result+=" $key =***** "
215
+ else
216
+ result+=" $pair "
217
+ fi
218
+ done
219
+
220
+ echo " ${result% } "
221
+ }
222
+
202
223
# Start JVM
203
224
startup () {
204
225
# Initialize environment
@@ -212,9 +233,11 @@ startup() {
212
233
args=" -jar ${JAVA_APP_JAR} "
213
234
fi
214
235
215
- procname=" ${JAVA_APP_NAME-java} "
236
+ local procname=" ${JAVA_APP_NAME-java} "
237
+
238
+ local masked_args=$( mask_passwords " ${args} " )
216
239
217
- log_info " exec -a \" ${procname} \" java $( get_java_options) -cp \" $( get_classpath) \" ${args } $* "
240
+ log_info " exec -a \" ${procname} \" java $( get_java_options) -cp \" $( get_classpath) \" ${masked_args } $* "
218
241
log_info " running in $PWD "
219
242
exec -a " ${procname} " java $( get_java_options) -cp " $( get_classpath) " ${args} $*
220
243
}
You can’t perform that action at this time.
0 commit comments