You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "lindenh (via GitHub)" <gi...@apache.org> on 2024/02/06 20:09:27 UTC
Re: [PR] fix: prevent guest user from modifying metrics [superset]
lindenh commented on PR #26749:
URL: https://github.com/apache/superset/pull/26749#issuecomment-1930672542
Hey, super glad this got prioritized. I've just pulled this change in on top of a fork of 3.0.2, so if there have been any changes in particular that would change the following please let me know, but we have seen two issues:
1. For big number charts, we primarily have been using saved metrics. When using them, we are seeing this error out:
February 06, 2024 at 10:53 (UTC-6:00) | File "/app/superset/security/manager.py", line 1927, in raise_for_access | 94b81be5bee24fc985dd3ce245f9cc46 | superset_app
-- | -- | -- | --
February 06, 2024 at 10:53 (UTC-6:00) | if form_data.get("metrics", []) != stored_chart.params_dict["metrics"]: | 94b81be5bee24fc985dd3ce245f9cc46 | superset_app
February 06, 2024 at 10:53 (UTC-6:00) | KeyError: 'metrics' | 94b81be5bee24fc985dd3ce245f9cc46 | superset_app
February 06, 2024 at 10:53 (UTC-6:00) | 2024-02-06 16:53:41,586:ERROR:superset.views.base:'metrics' | 94b81be5bee24fc985dd3ce245f9cc46 | superset_app
February 06, 2024 at 10:53 (UTC-6:00) | Traceback (most recent call last): | 94b81be5bee24fc985dd3ce245f9cc46 | superset_app
February 06, 2024 at 10:53 (UTC-6:00) | File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1823, in full_dispatch_request | 94b81be5bee24fc985dd3ce245f9cc46 | superset_app
Which tells me that we might want this line:
```
if form_data.get("metrics", []) != stored_chart.params_dict["metrics"]
```
to be
```
if form_data.get("metrics", []) != stored_chart.params_dict.get(["metrics"], [])
```
We don't see this error when not using saved metrics. Changing to the .get() call also appears to fix the issue.
2. For some charts (it seems primarily/only mixed charts), this line is getting hit and denying access to charts even when the guest user hasn't actually changed anything:
```any(
query.metrics != stored_chart.params_dict["metrics"]
for query in query_context.queries
)```
For some reason, it seems the metrics from stored_chart will only contain one of the two metrics from the mixed chart.
I'd like to test this locally and may if I get more time, but I've been bumping into an incredible amount of weird configuration errors. If I'm able to test this in other ways I'll update here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org