Skip to content

fix(rabbitmq): use SASL EXTERNAL for RabbitMQ AMQP TLS without credentials#7606

Merged
rickbrouwer merged 11 commits intokedacore:mainfrom
rickbrouwer:issue-6840
Apr 15, 2026
Merged

fix(rabbitmq): use SASL EXTERNAL for RabbitMQ AMQP TLS without credentials#7606
rickbrouwer merged 11 commits intokedacore:mainfrom
rickbrouwer:issue-6840

Conversation

@rickbrouwer
Copy link
Copy Markdown
Member

@rickbrouwer rickbrouwer commented Apr 4, 2026

The report in issue 6840 mentions that when RabbitMQ is configured for certificate-based authentication (SASL EXTERNAL via the rabbitmq_auth_mechanism_ssl plugin) KEDA would fail to connect with a 403 "username or password not allowed" error.
This happened because amqp091-go falls back to PLAIN auth using credentials from the host URL when Config.SASL is not set, even when TLS is enabled and no explicit credentials are provided.

So, the fix is that when TLS is enabled without credentials, explicitly set Config.SASL to ExternalAuth so it uses SASL EXTERNAL instead of falling back to PLAIN auth.

Checklist

  • When introducing a new scaler, I agree with the scaling governance policy
  • I have verified that my change is according to the deprecations & breaking changes policy
  • Tests have been added (if applicable)
  • Ensure make generate-scalers-schema has been run to update any outdated generated files
  • Changelog has been updated and is aligned with our changelog requirements, only when the change impacts end users
  • A PR is opened to update our Helm chart (repo) (if applicable, ie. when deployment manifests are modified)
  • A PR is opened to update the documentation on (repo) (if applicable)
  • Commits are signed with Developer Certificate of Origin (DCO - learn more)

Fixes #6840
Docs: kedacore/keda-docs#1727

…tials

Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com>
@rickbrouwer rickbrouwer requested a review from a team as a code owner April 4, 2026 16:43
@snyk-io
Copy link
Copy Markdown

snyk-io Bot commented Apr 4, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 4, 2026

Thank you for your contribution! 🙏

Please understand that we will do our best to review your PR and give you feedback as soon as possible, but please bear with us if it takes a little longer as expected.

While you are waiting, make sure to:

  • Add an entry in our changelog in alphabetical order and link related issue
  • Update the documentation, if needed
  • Add unit & e2e tests for your changes
  • GitHub checks are passing
  • Is the DCO check failing? Here is how you can fix DCO issues

Once the initial tests are successful, a KEDA member will ensure that the e2e tests are run. Once the e2e tests have been successfully completed, the PR may be merged at a later date. Please be patient.

Learn more about our contribution guide.

@keda-automation keda-automation requested a review from a team April 4, 2026 16:43
@rickbrouwer
Copy link
Copy Markdown
Member Author

rickbrouwer commented Apr 4, 2026

/run-e2e rabbit
Update: You can check the progress here

Copy link
Copy Markdown
Contributor

@dttung2905 dttung2905 left a comment

Choose a reason for hiding this comment

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

Thanks @rickbrouwer for the PR. We might also need some documentation about the expected behavior. something like
"with TLS and no username/password parameters, SASL EXTERNAL is used; put credentials in trigger auth if you need PLAIN"

Comment thread pkg/scalers/rabbitmq_scaler.go
@rickbrouwer
Copy link
Copy Markdown
Member Author

Thanks @rickbrouwer for the PR. We might also need some documentation about the expected behavior. something like "with TLS and no username/password parameters, SASL EXTERNAL is used; put credentials in trigger auth if you need PLAIN"

Thanks, can you check if my note is clear enough? kedacore/keda-docs#1727

Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com>
@keda-automation keda-automation requested a review from a team April 5, 2026 08:22
@rickbrouwer
Copy link
Copy Markdown
Member Author

rickbrouwer commented Apr 5, 2026

/run-e2e rabbit
Update: You can check the progress here

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the RabbitMQ scaler’s AMQP/TLS connection setup to support certificate-based authentication by explicitly selecting SASL EXTERNAL when TLS is enabled and no credentials are provided, preventing amqp091-go from falling back to PLAIN auth from the URI.

Changes:

  • Refactors AMQP connection config creation into a new buildAMQPConfig helper.
  • Sets amqp.Config.SASL to ExternalAuth for TLS connections without credentials (to avoid unintended PLAIN fallback).
  • Adds unit tests for buildAMQPConfig SASL selection behavior and updates the changelog.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
pkg/scalers/rabbitmq_scaler.go Builds AMQP config via helper and conditionally enables SASL EXTERNAL for TLS/no-credential scenarios
pkg/scalers/rabbitmq_scaler_test.go Adds unit tests validating the new SASL-selection logic
CHANGELOG.md Documents the RabbitMQ TLS/SASL EXTERNAL behavior change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/scalers/rabbitmq_scaler.go Outdated
Comment thread pkg/scalers/rabbitmq_scaler.go
Comment thread pkg/scalers/rabbitmq_scaler_test.go
@rickbrouwer rickbrouwer added the waiting-author-response All PR's or Issues where we are waiting for a response from the author label Apr 8, 2026
rickbrouwer and others added 3 commits April 8, 2026 21:38
Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com>
Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com>
@rickbrouwer
Copy link
Copy Markdown
Member Author

@zroubalik can you run a new copilot review? thanks!

Removed duplicate entry for Prometheus Scaler logging.

Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com>
@rickbrouwer rickbrouwer added waiting-author-response All PR's or Issues where we are waiting for a response from the author and removed waiting-author-response All PR's or Issues where we are waiting for a response from the author labels Apr 9, 2026
Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com>
Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/scalers/rabbitmq_scaler_test.go Outdated
@rickbrouwer rickbrouwer removed the waiting-author-response All PR's or Issues where we are waiting for a response from the author label Apr 9, 2026
@rickbrouwer rickbrouwer requested a review from dttung2905 April 10, 2026 05:37
@zroubalik zroubalik requested review from Copilot and removed request for Copilot April 10, 2026 08:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com>
@rickbrouwer rickbrouwer added the waiting-author-response All PR's or Issues where we are waiting for a response from the author label Apr 13, 2026
Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com>
@rickbrouwer rickbrouwer removed the waiting-author-response All PR's or Issues where we are waiting for a response from the author label Apr 13, 2026
@rickbrouwer
Copy link
Copy Markdown
Member Author

rickbrouwer commented Apr 13, 2026

/run-e2e rabbit
Update: You can check the progress here

@rickbrouwer rickbrouwer added the Awaiting/2nd-approval This PR needs one more approval review label Apr 13, 2026
@wozniakjan
Copy link
Copy Markdown
Member

wozniakjan commented Apr 14, 2026

/run-e2e rabbit
Update: You can check the progress here

@wozniakjan wozniakjan enabled auto-merge (squash) April 14, 2026 13:03
@wozniakjan wozniakjan disabled auto-merge April 14, 2026 13:04
Copy link
Copy Markdown
Member

@wozniakjan wozniakjan left a comment

Choose a reason for hiding this comment

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

lgtm, good to merge as is

Comment thread pkg/scalers/rabbitmq_scaler.go
@rickbrouwer rickbrouwer added waiting-author-response All PR's or Issues where we are waiting for a response from the author ok-to-merge This PR can be merged and removed Awaiting/2nd-approval This PR needs one more approval review waiting-author-response All PR's or Issues where we are waiting for a response from the author labels Apr 14, 2026
@wozniakjan wozniakjan added Awaiting/2nd-approval This PR needs one more approval review skip-e2e and removed Awaiting/2nd-approval This PR needs one more approval review labels Apr 14, 2026
@wozniakjan wozniakjan enabled auto-merge (squash) April 14, 2026 15:02
@wozniakjan wozniakjan added the Awaiting/2nd-approval This PR needs one more approval review label Apr 14, 2026
@rickbrouwer rickbrouwer removed the Awaiting/2nd-approval This PR needs one more approval review label Apr 15, 2026
@rickbrouwer rickbrouwer disabled auto-merge April 15, 2026 06:20
@rickbrouwer rickbrouwer merged commit f282ce2 into kedacore:main Apr 15, 2026
36 checks passed
@rickbrouwer rickbrouwer deleted the issue-6840 branch April 15, 2026 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-merge This PR can be merged skip-e2e

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rabbitmq scaler with TLS enabled trigger not working for passwordless authentication

4 participants