[FLINK-38685][cdc-connector-postgresql] Redact sensitive information like password from logs #4174
+32
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Flink Postgres CDC connector, when initialising, logs the complete connector configuration, including the database.password property, in plain text to the TaskManager logs.
This fix redacts such sensitive information from being leaked in logs.
Current behaviour
2025-11-14 11:04:29,954 INFO org.apache.flink.cdc.connectors.postgres.source.fetch.PostgresSourceFetchTaskContext [] - PostgresConnectorConfig is {connector.class=io.debezium.connector.postgresql.PostgresConnector, slot.name=flink_cdh_sample_1_3, schema.include.list=public, provide.transaction.metadata=true, include.schema.changes=false, database.sslmode=require, database.history.skip.unparseable.ddl=true, database.sslfactory=org.postgresql.ssl.NonValidatingFactory, database.history.instance.name=6d5b0651-f15b-49f3-a210-32a4654158de_3, database.tcpKeepAlive=true, database.dbname=foo_sample, database.user=foo_user, slot.drop.on.stop=true, database.history.refer.ddl=true, database.server.name=postgres_cdc_source, heartbeat.interval.ms=0, plugin.name=pgoutput, database.port=5432, database.hostname=postgres, database.password=postgres, database.sslrootcert=, table.include.list=public.foo_sample_users, database.history=org.apache.flink.cdc.connectors.base.source.EmbeddedFlinkDatabaseHistory, snapshot.mode=never}After this fix
2025-11-14 12:15:55,320 INFO org.apache.flink.cdc.connectors.postgres.source.fetch.PostgresSourceFetchTaskContext [] - PostgresConnectorConfig is {connector.class=io.debezium.connector.postgresql.PostgresConnector, schema.include.list=public, include.schema.changes=false, database.sslmode=require, database.sslfactory=org.postgresql.ssl.NonValidatingFactory, database.history.instance.name=cdb75629-ee4b-488f-bed7-4566777633b9_2, database.dbname=foo_sample, database.user=foo_user, database.history.refer.ddl=true, heartbeat.interval.ms=0, plugin.name=pgoutput, database.password=******, database.sslrootcert=, database.history=org.apache.flink.cdc.connectors.base.source.EmbeddedFlinkDatabaseHistory, snapshot.mode=never, slot.name=flink_cdh_sample_1_2, provide.transaction.metadata=true, database.history.skip.unparseable.ddl=true, database.tcpKeepAlive=true, slot.drop.on.stop=true, database.server.name=postgres_cdc_source, database.port=5432, database.hostname=postgres, table.include.list=public.foo_sample_orders}