MID-9639 Fix authorization for reference searches#641
Open
Conversation
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
Fixes MID-9639 by applying model-level authorization preprocessing to object-owned reference searches.
The All accesses panel loads role memberships through model reference-search APIs over
roleMembershipRef. Before this change,ModelController.preProcessReferenceQuerySecurity(...)was effectively a TODO and returned the query unchanged. As a result, a user with denied read access toUserType/roleMembershipRefcould still see role membership references in the All accesses panel.This change applies authorization preprocessing for object-owned reference searches:
ObjectQueryUtil.extractOwnedByFilterForReferenceSearch(...)securityEnforcer.preProcessObjectFilter(...)NoneFilterif the owner search or reference item read is deniedroleMembershipRefreference searches.The same preprocessing is used for:
searchReferences(...)countReferences(...)searchReferencesIterative(...)Behavior
If the current principal is denied read access to
UserType/roleMembershipRef, model reference search now returns:searchReferences(...)countReferences(...)searchReferencesIterative(...)Malformed reference-search query shapes are still rejected consistently with repository validation.
NoneFilterremains a valid empty query.Tests
Added regression coverage in
TestSecurityBasic:test321AutzDenyReadRoleMembershipRefReferenceSearchtest322AutzDenyReadRoleMembershipRefReferenceCounttest323AutzDenyReadRoleMembershipRefReferenceIterativeThese tests fail on master because the denied user still sees/counts/iterates two
roleMembershipRefvalues, and should pass with this patch.Manual verification
Reproduced on master through GUI:
assignmentandroleMembershipRef.With this patch, the All accesses panel should not show those role membership references.