Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-18339: Remove raw unversioned direct SASL protocol (KIP-896) #18295

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

ijuma
Copy link
Contributor

@ijuma ijuma commented Dec 22, 2024

Clients that support SASL but don't implement KIP-43 (eg Kafka producer/consumer 0.9.0.x) will
fail to connect after this change.

Added unit tests and also manually tested with the console producer 0.9.0.

While testing, I noticed that the logged message when a 0.9.0 Java client is used without sasl is
slightly misleading - fixed that too.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@github-actions github-actions bot added triage PRs from the community clients small Small PRs labels Dec 22, 2024
@github-actions github-actions bot added core Kafka Broker and removed small Small PRs labels Dec 23, 2024
// Raise an error prior to parsing if the api cannot be handled at this layer. This avoids
// unnecessary exposure to some of the more complex schema types.
if (apiKey != ApiKeys.API_VERSIONS && apiKey != ApiKeys.SASL_HANDSHAKE)
throw new IllegalSaslStateException("Unexpected Kafka request of type " + apiKey + " during SASL handshake.");
throw new InvalidRequestException("Unexpected Kafka request of type " + apiKey + " during SASL handshake.");
Copy link
Contributor Author

@ijuma ijuma Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rajinisivaram Do you know why we send IllegalSaslStateException here and InvalidRequestException for every other error? We seem to have special handling for Sasl related exceptions, but it doesn't seem to make sense in this case since we can't properly propagate an error if we get the wrong request type.

// InvalidRequestException is thrown if the request is not in Kafka format or if the API key is invalid.
// If it's the initial request, this could be an ancient client (see method documentation for more details),
// a client configured with the wrong security protocol or a non kafka-client altogether (eg http client).
throw new InvalidRequestException("Invalid request, potential reasons: kafka client configured with the " +
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look at the error message and check if it makes sense. This will only be captured in the broker, but still good to try and make it as informative as possible.

@ijuma ijuma force-pushed the kafka-18339-remove-raw-unversioned-sasl branch from 061cbb0 to 12d120c Compare December 24, 2024 02:19
@ijuma
Copy link
Contributor Author

ijuma commented Dec 24, 2024

@rajinisivaram @omkreddy Any of you has cycles to review this small change?

@github-actions github-actions bot removed the triage PRs from the community label Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clients core Kafka Broker
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant