Skip to content
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

[PM-13007] Replace ldapjs with ldapts #641

Merged
merged 9 commits into from
Nov 1, 2024

Conversation

eliykat
Copy link
Member

@eliykat eliykat commented Oct 10, 2024

🎟️ Tracking

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

📔 Objective

ldapjs is unmaintained. Replace it with ldapts, which is a TS fork from a previous version of ldapjs. It appears to be well maintained, and because it shares the same origin, it's a reasonably straightforward replacement.

The main changes are:

  • swap out calls to the old library with calls to the new library, minor changes to these interfaces
  • rewrite getAttrObj, getAttrVals and getAttr methods. ldapjs represented attributes as an array of key-value pairs, whereas ldapts stores these in a dict. Delete getAttrObj entirely because it's not really applicable here (it returned the key-value pair but now we can just index the value we want)
  • move tlsOptions construction into its own method
  • simplify calls to client.bind and client.startTLS (the old code explicitly returned new Promises and had callback chains etc, none of which appear necessary)
  • add typing and jsdoc comments where useful

Note that I added ldap integration tests in preparation for this change, we'll still have QA test manually particularly for Azure services, but they provide some assurance that it basically works.

📸 Screenshots

⏰ 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

Copy link

codecov bot commented Oct 10, 2024

Codecov Report

Attention: Patch coverage is 70.00000% with 21 lines in your changes missing coverage. Please review.

Project coverage is 8.46%. Comparing base (6db2840) to head (2a41d58).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/services/ldap-directory.service.ts 70.00% 13 Missing and 8 partials ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main    #641      +/-   ##
========================================
+ Coverage   2.21%   8.46%   +6.25%     
========================================
  Files         60      60              
  Lines       2662    2633      -29     
  Branches     475     467       -8     
========================================
+ Hits          59     223     +164     
+ Misses      2600    2392     -208     
- Partials       3      18      +15     

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

Copy link
Contributor

github-actions bot commented Oct 10, 2024

Logo
Checkmarx One – Scan Summary & Detailsbf1f77cb-6c48-4231-835b-834ab88e2996

No New Or Fixed Issues Found

Base automatically changed from ldap-integration-tests to main October 13, 2024 22:17
@eliykat eliykat force-pushed the ac/pm-13007/replace-ldapjs-with-ldapts branch from b457986 to 93f13b3 Compare October 13, 2024 22:19
@eliykat eliykat force-pushed the ac/pm-13007/replace-ldapjs-with-ldapts branch from 7073494 to 49b4ce7 Compare October 13, 2024 22:22
@eliykat eliykat marked this pull request as ready for review October 13, 2024 22:28
@eliykat eliykat requested a review from a team as a code owner October 13, 2024 22:28
@eliykat eliykat requested a review from r-tome October 13, 2024 22:28
Copy link
Contributor

@r-tome r-tome left a comment

Choose a reason for hiding this comment

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

Nice work!

@eliykat eliykat added the hold do not merge, do not approve yet label Oct 15, 2024
@eliykat
Copy link
Member Author

eliykat commented Oct 15, 2024

Holding this one until after the next release (last week of October).

@eliykat eliykat removed the hold do not merge, do not approve yet label Nov 1, 2024
@eliykat eliykat merged commit 91dfd7e into main Nov 1, 2024
22 of 23 checks passed
@eliykat eliykat deleted the ac/pm-13007/replace-ldapjs-with-ldapts branch November 1, 2024 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants