Repository navigation
feat: [ocisdev-1033] forward port - #12709
Merged
Merged
Conversation
Every graph LDAP create/update wrote the entry, then immediately re-read it back by DN solely to recover the entry ID for the response model. Against a replicated directory reached through a proxy, that read-back can hit a lagging replica and fail or return stale data. When oCIS generates the UUID itself (GRAPH_LDAP_SERVER_UUID disabled, the default), the read-back returns nothing new: create responses are now synthesized from the data already sent, and update responses are built by folding the applied modifications onto the entry read before the write. When the directory assigns the ID (GRAPH_LDAP_SERVER_UUID enabled), creates keep the existing read-back since the generated ID cannot otherwise be recovered. New ldap_writeback.go with two pure helpers: - attrsFromAddRequest: flatten an AddRequest for ldap.NewEntry (create paths) - applyModifyToEntry: fold a ModifyRequest (Replace/Add/Delete, case-insensitive, non-mutating, ByteValues populated for octet-string id parity) onto a copy of the pre-read entry (update paths) All 9 write sites updated: - creates (user, group, education user/class/school): synthesize when the ID is client-generated, keep the read-back when the server assigns it - updates (user, education user): fold the ModifyRequest onto the pre-read entry; the AccountEnabled trailing override and the rename read-back inside changeUserName are preserved (rename is out of scope) - education school update: updateSchoolProperties now returns its ModifyRequest so the caller can fold it; the displayName ModifyDN rename is folded as a displayName attribute replace - education class update: pre-read widened from name/id only to the full education-class attribute set so classification/externalID are not dropped from the response; the externalID ModifyDN rename is folded as an attribute replace Model builders are untouched, preserving the response shape. Existing update tests were reconciled: read-back Search mocks that are no longer issued were removed and the pre-read fixtures now carry the full baseline entry, with all assertions unchanged. OCISDEV-1033 Co-Authored-By: Claude Opus 4.8 <[email protected]>
Octet-string ID attributes (e.g. Active Directory's objectGUID) are assigned by the directory server and require GRAPH_LDAP_SERVER_UUID=true. With GRAPH_LDAP_SERVER_UUID=false oCIS generates the ID and writes it as a string UUID, so an octet-string ID attribute would be decoded from raw string bytes and produce a corrupt ID on both the read-back and the synthesize path. NewLDAPBackend now rejects this incompatible combination at startup instead of silently returning bad IDs. Also adds regression tests for the id-attribute and group-name lookup fixes: - CreateGroup / CreateEducationClass synthesize the response id under the configured GroupIDAttribute (not a hardcoded attribute name) - getLDAPGroupByNameOrID filters by the group name attribute, not the user one Co-Authored-By: Claude Opus 4.8 <[email protected]>
The synthesize-on-create test matched the read-back on a hard-coded createdDN whose correctness relied on the school base DN being empty. Match on ScopeBaseObject instead: DN-independent and precise about the read-back being eliminated. Co-Authored-By: Claude Opus 4.8 <[email protected]>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
9 tasks
2403905
enabled auto-merge (squash)
August 3, 2026 14:45
deyankiteworks
approved these changes
Aug 3, 2026
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.
feat: [ocisdev-1033] forward port