OmniaGM commented on PR #23843:
URL: https://github.com/apache/kafka/pull/23843#issuecomment-6289970872

   Thanks @fvaleri for the pr, quick comment the pattern and ACL configs 
(`topics.include/exclude`, `groups.include/exclude`, 
`topic.properties.exclude`, `acls.include/exclude`) are defined without a 
validator, so `AbstractConfig` would accept any string for them. They're only 
checked later, in the constructor, when compilePatternList and parseAclRules 
run.
   
   I believe here when a value is invalid, the exception thrown at that point 
is not a `ConfigException`:
   - `topics.include=foo[` throws `PatternSyntaxException`, which is a plain 
`RuntimeException`.
   - `acls.include=TOPIC;.*;REED` throws `IllegalArgumentException` from 
`AclOperation.valueOf`.
   
   So once the create-mirror path uses this config, a typo wouldn't come back 
`INVALID_CONFIG`, or the mirror would be accepted and only break later, once 
the link starts on the brokers.
   
   Could we add validators to these `define(...)`? the same way as 
`TopicCreationConfig::REGEX_VALIDATOR` in Connect (catching 
`PatternSyntaxException`)? Each entry would then be checked whenever the config 
is parsed, and a bad one would fail with `ConfigException(name, value, 
reason)`, which maps to `INVALID_CONFIG`. It would also name the entry that's 
wrong. same with rest of regex configs,  and the ACL ones could have a similar 
validator that calls `MirrorAclRule.parse`. 
   
   WDYT?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to