Fix NPE in LDAPAuthorizationBackend when rolesearch disabled#6112
Fix NPE in LDAPAuthorizationBackend when rolesearch disabled#6112cwperks merged 4 commits intoopensearch-project:mainfrom
Conversation
Signed-off-by: tronboto <142882846+tronboto@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6112 +/- ##
==========================================
+ Coverage 74.78% 74.79% +0.01%
==========================================
Files 447 447
Lines 28467 28467
Branches 4328 4331 +3
==========================================
+ Hits 21289 21293 +4
+ Misses 5184 5180 -4
Partials 1994 1994
🚀 New features to boost your workflow:
|
Signed-off-by: tronboto <142882846+tronboto@users.noreply.github.com>
PR Reviewer Guide 🔍(Review updated until commit aeeab94)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to aeeab94
Previous suggestionsSuggestions up to commit aeeab94
|
|
Persistent review updated to latest commit aeeab94 |
…rch-project#6112) Signed-off-by: tronboto <142882846+tronboto@users.noreply.github.com> Signed-off-by: Terry Quigley <terry.quigley@sas.com>
Description
When
rolesearch_enabled: falseis configured and the user authenticated via ldap, an NPE is thrown:This happens because a connection to ldap is never opened in the user lookup block as the user's DN is already known. The code then falls through to the else branch that calls
getRoleFromEntry()to resolve role names, but connection is still null at this point, causing the NPE.The rolesearch block (and the nested roles block) already have null guards which explains why enabling rolesearch worked as a workaround.
Issues Resolved
Fixes #5832
Is this a backport? No
Do these changes introduce new permission(s) to be displayed in the static dropdown on the front-end? No
Testing
Added
testLdapAuthorizationRolesearchDisabledWithLdapAuthContextwhich authenticates the user with anLDAPAuthenticationBackendthen callsaddRoleswithrolesearch_enabled: false.Check List