fix: Login token creation not respecting number of token limits#32216
Merged
kodiakhq[bot] merged 9 commits intodevelopfrom Apr 20, 2024
Merged
fix: Login token creation not respecting number of token limits#32216kodiakhq[bot] merged 9 commits intodevelopfrom
kodiakhq[bot] merged 9 commits intodevelopfrom
Conversation
Contributor
|
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 |
sampaiodiego
commented
Apr 15, 2024
sampaiodiego
commented
Apr 15, 2024
sampaiodiego
commented
Apr 15, 2024
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. |
KevLehman
previously approved these changes
Apr 15, 2024
ggazzo
reviewed
Apr 16, 2024
ggazzo
reviewed
Apr 16, 2024
ggazzo
reviewed
Apr 16, 2024
f81fa11 to
c91f1d7
Compare
c91f1d7 to
45252f0
Compare
ggazzo
approved these changes
Apr 19, 2024
debdutdeb
approved these changes
Apr 19, 2024
Merged
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.
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.