Repository navigation
fix(agent): apply the scope of collections reached through a relation - #2051
Open
ShohanRahman wants to merge 1 commit into
Open
ShohanRahman wants to merge 1 commit into
ShohanRahman wants to merge 1 commit into
Conversation
Read routes only fetched the scope of the collection they serve, so the columns a projection pulls from to-one relations ignored the scope set on those related collections, and a leaderboard aggregated its related collection under the root scope only. get, list, csv, list-related and csv-related now fetch the scope of every collection the projection reaches, and empty a related record that falls outside it, keeping the root row. The leaderboard intersects the aggregated collection's scope (and, for a many-to-many, the foreign collection's through the target relation) into its filter. Refs: PRD-907 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 new issue
|
|
Coverage Impact This PR will not change total coverage. Modified Files with Diff Coverage (8)
🛟 Help
|
Open
3 of 4 tasks
This branch has not been deployed
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.

fixes PRD-907
Read routes apply the scope of every collection they reach through a to-one relation, as well as the scope of the collection they serve. A related record outside its collection's scope is served empty, and the record it hangs off stays in the response.
What changes
AuthorizationService.getRelationScopes). The columns it reads are added to the query, the scope is evaluated on each related record (ConditionTree.match), and a record outside it is served asnull. The added columns are stripped before serialization.account: null, the same way as a card with no account.Notes for review
ConditionTree.match, so null handling follows the toolkit's matcher, not the datasource's SQL. For example,region != 'EU'keeps a holder whose region isNULL.skipRelationReadPermissionssays, because that option covers read permissions, not scopes.Tests
test/security/related-collection-scopes.test.tsdrives each route through the realAuthorizationService.test/utils/relation-scopes.test.tscovers the redaction itself: nested paths, a missing relation, and a deeper scope evaluated before its parent is emptied.Squash message
Definition of Done
General
Security
🤖 Generated with Claude Code