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 148 forks source link

Fixes an issue when loading unknown datasource causes page to crash #1947

Closed DarshitChanpura closed 3 weeks ago

DarshitChanpura commented 1 month ago

Description

Fixes an issue when entering an invalid dataSource id causes page to crash.

UnknownDataSourcePage component only displays when opensearch_security.multitenancy.enable_aggregation_view is set to true. When this setting is set to false, the page automatically reloads to the default dataSource.

Category

Bug Fix

Why these changes are required?

Issues Resolved

Testing

https://github.com/opensearch-project/security-dashboards-plugin/assets/35282393/b37b3255-4e2f-43dd-9a3d-041cc45fef80

https://github.com/opensearch-project/security-dashboards-plugin/assets/35282393/63418a13-8f33-4ebd-b03a-d26b4bc57f84

Check List

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 94.11765% with 2 lines in your changes missing coverage. Please review.

Project coverage is 71.07%. Comparing base (5fbc14e) to head (86c0b27).

Files Patch % Lines
.../apps/configuration/panels/auth-view/auth-view.tsx 80.00% 1 Missing :warning:
public/apps/configuration/unknown-datasource.tsx 50.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1947 +/- ## ========================================== + Coverage 70.61% 71.07% +0.46% ========================================== Files 97 98 +1 Lines 2600 2631 +31 Branches 380 393 +13 ========================================== + Hits 1836 1870 +34 + Misses 668 665 -3 Partials 96 96 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

DarshitChanpura commented 1 month ago

@kgcreative Would you mind giving this a look?

The proposed design of adding a button to switch to default cluster is not required in this case since the page auto-reloads to default cluster when aggregation view is disabled.

In the case where aggregation view is enabled, the user needs permissions to be able to read all data-source connections. Two possible outcomes in this case:

  1. If user has required read permission the page auto-reloads to default data-source connection in case of unknown data-source.
  2. If user doesn't have the required read permission, the following page appears: Screenshot 2024-05-14 at 11 01 18 AM

This is the new file that was introduced. Please let me know if any language needs to be changed.

derek-ho commented 1 month ago

I would maybe suggest:

The likely cause is that the aggregation view setting
            `opensearch_security.multitenancy.enable_aggregation_view` is enabled.
            Please contact your administrator to grant you access to global tenant to be able to
            view the data-sources or turn this feature off.
derek-ho commented 1 month ago

Can we move this into a panel, WDYT @kgcreative ? @cwperks what is the relative usage of this feature flag/ I know it is marked as experimental so maybe not high? Is it still worth it to add this?

cwperks commented 1 month ago

@cwperks what is the relative usage of this feature flag/ I know it is marked as experimental so maybe not high? Is it still worth it to add this?

@derek-ho there is no active work on the feature flag. This was intended to simplify sharing amongst tenants, but is now* being supplanted by workspaces. The feature flag is not supported and IMO can be removed.

derek-ho commented 1 month ago

Most of the relevant code bits have been moved to the latest PR: #1964 I would be in favor of closing this down if the setting is deprecated

DarshitChanpura commented 1 month ago

I agree if the feature flag is not relevant anymore this can be closed in favor of #1964, since all the important changes from this PR are present over there.

DarshitChanpura commented 3 weeks ago

Closing as this is not needed since aggregation view is an experimental feature