Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] OpenSearch 2.11 401 errors even though valid Authorization header is sent #3678

Open
ed-ud opened this issue Nov 10, 2023 · 5 comments
Labels
bug Something isn't working triaged Issues labeled as 'Triaged' have been reviewed and are deemed actionable.

Comments

@ed-ud
Copy link

ed-ud commented Nov 10, 2023

Describe the bug
After upgrade from 2.10 to 2.11, we are getting 401 errors with reprompt for login when using a browser to make requests.

To Reproduce
Steps to reproduce the behavior:

  1. Go to any URL such as https://host.example.com:9200/_cat_nodes
  2. Login (BasicAuth username/password - internal user)
  3. Page is displayed
  4. Refresh the page
  5. User is re-prompted to login again
  6. Page is displayed
  7. Wait 5 minutes
  8. Refresh the page
  9. Page is displayed
  10. Refresh the page
  11. User is re-prompted to login again

Expected behavior
User should not be re-prompted for login over and over again.

Plugins
Stock set of plugins included with 2.11 "opensearch" package from repo:
https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/yum

Screenshots
N/A

Host/Environment (please complete the following information):

  • OS: Rocky Linux
  • Version: 9

Additional context
We have a 7-node cluster with 3 coord-only nodes and 4 dim nodes.
The problem didn't occur with 2.10... and started when the 2.11 update came in during a "yum upgrade".
I've reinstalled the cluster from scratch with 2.10 and the problem does not occur.
I've reinstalled the cluster from scratch with 2.11 and the problem occurs.
Using curl with username/password or with the admin cert works without issue in both 2.10 and 2.11.

When using Chrome and watching the requests, I can see the exact same Authorization header being sent during
a successful request, and when a request is made where the server returns a 401 error causing re-prompt for username/password.

I've tried both Chrome and Edge and they both see the same 401 errors.

It seems that if you wait for some number of minutes (5+) between page refreshes, you can avoid the bug, but that is not a suitable workaround. This oddity makes me think that there is some new "rate limit" sort of setting that is needed for 2.11.

@ed-ud ed-ud added bug Something isn't working untriaged Require the attention of the repository maintainers and may need to be prioritized labels Nov 10, 2023
@dblock dblock transferred this issue from opensearch-project/OpenSearch Nov 10, 2023
@cwperks
Copy link
Member

cwperks commented Nov 11, 2023

Hi @ed-ud , when using a browser to query opensearch directly, it will always challenge for a username and password since the URL does not contain username and password. After you fill out the prompt it will send the Authorization header with the request to OpenSearch. There is no session in the browser when querying opensearch directly, unlike when using OpenSearch dashboards and logging in with username and password. If you are using OpenSearch Dashboards, there is a Dev Tools section where you can make repeat requests against OpenSearch without having to re-login.

I don't believe the browser stores a cookie after you fill out the challenge box to remember the user on subsequent requests directly to <opensearch_host>:9200. Is it possible that there was a change in chrome that affected the behavior?

@ed-ud
Copy link
Author

ed-ud commented Nov 11, 2023

Yes, the browser does retain Basic Authentication credentials and submits an Authorization header with every request after login for the same URL or URL prefix, without re-prompting the user. That's just the way Basic Authentication works: https://datatracker.ietf.org/doc/html/rfc7617#section-2.2

As I said, the browser is sending the same Authorization header on successive requests, but in 2.11, OpenSearch ignores the valid header and replies with a 401 error (which causes the browser to re-prompt for credentials). OpenSearch 2.10 did not do this on successive requests with a valid Authorization header.

@scrawfor99
Copy link
Collaborator

[Triage] Hi @ed-ud, thank you for filing this issue. Looks like this could be an unintended change as part of 2.11 or that there is some other issue causing this behavior. Either way, someone will be able to look into this and hopefully identify the cause and fix.

Action items:

  • Determine cause of behavior & whether it is expected
  • Correct any introduced bugs

@scrawfor99 scrawfor99 added triaged Issues labeled as 'Triaged' have been reviewed and are deemed actionable. and removed untriaged Require the attention of the repository maintainers and may need to be prioritized labels Nov 13, 2023
@ed-ud
Copy link
Author

ed-ud commented Nov 28, 2023

Any luck determining the cause of this bug?

@cwperks
Copy link
Member

cwperks commented Dec 4, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged Issues labeled as 'Triaged' have been reviewed and are deemed actionable.
Projects
None yet
Development

No branches or pull requests

3 participants