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

[MD] multiple datasource doesn't throw 401 error as expected when security plugin enabled #2591

Closed
Tracked by #2592
zhongnansu opened this issue Oct 18, 2022 · 1 comment
Assignees
Labels
bug Something isn't working multiple datasource multiple datasource project v2.4.0 'Issues and PRs related to version v2.4.0'

Comments

@zhongnansu
Copy link
Member

zhongnansu commented Oct 18, 2022

Issue description

Security-dashboards-plugin has below logic to detect any 401 error on the page, and enforce reload of the page to achieve log out. This was intended to handle the session time out. However, in MD use case, since data source client could also throw 401 error during connection, if provided with invalid auth. Current logic in security plugin couldn't distinguish if 401 is from default opensearch cluster or from data source. And it will apply a reload, which overwrite the error toasts MD has, leading to a bad user experience.

https://github.com/opensearch-project/security-dashboards-plugin/blob/5d018b0130d311be625ad5dd00466054607a907b/public/utils/logout-utils.tsx#L38

Solution

short term solution is to find places to cast all 401 error thrown by data source client to 400

  • 401 error is returned by OSD request /internal/search/<search-strategy> which is defined in data plugin
  • the request flow is
    Create DS with wrong credential -> create index-pattern with this DS -> use index pattern to search -> search_intercepter.ts(client) issue the request -> search_strategy(server side) get the request -> opensearch-js client forward the request to talk to OS -> get 401 --> data plugin server side error handler -> http router error handler -> security plugin error intercepter at http router layer -> search intercepter error handler -> Browser(client)
@zhongnansu zhongnansu added bug Something isn't working multiple datasource multiple datasource project v2.4.0 'Issues and PRs related to version v2.4.0' labels Oct 18, 2022
@seraphjiang
Copy link
Member

good finding, thanks @zhongnansu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working multiple datasource multiple datasource project v2.4.0 'Issues and PRs related to version v2.4.0'
Projects
None yet
Development

No branches or pull requests

3 participants