Skip to content

Commit 77a5bc6

Browse files
committed
strip pwds from logged info
Signed-off-by: Paul Cooper <[email protected]>
1 parent 7b70c15 commit 77a5bc6

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/cli/shared/BundleParent.handler.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,14 @@ export abstract class BundleParentHandler implements ICommandHandler {
4444
// log the arguments on entry to the Handler
4545
const logger = Logger.getAppLogger();
4646
if (params.arguments.silent === undefined) {
47-
logger.debug("Arguments received by cics-deploy: " + JSON.stringify(params.arguments));
47+
48+
// Strip passwords from the data before logging it
49+
let inputParms = JSON.stringify(params.arguments);
50+
inputParms = this.replacePassword(inputParms, params.arguments.zpw);
51+
inputParms = this.replacePassword(inputParms, params.arguments.spw);
52+
inputParms = this.replacePassword(inputParms, params.arguments.cpw);
53+
54+
logger.debug("Arguments received by cics-deploy: " + inputParms);
4855
}
4956

5057
try {
@@ -87,4 +94,11 @@ export abstract class BundleParentHandler implements ICommandHandler {
8794
* @memberof BundleParentHandler
8895
*/
8996
public abstract async performAction(params: IHandlerParameters): Promise<string>;
97+
98+
private replacePassword(source: string, pwd: string): string {
99+
if (pwd !== undefined) {
100+
return source.split(pwd).join("*REDACTED*");
101+
}
102+
return source;
103+
}
90104
}

0 commit comments

Comments
 (0)