-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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: Login token creation not respecting number of token limits #32216
Conversation
Looks like this PR is ready to merge! 🎉 |
🦋 Changeset detectedLatest commit: 2a4075d The changes in this PR will be included in the next version bump. This PR includes changesets to release 32 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #32216 +/- ##
===========================================
+ Coverage 55.37% 55.43% +0.06%
===========================================
Files 2323 2329 +6
Lines 51295 51349 +54
Branches 10492 10503 +11
===========================================
+ Hits 28405 28466 +61
+ Misses 20387 20375 -12
- Partials 2503 2508 +5
Flags with carried forward coverage won't be shown. Click here to find out more. |
f81fa11
to
c91f1d7
Compare
c91f1d7
to
45252f0
Compare
The maximum login tokens limit for users has a huge impact on both Rocket.Chat and MongoDB performance, but since this endpoint doesn't trigger a real "login", it wasn't being applied at there.. but since it is indeed creating new login tokens, it should be treated like so, that's why this can be considered a fix.
I'm also deprecating the mentioned endpoint since this was a feature already under a environment variable for many reasons. Rocket.Chat has now evolved enough where this approach is not required anymore.
I've also tested the performance impact of a user with too many login tokens, you can see the results below:
Performance impact
User starting with 50 tokens in DB
This is prior the fix:
User starting with 10k token in DB
This is also prior the fix, hence a user was allowed to have that many login tokes:
As you can see, the extra load added was so massive that only 532 new login tokens were created during the same period.
Ensuring 50 tokens (after the change)
After the change, even with an additional operations to make sure the limits are being respected, since the number of login tokens is not increasing anymore, it was able to generate almost the double amount of login tokens comparing to prior the fix.