opensearch-project / security-dashboards-plugin

🔐 Manage your internal users, roles, access control, and audit logs from OpenSearch Dashboards
https://opensearch.org/docs/latest/security-plugin/index/
Apache License 2.0
66 stars 147 forks source link

[BUG] Tenant is defaulting incorrectly based on the ordering of: opensearch_security.multitenancy.tenants.preferred #2019

Open derek-ho opened 4 days ago

derek-ho commented 4 days ago

What is the bug? Even when a default tenant is set, when logging in the default tenant selected still varies based on the value of opensearch_security.multitenancy.tenants.preferred. For example, if I have selected private as the default tenant but I have a value of opensearch_security.multitenancy.tenants.preferred set as ['Global', 'Private'], users will be automatically logged into the global tenant. How can one reproduce the bug? See above

What is the expected behavior? Whatever is set as the default tenant should be logged in. What is your host/environment?

Do you have any screenshots? This issue existed for a while, but has become bigger impact due to recent changes that removed the tenant picker from automatically popping up if the default tenant is set. Do you have any additional context? No

derek-ho commented 3 days ago

Most likely culprit: https://github.com/opensearch-project/security-dashboards-plugin/blob/main/public/apps/login/login-page.tsx#L53

derek-ho commented 3 days ago

Actually here is the issue: https://github.com/opensearch-project/security-dashboards-plugin/blob/main/server/auth/types/authentication_type.ts#L179

derek-ho commented 2 days ago

https://github.com/opensearch-project/security-dashboards-plugin/blob/main/server/backend/opensearch_security_client.ts#L41