SQLLab page access with insufficient permissions is not redirecting #31513
Labels
authentication:access-control
Rlated to access control
sqllab
Namespace | Anything related to the SQL Lab
Bug description
The bug involves a user without the admin or sql_lab roles being allowed to access the SQLLab editor page. When on this page, they are unable to do anything, as the backend correctly refuses to send through any data to an unauthenticated account. However, the user is not redirected off this page as intended, and instead is presented with an Unexpected Error header. To achieve this bug:
The expected behavior here (as occurred in previous Superset versions) is that the user gets redirected to the home page with an "Access denied" toast notifying them of their insufficient permissions. The observed behavior is that they stay on this page, which is marked with an Unexpected Error header.
Attached below are the screenshots as the error occurs/appears in the master branch, using the
docker-compose-non-dev.yml
docker compose file. That is, the errors displayed in the screenshots are what appears in production.Screenshots/recordings
Superset version
master / latest-dev
Python version
3.10
Node version
16
Browser
Firefox
Additional context
I narrowed the bug down specifically to commit 5ab1e7e, to the changes made in the following file:
superset-frontend/src/features/datasets/AddDataset/DatasetPanel/MessageContent.tsx
. Specifically, changing the span thatonClick
redirected the page to /superset/sqllab into a SPA react-router link. This SPA<Link>
component appears to skip the permissions check, allowing the user onto the SQLLab page, although I am unsure why. This can be verified by refreshing the broken SQLLab page, or reverting the<Link>
into a<a>
element, which causes Superset to correctly re-route the user to the home page.The unexpected error in the frontend (if viewed in development mode) reveals that the SQLLab editor page is throwing an error due a requisite prop being
undefined
. This happens because the SQLLab page is displayed but no data is sent through from the backend due to insufficient permissions, so the data is undefined.Checklist
The text was updated successfully, but these errors were encountered: