-
Notifications
You must be signed in to change notification settings - Fork 13.8k
chore: migrate 2FA TOTP DDP methods to /v1/users.totp.* REST endpoints #40734
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
719da2c
chore: migrate 2FA TOTP DDP methods to REST endpoints
ggazzo 53fb2ea
fix(api): address review feedback on TOTP REST endpoints
ggazzo 3d37909
fix(api): correct checkCodesRemaining import paths after backend reorg
ggazzo 92a0557
test(api): cover TOTP REST endpoints (enable/validate/regenerate/disa…
ggazzo a14bb99
fix(api): correct 2fa import paths after develop reorg (2fa→server/li…
ggazzo 6116341
fix(security): rate-limit all TOTP REST endpoints (enable/codesRemain…
ggazzo ddc6761
chore: fix import order and prettier formatting
ggazzo 335d8e0
fix(security): require 2FA to enroll TOTP (enableTotp/validateTotp)
ggazzo f53a974
test(api): enable 2FA + password fallback so TOTP twoFactorRequired t…
ggazzo 6cf199e
test(api): simplify TOTP tests — TEST_MODE bypasses the 2FA gate
ggazzo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@rocket.chat/meteor': patch | ||
| --- | ||
|
|
||
| Migrates the `TwoFactorTOTP` account settings page from the five `2fa:*` DDP methods to the new TOTP REST endpoints. DDP methods stay registered for external SDK/mobile clients with deprecation logs pointing at the new routes until 9.0.0. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| --- | ||
| '@rocket.chat/rest-typings': minor | ||
| '@rocket.chat/meteor': minor | ||
| --- | ||
|
|
||
| Adds five new REST endpoints covering the TOTP 2FA flows that previously only existed as DDP methods: | ||
|
|
||
| - `POST /v1/users.enableTotp` → `{ secret, url }` (replaces `2fa:enable`) | ||
| - `POST /v1/users.disableTotp` body `{ code }` → `{ disabled }` (replaces `2fa:disable`) | ||
| - `POST /v1/users.validateTotp` body `{ code }` → `{ codes }` (replaces `2fa:validateTempToken`; also rotates non-PAT login tokens server-side) | ||
| - `POST /v1/users.regenerateTotpCodes` body `{ code }` → `{ codes }` (replaces `2fa:regenerateCodes`) | ||
| - `GET /v1/users.totpCodesRemaining` → `{ remaining }` (replaces `2fa:checkCodesRemaining`) | ||
|
|
||
| `users.enableTotp` and `users.validateTotp` require two-factor verification (`twoFactorRequired`) so enrolling a new TOTP device confirms the account owner's identity first — closing a 2FA-enrollment bypass where a hijacked session could register an attacker-controlled TOTP without verifying the existing 2FA. All five endpoints are rate-limited. | ||
|
|
||
| The legacy DDP methods stay registered with deprecation logs pointing at the new routes until 9.0.0 removes them. |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.