Skip to content

[pkg/kafka] Add validation for AWS MSK SASL config and fix error message - #50936

Open
Rucha0901 wants to merge 1 commit into
open-telemetry:mainfrom
Rucha0901:fix-aws-msk-sasl-validation
Open

[pkg/kafka] Add validation for AWS MSK SASL config and fix error message#50936
Rucha0901 wants to merge 1 commit into
open-telemetry:mainfrom
Rucha0901:fix-aws-msk-sasl-validation

Conversation

@Rucha0901

@Rucha0901 Rucha0901 commented Sep 11, 2026

Copy link
Copy Markdown

Description:
Missing AWS MSK SASL validation in the kafka package config and incomplete error message.

  1. Validate that the region is not empty when the AWS MSK mechanism is used.
  2. Add the missing OAuth mechanism to the default switch case error message.

Link to tracking issue:
Fixes #50934

Testing:
Tests updated in config_test.go and verified locally.

Documentation:
None

Authorship:

  • I, a human, wrote this pull request description myself.

@github-actions github-actions Bot added the first-time contributor PRs made by new contributors label Sep 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib.

Important reminders:

  • Read our Contributing Guidelines.
  • Sign the CLA if you haven't already.
  • Follow the OpenTelemetry Generative AI policy: disclose any AI use in your contribution, and communicate (PR descriptions, review replies) in your own words rather than AI-generated text.
  • Give reviewers at least a few days before pinging them for feedback.
  • If you need help with general setup, development process, or contributor etiquette, ask in #opentelemetry-new-contributors.
  • First-time contributors should keep at most one PR marked as ready for review until their first PR is merged; once two are open for review, any further PR is automatically converted to draft.
  • If your change isn't one of our priority components, reviews may take more time.
  • Raise technical or Collector-specific questions in #otel-collector-dev or a Collector SIG meeting.

@singhvibhanshu singhvibhanshu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add a changelog entry.

Signed-off-by: Rucha0901 <imt_2025071@iiitm.ac.in>
@singhvibhanshu

Copy link
Copy Markdown
Member

/workflow-approve

@singhvibhanshu singhvibhanshu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this be breaking instead of bug_fix? Let's wait for the code-owners to have a look at it first 👍


# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking
change_type: 'bug_fix'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
change_type: 'bug_fix'
change_type: breaking

@paulojmdias paulojmdias left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add to test data client config, a test with a valid region.

# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
change_logs: ['user']

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
change_logs: ['user']
change_logs: [user]

},
"sasl_invalid_mechanism": {
expectedErr: "auth::sasl: mechanism should be one of 'PLAIN', 'AWS_MSK_IAM_OAUTHBEARER', 'SCRAM-SHA-256' or 'SCRAM-SHA-512'. configured value FANCY",
expectedErr: "auth::sasl: mechanism should be one of 'PLAIN', 'AWS_MSK_IAM_OAUTHBEARER', 'OAUTHBEARER', 'SCRAM-SHA-256' or 'SCRAM-SHA-512'. configured value FANCY",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
expectedErr: "auth::sasl: mechanism should be one of 'PLAIN', 'AWS_MSK_IAM_OAUTHBEARER', 'OAUTHBEARER', 'SCRAM-SHA-256' or 'SCRAM-SHA-512'. configured value FANCY",
expectedErr: "auth::sasl::mechanism should be one of 'PLAIN', 'AWS_MSK_IAM_OAUTHBEARER', 'OAUTHBEARER', 'SCRAM-SHA-256' or 'SCRAM-SHA-512'. configured value FANCY",

expectedErr: "auth::sasl: mechanism should be one of 'PLAIN', 'AWS_MSK_IAM_OAUTHBEARER', 'OAUTHBEARER', 'SCRAM-SHA-256' or 'SCRAM-SHA-512'. configured value FANCY",
},
"sasl_aws_msk_iam_oauthbearer_missing_region": {
expectedErr: "auth::sasl: region is required for AWS_MSK_IAM_OAUTHBEARER mechanism",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
expectedErr: "auth::sasl: region is required for AWS_MSK_IAM_OAUTHBEARER mechanism",
expectedErr: "auth::sasl::region is required for AWS_MSK_IAM_OAUTHBEARER mechanism",

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No unresolved approval-blocking issues were identified.

Pull request overview

Adds AWS MSK SASL region validation and updates the unsupported-mechanism error message.

Changes:

  • Requires a region for AWS_MSK_IAM_OAUTHBEARER.
  • Includes OAUTHBEARER in the error message.
  • Updates tests, fixtures, and changelog documentation.
File summaries
File Summary
pkg/kafka/configkafka/testdata/client_config.yaml Adds a missing-region test fixture.
pkg/kafka/configkafka/config.go Adds validation and updates the error message.
pkg/kafka/configkafka/config_test.go Tests validation and revised errors.
.chloggen/fix-aws-msk-sasl-validation.yaml Documents the bug fix.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[pkg/kafka] Add validation for AWS MSK SASL config and fix error message

4 participants