Chris Egerton created KAFKA-9888: ------------------------------------ Summary: REST extensions can mutate connector configs in worker config state snapshot Key: KAFKA-9888 URL: https://issues.apache.org/jira/browse/KAFKA-9888 Project: Kafka Issue Type: Bug Components: KafkaConnect Affects Versions: 2.4.1, 2.5.0, 2.3.1, 2.4.0, 2.3.0 Reporter: Chris Egerton Assignee: Chris Egerton
The changes made in [KIP-454|https://cwiki.apache.org/confluence/display/KAFKA/KIP-454%3A+Expansion+of+the+ConnectClusterState+interface] involved adding a {{connectorConfig}} method to the [ConnectClusterState|https://github.com/apache/kafka/blob/ecde596180975f8546c0e8e10f77f7eee5f1c4d8/connect/api/src/main/java/org/apache/kafka/connect/health/ConnectClusterState.java] interface that REST extensions could use to query the worker for the configuration of a given connector. The [implementation for this method|https://github.com/apache/kafka/blob/ecde596180975f8546c0e8e10f77f7eee5f1c4d8/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/health/ConnectClusterStateImpl.java#L86-L89] returns the Java {{Map}} that's stored in the worker's view of the config topic (when running in distributed mode). No copying is performed, which causes mutations of that {{Map}} object to persist across invocations of {{connectorConfig}} and, even worse, propagate to the worker when, e.g., starting a connector. We should not give REST extensions that original map, but instead a copy of it. -- This message was sent by Atlassian Jira (v8.3.4#803005)