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
70 stars 152 forks source link

[BUG] Copying Short URL is not adding the security_tenant query parameter #1769

Closed devardee closed 5 months ago

devardee commented 7 months ago

What is the bug?

In Dashboards, to share visualizations we generate short url's and click on Copy link button. The copied url is not adding the security_tenant query parameter.

How can one reproduce the bug? Steps to reproduce the behavior: Adding the screen capture

What is the expected behavior? The copied link should have the security_tenant query parameter. So that the short link can be resolved correctly.

What is your host/environment?

Do you have any screenshots? Yes

https://github.com/opensearch-project/security-dashboards-plugin/assets/80896069/2212cf20-afd4-47b5-982e-001eb2b0fccf

Do you have any additional context? No

cwperks commented 7 months ago

@devardee There was a recent PR related to tenancy and short links that should resolve the tenant when the short URL is used: https://github.com/opensearch-project/security-dashboards-plugin/pull/1462

Edit: I see, the PR above will ensure the user gets logged into the tenant specified in the URL but this issue is around the copy link button not including the url param for security_tenant.

sumukhswamy commented 7 months ago

@cwperks I am facing a similar issue

https://github.com/opensearch-project/security-dashboards-plugin/assets/107440906/c80e3eb8-1114-4b55-b48a-8d79e052366d

where when I copy the link and open it in a new browser session, I get this error {"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred."}

stephen-crawford commented 7 months ago

[Triage] Hi @devardee, thanks for filing an issue. We can probably resolve this issue in a similar way to #1462, so we can close this when a fix is put in place to correct this behavior.

cwperks commented 7 months ago

I reproduced the error on the 2.12 release and see this error in the dashboards logs.

opensearch-dashboards-1  | {"type":"log","@timestamp":"2024-02-23T15:50:14Z","tags":["error","http","server","OpenSearchDashboards"],"pid":1,"message":"TypeError: Cannot read properties of undefined (reading 'location')\n    at addTenantParameterToResolvedShortLink (/usr/share/opensearch-dashboards/plugins/securityDashboards/server/multitenancy/tenant_resolver.ts:213:46)\n    at /usr/share/opensearch-dashboards/plugins/securityDashboards/server/plugin.ts:130:46\n    at interceptPreResponse (/usr/share/opensearch-dashboards/src/core/server/http/lifecycle/on_pre_response.js:107:30)\n    at exports.Manager.execute (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/toolkit.js:57:29)\n    at Request._invoke (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:398:55)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at Request._postCycle (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:469:32)\n    at Request._reply (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:448:9)"
derek-ho commented 5 months ago

Completed by @cwperks in: https://github.com/opensearch-project/security-dashboards-plugin/pull/1804