Repository navigation
fix(reports): check the report target as the identity the report runs as - #45698
Conversation
A report's chart or dashboard access was checked only as the saving user. When ALERT_REPORTS_EXECUTORS or the "Run As" choice resolved to a different identity that could not access the target, the report saved but could never deliver. For dashboards with tab anchors, URL params or native filters the executor failed building the permalink before the execution was claimed, so no log row was written, the state never changed and no one was notified; a plain dashboard URL failed as a generic screenshot error. - On create/update, resolve the executor the saved schedule will run as and check the target as that user, returning a field-level 422. Paused schedules, attachment-free alerts, unresolvable executors and edits that leave the target/executor/delivery unchanged are exempt, so an already-broken schedule can always be paused or edited. Only admins and self-executors are told the executor's username. - At execution, check dashboard access as the executor before building any URL and raise an error naming the executor and the security manager's reason (recovered from the DAO denial's cause, leaving the DAO's generic public message unchanged). The pre-claim permalink pre-commit skips this denial so the state machine records it: ERROR log, ERROR state and the editors' failure notification, which falls back to a plain dashboard link. The denial is not retried. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #45698 +/- ##
==========================================
- Coverage 84.62% 84.57% -0.05%
==========================================
Files 3069 3060 -9
Lines 205473 204702 -771
Branches 48295 47909 -386
==========================================
- Hits 173875 173130 -745
+ Misses 28305 28279 -26
Partials 3293 3293
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Regenerate messages.pot so it carries the three executor-access strings added by this change, which the template drift check requires. Make the unchanged-target shortcut in the executor access validation kind-aware. A report moved from a chart to a dashboard with the same numeric id previously matched the stored target and skipped the check. Release the integration test's report schedule in a finally block so a failing assertion cannot leak state into later tests. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
| if user is None or getattr(user, "is_anonymous", False): | ||
| return | ||
| try: | ||
| security_manager.raise_for_access(dashboard=self._report_schedule.dashboard) |
There was a problem hiding this comment.
Suggestion: This RBAC check ignores EXTRA_ACCESS_QUERY_EXCLUSIONS; an excluded executor passes save validation, then permalink creation raises uncaught DashboardNotFoundError before claiming or logging.
Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Api mismatch
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** superset/commands/report/execute.py
**Line:** 848:848
**Comment:**
*Api Mismatch: This RBAC check ignores `EXTRA_ACCESS_QUERY_EXCLUSIONS`; an excluded executor passes save validation, then permalink creation raises uncaught `DashboardNotFoundError` before claiming or logging.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fixThere was a problem hiding this comment.
Confirmed, and fixed in 0ed1af3. raise_for_access does not consult EXTRA_ACCESS_QUERY_EXCLUSIONS, but DashboardDAO.get_by_id_or_slug (used by the permalink command) does, so an executor the hook withholds the dashboard from passed both checks and then hit an unhandled DashboardNotFoundError before the claim. Now a withheld dashboard is treated as an executor access denial: validate_executor_target_access rejects it at save time, and _raise_for_executor_dashboard_access raises ReportScheduleExecutorAccessDeniedError before any permalink is built (covers single-tab, multi-tab and plain-URL paths), so the state machine records and notifies. Regression tests added in executor_target_access_test.py.
There was a problem hiding this comment.
✅ CodeAnt verified this suggestion was addressed in subsequent commits and marked this thread resolved as of 0ed1af3.
After the dashboard access check, the code now checks is_excluded_by_extra_access("dashboards", dashboard.id) and raises ReportScheduleExecutorAccessDeniedError for excluded dashboards.
If that's not right, unresolve this thread and CodeAnt will leave it open.
There was a problem hiding this comment.
✅ CodeAnt verified this suggestion was addressed in subsequent commits and marked this thread resolved as of 74a40cf.
After the dashboard access check, the code now checks is_excluded_by_extra_access("dashboards", dashboard.id) and raises ReportScheduleExecutorAccessDeniedError for excluded dashboards.
If that's not right, unresolve this thread and CodeAnt will leave it open.
There was a problem hiding this comment.
✅ CodeAnt verified this suggestion was addressed in subsequent commits and marked this thread resolved as of e7c849d.
After the normal dashboard access check, the code now checks is_excluded_by_extra_access("dashboards", dashboard.id) and raises ReportScheduleExecutorAccessDeniedError for excluded dashboards.
If that's not right, unresolve this thread and CodeAnt will leave it open.
There was a problem hiding this comment.
✅ CodeAnt verified this suggestion was addressed in subsequent commits and marked this thread resolved as of 982dc32.
After the normal dashboard access check, the code now checks is_excluded_by_extra_access("dashboards", dashboard.id) and raises ReportScheduleExecutorAccessDeniedError for excluded dashboards.
If that's not right, unresolve this thread and CodeAnt will leave it open.
…or's dashboard raise_for_access does not consult EXTRA_ACCESS_QUERY_EXCLUSIONS, but the permalink command's dashboard lookup does. An executor the hook withholds the dashboard from therefore passed the save-time check and the pre-claim access check, then hit an unhandled DashboardNotFoundError while building a tab permalink, aborting the run before it was claimed or logged. Treat a withheld dashboard as an executor access denial both when the schedule is saved and when the dashboard URLs are built. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Request changes: excluded dashboards still bypass the new error handling. All 795 unit tests passed, but two focused regression checks reproduced this gap; integration tests were not run. 🟡 Medium — Excluded dashboards still suppress failure notifications |
…lookup Dashboard exclusions make the permalink command answer with a not-found error, which only get_dashboard_urls translated into the executor access-denied error. Content generation and failure notifications reach the stored-state permalink through _get_url, so the not-found error escaped there, defeating the plain-link fallback and the editors' failure notification. Run the executor access check inside _get_tab_url so every caller sees the same access-denied error. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
Thanks for the catch, this was a real gap. Fixed in 74a40cf: |
rebenitez1802
left a comment
There was a problem hiding this comment.
Approve: commit 74a40cfd7b fixes the previous finding; the team found no new issues. All 523 unit tests and both exclusion regression checks passed. Integration tests were not run.
Resolve the messages.pot POT-Creation-Date conflict; the report executor access strings from this branch are retained. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… as (#45698) Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: sadpandajoe <[email protected]> Co-authored-by: Joe Li <[email protected]>
The quoted native-filter round-trip test patched BaseReportState._raise_for_executor_dashboard_access, which comes from master's #45698 and doesn't exist on 7.0, where get_dashboard_urls doesn't call it.
SUMMARY
A scheduled report's chart or dashboard access was checked only as the saving user. The identity the report actually runs as (the legacy
ALERT_REPORTS_EXECUTORSresolution, e.g. a fixed service account, or the SIP-209 "Run As" user) was never checked. If that identity couldn't see the target (for example, because access came from grants only the creator holds), the report saved successfully but could never deliver:DashboardAccessDeniedErrorbefore the execution was claimed. No execution log row was written, the report state never changed, and no one was notified. The reason only reached the Celery worker log. The editors' failure notification also built that permalink as the executor, so it failed too.This PR:
dashboard/chart. Exempt: paused schedules (so a broken schedule can always be paused), alerts without attachments, executors that can't be resolved until run time, and edits that leave the target, executor, delivery, and active state unchanged. The executor's username is shown only to admins or to a saver who is the executor; everyone else gets a generic message.ReportScheduleExecutorAccessDeniedError, which names the executor and the security manager's specific reason. The pre-claim permalink pre-commit step skips this denial, so the claimed state machine records it as an ERROR log row and ERROR state and notifies editors. The failure notification falls back to a plain dashboard link. The denial is not retried.DashboardDAO.get_by_id_or_slugand the permalink API/view are untouched and still return the generic "You don't have access to this dashboard." The specific reason is read from the denial's__cause__only inside report execution, so a custom security manager's denial text never reaches users without access.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A (backend only)
TESTING INSTRUCTIONS
Automated:
tests/unit_tests/commands/report/executor_target_access_test.py(new, 17 tests): save-time executor resolution and checks, exemptions, username disclosure, execution-time conversion of the denial using__cause__, and the pre-commit skip.tests/integration_tests/reports/api_tests.py: create/update returns 422 when the saving user can access the dashboard but the configured executor can't; a paused report still saves; an admin-chosen "Run As" user without access returns 422. These returned 201/200 before the fix.tests/integration_tests/reports/commands_tests.py: tab-permalink and plain-URL dashboard reports whose executor lacks access end with an ERROR log row, ERROR state, and an editors' email carrying the specific reason. Before the fix, no log row was written.tests/integration_tests/dashboards/permalink/api_tests.py: with a security manager that returns a specific denial reason, the permalink API and the/superset/dashboard/p/<key>/view still return the generic message.Manual:
ALERT_REPORTS_EXECUTORSwith a fixed user that cannot access dashboard D, while your own user can.Not covered: a real-webdriver run of the old plain-URL 404 behaviour. With this change the access check fails before the browser loads anything, so that path is no longer reached for this case.
ADDITIONAL INFORMATION
🤖 Generated with Claude Code