From a805843a0bc167b508d265b1bee2049b07463a8e Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Fri, 25 Aug 2023 11:11:13 -0700 Subject: [PATCH] Change to use copyof in getSecurityRoles in AuthCredentials class Signed-off-by: Ryan Liang --- src/main/java/org/opensearch/security/user/AuthCredentials.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/opensearch/security/user/AuthCredentials.java b/src/main/java/org/opensearch/security/user/AuthCredentials.java index f024fe271f..beb3ae1733 100644 --- a/src/main/java/org/opensearch/security/user/AuthCredentials.java +++ b/src/main/java/org/opensearch/security/user/AuthCredentials.java @@ -222,7 +222,7 @@ public Set getBackendRoles() { * @return Defensive copy of the security roles this user is member of. */ public Set getSecurityRoles() { - return new HashSet(securityRoles); + return Set.copyOf(securityRoles); } public boolean isComplete() {