-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
fix: prevent guest users from changing columns #29530
Conversation
15467b8
to
08833b6
Compare
superset/security/manager.py
Outdated
@@ -145,9 +145,9 @@ def __init__(self, **kwargs: Any) -> None: | |||
RoleModelView.related_views = [] | |||
|
|||
|
|||
def freeze_metric(metric: Metric) -> str: | |||
def freeze_value(metric: Metric) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nitpicky, but maybe we want to also change the parameter name from metric
to something generic as well (such as value
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
D'oh, good point! I missed that!
superset/security/manager.py
Outdated
for metric in query.metrics or [] | ||
} | ||
# compare columns and metrics in form_data with stored values | ||
for key in ["metrics", "columns"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested via the browser (just inspecting the request the frontend sends to the /api/v1/chart/data
endpoint), but it's possible this structure changes until it gets to this point, so I could be wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments -- let me know your thoughts
Good point! I added |
3b395b8
to
bee3895
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick fixes! 🙌 LGTM!
Not a blocking comment, but I would just also add a test with a payload containing groupby
as opposed (or maybe both) to columns
.
Question from the PR review session: If the last PR that this builds on caused a lot of Issues for embedded users, will there be any additional fallout from this PR, and will we be available to address these concerns? |
Not sure if/how this intersects with this issue. |
@rusackas I'm not expecting as much trouble as the first PR, since this one just extends the first one for a few more attributes. |
SUMMARY
An extension to #26749, preventing guest users from modifying adhoc columns when requesting charts.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
Added unit tests.
ADDITIONAL INFORMATION