Skip to content

Comments

[PM-11981] Support LDAP membership with UID#841

Merged
eliykat merged 9 commits intobitwarden:mainfrom
sso-bitwarden:fixgroupMember
Oct 1, 2025
Merged

[PM-11981] Support LDAP membership with UID#841
eliykat merged 9 commits intobitwarden:mainfrom
sso-bitwarden:fixgroupMember

Conversation

@sso-bitwarden
Copy link
Contributor

@sso-bitwarden sso-bitwarden commented Aug 8, 2025

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-11981

📔 Objective

LDAP could have many structures. For group membership, it can be listed by DN and by UID. The current Directory Connector could handle DN, but failed to cater to UID. This PR is to improve and cater for both DN and UID

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@sso-bitwarden sso-bitwarden requested a review from a team as a code owner August 8, 2025 04:39
@sso-bitwarden sso-bitwarden requested a review from JimmyVo16 August 8, 2025 04:39
@CLAassistant
Copy link

CLAassistant commented Aug 8, 2025

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Aug 8, 2025

Codecov Report

❌ Patch coverage is 81.48148% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 13.15%. Comparing base (e74546e) to head (b0dbf2b).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/services/ldap-directory.service.ts 84.61% 2 Missing and 2 partials ⚠️
src/services/sync.service.integration.spec.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##            main     #841      +/-   ##
=========================================
+ Coverage   7.72%   13.15%   +5.42%     
=========================================
  Files         68       68              
  Lines       2757     2775      +18     
  Branches     477      482       +5     
=========================================
+ Hits         213      365     +152     
+ Misses      2529     2381     -148     
- Partials      15       29      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@eliykat eliykat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR Sugi!

This adds uid support, but #177 also mentions supporting nested groups specified by cn. Do you need support for nested groups by cn as well, or is not blocking at this stage? Either way I'm OK with doing that in another PR.

The main thing missing here is test coverage. Our current integration tests are in ldap-directory.service.integration.spec.ts. More info in the contributing docs, but basically it spins up a local ldap instance and performs a sync to make sure the test directory data matches the expected sync requests sent to the Bitwarden server.

You would need to add some members and groups using uids and then assert that they are correctly parsed. Existing tests should provide examples.

EDIT: it would also be ideal to add a nested group in our test data, as that is untested at the moment but this logic is touched on by your changes.

@@ -193,13 +193,20 @@ export class LdapDirectoryService implements IDirectoryService {
);
const userPath = this.makeSearchPath(this.syncConfig.userPath);
const userIdMap = new Map<string, string>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To match my suggestion above: userIdMap -> userDnMap

@eliykat eliykat changed the title fix LDAP membership with UID [PM-11981] Support LDAP membership with UID Aug 12, 2025
@eliykat eliykat self-requested a review September 20, 2025 02:45
@github-actions
Copy link
Contributor

github-actions bot commented Sep 20, 2025

Logo
Checkmarx One – Scan Summary & Details83ebc5f4-1d50-44d6-a740-58f443c6d091

New Issues (1)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
MEDIUM CVE-2025-10890 Npm-electron-38.1.0
detailsDescription: The google chrome version prior to 140.0.7339.207 is vulnerable to Side-channel information leakage in V8.
Attack Vector: NETWORK
Attack Complexity: HIGH

ID: nb47gCvQ3c3%2FZDhEio5ufnnL5F7Ue1x0iGsFiePlhK0%3D
Vulnerable Package

Copy link
Member

@eliykat eliykat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor tweaks, then we can pass it to QA 🙌

Please re-request my review once you've made the changes.

@sonarqubecloud
Copy link

eliykat
eliykat previously approved these changes Sep 30, 2025
@eliykat eliykat dismissed their stale review September 30, 2025 06:41

Approved but needs QA first

@eliykat eliykat merged commit 77ea7a3 into bitwarden:main Oct 1, 2025
18 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Group members are not synced with FreeIPA LDAP (lack of uid and cn member support?) LDAP group members are not synced correctly

4 participants