fix: filter user attached policy accesses on pull#207
Merged
EdouardDem merged 8 commits intoApr 13, 2026
Merged
Conversation
Contributor
Author
|
Hi @EdouardDem would you be able to review the changes to see if it fixes the issue. |
Member
|
Hi @legendac Thanks for the PR. I approved it. I'm waiting for the tests to pass and i'll publish a new version |
5b24ab7 to
630b96f
Compare
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.
Closes #170
Problem
When a policy is assigned directly to a user (rather than via a role), Directus creates an
accessrecord withrole = nullanduser = <uuid>. Two bugs stemmed from this:role = null(anduser = null). User-attached accesses also haverole = null, causing them to be mistakenly matched as the public policy.Changes
policies/id-mapper-client.ts— tightened the public policy filter to also requireuser = null, so user-attached accesses (role = null, user = uuid) are no longer mistaken for the public policy.policies/data-client.ts— addedroles.userto the fetched fields so user-attached accesses can be identified during pull.policies/data-mapper.ts— overridesmapIdsToSyncIdAndRemoveIgnoredFieldsto strip any access entries whererole = nullanduser != nullbefore they reach the dump.e2e/push-with-user-policy-assignment.ts— adds a new test asserting that user-attached accesses are absent from the pulled dump.