Skip to content

Conversation

PeteGillinElastic
Copy link
Member

@PeteGillinElastic PeteGillinElastic commented Oct 13, 2025

This fixes a bug in the reindex API where it did not correctly validate the request parameters for authenticating with a remote source using basic auth. These require both username and password, and providing only one or the other is a user error.

  1. Prior to this change, a reindex request which set source.remote.username but not source.remote.password would result in a response with HTTP status code 500 (Internal Server Error). This will now result in a response with HTTP status code 400 (Bad Request).

  2. Prior to this change, a reindex request which set source.remote.password but not source.remote.username would normally result in a response with HTTP status code 401 (Unuauthorized). (If the remote cluster does not require authentication, or if an API key or some other form of authentication is provided, the request would succeed, with the password silently ignored.) This will now result in a response with HTTP status code 400 (Bad Request).

The new behaviour more correctly indicates to the user that there is an error in their request.

Closes #135925

This fixes a bug in the reindex API where it did not correctly
validate the request parameters for authenticating with a remote
source using basic auth, which requires both username and password.

1. Prior to this change, a reindex request which set
`source.remote.username` but not `source.remote.password` would result
in a response with HTTP status code 500 (Internal Server Error). This
will now result in a response with HTTP status code 400 (Bad Request).

2. Prior to this change, a reindex request which set
`source.remote.password` but not `source.remote.username` would
normally result in a response with HTTP status code 401
(Unuauthorized). (If the remote cluster does not require
authentication, or if an API key or some other form of authentication
is provided, the request would succeed, with the password silently
ignored.) This will now result in a response with HTTP status code 400
(Bad Request).
@PeteGillinElastic PeteGillinElastic added >bug :Data Management/Indices APIs APIs to create and manage indices and templates auto-backport Automatically create backport pull requests when merged v8.19.6 v9.1.6 v8.18.9 v9.2.1 v9.3.0 labels Oct 13, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @PeteGillinElastic, I've created a changelog YAML for you.

@elasticsearchmachine
Copy link
Collaborator

Hi @PeteGillinElastic, I've updated the changelog YAML for you.

@PeteGillinElastic PeteGillinElastic marked this pull request as ready for review October 14, 2025 14:49
@elasticsearchmachine elasticsearchmachine added the Team:Data Management Meta label for data/management team label Oct 14, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

Copy link
Contributor

@seanzatzdev seanzatzdev left a comment

Choose a reason for hiding this comment

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

lgtm, thanks

Copy link
Contributor

@szybia szybia left a comment

Choose a reason for hiding this comment

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

lgtm!

left a nice-to-have, but i don't think it's that important so not blocking

@PeteGillinElastic PeteGillinElastic merged commit 34a79b1 into elastic:main Oct 14, 2025
34 checks passed
@PeteGillinElastic PeteGillinElastic deleted the reindex-remote-basic-auth-validation branch October 14, 2025 16:49
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.19
9.1
9.2

PeteGillinElastic added a commit to PeteGillinElastic/elasticsearch that referenced this pull request Oct 14, 2025
This fixes a bug in the reindex API where it did not correctly validate the request parameters for authenticating with a remote source using basic auth. These require both username and password, and providing only one or the other is a user error.

1. Prior to this change, a reindex request which set `source.remote.username` but not `source.remote.password` would result in a response with HTTP status code 500 (Internal Server Error). This will now result in a response with HTTP status code 400 (Bad Request).

2. Prior to this change, a reindex request which set `source.remote.password` but not `source.remote.username` would normally result in a response with HTTP status code 401 (Unuauthorized). (If the remote cluster does not require authentication, or if an API key or some other form of authentication is provided, the request would succeed, with the password silently ignored.) This will now result in a response with HTTP status code 400 (Bad Request).

The new behaviour more correctly indicates to the user that there is an error in their request.

Closes elastic#135925
PeteGillinElastic added a commit to PeteGillinElastic/elasticsearch that referenced this pull request Oct 14, 2025
This fixes a bug in the reindex API where it did not correctly validate the request parameters for authenticating with a remote source using basic auth. These require both username and password, and providing only one or the other is a user error.

1. Prior to this change, a reindex request which set `source.remote.username` but not `source.remote.password` would result in a response with HTTP status code 500 (Internal Server Error). This will now result in a response with HTTP status code 400 (Bad Request).

2. Prior to this change, a reindex request which set `source.remote.password` but not `source.remote.username` would normally result in a response with HTTP status code 401 (Unuauthorized). (If the remote cluster does not require authentication, or if an API key or some other form of authentication is provided, the request would succeed, with the password silently ignored.) This will now result in a response with HTTP status code 400 (Bad Request).

The new behaviour more correctly indicates to the user that there is an error in their request.

Closes elastic#135925
elasticsearchmachine pushed a commit that referenced this pull request Oct 14, 2025
This fixes a bug in the reindex API where it did not correctly validate the request parameters for authenticating with a remote source using basic auth. These require both username and password, and providing only one or the other is a user error.

1. Prior to this change, a reindex request which set `source.remote.username` but not `source.remote.password` would result in a response with HTTP status code 500 (Internal Server Error). This will now result in a response with HTTP status code 400 (Bad Request).

2. Prior to this change, a reindex request which set `source.remote.password` but not `source.remote.username` would normally result in a response with HTTP status code 401 (Unuauthorized). (If the remote cluster does not require authentication, or if an API key or some other form of authentication is provided, the request would succeed, with the password silently ignored.) This will now result in a response with HTTP status code 400 (Bad Request).

The new behaviour more correctly indicates to the user that there is an error in their request.

Closes #135925
elasticsearchmachine pushed a commit that referenced this pull request Oct 14, 2025
This fixes a bug in the reindex API where it did not correctly validate the request parameters for authenticating with a remote source using basic auth. These require both username and password, and providing only one or the other is a user error.

1. Prior to this change, a reindex request which set `source.remote.username` but not `source.remote.password` would result in a response with HTTP status code 500 (Internal Server Error). This will now result in a response with HTTP status code 400 (Bad Request).

2. Prior to this change, a reindex request which set `source.remote.password` but not `source.remote.username` would normally result in a response with HTTP status code 401 (Unuauthorized). (If the remote cluster does not require authentication, or if an API key or some other form of authentication is provided, the request would succeed, with the password silently ignored.) This will now result in a response with HTTP status code 400 (Bad Request).

The new behaviour more correctly indicates to the user that there is an error in their request.

Closes #135925
elasticsearchmachine pushed a commit that referenced this pull request Oct 14, 2025
This fixes a bug in the reindex API where it did not correctly validate the request parameters for authenticating with a remote source using basic auth. These require both username and password, and providing only one or the other is a user error.

1. Prior to this change, a reindex request which set `source.remote.username` but not `source.remote.password` would result in a response with HTTP status code 500 (Internal Server Error). This will now result in a response with HTTP status code 400 (Bad Request).

2. Prior to this change, a reindex request which set `source.remote.password` but not `source.remote.username` would normally result in a response with HTTP status code 401 (Unuauthorized). (If the remote cluster does not require authentication, or if an API key or some other form of authentication is provided, the request would succeed, with the password silently ignored.) This will now result in a response with HTTP status code 400 (Bad Request).

The new behaviour more correctly indicates to the user that there is an error in their request.

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

Labels

auto-backport Automatically create backport pull requests when merged >bug :Data Management/Indices APIs APIs to create and manage indices and templates Team:Data Management Meta label for data/management team v8.19.6 v9.1.6 v9.2.1 v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong/missing error when supplying username but not password or vice versa for reindex-from-remote

4 participants