[ https://issues.apache.org/jira/browse/KAFKA-7242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16572353#comment-16572353 ]
ASF GitHub Bot commented on KAFKA-7242: --------------------------------------- rayokota opened a new pull request #5475: KAFKA-7242: Reverse xform configs before saving URL: https://github.com/apache/kafka/pull/5475 During actions such as a reconfiguration, the task configs are obtained via `Worker.connectorTaskConfigs` and then subsequently saved into an instance of `ClusterConfigState`. The values of the properties are post-transformation (of variable references) when they should be pre-transformation. This is to avoid secrets appearing in plaintext in the `connect-configs` topic, for example. The fix is to change the 2 clients of `Worker.connectorTaskConfigs` to perform a reverse transformation (values converted back into variable references) before saving them into an instance of `ClusterConfigState`. The 2 places where the save is performed are `DistributedHerder.reconfigureConnector` and `StandaloneHerder.updateConnectorTasks`. The way that the reverse transformation works is to try to obtain the "raw" task config (with variable references still intact) from `ClusterConfigState`, and if that is not available, then use the "raw" connector config from `ClusterConfigState`. The "raw" task config is checked first since the user may have inserted task configs directly using the REST API that may differ from the "raw" connector config. There are 2 additional small changes: 1) `ClusterConfigState.allTasksConfigs` has been changed to perform a transformation (resolution) on all variable references. This is necessary because the result of this method is compared directly to `Worker.connectorTaskConfigs`, which also has variable references resolved. 2) `StandaloneHerder.startConnector` has been changed to match `DistributedHerder.startConnector`. This is to fix an issue where during `StandaloneHerder.restartConnector`, the post-transformed connector config would be saved back into `ClusterConfigState`. I also performed an anlysis of all other code paths where configs are saved back into `ClusterConfigState` and did not find any other issues. ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Externalized secrets are revealed in task configuration > ------------------------------------------------------- > > Key: KAFKA-7242 > URL: https://issues.apache.org/jira/browse/KAFKA-7242 > Project: Kafka > Issue Type: Bug > Reporter: Bahdan Siamionau > Assignee: Robert Yokota > Priority: Major > > Trying to use new [externalized > secrets|https://issues.apache.org/jira/browse/KAFKA-6886] feature I noticed > that task configuration is being saved in config topic with disclosed > secrets. It seems like the main goal of feature was not achieved - secrets > are still persisted in plain-text. Probably I'm misusing this new config, > please correct me if I wrong. > I'm running connect in distributed mode, creating connector with following > config: > {code:java} > { > "name" : "jdbc-sink-test", > "config" : { > "connector.class" : "io.confluent.connect.jdbc.JdbcSinkConnector", > "tasks.max" : "1", > "config.providers" : "file", > "config.providers.file.class" : > "org.apache.kafka.common.config.provider.FileConfigProvider", > "config.providers.file.param.secrets" : "/opt/mysecrets", > "topics" : "test_topic", > "connection.url" : "${file:/opt/mysecrets:url}", > "connection.user" : "${file:/opt/mysecrets:user}", > "connection.password" : "${file:/opt/mysecrets:password}", > "insert.mode" : "upsert", > "pk.mode" : "record_value", > "pk.field" : "id" > } > } > {code} > Connector works fine, placeholders are substituted with correct values from > file, but then updated config is written into the topic again (see 3 > following records in config topic): > {code:java} > key: connector-jdbc-sink-test > value: > { > "properties": { > "connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector", > "tasks.max": "1", > "config.providers": "file", > "config.providers.file.class": > "org.apache.kafka.common.config.provider.FileConfigProvider", > "config.providers.file.param.secrets": "/opt/mysecrets", > "topics": "test_topic", > "connection.url": "${file:/opt/mysecrets:url}", > "connection.user": "${file:/opt/mysecrets:user}", > "connection.password": "${file:/opt/mysecrets:password}", > "insert.mode": "upsert", > "pk.mode": "record_value", > "pk.field": "id", > "name": "jdbc-sink-test" > } > } > key: task-jdbc-sink-test-0 > value: > { > "properties": { > "connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector", > "config.providers.file.param.secrets": "/opt/mysecrets", > "connection.password": "actualpassword", > "tasks.max": "1", > "topics": "test_topic", > "config.providers": "file", > "pk.field": "id", > "task.class": "io.confluent.connect.jdbc.sink.JdbcSinkTask", > "connection.user": "datawarehouse", > "name": "jdbc-sink-test", > "config.providers.file.class": > "org.apache.kafka.common.config.provider.FileConfigProvider", > "connection.url": > "jdbc:postgresql://actualurl:5432/datawarehouse?stringtype=unspecified", > "insert.mode": "upsert", > "pk.mode": "record_value" > } > } > key: commit-jdbc-sink-test > value: > { > "tasks":1 > } > {code} > Please advice have I misunderstood the goal of the given feature, have I > missed smth in configuration or is it actually a bug? Thank you -- This message was sent by Atlassian JIRA (v7.6.3#76005)