mikebridge commented on code in PR #44094:
URL: https://github.com/apache/superset/pull/44094#discussion_r4008447910


##########
superset/mcp_service/dashboard/tool/manage_dashboard_certification.py:
##########
@@ -92,6 +98,25 @@ def manage_dashboard_certification(
             warnings=["No fields provided; dashboard unchanged."],
         )
 
+    # Externally managed dashboards refuse certification CHANGES (the
+    # no-field inspect path above still returns current values): their
+    # source of truth lives outside Superset, so a badge set here would be
+    # overwritten (or drift from the certifying system) on the next
+    # external sync. This tool writes by direct attribute assignment +
+    # commit rather than through a command, so no command-layer check can
+    # protect it — the refusal must live in the tool itself, after the
+    # editorship check, where a caller with no edit rights keeps getting
+    # the plain editorship denial.
+    if dashboard.is_managed_externally:
+        return ManageDashboardCertificationResponse(

Review Comment:
   Confirmed real in shape, deferred to the tracked hoist rather than this PR: 
the check reads the already-loaded row and nothing re-verifies the flag inside 
the transaction that commits (manage_dashboard_certification.py — check at the 
guard, direct attribute writes + `db.session.commit()` ~40 lines later, no 
lock/re-read), so a concurrent sync flipping `is_managed_externally` between 
the two can let one certification write land on a newly-managed dashboard. Same 
TOCTOU class as the entity-lock work in #44027/#44091, and the right fix is the 
same shape — re-read/lock the flag in the writing transaction. It belongs in 
sc-120483 (the shared managed-externally hoist for ALL the governance tools 
that share this direct-commit path), where one helper can own gate + re-verify 
for owners/roles/update_dashboard/certification together instead of four 
hand-rolled copies; noted on that ticket's scope. Consequence bound meanwhile: 
a lost race produces one drifting write that the next externa
 l sync overwrites — the exposure the gate narrows, not a privilege change.



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