Default Kafka ClickPipes to no auth when no auth flags are given - #629
Open
sdairs wants to merge 1 commit into
Open
Default Kafka ClickPipes to no auth when no auth flags are given#629sdairs wants to merge 1 commit into
sdairs wants to merge 1 commit into
Conversation
sdairs
force-pushed
the
fix/606-kafka-no-auth
branch
from
August 28, 2026 14:46
9013172 to
e7a45b4
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e7a45b4. Configure here.
…given `clickpipe create kafka` and `clickpipe schema-discover kafka` defaulted the authentication mechanism to PLAIN whenever `--auth` was omitted, so an invocation with no auth flags at all failed client-side with "PLAIN requires --username and --password" and a broker that requires no authentication was unreachable. An unauthenticated Kafka source has no value in the spec enum (PLAIN..MUTUAL_TLS), and the schema carries no `required[]`; absence of the key is the wire representation, matching the object-storage source (whose `authentication` is already omitted for public buckets) and the control plane's own `omitempty` field. `ClickPipePostKafkaSource.authentication` is therefore now `Option<T>` with `skip_serializing_if`, plus a documented `optionality_exemptions` entry so the drift analyzer keeps checking presence and enum values without demanding a mechanism per request. The CLI now resolves the mechanism as: explicit `--auth` wins; otherwise it is inferred from the credential flags that were passed (`--username`/`--password` → PLAIN, `--access-key-id`/`--secret-key` → IAM_USER, `--iam-role` → IAM_ROLE, `--client-certificate`/`--client-key` → MUTUAL_TLS); otherwise no authentication is sent. An explicitly selected mechanism still fails fast when its credentials are missing, and the message now names the mechanism the user actually asked for instead of always PLAIN. Tests: builder unit tests for the no-auth default, each inference path, and the explicit-mechanism error messages; inference tests for half-specified credential pairs; clap coverage that schema-discover parses with no auth flags and builds a no-auth source; wiremock subprocess tests asserting `create` and `schema-discover` omit `authentication` and send null `credentials` with no auth flags, and still send PLAIN when only `--username`/`--password` are given; a library test pinning that an absent mechanism is omitted rather than serialized as `null`. Fixes #606 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sdairs
force-pushed
the
fix/606-kafka-no-auth
branch
from
August 28, 2026 19:41
e7a45b4 to
fc98375
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
clickpipe create kafkaandclickpipe schema-discover kafkaimplicitly defaulted the authentication mechanism to PLAIN whenever--authwas omitted. An invocation with no auth flags at all therefore failed client-side withPLAIN requires --username and --password, making a broker that requires no authentication unreachable.Auth resolution is now:
--authwins;--username/--password→ PLAIN,--access-key-id/--secret-key→ IAM_USER,--iam-role→ IAM_ROLE,--client-certificate/--client-key→ MUTUAL_TLS;An explicitly selected mechanism still fails fast when its credentials are missing, and the error now names the mechanism the user actually asked for rather than always saying PLAIN.
Why this request shape
An unauthenticated Kafka source has no value in the spec enum (
PLAIN..MUTUAL_TLS), andClickPipePostKafkaSourcecarries norequired[], so absence of the key is the wire representation of "no auth":authenticationis nullable and omitted for public buckets ("PUBLIC uses no authentication" in the spec description), and the CLI already omits it;ClickPipePatchKafkaSource.authentication) is nullable upstream;omitempty(visible in the official Terraform provider'sinternal/api/clickpipe_models.go).So
ClickPipePostKafkaSource.authenticationbecomesOption<T>withskip_serializing_if, paired with a documentedoptionality_exemptionsentry in the analyzer config. Presence and enum-value checking are unchanged; only the requiredness demand is exempted.credentialsstays as-is and carriesnullfor a no-auth source, exactly as it already does for IAM_ROLE.Tests
build_kafka_credentials(None, ..)→ null.schema-discover kafkaparses with no auth flags and builds a source with no authentication.create kafkaandschema-discover kafkawith no auth flags omitauthenticationand send nullcredentials;--username/--passwordwithout--authstill sends PLAIN with the right credential body.null.cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test -p clickhousectl,cargo test -p clickhouse-cloud-api --test spec_coverage_test --test models_test --lib,cargo test -p clickhouse-openapi-analyzer,cargo check --workspace --all-features. Cloud integration suites were not run (they need live credentials); the Kafka stages/smoke constructions were updated to the newOptionfield and compile under--all-targets.README documents the optional
--authbehaviour with a no-auth example for both commands.Part of a stacked PR chain: this PR is based on
fix/605-clickpipe-scale-usage-error, notmain.Fixes #606
🤖 Generated with Claude Code