mikebridge opened a new pull request, #44094:
URL: https://github.com/apache/superset/pull/44094

   ### SUMMARY
   
   The sc-120051 write-surface inventory (which walked every path that mutates 
chart/dashboard/dataset content outside the gated `UpdateCommand`s) found 
exactly one live command-layer bypass: the `manage_dashboard_certification` MCP 
tool writes `certified_by` / `certification_details` — exported governance 
fields — by direct model-attribute assignment + `db.session.commit()`. It 
therefore never inherits the server-side `is_managed_externally` gate the 
ordinary update paths carry, so an MCP caller could badge or un-badge an 
**externally managed** dashboard, for the next external sync to overwrite (or 
worse, leave the badge drifting from the certifying system of record).
   
   **Fix**: after the tool's editorship check (mirroring the command-layer 
ordering — a caller with no edit rights keeps getting the plain editorship 
denial), an externally managed dashboard is refused through the tool's 
structured `permission_denied` response, naming the reason. The write path is 
otherwise unchanged.
   
   Sibling context: the ordinary update/refresh/restore surfaces are gated in 
#44025/#44013; other MCP writers (`update_chart`, `update_dashboard`, 
`update_dataset_metric`) route through the gated commands and inherit the 
refusal; the DeleteCommands' exemption is an explicitly ratified policy (soft 
delete changes visibility, not content) documented separately.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — MCP tool behavior. Before: badge applied + committed on a managed 
dashboard. After: structured `permission_denied` response, nothing assigned, 
nothing committed.
   
   ### TESTING INSTRUCTIONS
   
   `pytest 
tests/unit_tests/mcp_service/dashboard/tool/test_manage_dashboard_certification.py`
 — 16 tests. The new `test_refuses_externally_managed_dashboard` pins the 
refusal (permission_denied + reason), that no attribute is assigned, and that 
`commit` is never called; reverting the production change flips exactly that 
test (stash-verified). The fixture change declares 
`is_managed_externally=False` explicitly — a bare `Mock` attribute is truthy 
and would otherwise trip the gate across the suite (real dashboards default the 
flag to `False`).
   
   Manual: flip `is_managed_externally` on a dashboard, call the 
`manage_dashboard_certification` MCP tool → `permission_denied: true` with the 
externally-managed reason; flip it back → badge applies.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01JRLEJS4mUqKBoPjSjviKUW
   


-- 
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]

Reply via email to