Visitar URL original
fix(semantic-layer): require data access for semantic view edits by mikebridge · Pull Request #45154 · apache/superset · GitHub
Skip to content

fix(semantic-layer): require data access for semantic view edits - #45154

Merged
aminghadersohi merged 4 commits into
apache:masterfrom
mikebridge:sc-125596-semantic-view-write-access
Oct 14, 2026
Merged

aminghadersohi merged 4 commits into
apache:masterfrom
mikebridge:sc-125596-semantic-view-write-access

Conversation

@mikebridge

Copy link
Copy Markdown
Contributor

SUMMARY

Require data access as well as editorship when updating, deleting, or bulk-deleting semantic views. The commands use the existing view and parent-layer grants, preserving Admin behavior and all-or-nothing batch validation.

@aminghadersohi, could you take a look when convenient?

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Not applicable; no UI changes.

TESTING INSTRUCTIONS

With SEMANTIC_LAYERS enabled, verify updates, individual deletes, and bulk deletes for editors with a view grant or parent-layer grant, and for Admin. Confirm that a refused batch leaves all selected views unchanged.

Run the regression tests:

python -m pytest tests/unit_tests/commands/semantic_layer/view_data_access_test.py -q
  • Regression tests: 13 passed.
  • Focused semantic-layer verification and changed-file pre-commit checks passed.
  • Full unit suite: 24,221 passed; 6 accepted local baseline failures involving platform numeric precision, timezone data, and fixture PATH. CI remains authoritative.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags: SEMANTIC_LAYERS
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

mikebridge and others added 3 commits October 8, 2026 23:17
Updating, deleting and bulk-deleting a semantic view checked editorship but
not access to the view's data, unlike reading the view and editing a
semantic layer. The three commands now run the view's access check before
the editorship check and refuse with SemanticViewForbiddenError (403), the
same answer as reading the view. Bulk delete still refuses the whole batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he layer grant

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.38%. Comparing base (ab2c69f) to head (3e11315).
⚠️ Report is 71 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #45154      +/-   ##
==========================================
+ Coverage   82.84%   83.38%   +0.54%     
==========================================
  Files        3017     3023       +6     
  Lines      192709   205548   +12839     
  Branches    44914    48414    +3500     
==========================================
+ Hits       159642   171396   +11754     
- Misses      30033    30742     +709     
- Partials     3034     3410     +376     
Flag Coverage Δ
hive 34.73% <0.00%> (-0.63%) ⬇️
mysql 51.95% <0.00%> (-1.86%) ⬇️
postgres 51.94% <0.00%> (-1.88%) ⬇️
presto 36.55% <0.00%> (-0.65%) ⬇️
python 87.02% <100.00%> (+0.54%) ⬆️
sqlite 51.72% <0.00%> (-1.84%) ⬇️
unit 81.30% <100.00%> (+1.18%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mikebridge

Copy link
Copy Markdown
Contributor Author

Merged latest master in 3e11315fce to restart CI after the Docker Hub image-pull failures. Focused local tests and changed-file checks passed. This PR remains a draft.

@mikebridge
mikebridge marked this pull request as ready for review October 13, 2026 04:11
@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

CodeAnt PR Risk: Low Risk

  • The PR appears safe to merge; update and delete now check data access before allowing changes.
  • Tests cover view grants, parent-layer grants, admin access, and rejecting a bulk delete when any view lacks access.

Assessed commit: 3e11315fcea9

@EnxDev EnxDev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This brings the view commands in line with DeleteSemanticLayerCommand and UpdateSemanticLayerCommand, which already call raise_for_access() before the editorship check. The parametrized test covers the view grant, the layer grant and Admin for all three commands, and the bulk case stays all-or-nothing.

Looks good, no inline notes.

@aminghadersohi aminghadersohi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head 3e11315.

Verified:

  • Update, delete, and bulk delete of semantic views now call SemanticView.raise_for_access() before the editorship check, matching the existing layer commands and CreateSemanticViewsCommand. The SupersetSecurityException maps to SemanticViewForbiddenError, which the API already returns as 403.
  • These three commands are the only write paths for views (api.py update/delete/bulk_delete); no other callers of SemanticViewDAO.update/delete.
  • Bulk delete validates every view before SemanticViewDAO.delete, so a refused batch deletes nothing.
  • Ran tests/unit_tests/commands/semantic_layer/ and tests/unit_tests/semantic_layers/ locally: all pass apart from one env-only import check. Reverting the two source files makes 4 of the 13 new tests fail, so they cover the change.

@aminghadersohi
aminghadersohi merged commit bf0a9cc into apache:master Oct 14, 2026
114 checks passed
villebro pushed a commit that referenced this pull request Oct 16, 2026
)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Mike Bridge <michael.bridge@ext.preset.io>
(cherry picked from commit bf0a9cc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants