Repository: hazelcast/hazelcast (language: java)

Issue:
CdcSourceP should not log database password (debezium extension) [HZ-3861]
<!--
Thanks for reporting your issue. Please share with us the following information, to help us resolve your issue quickly and efficiently.
-->
  
**Describe the bug**
When running a pipeline based on `DebeziumCdcSources` database password is logged out via [CdcSourceP#startNewTask](https://github.com/hazelcast/hazelcast/blob/master/extensions/cdc-debezium/src/main/java/com/hazelcast/jet/cdc/impl/CdcSourceP.java#L253) method (`database.password` property).

**Expected behavior**
Database password should not be logged - skip the `database.password` or mask it with asterisks.

**To Reproduce**

Steps to reproduce the behavior:
1. Run one of the integration tests, e.g. `com.hazelcast.jet.cdc.DebeziumCdcIntegrationTest#postgres` with HZ instance logs enabled.
2. In the logs you can find:

```
13:43:03,596  INFO || - [ChangeRecordCdcSourceP] hz.DebeziumCdcIntegrationTest_jovial_heyrovsky.jet.blocking.thread-0 - [127.0.0.1]:5702 [dev] [5.4.0-SNAPSHOT] [0acf-6f39-3ac0-0001/postgres#0] starting new task with config: {connector.class=io.debezium.connector.postgresql.PostgresConnector, database.dbname=postgres, database.user=postgres, database.server.name=dbserver1, sequence.extractor.class=com.hazelcast.jet.cdc.impl.ConstantSequenceExtractor, database.port=32826, table.whitelist=inventory.customers, tombstones.on.delete=false, database.hostname=localhost, database.password=postgres, name=postgres, database.history=com.hazelcast.jet.cdc.impl.CdcSourceP$DatabaseHistoryImpl}
```

`[...] database.password=postgres [...]`

<!--
Add any other context about the problem here.

Common details that we're often interested in:
- Detailed description of the steps to reproduce your issue
- Logs and stack traces, if available
- Hazelcast version that you use (e.g. 3.4, also specify whether it is a minor release or the latest snapshot)
- If available, integration module versions (e.g. Tomcat, Jetty, Spring, Hibernate). Also, include their detailed configuration information such as web.xml, Hibernate configuration and `context.xml` for Spring
- Cluster size, i.e. the number of Hazelcast cluster members
- Number of the clients
- Version of Java. It is also helpful to mention the JVM parameters
- Operating system. If it is Linux, kernel version is helpful
- Unit test with the `hazelcast.xml` file. If you could include a unit test which reproduces your issue, we would be grateful
-->



Discussion / hints:
Internal Jira issue: [HZ-3861](https://hazelcast.atlassian.net//browse/HZ-3861)

Fix patch:
diff --git a/extensions/cdc-debezium/src/main/java/com/hazelcast/jet/cdc/impl/CdcSourceP.java b/extensions/cdc-debezium/src/main/java/com/hazelcast/jet/cdc/impl/CdcSourceP.java
index 8c9414e2cacc9..6921767ac62b8 100644
--- a/extensions/cdc-debezium/src/main/java/com/hazelcast/jet/cdc/impl/CdcSourceP.java
+++ b/extensions/cdc-debezium/src/main/java/com/hazelcast/jet/cdc/impl/CdcSourceP.java
@@ -250,7 +250,11 @@ private SourceConnector startNewConnector() {
     }
 
     private SourceTask startNewTask() {
-        logger.info("starting new task with config: " + taskConfig);
+        if (taskConfig.containsKey("name")) {
+            logger.info("starting new task: " + taskConfig.get("name"));
+        } else {
+            logger.info("starting new task");
+        }
         SourceTask task = newInstance(connector.taskClass().getName(), "task");
         task.initialize(new JetSourceTaskContext());
 


Test patch: