[ 
https://issues.apache.org/jira/browse/KAFKA-4930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15937220#comment-15937220
 ] 

Sönke Liebau commented on KAFKA-4930:
-------------------------------------

I've created a potential fix for this issue and pushed to 
https://github.com/soenkeliebau/kafka/tree/KAFKA-4930

However I am unsure, whether this fully addresses all potential issues tbh. All 
tests pass, but I won't pretend that I have fully understood all dependencies 
in the validation model, so some feedback would be very welcome. 
My fundamental worry with this implementation is, that I create a validator for 
a option that cannot have a default value, which means that the validator won't 
greenlight a default config, which I then get around by allowing a null value. 
This seems not entirely clean. 
An alternative approach would be to add checks 
[here|https://github.com/apache/kafka/blob/trunk/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/resources/ConnectorsResource.java#L91]
 but I actually found that the existing check here throws a 
NullPointerException for requests that don't have the _name_ parameter (will 
create an issue for that), so there are caveats here as well.

Anyway, thoughts?

> Connect Rest API allows creating connectors with an empty name
> --------------------------------------------------------------
>
>                 Key: KAFKA-4930
>                 URL: https://issues.apache.org/jira/browse/KAFKA-4930
>             Project: Kafka
>          Issue Type: Bug
>          Components: KafkaConnect
>    Affects Versions: 0.10.2.0
>            Reporter: Sönke Liebau
>            Priority: Minor
>
> The Connect Rest API allows to deploy connectors with an empty name field, 
> which then cannot be removed through the api.
> Sending the following request:
> {code}
> {
>     "name": "",
>     "config": {
>         "connector.class": 
> "org.apache.kafka.connect.tools.MockSourceConnector",
>         "tasks.max": "1",
>         "topics": "test-topic"
>         
>     }
> }
> {code}
> Results in a connector being deployed which can be seen in the list of 
> connectors:
> {code}
> [
>       "",
>       "testconnector"
> ]{code}
> But cannot be removed via a DELETE call, as the api thinks we are trying to 
> delete the /connectors endpoint and declines the request.
> I don't think there is a valid case for the connector name to be empty so 
> perhaps we should add a check for this. I am happy to work on this.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to