RANGER-5793: Align delegated-admin checks for policy update and delet… - #1223
Open
vyommani wants to merge 1 commit into
Open
RANGER-5793: Align delegated-admin checks for policy update and delet…#1223vyommani wants to merge 1 commit into
vyommani wants to merge 1 commit into
Conversation
…e when access grants are unchanged
vyommani
requested review from
dineshkumar-yadav,
mneethiraj,
pradeepagrawal8184 and
ramackri
September 10, 2026 11:18
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.
What changes were proposed in this pull request?
RangerPolicyAdminImpl.isDelegatedAdminAccessAllowed()authorizes a modify on the access-typedelta between the submitted and stored policy. An empty delta was substituted with
_admin, whichany
delegateAdmin=trueitem satisfies regardless of access-type. The delta is empty for a DELETE(stored policy is passed as-is) and for changes to
isEnabled,policyPriority,validitySchedules,conditions,isDenyAllElseor thedelegateAdminflag, so a delegated-adminholding a single access-type on a resource could delete/disable/re-prioritize a policy whose other
access-types are outside their delegation.
getAllModifiedAccessTypes(): empty delta → full access-type set of the stored policy, same asthe existing resource-changed branch.
isPolicyScopeChanged(): a change to any of the fields above routes to the resource-changedbranch (full set on old and new policy), so bundling one with an otherwise-permitted access-type
change does not bypass the check.
collectAccessTypes(): oneSetper principal; the shared instance letaddAll()for oneprincipal leak into others and hide real changes.
Behaviour change: a delegated-admin with partial scope on a policy can no longer delete, toggle,
re-prioritize, re-scope or grant
delegateAdminon it (they could not read it before either).Access-type add/remove is still authorized on the delta only. All changes are deny-only.
How was this patch tested?
TestRangerPolicyAdminImpl: delete/disable/re-prioritize/delegateAdmin-toggle/combined-changedenied for partial scope and allowed for full scope; delta-only regression guard;
isPolicyScopeChangedper field; per-principal set isolation; recursive flip (RANGER-1718).TestServiceREST:deletePolicy(id)→ 403 when the modify check fails, store not called.change and the combined PUT (previously 204/200); full-scope user still succeeds.