Skip to content

chore: Passport Drupal OAuth#40610

Merged
yash-rajpal merged 1 commit into
feat/phishing-resistant-mfafrom
passport-drupal
May 19, 2026
Merged

chore: Passport Drupal OAuth#40610
yash-rajpal merged 1 commit into
feat/phishing-resistant-mfafrom
passport-drupal

Conversation

@yash-rajpal
Copy link
Copy Markdown
Member

@yash-rajpal yash-rajpal commented May 19, 2026

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

PRM-43

Summary by CodeRabbit

Release Notes

  • Refactor
    • Restructured Drupal OAuth authentication configuration to dynamically monitor and apply multiple runtime settings instead of a single setting, improving configuration flexibility.

Review Change Stack

@yash-rajpal yash-rajpal marked this pull request as ready for review May 19, 2026 14:06
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented May 19, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 19, 2026

⚠️ No Changeset found

Latest commit: 5224d90

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

Walkthrough

This PR refactors Drupal OAuth configuration to be driven by multiple runtime settings. The change replaces single-setting watchers with a debounced multi-setting callback, introduces dynamic passport strategy lifecycle management, and switches OAuth configuration typing to OAuthConfiguration while removing previous direct CustomOAuth instantiation.

Changes

Drupal OAuth Multi-Setting Configuration

Layer / File(s) Summary
OAuth configuration imports and types
apps/meteor/app/drupal/server/lib.ts
Imports switch from OauthConfig to OAuthConfiguration, and a passport import is added for strategy lifecycle management. The prior CustomOAuth-based construction is removed from module scope.
Dynamic OAuth configuration and multi-setting watcher
apps/meteor/app/drupal/server/lib.ts
configureDrupalOAuth function is introduced to conditionally unregister, check enablement, read settings, and register/update the drupal passport strategy. Single-setting watcher on API_Drupal_URL is replaced with debounced multi-setting watcher on Accounts_OAuth_Drupal, API_Drupal_URL, Accounts_OAuth_Drupal_id, and Accounts_OAuth_Drupal_secret.

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • RocketChat/Rocket.Chat#40203: Introduces the Passport wiring (addPassportCustomOAuth and strategy registration pattern) that this PR depends on for dynamic Drupal OAuth configuration.

Suggested labels

type: chore

Suggested reviewers

  • KevLehman
  • ricardogarim
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title "chore: Passport Drupal OAuth" is vague and does not clearly convey the specific refactoring changes made to the Drupal OAuth configuration. Consider using a more descriptive title that reflects the main change, such as "Refactor Drupal OAuth to use runtime settings" or "chore: Make Drupal OAuth configuration runtime-driven".
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • PRM-43: Request failed with status code 401

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/drupal/server/lib.ts`:
- Line 31: The current serverURL assignment calls
settings.get<string>('API_Drupal_URL').trim() which can throw if the setting is
undefined; update the code around serverURL (reference: serverURL and
settings.get<string>('API_Drupal_URL')) to first read the raw value into a
variable, guard for undefined/empty (either throw a clear error or default to an
empty string), then call .trim().replace(...) on the safe string so the guard
executes before any string methods are invoked.
🪄 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: efdd7fac-c41b-4bd4-966d-713fdeba9d74

📥 Commits

Reviewing files that changed from the base of the PR and between afda09b and 5224d90.

📒 Files selected for processing (1)
  • apps/meteor/app/drupal/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). (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • 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/drupal/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/drupal/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/drupal/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/drupal/server/lib.ts
🔇 Additional comments (4)
apps/meteor/app/drupal/server/lib.ts (4)

1-7: LGTM!


9-22: LGTM!


42-49: LGTM!


25-25: No action needed—passport.unuse() is safe for non-existent strategies.

Passport.js's unuse() method does not throw when a strategy name doesn't exist, so calling passport.unuse('drupal') on first startup or when the strategy was never registered poses no risk.

Comment thread apps/meteor/app/drupal/server/lib.ts
@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.68%. Comparing base (afda09b) to head (5224d90).

Additional details and impacted files

Impacted file tree graph

@@                       Coverage Diff                       @@
##           feat/phishing-resistant-mfa   #40610      +/-   ##
===============================================================
- Coverage                        69.70%   69.68%   -0.03%     
===============================================================
  Files                             3322     3320       -2     
  Lines                           122760   122705      -55     
  Branches                         21839    21873      +34     
===============================================================
- Hits                             85569    85505      -64     
- Misses                           33853    33863      +10     
+ Partials                          3338     3337       -1     
Flag Coverage Δ
unit 70.34% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yash-rajpal yash-rajpal merged commit 02fa86b into feat/phishing-resistant-mfa May 19, 2026
38 of 47 checks passed
@yash-rajpal yash-rajpal deleted the passport-drupal branch May 19, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants