feat: Add reverse group lookup for LDAP servers that do not return memberOf#19432
Open
JWuCines wants to merge 2 commits into
Open
feat: Add reverse group lookup for LDAP servers that do not return memberOf#19432JWuCines wants to merge 2 commits into
JWuCines wants to merge 2 commits into
Conversation
FrankChen021
reviewed
May 8, 2026
Member
FrankChen021
left a comment
There was a problem hiding this comment.
| Severity | Findings |
|---|---|
| P0 | 0 |
| P1 | 0 |
| P2 | 1 |
| P3 | 0 |
| Total | 1 |
This is an automated review by Codex GPT-5
fc3d1cf to
a81ccf7
Compare
FrankChen021
reviewed
May 9, 2026
Member
FrankChen021
left a comment
There was a problem hiding this comment.
Reviewed 8 of 8 changed files. The reverse group lookup now runs only after password verification, and I found no remaining PR-caused correctness issues in the LDAP reverse lookup changes.
This is an automated review by Codex GPT-5
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.
Description
When using LDAP servers that do not return the
memberOfattribute in user search results, group-based authorization denies all requests because Druid cannot determine the user's group memberships. This is a known issue with LDAP servers such as OpenLDAP, wherememberOfis either not enabled by default (it requires thememberofoverlay module) or is stored as an operational attribute that Java JNDI cannot retrieve — even whenldapsearchreturns it correctly.This PR adds an optional reverse group lookup mechanism to
LDAPCredentialsValidator. When configured, if the user search does not return amemberOfattribute, Druid searches group entries to find which groups contain the user's DN and injects the resolved group DNs as syntheticmemberOfvalues into theSearchResult. The existingLDAPRoleProvider(authorizer) then processes these groups as usual, requiring no changes.The feature is disabled by default. It activates only when both
groupBaseDnandgroupSearchare configured and the user search result lacksmemberOf.Added reverse group lookup to LDAPCredentialsValidator
Added
populateMemberOfFromGroupSearch()method that performs a reverse LDAP search (e.g.,(uniqueMember=<userDN>)) against the configured group base DN. The method:setReturningAttributes(new String[]{"1.1"})to request only the DN, minimizing response size.encodeForLDAP(userDn, true)to prevent LDAP filter injection.NamingExceptioninternally and logs an error, so a misconfigured group search does not block user authentication — the user proceeds without group memberships.Added group search configuration to BasicAuthLDAPConfig
Added two optional fields (
groupBaseDn,groupSearch) with a backward-compatible constructor that delegates to the new constructor withnulldefaults. AddedisGroupSearchConfigured()convenience method.Added helper methods for readability
hasMemberOfAttribute(SearchResult): checks ifmemberOfis present on the search result.isGroupSearchConfigured(): checks if both group search properties are set.Added embedded integration test for reverse group lookup
LdapReverseGroupLookupAuthResource: ExtendsLdapAuthResourceto addgroupBaseDnandgroupSearchproperties to the LDAP credentials validator configuration.BasicAuthLdapReverseGroupLookupTest: ExtendsBasicAuthLdapConfigurationTestto run the full LDAP auth test suite with reverse group lookup enabled. Verifies that group-based authorization works on OpenLDAP (which does not returnmemberOfby default).Updated documentation
docs/development/extensions-core/druid-basic-security.md: Added property reference entries forgroupBaseDnandgroupSearch.docs/operations/auth-ldap.md: Added "Group search reverse lookup configuration" section explaining the problem and configuration. Updated the existing info box to reference both manual role mapping and the new reverse lookup as alternatives.Updated spellcheck dictionary
website/.spelling: AddedDNandJNDIto the global dictionary to fix 5 spellcheck errors in the new documentation.Release note
Added support for LDAP group-based authorization on servers that do not return the
memberOfattribute (e.g., OpenLDAP). ConfiguregroupBaseDnandgroupSearchon the LDAP credentials validator to enable a reverse group lookup that resolves group memberships automatically.Key changed/added classes in this PR
BasicAuthLDAPConfigLDAPCredentialsValidatorLDAPCredentialsValidatorTestLdapReverseGroupLookupAuthResourceBasicAuthLdapReverseGroupLookupTestThis PR has: