chore: Passport Meteor OAuth#40595
Conversation
|
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 |
|
WalkthroughThis PR adds support for Meteor Developer OAuth authentication. It introduces OAuth configuration that conditionally registers the ChangesMeteor Developer OAuth Integration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feat/phishing-resistant-mfa #40595 +/- ##
===============================================================
+ Coverage 69.71% 69.76% +0.05%
===============================================================
Files 3304 3297 -7
Lines 121731 120969 -762
Branches 21561 21564 +3
===============================================================
- Hits 84866 84398 -468
+ Misses 33602 33302 -300
- Partials 3263 3269 +6
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/app/meteor-developer/server/lib.ts`:
- Around line 6-17: The configureMeteorDeveloperOAuth function returns early
when Accounts_OAuth_Meteor is disabled or when clientId/clientSecret are missing
but doesn’t unregister a previously registered Passport strategy; update
configureMeteorDeveloperOAuth to call passport.unuse('meteor-developer') in both
early-return branches (when enabled is false and when clientId or clientSecret
are falsy) so any stale strategy is torn down before returning—refer to
configureMeteorDeveloperOAuth and the existing addPassportCustomOAuth usage for
context.
🪄 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: d33ab808-24fd-4620-93a4-58ea839799e3
📒 Files selected for processing (3)
apps/meteor/app/meteor-developer/server/index.tsapps/meteor/app/meteor-developer/server/lib.tsapps/meteor/server/importPackages.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: 📦 Meteor Build (coverage)
- GitHub Check: 🔎 Code Check / Code Lint
- GitHub Check: 🔎 Code Check / TypeScript
- GitHub Check: 🔨 Test Unit / Unit Tests
🧰 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/importPackages.tsapps/meteor/app/meteor-developer/server/index.tsapps/meteor/app/meteor-developer/server/lib.ts
🧠 Learnings (3)
📚 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/importPackages.tsapps/meteor/app/meteor-developer/server/index.tsapps/meteor/app/meteor-developer/server/lib.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/importPackages.tsapps/meteor/app/meteor-developer/server/index.tsapps/meteor/app/meteor-developer/server/lib.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/importPackages.tsapps/meteor/app/meteor-developer/server/index.tsapps/meteor/app/meteor-developer/server/lib.ts
🔇 Additional comments (3)
apps/meteor/app/meteor-developer/server/lib.ts (1)
19-32: LGTM!apps/meteor/app/meteor-developer/server/index.ts (1)
1-1: LGTM!apps/meteor/server/importPackages.ts (1)
36-36: LGTM!
| const configureMeteorDeveloperOAuth = (): void => { | ||
| const enabled = settings.get<boolean>('Accounts_OAuth_Meteor'); | ||
| if (!enabled) { | ||
| return; | ||
| } | ||
|
|
||
| const clientId = settings.get<string>('Accounts_OAuth_Meteor_id'); | ||
| const clientSecret = settings.get<string>('Accounts_OAuth_Meteor_secret'); | ||
|
|
||
| if (!clientId || !clientSecret) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Locate OAuth helper(s):"
fd -i "addPassportCustomOAuth"
echo
echo "Search for registration and unregistration APIs:"
rg -n -C3 --type ts --type js "addPassportCustomOAuth\\(|passport\\.use\\(|passport\\.unuse\\(|removePassport|unregister.*OAuth"
echo
echo "Compare disable-handling patterns across OAuth providers:"
rg -n -C4 --type ts --type js "watchMultiple\\(|Accounts_OAuth_|configure.*OAuth|addPassportCustomOAuth\\(" apps/meteor/appRepository: RocketChat/Rocket.Chat
Length of output: 47216
Call passport.unuse('meteor-developer') when OAuth is disabled or credentials are cleared.
The configureMeteorDeveloperOAuth function returns early when Accounts_OAuth_Meteor is false or credentials are missing, but never unregisters the Passport strategy that was registered in previous executions. Each call to addPassportCustomOAuth already unuses before re-registering; however, when settings become invalid, the function skips the registration entirely, leaving the stale strategy active until restart.
Add explicit teardown on disable:
- When
enabled === false, callpassport.unuse('meteor-developer') - When
clientId || clientSecretare missing, callpassport.unuse('meteor-developer')
🤖 Prompt for 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.
In `@apps/meteor/app/meteor-developer/server/lib.ts` around lines 6 - 17, The
configureMeteorDeveloperOAuth function returns early when Accounts_OAuth_Meteor
is disabled or when clientId/clientSecret are missing but doesn’t unregister a
previously registered Passport strategy; update configureMeteorDeveloperOAuth to
call passport.unuse('meteor-developer') in both early-return branches (when
enabled is false and when clientId or clientSecret are falsy) so any stale
strategy is torn down before returning—refer to configureMeteorDeveloperOAuth
and the existing addPassportCustomOAuth usage for context.
There was a problem hiding this comment.
1 issue found across 3 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/app/meteor-developer/server/lib.ts">
<violation number="1" location="apps/meteor/app/meteor-developer/server/lib.ts:8">
P2: Disabling Meteor OAuth (or clearing its credentials) does not undo a previously registered strategy because the watcher callback returns early without cleanup.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
|
||
| const configureMeteorDeveloperOAuth = (): void => { | ||
| const enabled = settings.get<boolean>('Accounts_OAuth_Meteor'); | ||
| if (!enabled) { |
There was a problem hiding this comment.
P2: Disabling Meteor OAuth (or clearing its credentials) does not undo a previously registered strategy because the watcher callback returns early without cleanup.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/meteor/app/meteor-developer/server/lib.ts, line 8:
<comment>Disabling Meteor OAuth (or clearing its credentials) does not undo a previously registered strategy because the watcher callback returns early without cleanup.</comment>
<file context>
@@ -0,0 +1,40 @@
+
+const configureMeteorDeveloperOAuth = (): void => {
+ const enabled = settings.get<boolean>('Accounts_OAuth_Meteor');
+ if (!enabled) {
+ return;
+ }
</file context>
Proposed changes (including videos or screenshots)
Issue(s)
Steps to test or reproduce
Further comments
PRM-35
Summary by CodeRabbit