chore: migrate web-ui-registration DDP callers to REST (resetPassword, checkRegistrationSecretURL) - #41455
chore: migrate web-ui-registration DDP callers to REST (resetPassword, checkRegistrationSecretURL)#41455ggazzo wants to merge 4 commits into
Conversation
- checkRegistrationSecretURL -> GET /v1/misc.registrationSecretCheck (DDP method deprecated)
- resetPassword -> POST /v1/users.resetPassword (delegates to accounts-password reset)
DRAFT: the resetPassword endpoint wraps Meteor.callAsync('resetPassword') — the
server-side behavior of that built-in login method (no DDP connection) needs review.
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
🦋 Changeset detectedLatest commit: 9397ee5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 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 |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughRegistration secret validation and password reset callers migrate from DDP methods to typed REST endpoints. The server adds unauthenticated, rate-limited routes, while the legacy registration-secret method logs deprecation and the password-reset method remains registered. ChangesRegistration REST migration
Suggested labels: Suggested reviewers: Sequence Diagram(s)Registration secret validationsequenceDiagram
participant RegistrationUI
participant MiscREST
participant ServerSettings
RegistrationUI->>MiscREST: GET /v1/misc.registrationSecretCheck with hash
MiscREST->>ServerSettings: Read Accounts_RegistrationForm_SecretURL
ServerSettings-->>MiscREST: Configured secret hash
MiscREST-->>RegistrationUI: Return valid
Password resetsequenceDiagram
participant ResetPasswordPage
participant UsersREST
participant MeteorAccounts
ResetPasswordPage->>UsersREST: POST /v1/users.resetPassword with token and newPassword
UsersREST->>MeteorAccounts: Call resetPassword(token, newPassword)
MeteorAccounts-->>UsersREST: Return resume login token
UsersREST-->>ResetPasswordPage: Return token
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #41455 +/- ##
===========================================
- Coverage 68.52% 68.39% -0.14%
===========================================
Files 4128 4157 +29
Lines 160182 158884 -1298
Branches 29167 28422 -745
===========================================
- Hits 109771 108668 -1103
+ Misses 45311 45002 -309
- Partials 5100 5214 +114
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/meteor/server/api/v1/users.ts`:
- Around line 2129-2169: Replace the Meteor.callAsync invocation in the
users.resetPassword action with the underlying server-side Accounts APIs,
validating the reset token, updating the password, and obtaining the resulting
login token without relying on a DDP connection. Preserve the endpoint’s
existing success response and error behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e6df2be9-a25e-437c-8d07-c895a20902d7
📒 Files selected for processing (8)
.changeset/ddp-migrate-registration.mdapps/meteor/server/api/v1/misc.tsapps/meteor/server/api/v1/users.tsapps/meteor/server/meteor-methods/auth/checkRegistrationSecretURL.tspackages/rest-typings/src/v1/misc.tspackages/rest-typings/src/v1/users.tspackages/web-ui-registration/src/ResetPassword/ResetPasswordPage.tsxpackages/web-ui-registration/src/hooks/useCheckRegistrationSecret.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Hacktron Security Check
⚠️ CI failures not shown inline (1)
GitHub Actions: Code scanning - action / 0_CodeQL-Build.txt: chore: migrate web-ui-registration DDP callers to REST (resetPassword, checkRegistrationSecretURL)
Conclusion: failure
##[group]Run github/codeql-action/autobuild@7188fc363630916deb702c7fdcf4e481b751f97a
with:
***REDACTED***
matrix: null
env:
CODEQL_ACTION_FEATURE_MULTI_LANGUAGE: false
CODEQL_ACTION_FEATURE_SANDWICH: false
CODEQL_ACTION_FEATURE_SARIF_COMBINE: true
CODEQL_ACTION_FEATURE_WILL_UPLOAD: true
CODEQL_ACTION_VERSION: 4.36.2
JOB_RUN_UUID: d1c20fda-8596-4e3d-bbb2-3f49942a3454
CODEQL_ACTION_INIT_HAS_RUN: true
CODEQL_ACTION_ANALYSIS_KEY: .github/workflows/codeql-analysis.yml:CodeQL-Build
CODEQL_WORKFLOW_STARTED_AT:
CODEQL_ACTION_CLI_VERSION_INFO: {"cmd":"/opt/hostedtoolcache/CodeQL/2.26.1/x64/codeql/codeql","version":{"productName":"CodeQL","vendor":"GitHub","version":"2.26.1","sha":"1ffdebae722922fb50a64b14a97789ed6161f4a7","branches":["codeql-cli-2.26.1"],"copyright":"Copyright (C) 2019-2026 GitHub, Inc.","unpackedLocation":"/opt/hostedtoolcache/CodeQL/2.26.1/x64/codeql","configFileLocation":"/home/runner/.config/codeql/config","configFileFound":false,"overlayVersion":4,"features":{"analysisSummaryV2Default":true,"buildModeOption":true,"bundleSupportsIncludeDiagnostics":true,"bundleSupportsIncludeLogs":true,"bundleSupportsOverlay":true,"databaseInterpretResultsSupportsSarifRunProperty":true,"featuresInVersionResult":true,"indirectTracingSupportsStaticBinaries":false,"informsAboutUnsupportedPathFilters":true,"supportsPython312":true,"mrvaPackCreate":true,"threatModelOption":true,"traceCommandUseBuildMode":true,"v2ramSizing":true,"mrvaPackCreateMultipleQueries":true,"setsCodeqlRunnerEnvVar":true,"sarifMergeRunsFromEqualCategory":true,"forceOverwrite":true,"generateSummarySymbolMap":true,"pythonDefaultIsToNotExtractStdlib":true,"queryServerRunQueries":true,"queryServerTrimCacheWithMode":true,"builtinExtractorsSpecifyDefaultQueries":true,"bqrsDiffResultSets":true,"bundleSupportsIncludeOption":true,"suppressesMissingFileBaselineWarning":true}}}
CODEQL_RAM: 14575
CODEQL_THREADS: 4
##[endgroup]
##[error]We were unable to automatically...
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
apps/meteor/server/meteor-methods/auth/checkRegistrationSecretURL.tspackages/web-ui-registration/src/hooks/useCheckRegistrationSecret.tspackages/rest-typings/src/v1/users.tspackages/rest-typings/src/v1/misc.tsapps/meteor/server/api/v1/users.tsapps/meteor/server/api/v1/misc.tspackages/web-ui-registration/src/ResetPassword/ResetPasswordPage.tsx
🧠 Learnings (6)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
apps/meteor/server/meteor-methods/auth/checkRegistrationSecretURL.tspackages/web-ui-registration/src/hooks/useCheckRegistrationSecret.tspackages/rest-typings/src/v1/users.tspackages/rest-typings/src/v1/misc.tsapps/meteor/server/api/v1/users.tsapps/meteor/server/api/v1/misc.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
apps/meteor/server/meteor-methods/auth/checkRegistrationSecretURL.tspackages/web-ui-registration/src/hooks/useCheckRegistrationSecret.tspackages/rest-typings/src/v1/users.tspackages/rest-typings/src/v1/misc.tsapps/meteor/server/api/v1/users.tsapps/meteor/server/api/v1/misc.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
apps/meteor/server/meteor-methods/auth/checkRegistrationSecretURL.tspackages/web-ui-registration/src/hooks/useCheckRegistrationSecret.tspackages/rest-typings/src/v1/users.tspackages/rest-typings/src/v1/misc.tsapps/meteor/server/api/v1/users.tsapps/meteor/server/api/v1/misc.tspackages/web-ui-registration/src/ResetPassword/ResetPasswordPage.tsx
📚 Learning: 2026-03-16T21:50:37.589Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:37.589Z
Learning: For changes related to OpenAPI migrations in Rocket.Chat/OpenAPI, when removing endpoint types and validators from rocket.chat/rest-typings (e.g., UserRegisterParamsPOST, /v1/users.register) document this as a minor changeset (not breaking) per RocketChat/Rocket.Chat-Open-API#150 Rule 7. Note that the endpoint type is re-exposed via a module augmentation .d.ts in the consuming package (e.g., packages/web-ui-registration/src/users-register.d.ts). In reviews, ensure the changeset clearly states: this is a non-breaking change, the major version should not be bumped, and the changeset reflects a minor version bump. Do not treat this as a breaking change during OpenAPI migrations.
Applied to files:
.changeset/ddp-migrate-registration.md
📚 Learning: 2026-05-11T23:14:59.316Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 40469
File: packages/rest-typings/src/v1/users.ts:337-337
Timestamp: 2026-05-11T23:14:59.316Z
Learning: In Rocket.Chat REST endpoint typings (e.g., packages/rest-typings/src/v1/users.ts and other rest-typings files), keep the established convention of deriving field types from the domain model (e.g., use IUser indexed access like IUser['statusExpiresAt']) rather than swapping individual fields to serialized primitives (like string) in an ad-hoc way. If a truly different “serialized” representation is needed, perform the refactor consistently across the codebase (not just a single endpoint/field) and ensure all related REST typings stay aligned with the shared serialization types.
Applied to files:
packages/rest-typings/src/v1/users.tspackages/rest-typings/src/v1/misc.ts
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.
Applied to files:
packages/web-ui-registration/src/ResetPassword/ResetPasswordPage.tsx
🔇 Additional comments (7)
packages/rest-typings/src/v1/misc.ts (1)
263-266: LGTM!apps/meteor/server/api/v1/misc.ts (1)
887-921: LGTM!apps/meteor/server/meteor-methods/auth/checkRegistrationSecretURL.ts (1)
5-10: LGTM!packages/web-ui-registration/src/hooks/useCheckRegistrationSecret.ts (1)
1-5: LGTM!Also applies to: 14-15
.changeset/ddp-migrate-registration.md (1)
1-10: LGTM!packages/rest-typings/src/v1/users.ts (1)
274-277: LGTM!packages/web-ui-registration/src/ResetPassword/ResetPasswordPage.tsx (1)
29-29: LGTM!Also applies to: 71-71
There was a problem hiding this comment.
1 issue found across 8 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/meteor/server/api/v1/misc.ts">
<violation number="1" location="apps/meteor/server/api/v1/misc.ts:889">
P3: The new public route has no automated coverage, so regressions in the validation contract, `{ valid, success }` response, or anonymous rate limiting would not be caught. A focused API test covering valid and invalid hashes plus malformed/extra query parameters would make this migration verifiable.
(Based on your team's feedback about meaningful behavior and edge-case tests.)</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| ); | ||
|
|
||
| API.v1.get( | ||
| 'misc.registrationSecretCheck', |
There was a problem hiding this comment.
P3: The new public route has no automated coverage, so regressions in the validation contract, { valid, success } response, or anonymous rate limiting would not be caught. A focused API test covering valid and invalid hashes plus malformed/extra query parameters would make this migration verifiable.
(Based on your team's feedback about meaningful behavior and edge-case tests.)
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/meteor/server/api/v1/misc.ts, line 889:
<comment>The new public route has no automated coverage, so regressions in the validation contract, `{ valid, success }` response, or anonymous rate limiting would not be caught. A focused API test covering valid and invalid hashes plus malformed/extra query parameters would make this migration verifiable.
(Based on your team's feedback about meaningful behavior and edge-case tests.) </comment>
<file context>
@@ -884,3 +884,38 @@ API.v1.post(
);
+
+API.v1.get(
+ 'misc.registrationSecretCheck',
+ {
+ authRequired: false,
</file context>
There was a problem hiding this comment.
Added in 95c4233 — [/misc.registrationSecretCheck] API tests covering the configured secret (valid: true), a wrong secret (valid: false), and a missing hash param (400), reusing the existing secret-URL registration setup.
The core accounts-password resetPassword method issues its login token through the DDP connection, which is unavailable over REST (this.connection is null). Reimplement the flow directly: validate the reset token and its expiry, verify the email, enforce the password policy, set the new password (logout: true to invalidate existing sessions) and issue a fresh login token.
- Add API tests for GET /v1/misc.registrationSecretCheck (valid/invalid hash, missing param) under the existing secret-URL registration setup. - Changeset: hash is a query param (not a body); resetPassword is reimplemented server-side against Accounts, not delegated.
Seed a reset token directly in the DB (it's normally emailed), then verify the endpoint resets the password (login with the new password succeeds), consumes the token (reuse fails), and rejects unknown tokens / missing params.
Proposal (ARCH-2166)
Migrates the two remaining
web-ui-registrationDDP callers to REST.Changes
checkRegistrationSecretURL→ newGET /v1/misc.registrationSecretCheck(query{ hash }→{ valid }),authRequired: false, rate-limited. The DDP method keeps its registration with a deprecation log pointing at the new route until 9.0.0.resetPassword→ newPOST /v1/users.resetPassword(body{ token, newPassword }→{ token }),authRequired: false, rate-limited. TheResetPasswordpage now uses it and resumes the returned login token.resetPasswordis a Meteor core accounts-password method; the endpoint currently delegates viaMeteor.callAsync('resetPassword', ...). Its behavior invoked server-side (no DDP connection) needs verifying — it may need reimplementing directly againstAccounts(validate reset token → set password → issue login token). See theTODO(review)inusers.ts.twoFactorRequired-style gates aren't exercisable in the API e2e suite anyway (TEST_MODEbypasses 2FA unlessrequireSecondFactoris set), so any tests here would only cover the happy/validation paths./jira ARCH-2166
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation