-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix potential unwarranted memberships in nested groups from LDAP #29329
Conversation
/backport to stable22 |
/backport to stable21 |
/backport to stable20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is fine, but I do not understand the description of the problem.
Why was caching everything a problem, the nested members ended up being duplicated in the member list?
Eventually the result are the validated entries in the $seen array. Let me give you a simple example:
|
Thank you for your explanation, I understand now. I read the code for _groupMembers, walkNestedGroups and _getGroupDNsFromMemberOf. I’m not sure what is the best way to fix this but adding a layer of local cache feels like making it worse. |
$list is just a working queue, it's empty eventually.
The runtime one? That's mostly to catch some of the performance that would get lost from fixing the erroneous behaviour. |
After talking with @come-nc i will take another look and see whether it is not possible by indeed caching the correct members by having a seperate/second array next to $seen to track them. |
- the issue was present only when using PHP based resolving of nested group members. Normally nested members are common in AD (and Samba4) and are resolved per LDAP_MATCHING_RULE_IN_CHAIN by default - resolving nested members is recursive - when the cache entry was created it happend for intermediate groups, too, containing members from the parent group - the check was added to only cache the root group with its members - a runtime cache stores intermediate ldap read results Signed-off-by: Arthur Schiwon <[email protected]>
@come-nc for the recursion i did not come across a mechanics that would allows the desired effect. My preference would be to get this in as is, also because the changes are simple easy to backport. A more sophisticated solution / restructuring would be better for a next major. I am also not having the time for this at the moment. Ok? |
4dcb6fd
to
8266f88
Compare
(rebased) |
@blizzz Is it possible to have a test for this (which would fail before the PR and pass after)? |
I have a separate item on my backlog to look again into integration tests with Samba4. |
/backport to stable23 |
Fix
Background
I found it when running the
occ group:list
command over all groups and afterwards (with a hot cache) checking the results for a single group in a similar way.The result should match with following LDAP query (number of group members have to be subtracted)
(obviously only with AD or Samba4)
In my test setup I have about 200 LDAP groups with nested members (including groups). About 80 groups are enabled in Nextcloud, the remaining groups may be intermediaries.