fix(explore): apply per-datasource access check on the legacy explore view#41425
fix(explore): apply per-datasource access check on the legacy explore view#41425sha174n wants to merge 4 commits into
Conversation
… view Mirror the per-datasource access check the /api/v1/explore command already performs (security_manager.raise_for_access(datasource=...)) on the deprecated /superset/explore/ view, so both paths apply the same per-object datasource check before rendering datasource metadata. Guarded for the placeholder (missing-dataset) case the view already supports. Adds a regression test.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #41425 +/- ##
==========================================
- Coverage 64.47% 64.45% -0.03%
==========================================
Files 2662 2662
Lines 145905 145817 -88
Branches 33669 33638 -31
==========================================
- Hits 94073 93982 -91
+ Misses 50128 50127 -1
- Partials 1704 1708 +4
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:
|
|
The flagged issue is correct. The test method @mock.patch("superset.security.SupersetSecurityManager.raise_for_access")
def test_explore_view_checks_datasource_access(self, mock_raise_for_access: mock.Mock) -> None:There are no other comments on this pull request to address. tests/integration_tests/core_tests.py |
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review Agent Run #1d61bf
Actionable Suggestions - 1
-
superset/views/core.py - 1
- CWE-552: Unhandled Security Exception · Line 510-511
Review Details
-
Files reviewed - 2 · Commit Range:
614848f..8dd1f7b- superset/views/core.py
- tests/integration_tests/core_tests.py
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.
Documentation & Help
Condense the explanatory comment on the per-datasource access check to match the file's terse style for security calls. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@bito-code-review The CWE-552 item is a false positive and I've resolved the inline thread. |
SUMMARY
Applies the same per-datasource access check the
/api/v1/explorecommand uses (security_manager.raise_for_access(datasource=...)) to the deprecated/superset/explore/view, so both paths apply a consistent per-object datasource check before rendering datasource metadata. The check is guarded for the placeholder (missing-dataset) case the view already supports, and runs ahead of the save-as/overwrite action paths so they share the same check.TESTING INSTRUCTIONS
Adds a regression test asserting the view runs the per-datasource check on the loaded datasource:
pytest tests/integration_tests/core_tests.py::TestCore::test_explore_view_checks_datasource_accessADDITIONAL INFORMATION