Skip to content

Commit

Permalink
RANGER-4403: security-zone validation updated to prevent duplicate re…
Browse files Browse the repository at this point in the history
…source entries - #2
  • Loading branch information
mneethiraj committed Sep 13, 2023
1 parent da68108 commit d4972f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ public RangerPolicyResourceSignature(RangerPolicy policy) {
}
}

public RangerPolicyResourceSignature(Map<String, List<String>> resources) {
this(toSignatureString(toPolicyResources(resources)));
public RangerPolicyResourceSignature(Map<String, RangerPolicyResource> resources) {
this(toSignatureString(resources));
}

// alternate to constructor that takes Map<String, List<String>>
public static RangerPolicyResourceSignature from(Map<String, List<String>> resources) {
return new RangerPolicyResourceSignature(toPolicyResources(resources));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ private boolean validateSecurityZoneService(String serviceName, RangerSecurityZo
}
}

RangerPolicyResourceSignature resourceSignature = new RangerPolicyResourceSignature(resource);
RangerPolicyResourceSignature resourceSignature = RangerPolicyResourceSignature.from(resource);

if (!resourceSignatures.add(resourceSignature.getSignature())) {
ValidationErrorCode error = ValidationErrorCode.SECURITY_ZONE_VALIDATION_ERR_DUPLICATE_RESOURCE_ENTRY;
Expand Down

0 comments on commit d4972f7

Please sign in to comment.