[ 
https://issues.apache.org/jira/browse/KNOX-3618?focusedWorklogId=1057061&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1057061
 ]

ASF GitHub Bot logged work on KNOX-3618:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 25/Nov/26 09:41
            Start Date: 25/Nov/26 09:41
    Worklog Time Spent: 10m 
      Work Description: smolnar82 opened a new pull request, #1545:
URL: https://github.com/apache/knox/pull/1545

   [KNOX-3618](https://issues.apache.org/jira/browse/KNOX-3618) - LDAP proxy 
floods gateway.log with ERR_13207_VALUE_ALREADY_EXISTS warnings for memberOf
   
   ## What changes were proposed in this pull request?
   
   With recursive group resolution enabled, 
`LdapProxyBackend#addGroupMemberships` adds every resolved group DN to the 
entry's `memberOf`. The resolved list includes the direct groups, which are 
already on the entry: from the remote `memberOf` when `useMemberOf=true`, or 
because AD returns `memberOf` for `"*"` otherwise. The Directory API drops each 
duplicate but logs `ERR_13207_VALUE_ALREADY_EXISTS` at WARN, one line per 
direct group, per user entry, per lookup.
   
   The fix skips group DNs the entry already contains before calling 
`entry.add()`. `Entry.contains()` and the duplicate check in 
`DefaultAttribute.add()` use the same equality, so the resulting `memberOf` 
values, and the roles derived from them, are unchanged.
   
   ## How was this patch tested?
   
   - Added 
`LdapProxyBackendTest#testGetUserUseMemberOfRecursiveDoesNotReAddExistingMemberOf`,
 which captures WARN events from the `DefaultAttribute` logger and asserts that 
none contains `ERR_13207`. It fails without the fix and passes with it.
   - `mvn verify` on `gateway-server` for `LdapProxyBackend*Test` and 
`LDAPRolesLookupInterceptorTest` (including the static checks): all tests pass.
   
   ## Integration Tests
   
   No integration test added. The change only removes a log warning and doesn't 
change LDAP proxy responses; the unit test above covers the regression.
   




Issue Time Tracking
-------------------

            Worklog Id:     (was: 1057061)
    Remaining Estimate: 0h
            Time Spent: 10m

> LDAP proxy floods gateway.log with ERR_13207_VALUE_ALREADY_EXISTS warnings 
> for memberOf
> ---------------------------------------------------------------------------------------
>
>                 Key: KNOX-3618
>                 URL: https://issues.apache.org/jira/browse/KNOX-3618
>             Project: Apache Knox
>          Issue Type: Task
>            Reporter: Sandor Molnar
>            Assignee: Sandor Molnar
>            Priority: Major
>             Fix For: 3.1.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When recursive group resolution is enabled, the LDAP proxy backend floods 
> gateway.log with one WARN per direct group, per user entry, per lookup:
> {noformat}
> WARN  entry.DefaultAttribute (DefaultAttribute.java:add(1099)) - 
> ERR_13207_VALUE_ALREADY_EXISTS The value 
> 'CN=group1,OU=Groups,DC=example,DC=com' already exists in the attribute 
> (memberOf)
> {noformat}
> *Root cause:* {{LdapProxyBackend#addGroupMemberships}} adds every resolved 
> group DN to the entry's {{memberOf}}. The resolved list includes the direct 
> groups, which are already on the entry (from the remote {{memberOf}} when 
> {{useMemberOf=true}}, or because AD returns {{memberOf}} for {{"*"}} 
> otherwise). The Directory API drops the duplicate but logs a warning each 
> time.
> Group membership results are correct; the issue is log noise only.
> *Fix:* skip group DNs that the entry already contains before calling 
> {{entry.add()}}.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to