fix(semantic-layers): apply datasource access checks on layer endpoints#41430
Open
sha174n wants to merge 3 commits into
Open
fix(semantic-layers): apply datasource access checks on layer endpoints#41430sha174n wants to merge 3 commits into
sha174n wants to merge 3 commits into
Conversation
…pdate/delete Add SemanticLayer.raise_for_access(), mirroring the existing SemanticView.raise_for_access(), and apply it on the single-layer GET (returning 404 when the layer is not accessible), update, and delete paths. This makes the per-object endpoints consistent with the list endpoint, which already filters via SemanticLayerDAO.find_all(). Adds unit coverage for the new model method and the command paths. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CreateSemanticViewCommand previously only checked that the parent layer existed. Call the parent layer's raise_for_access() during validation so a user without access to a layer cannot create a view under it, consistent with the access checks on the layer get/update/delete paths. The batch view-create endpoint reports this as a per-item error. Adds unit coverage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #41430 +/- ##
==========================================
- Coverage 64.48% 63.88% -0.60%
==========================================
Files 2661 2661
Lines 145642 145697 +55
Branches 33613 33618 +5
==========================================
- Hits 93912 93082 -830
- Misses 50029 50911 +882
- Partials 1701 1704 +3
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:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
Brings the per-object semantic layer endpoints in line with the list endpoint and with the semantic view endpoints for
datasource_accesshandling.SemanticLayerDAO.find_all()(used by the list endpoint) already scopes layers to the caller'sdatasource_accessgrants. This change introducesSemanticLayer.raise_for_access(), mirroring the existingSemanticView.raise_for_access(), and applies it consistently on:GET /api/v1/semantic_layer/<uuid>— returns 404 when the layer is not accessible to the callerPUTandDELETE /api/v1/semantic_layer/<uuid>— return 403 when not accessibleThis keeps single-object access behavior consistent with the list endpoint and with the semantic view resource. The feature is behind the
SEMANTIC_LAYERSflag (off by default).TESTING INSTRUCTIONS
Unit tests added for
SemanticLayer.raise_for_access()and for the get / update / delete / view-create command paths. Run:ADDITIONAL INFORMATION
SEMANTIC_LAYERSflagSEMANTIC_LAYERS