chore: Passport Gitlab OAuth#40609
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 |
|
WalkthroughGitLab OAuth configuration is refactored to re-register the Passport strategy instead of directly mutating a ChangesGitLab OAuth Configuration Refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 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 |
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/gitlab/server/lib.ts`:
- Line 31: The expression that initializes serverURL calls .trim() on
settings.get('API_Gitlab_URL') without guarding for null/undefined; update the
serverURL initialization so the value from
settings.get<string>('API_Gitlab_URL') is defaulted or checked before calling
.trim() (for example, use optional chaining or fallback to an empty string) and
then apply .trim().replace(...) so serverURL is computed safely in the
declaration where serverURL is defined.
🪄 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: 373a3557-e504-4dde-a235-c04b25f6471b
📒 Files selected for processing (1)
apps/meteor/app/gitlab/server/lib.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). (3)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: 📦 Build Packages
- GitHub Check: CodeQL-Build
🧰 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/app/gitlab/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/app/gitlab/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/app/gitlab/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/app/gitlab/server/lib.ts
🔇 Additional comments (5)
apps/meteor/app/gitlab/server/lib.ts (5)
1-6: LGTM!
9-19: LGTM!
24-27: LGTM!Also applies to: 29-30, 32-33, 35-37, 39-40
42-56: LGTM!
22-22: ⚡ Quick winNo action needed.
passport.unuse()safely handles missing strategies without throwing an error—it simply deletes the entry if it exists and returns the authenticator instance. The code is correct as written.> Likely an incorrect or invalid review comment.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feat/phishing-resistant-mfa #40609 +/- ##
============================================================
Coverage 69.70% 69.71%
============================================================
Files 3322 3320 -2
Lines 122760 122705 -55
Branches 21839 21928 +89
============================================================
- Hits 85569 85541 -28
+ Misses 33853 33823 -30
- Partials 3338 3341 +3
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
| return; | ||
| } | ||
|
|
||
| addPassportCustomOAuth('gitlab', { ...config, clientId, clientSecret, serverURL, identityPath, mergeUsers }); |
There was a problem hiding this comment.
When the settings are changed, the addPassportCustomOAuth re adds the endpoint routes. Will it have impact on memory (duplications) or are the routes just overwritten?
Rest everything LGTM.
There was a problem hiding this comment.
I was checking this, I assumed it will overwrite but sadly no, it adds middlewares to the chain.
For our implementation it shouldn't create any impact as we send a response, so it never goes to stacked middleware.
I'll open a task to improve this, for now it should increase a little memory consumption if routes are over-written many times.
dc44d7c
into
feat/phishing-resistant-mfa
Proposed changes (including videos or screenshots)
Issue(s)
Steps to test or reproduce
Further comments
PRM-42
Summary by CodeRabbit
Release Notes