aminghadersohi commented on code in PR #44337:
URL: https://github.com/apache/superset/pull/44337#discussion_r4038165949
##########
tests/unit_tests/mcp_service/test_rbac_tool_enforcement.py:
##########
@@ -110,6 +110,24 @@
"write",
"Dataset",
),
+ (
+ "update_dataset",
+ {"dataset_id": 1, "description": "denied"},
+ "write",
+ "Dataset",
+ ),
+ (
+ "delete_dataset",
+ {"identifier": 1},
+ "write",
+ "Dataset",
+ ),
+ (
+ "restore_dataset",
+ {"identifier": 1},
+ "write",
+ "Dataset",
+ ),
Review Comment:
Doesn't reproduce at `a7739e4aa9`.
`superset/core/mcp/core_mcp_injection.py:205-207` sets
`_method_permission_name` to `"write" if "mutate" in tool_tags else "read"`
*before* `mcp_auth_hook` wraps the tool, so the `getattr(..., "read")` fallback
at `auth.py:397` never fires for these — all three declare `tags=["mutate"]`.
Running the file: 5 selected, 5 passed, 0 skipped, `delete_dataset` and
`restore_dataset` included. `generate_chart` is a pre-existing entry in the
same list with the identical shape (no `method_permission_name`, expects
`write`).
Flagging that the second half of the suggestion — aligning the test
expectation — would downgrade these two destructive tools to asserting
`can_read`.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]