KAFKA-9577: SaslClientAuthenticator incorrectly negotiates SASL_HANDSHAKE version#8142
KAFKA-9577: SaslClientAuthenticator incorrectly negotiates SASL_HANDSHAKE version#8142hachikuji merged 3 commits intoapache:trunkfrom
Conversation
SaslHandshakeRequest versions and uses the max versions supported by the broker whether or not the client supports it. This PR rolls back the SaslHandshake[Request,Response] bump, fixes the version negotiation, and adds a test to prevent anyone from accidentally bumping the version without a workaround (e.g. a new ApiKey).
| break; | ||
| else { | ||
| saslAuthenticateVersion(apiVersionsResponse); | ||
| saslApiVersions(apiVersionsResponse); |
There was a problem hiding this comment.
Set the versions for both auth and handshake the same way.
There was a problem hiding this comment.
nit: saslAuthenticateAndHandshakeVersions() is more intuitive to me (100% subjective, of course; I mention it only in case it didn't occur to you)
|
cc @dajac |
| // Version 2 adds flexible version support | ||
| "validVersions": "0-2", | ||
| "flexibleVersions": "2+", | ||
| // NOTE: Version cannot be easily bumped due to incorrect |
There was a problem hiding this comment.
Rollback version with comment
| */ | ||
| @Test | ||
| public void testApiVersionsRequestWithUnsupportedVersion() throws Exception { | ||
| public void testApiVersionsRequestWithServerUnsupportedVersion() throws Exception { |
There was a problem hiding this comment.
Rename as this only tested part of the version support.
|
|
||
|
|
||
| @Test | ||
| public void testForBrokenSaslHandshakeVersionBump() { |
There was a problem hiding this comment.
Block anyone from bumping the schema without realizing.
rondagostino
left a comment
There was a problem hiding this comment.
The fact that this lives on the client indeed makes it tough to bump the SaslHandshake version -- older clients without this fix will run into trouble. Releasing patch versions (2.4.1, etc.) gives an easier client upgrade path, but I'm wondering if there is there a way to make the broker respond intelligently about its max version for SaslHandshake? Does it know the version of the client making the ApiVersionsRequest request, and if so, it could downgrade its response for SaslHandshake for older clients? It feels like an awful solution, but I figured I would suggest it anyway.
| break; | ||
| else { | ||
| saslAuthenticateVersion(apiVersionsResponse); | ||
| saslApiVersions(apiVersionsResponse); |
There was a problem hiding this comment.
nit: saslAuthenticateAndHandshakeVersions() is more intuitive to me (100% subjective, of course; I mention it only in case it didn't occur to you)
Client version detection is one possibility as we do get supplied with client versions nowadays. I haven't thought too deeply about potential solutions though. |
|
One alternative would be to update When we do want to use handshake requests with version > 1 in the future because we want to make an actual change to handshake, we can update clients which know about this updated handshake protocol to send a second ApiVersions request with the latest supported ApiVersions request version derived from the broker's first ApiVersions response in order to get the broker's actual max handshake version. We could add this flow now to enable testing, but we don't have to because handshake hasn't really changed. |
That makes sense as an option. For this PR I think we should avoid any further changes as trunk is currently broken and this is a blocker for 2.5. |
| "validVersions": "0-2", | ||
| "flexibleVersions": "2+", | ||
| // NOTE: Version cannot be easily bumped due to incorrect | ||
| // client negotiation. See https://issues.apache.org/jira/browse/KAFKA-9577 |
There was a problem hiding this comment.
Can you specify the client versions with the incorrect negotiation? 2.4 and earlier, right?
|
LGTM pending one comment |
hachikuji
left a comment
There was a problem hiding this comment.
LGTM. I think we have some options to bump this protocol again in the future, but there seems to be no pressing need for it now.
|
ok to test |
|
retest this please |
…HAKE version (#8142) The SaslClientAuthenticator incorrectly negotiates supported SaslHandshakeRequest version and uses the maximum version supported by the broker whether or not the client supports it. This bug was exposed by a recent version bump in 0a2569e. This PR rolls back the recent SaslHandshake[Request,Response] bump, fixes the version negotiation, and adds a test to prevent anyone from accidentally bumping the version without a workaround such as a new ApiKey. The existing key will be difficult to support for clients < 2.5 due to the incorrect negotiation. Reviewers: Ron Dagostino <rdagostino@confluent.io>, Rajini Sivaram <rajinisivaram@googlemail.com>, Colin P. McCabe <cmccabe@apache.org>, Jason Gustafson <jason@confluent.io>
* apache-github/trunk: (23 commits) KAFKA-9530; Fix flaky test `testDescribeGroupWithShortInitializationTimeout` (apache#8154) HOTFIX: fix NPE in Kafka Streams IQ (apache#8158) MINOR: set scala version automatically based on gradle.properties KAFKA-9577; SaslClientAuthenticator incorrectly negotiates SASL_HANDSHAKE version (apache#8142) KAFKA-9441: Add internal TransactionManager (apache#8105) MINOR: Document endpoints for connector topic tracking (KIP-558) MINOR: Standby task commit needed when offsets updated (apache#8146) KAFKA-9206; Throw KafkaException on CORRUPT_MESSAGE error in Fetch response (apache#8111) MINOR: Remove unwanted regexReplace on tests/kafkatest/__init__.py KAFKA-9586: Fix errored json filename in ops documentation KAFKA-9575: Mention ZooKeeper 3.5.7 upgrade KAFKA-9481: Graceful handling TaskMigrated and TaskCorrupted (apache#8058) HOTFIX: don't try to remove uninitialized changelogs from assignment & don't prematurely mark task closed (apache#8140) MINOR: Fix javadoc at org.apache.kafka.clients.producer.KafkaProducer.InterceptorCallback#onCompletion (apache#7337) MINOR: Improve EOS example exception handling (apache#8052) MINOR: Fix a number of warnings in clients test (apache#8073) MINOR: Update shell scripts to support z/OS system (apache#7913) MINOR: Wording fix in Streams DSL docs (apache#5692) MINOR: Add missing @test annotation to MetadataTest#testMetadataMerge (apache#8141) KAFKA-9533: ValueTransform forwards `null` values (apache#8108) ...
…etrics-common * confluent/master: (76 commits) KAFKA-9530; Fix flaky test `testDescribeGroupWithShortInitializationTimeout` (apache#8154) HOTFIX: fix NPE in Kafka Streams IQ (apache#8158) MINOR: set scala version automatically based on gradle.properties KAFKA-9577; SaslClientAuthenticator incorrectly negotiates SASL_HANDSHAKE version (apache#8142) KAFKA-9441: Add internal TransactionManager (apache#8105) MINOR: Document endpoints for connector topic tracking (KIP-558) MINOR: Standby task commit needed when offsets updated (apache#8146) Changes to migrate to Artifactory (#263) KAFKA-9206; Throw KafkaException on CORRUPT_MESSAGE error in Fetch response (apache#8111) MINOR: Remove unwanted regexReplace on tests/kafkatest/__init__.py KAFKA-9586: Fix errored json filename in ops documentation KAFKA-9575: Mention ZooKeeper 3.5.7 upgrade KAFKA-9481: Graceful handling TaskMigrated and TaskCorrupted (apache#8058) HOTFIX: don't try to remove uninitialized changelogs from assignment & don't prematurely mark task closed (apache#8140) MINOR: Fix javadoc at org.apache.kafka.clients.producer.KafkaProducer.InterceptorCallback#onCompletion (apache#7337) MINOR: Improve EOS example exception handling (apache#8052) MINOR: Fix a number of warnings in clients test (apache#8073) MINOR: Update shell scripts to support z/OS system (apache#7913) MINOR: Wording fix in Streams DSL docs (apache#5692) MINOR: Add missing @test annotation to MetadataTest#testMetadataMerge (apache#8141) ...
…HAKE version (apache#8142) The SaslClientAuthenticator incorrectly negotiates supported SaslHandshakeRequest version and uses the maximum version supported by the broker whether or not the client supports it. This bug was exposed by a recent version bump in apache@0a2569e. This PR rolls back the recent SaslHandshake[Request,Response] bump, fixes the version negotiation, and adds a test to prevent anyone from accidentally bumping the version without a workaround such as a new ApiKey. The existing key will be difficult to support for clients < 2.5 due to the incorrect negotiation. Reviewers: Ron Dagostino <rdagostino@confluent.io>, Rajini Sivaram <rajinisivaram@googlemail.com>, Colin P. McCabe <cmccabe@apache.org>, Jason Gustafson <jason@confluent.io>
apache#8142) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alter Topic with Zookeeper Flag * Addressed PR Comments and added a check to see if TopicID still exists after the command is stopped * Addressed PR Comments and added a check to see if TopicID still exists after the command is stopped * Changed exception message * Changed exception message * Changed exception message
…er Topic with Zookeeper Flag (#844) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alt… (apache#8142) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alter Topic with Zookeeper Flag * Addressed PR Comments and added a check to see if TopicID still exists after the command is stopped * Addressed PR Comments and added a check to see if TopicID still exists after the command is stopped * Changed exception message * Changed exception message * Changed exception message * Don't need assignment * Nit change
…er Topic with Zookeeper Flag (#844) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alt… (apache#8142) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alter Topic with Zookeeper Flag * Addressed PR Comments and added a check to see if TopicID still exists after the command is stopped * Addressed PR Comments and added a check to see if TopicID still exists after the command is stopped * Changed exception message * Changed exception message * Changed exception message * Don't need assignment * Nit change
…er Topic with Zookeeper Flag (#844) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alt… (apache#8142) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alter Topic with Zookeeper Flag * Addressed PR Comments and added a check to see if TopicID still exists after the command is stopped * Addressed PR Comments and added a check to see if TopicID still exists after the command is stopped * Changed exception message * Changed exception message * Changed exception message * Don't need assignment * Nit change
…er Topic with Zookeeper Flag (#844) (#851) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alt… (apache#8142) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alter Topic with Zookeeper Flag * Addressed PR Comments and added a check to see if TopicID still exists after the command is stopped * Addressed PR Comments and added a check to see if TopicID still exists after the command is stopped * Changed exception message * Changed exception message * Changed exception message * Don't need assignment * Nit change
…er Topic with Topic ID present (#852) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alter Topic with Zookeeper Flag (#844) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alt… (apache#8142) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alter Topic with Zookeeper Flag * Addressed PR Comments and added a check to see if TopicID still exists after the command is stopped * Addressed PR Comments and added a check to see if TopicID still exists after the command is stopped * Changed exception message * Changed exception message * Changed exception message * Don't need assignment * Nit change * Nit change
…er Topic with Topic ID present (#852) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alter Topic with Zookeeper Flag (#844) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alt… (apache#8142) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alter Topic with Zookeeper Flag * Addressed PR Comments and added a check to see if TopicID still exists after the command is stopped * Addressed PR Comments and added a check to see if TopicID still exists after the command is stopped * Changed exception message * Changed exception message * Changed exception message * Don't need assignment * Nit change * Nit change
…er Topic with Topic ID present (#852) (#854) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alter Topic with Zookeeper Flag (#844) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alt… (apache#8142) * KENGINE-283 Topic ID Mismatch Issue - Exception added to disallow Alter Topic with Zookeeper Flag * Addressed PR Comments and added a check to see if TopicID still exists after the command is stopped * Addressed PR Comments and added a check to see if TopicID still exists after the command is stopped * Changed exception message * Changed exception message * Changed exception message * Don't need assignment * Nit change * Nit change
The SaslClientAuthenticator incorrectly negotiates supported SaslHandshakeRequest version and uses the maximum version supported by the broker whether or not the client supports it.
This bug was exposed by a recent version bump in 0a2569e.
This PR rolls back the recent SaslHandshake[Request,Response] bump, fixes the version negotiation, and adds a test to prevent anyone from accidentally bumping the version without a workaround such as a new ApiKey. The existing key will be difficult to support for clients < 2.5 due to the incorrect negotiation.
Tests: