Skip to content

fix(pulsar): scope auth header re-application on redirects#7692

Merged
rickbrouwer merged 1 commit into
kedacore:mainfrom
mateenali66:fix/7686-pulsar-redirect-auth
May 7, 2026
Merged

fix(pulsar): scope auth header re-application on redirects#7692
rickbrouwer merged 1 commit into
kedacore:mainfrom
mateenali66:fix/7686-pulsar-redirect-auth

Conversation

@mateenali66
Copy link
Copy Markdown
Contributor

the pulsar scaler overrides CheckRedirect so 307 redirects between brokers keep their Authorization header. it does that unconditionally, which means a redirect to a different host (or an https->http downgrade from a trusted adminURL with an open redirect) re-applies the bearer/basic credentials to the new target.

re-apply auth only when the redirect target shares the original request's hostname (port-stripped, case-insensitive) and does not downgrade the scheme. cross-host and https->http redirects fall through without setting the headers, so the redirect still happens but the credentials don't follow.

added TestPulsarRedirectAuthHostScopeGuard covering same-host (with port change), case-insensitive host match, cross-host, https->http downgrade, and plain http same-host. existing TestPulsarScalerRedirectNilPointerFix still passes.

note: pulsar deployments where peer brokers run on entirely different hostnames will now lose auth on the broker-to-broker hop, same as Go's stdlib default would. happy to relax the host check (subdomain match, or configurable allowlist) if that turns out to break legitimate setups.

Fixes #7686

The Pulsar scaler overrides CheckRedirect to keep Authorization headers
across 307 redirects so broker-to-broker handoffs work, but it did so
without checking the redirect target. A trusted adminURL induced into
issuing an open redirect, or a malicious adminURL pointed at the operator,
could harvest the bearer or basic credentials.

Re-apply auth only when the redirect target shares the original request's
hostname (port-stripped, case-insensitive) and does not downgrade an https
adminURL to http. Cross-host or downgraded redirects fall through with no
auth, so the request follows the redirect anonymously and the credentials
stay on the trusted host.

Signed-off-by: Mateen Anjum <mateenali66@gmail.com>
@mateenali66 mateenali66 requested a review from a team as a code owner April 27, 2026 06:02
@snyk-io
Copy link
Copy Markdown

snyk-io Bot commented Apr 27, 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

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 27, 2026 06:02
@rickbrouwer
Copy link
Copy Markdown
Member

rickbrouwer commented May 6, 2026

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

@rickbrouwer rickbrouwer added Awaiting/2nd-approval This PR needs one more approval review required:keda-v2.20 labels May 6, 2026
@rickbrouwer rickbrouwer removed the Awaiting/2nd-approval This PR needs one more approval review label May 7, 2026
@rickbrouwer rickbrouwer merged commit 9e2332a into kedacore:main May 7, 2026
28 checks passed
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.

Pulsar Scaler Insecure HTTP Redirect Handling

3 participants