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
71 stars 162 forks source link

[BUG] `oidcHash`/`redirectHash` ignored when using Keycloak authentication #2119

Open heto-soptim opened 2 months ago

heto-soptim commented 2 months ago

What is the bug? We are using OpenSearch Dashboards and have this plugin enabled to log in via Keycloak SSO (OIDC). We recently noticed that hash links (such as set filters) are lost when using that login method. When returning from the OIDC login process, /auth/openid/login immediately redirects to the target page, skipping redirectUrlFragment and ignoring the previously set oidcHash.

Consider the following (simplified) location chain:

What is the expected behavior? Based on openid/routes.ts, ll. 154 ff., the service should have extracted redirectHash as being true from the cookie previously set at ll. 136 ff., thereby enacting a redirect to /auth/openid/redirectUrlFragment?nextUrl=%2Fapp%2Ftest1#test2 and restoring the oidcHash once the login is complete.

The cookie itself appears functional, and nextUrl is extracted from it successfully. redirectUrlFragment and oidcHash also work as intended when forcing the former into the location chain (e.g. by starting from /app/login?nextUrl=%2Fauth%2Fopenid%2FredirectUrlFragment%3FnextUrl%3D%252Fapp%252Ftest1#test2), but this should not be a permanent workaround.

What is your host/environment?

cwperks commented 2 months ago

[Triage] @HETO-SOPTIM Thank you for filing this issue. I found another issue on this repo that may be related as well: https://github.com/opensearch-project/security-dashboards-plugin/issues/1823