Skip to content

Commit

Permalink
[2.x] Avoid ConcurrentModificationException for User class fields (#5084
Browse files Browse the repository at this point in the history
)

Signed-off-by: shikharj05 <[email protected]>
(cherry picked from commit 05e56ec)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Feb 4, 2025
1 parent 0326d7a commit 8a173a8
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,10 @@ private Set<String> map(final User user, final TransportAddress caller) {
return Collections.emptySet();
}

final Set<String> securityRoles = new HashSet<>(user.getSecurityRoles());
final Set<String> securityRoles = new HashSet<>();
synchronized (user.getSecurityRoles()) {
securityRoles.addAll(user.getSecurityRoles());
}

if (rolesMappingResolution == ConfigConstants.RolesMappingResolution.BOTH
|| rolesMappingResolution == ConfigConstants.RolesMappingResolution.BACKENDROLES_ONLY) {
Expand Down

0 comments on commit 8a173a8

Please sign in to comment.