From 1e86a51bcd520e60845634d0a8aedb50a6a81dbb Mon Sep 17 00:00:00 2001 From: andrei Date: Thu, 21 Oct 2021 14:51:59 +0200 Subject: [PATCH] hide credentials in System Properties printout --- src/ibcalpha/ibc/IbcTws.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ibcalpha/ibc/IbcTws.java b/src/ibcalpha/ibc/IbcTws.java index 82831a0..5a19c1c 100644 --- a/src/ibcalpha/ibc/IbcTws.java +++ b/src/ibcalpha/ibc/IbcTws.java @@ -408,7 +408,16 @@ private static void printProperties() { Utils.logRawToConsole("------------------------------------------------------------"); while (i.hasMoreElements()) { String props = (String) i.nextElement(); - Utils.logRawToConsole(props + " = " + (String) p.get(props)); + String vals = (String) p.get(props); + if (props.equals("sun.java.command")) { + //hide credentials + String[] args = vals.split(" "); + for (int j = 2; j < args.length - 1; j++) { + args[j] = "***"; + } + vals = String.join(" ", args); + } + Utils.logRawToConsole(props + " = " + vals); } Utils.logRawToConsole("------------------------------------------------------------"); }