Skip to content

Conversation

@KevLehman
Copy link
Member

@KevLehman KevLehman commented Nov 4, 2025

Proposed changes (including videos or screenshots)

Issue(s)

ABAC-37
ABAC-38
ABAC-39
ABAC-40

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • New Features

    • LDAP → ABAC attribute synchronization added, including manual and automatic background sync that applies ABAC attributes to users.
  • Settings

    • New LDAP enterprise options to enable ABAC background sync, set sync interval (cron), and provide an LDAP→ABAC mapping (JSON); mapping is validated at runtime with error feedback.
  • Localization

    • Added English labels/descriptions for the ABAC data-sync settings.
  • Tests

    • Expanded unit tests for ABAC attribute handling, merging, and change detection.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Nov 4, 2025

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

changeset-bot bot commented Nov 4, 2025

⚠️ No Changeset found

Latest commit: f1a721f

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
Contributor

coderabbitai bot commented Nov 4, 2025

Walkthrough

Adds LDAP → ABAC attribute sync: new enterprise settings and validation, a background cron and watcher wiring, manager and service APIs to sync/validate attribute maps, AbacService methods/helpers to apply mapped attributes to users, and unit tests for attribute-loss detection.

Changes

Cohort / File(s) Summary
LDAP Background Sync Configuration
apps/meteor/ee/server/configuration/ldap.ts
Registers ABAC background cron (LDAP_AbacSync), watches LDAP_Background_Sync_ABAC_Attributes and LDAP_Background_Sync_ABAC_Attributes_Interval, wires cron into LDAP enable path, and validates LDAP_ABAC_AttributeMap changes with error logging.
LDAP Manager Implementation
apps/meteor/ee/server/lib/ldap/Manager.ts
Adds LDAPEEManager.syncAbacAttributes() and validateLDAPABACAttributeMap(); new private updateUserAbacAttributes() iterates LDAP users, resolves entries, and calls Abac.addSubjectAttributes; includes license/setting guards and connection/error handling.
LDAP Service & Interface
apps/meteor/ee/server/local-services/ldap/service.ts, apps/meteor/ee/server/sdk/types/ILDAPEEService.ts
Adds syncAbacAttributes(): Promise<void> to service and interface; service delegates to LDAPEEManager.syncAbacAttributes().
LDAP Enterprise Settings
apps/meteor/ee/server/settings/ldap.ts
Adds LDAP_DataSync_ABAC section with LDAP_Background_Sync_ABAC_Attributes (bool), LDAP_Background_Sync_ABAC_Attributes_Interval (cron), and LDAP_ABAC_AttributeMap (JSON code), gated by abac and ldap-enterprise modules.
ABAC Service Implementation
ee/packages/abac/src/index.ts, ee/packages/abac/src/helper.ts
Adds addSubjectAttributes(user, ldapUser, map) to compute and persist user.abacAttributes, didSubjectLoseAttributes() helper, protected hook onSubjectAttributesChanged(), and helper extractAttribute to normalize/deduplicate LDAP values.
ABAC Service Tests
ee/packages/abac/src/index.spec.ts
Adds comprehensive unit tests for merging, deduplication, unsetting, change-hook invocation, value-shape handling, and didSubjectLoseAttributes() behavior.
ABAC Service Types & Core Services
packages/core-services/src/types/IAbacService.ts, packages/core-typings/src/IUser.ts
Adds addSubjectAttributes(...) to IAbacService and abacAttributes?: IAbacAttributeDefinition[] to IUser; imports ILDAPEntry where needed.
Localization
packages/i18n/src/locales/en.i18n.json
Adds translation keys for LDAP ABAC DataSync: section, enable flag, description, interval, and attribute map description.

Sequence Diagram(s)

sequenceDiagram
    participant Cron as Cron (LDAP_AbacSync)
    participant Manager as LDAPEEManager
    participant LDAP as LDAP Connection
    participant Abac as AbacService
    participant DB as User Collection

    Cron->>Manager: syncAbacAttributes()
    activate Manager
    Manager->>Manager: check license & settings
    Manager->>LDAP: connect()
    activate LDAP
    Manager->>Manager: parse LDAP_ABAC_AttributeMap
    Manager->>LDAP: fetch users
    LDAP-->>Manager: user list
    deactivate LDAP

    loop per user
        Manager->>LDAP: resolve user entry
        activate LDAP
        LDAP-->>Manager: entry data
        deactivate LDAP
        Manager->>Abac: addSubjectAttributes(user, ldapEntry, map)
        activate Abac
        Abac->>DB: persist abacAttributes[]
        alt attributes removed
            Abac->>Abac: onSubjectAttributesChanged(user, next)
        end
        Abac-->>Manager: done
        deactivate Abac
    end

    Manager->>LDAP: disconnect()
    Manager-->>Cron: complete
    deactivate Manager
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Focus review on:
    • LDAPEEManager.updateUserAbacAttributes() iteration, per-user resolution, and error handling.
    • Correct gating by license/settings and cron registration.
    • didSubjectLoseAttributes() correctness (edge cases, immutability).
    • Type surface changes: IUser.abacAttributes and IAbacService signature.

Possibly related PRs

Suggested reviewers

  • tassoevan
  • lucas-a-pelegrino
  • ggazzo

Poem

🐇 I nibble through maps of LDAP light,
cron hops softly to sync through night.
Keys trimmed, values set in rows,
users bloom where ABAC grows.
Hop—subscriptions update just right!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding ABAC (Attribute-Based Access Control) attributes integration with LDAP, which is the primary focus of all changeset modifications.
Linked Issues check ✅ Passed The PR implements all coding requirements from linked issues ABAC-37, ABAC-38, ABAC-39, and ABAC-40: adds enterprise-only LDAP settings with validation ABAC-37, implements sync mechanism using the mapping [ABAC-38], wires background cron job for interval-based syncing [ABAC-39], and persists mapped attributes to user objects with subscription reevaluation hooks [ABAC-40].
Out of Scope Changes check ✅ Passed All changes are in scope: configuration/settings files for LDAP ABAC setup, service implementations for syncing, ABAC service extensions for attribute application and subscription change detection, type definitions for new methods, and comprehensive unit tests for merging and attribute loss detection logic.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/abac-ldap

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1d88b96 and f1a721f.

📒 Files selected for processing (1)
  • ee/packages/abac/src/index.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • ee/packages/abac/src/index.ts
⏰ 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: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

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.

@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.29%. Comparing base (8d07d94) to head (f1a721f).
⚠️ Report is 1 commits behind head on feat/abac.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##           feat/abac   #37379      +/-   ##
=============================================
- Coverage      54.30%   54.29%   -0.01%     
=============================================
  Files           2658     2658              
  Lines          49963    49964       +1     
  Branches       11126    11126              
=============================================
- Hits           27132    27130       -2     
- Misses         20697    20703       +6     
+ Partials        2134     2131       -3     
Flag Coverage Δ
e2e 57.46% <ø> (-0.01%) ⬇️
e2e-api 42.82% <ø> (-0.02%) ⬇️

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.

@KevLehman KevLehman marked this pull request as ready for review November 10, 2025 14:49
@KevLehman KevLehman requested a review from a team as a code owner November 10, 2025 14:49
Copy link
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: 3

🧹 Nitpick comments (2)
ee/packages/abac/src/index.ts (1)

615-617: Clarify the hook's purpose and when it's invoked.

The comment states this hook is for "when a user loses an ABAC attribute or value," but examining line 68 shows it's called via didSubjectLoseAttributes, which detects any attribute or value loss. Consider adding more documentation about:

  • What implementations should do (e.g., trigger subscription re-evaluation)
  • Whether it's called only on loss or also on other changes
  • Expected error handling behavior
apps/meteor/ee/server/lib/ldap/Manager.ts (1)

719-735: Consider performance optimizations for large user bases.

The method loads all LDAP users into memory (line 726) and processes them sequentially. For deployments with thousands of LDAP users, this could cause:

  • High memory usage from loading all users at once
  • Slow sync times from sequential processing
  • No visibility into sync progress

Consider these improvements:

 private static async updateUserAbacAttributes(ldap: LDAPConnection): Promise<void> {
   const mapping = this.parseJson(settings.get('LDAP_ABAC_AttributeMap'));
   if (!mapping) {
     logger.error('LDAP to ABAC attribute mapping is not valid JSON');
     return;
   }

-  const users = await Users.findLDAPUsers().toArray();
-  for await (const user of users) {
+  let processed = 0;
+  let updated = 0;
+  const cursor = Users.findLDAPUsers();
+  for await (const user of cursor) {
     const ldapUser = await this.findLDAPUser(ldap, user);
     if (!ldapUser) {
+      processed++;
       continue;
     }

     await Abac.addSubjectAttributes(user, ldapUser, mapping);
+    processed++;
+    updated++;
+    if (processed % 100 === 0) {
+      logger.info({ msg: 'ABAC attribute sync progress', processed, updated });
+    }
   }
+  logger.info({ msg: 'ABAC attribute sync completed', processed, updated });
 }

This uses cursor iteration to avoid loading all users into memory and adds progress logging.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between db3fe9f and f847b14.

📒 Files selected for processing (10)
  • apps/meteor/ee/server/configuration/ldap.ts (2 hunks)
  • apps/meteor/ee/server/lib/ldap/Manager.ts (4 hunks)
  • apps/meteor/ee/server/local-services/ldap/service.ts (1 hunks)
  • apps/meteor/ee/server/sdk/types/ILDAPEEService.ts (1 hunks)
  • apps/meteor/ee/server/settings/ldap.ts (1 hunks)
  • ee/packages/abac/src/index.spec.ts (2 hunks)
  • ee/packages/abac/src/index.ts (3 hunks)
  • packages/core-services/src/types/IAbacService.ts (2 hunks)
  • packages/core-typings/src/IUser.ts (2 hunks)
  • packages/i18n/src/locales/en.i18n.json (1 hunks)
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37299
File: apps/meteor/ee/server/lib/ldap/Manager.ts:438-454
Timestamp: 2025-10-24T17:32:05.348Z
Learning: In Rocket.Chat, ABAC attributes can only be set on private rooms and teams (type 'p'), not on public rooms (type 'c'). Therefore, when checking for ABAC-protected rooms/teams during LDAP sync or similar operations, it's sufficient to query only private rooms using methods like `findPrivateRoomsByIdsWithAbacAttributes`.
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37303
File: apps/meteor/tests/end-to-end/api/abac.ts:1125-1137
Timestamp: 2025-10-27T14:38:46.994Z
Learning: In Rocket.Chat ABAC feature, when ABAC is disabled globally (ABAC_Enabled setting is false), room-level ABAC attributes are not evaluated when changing room types. This means converting a private room to public will succeed even if the room has ABAC attributes, as long as the global ABAC setting is disabled.
📚 Learning: 2025-10-24T17:32:05.348Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37299
File: apps/meteor/ee/server/lib/ldap/Manager.ts:438-454
Timestamp: 2025-10-24T17:32:05.348Z
Learning: In Rocket.Chat, ABAC attributes can only be set on private rooms and teams (type 'p'), not on public rooms (type 'c'). Therefore, when checking for ABAC-protected rooms/teams during LDAP sync or similar operations, it's sufficient to query only private rooms using methods like `findPrivateRoomsByIdsWithAbacAttributes`.

Applied to files:

  • ee/packages/abac/src/index.ts
  • packages/core-services/src/types/IAbacService.ts
  • ee/packages/abac/src/index.spec.ts
  • apps/meteor/ee/server/settings/ldap.ts
  • packages/i18n/src/locales/en.i18n.json
  • apps/meteor/ee/server/lib/ldap/Manager.ts
📚 Learning: 2025-10-27T14:38:46.994Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37303
File: apps/meteor/tests/end-to-end/api/abac.ts:1125-1137
Timestamp: 2025-10-27T14:38:46.994Z
Learning: In Rocket.Chat ABAC feature, when ABAC is disabled globally (ABAC_Enabled setting is false), room-level ABAC attributes are not evaluated when changing room types. This means converting a private room to public will succeed even if the room has ABAC attributes, as long as the global ABAC setting is disabled.

Applied to files:

  • ee/packages/abac/src/index.ts
  • packages/core-services/src/types/IAbacService.ts
  • ee/packages/abac/src/index.spec.ts
  • apps/meteor/ee/server/settings/ldap.ts
📚 Learning: 2025-11-04T16:49:19.107Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37377
File: apps/meteor/ee/server/hooks/federation/index.ts:86-88
Timestamp: 2025-11-04T16:49:19.107Z
Learning: In Rocket.Chat's federation system (apps/meteor/ee/server/hooks/federation/), permission checks follow two distinct patterns: (1) User-initiated federation actions (creating rooms, adding users to federated rooms, joining from invites) should throw MeteorError to inform users they lack 'access-federation' permission. (2) Remote server-initiated federation events should silently skip/ignore when users lack permission. The beforeAddUserToRoom hook only executes for local user-initiated actions, so throwing an error there is correct. Remote federation events are handled separately by the federation Matrix package with silent skipping logic.

Applied to files:

  • ee/packages/abac/src/index.ts
📚 Learning: 2025-11-07T14:50:33.544Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37423
File: packages/i18n/src/locales/en.i18n.json:18-18
Timestamp: 2025-11-07T14:50:33.544Z
Learning: Rocket.Chat settings: in apps/meteor/ee/server/settings/abac.ts, the Abac_Cache_Decision_Time_Seconds setting uses invalidValue: 0 as the fallback when ABAC is unlicensed. With a valid license, admins can still set the value to 0 to intentionally disable the ABAC decision cache.

Applied to files:

  • ee/packages/abac/src/index.ts
  • apps/meteor/ee/server/configuration/ldap.ts
  • apps/meteor/ee/server/settings/ldap.ts
  • apps/meteor/ee/server/lib/ldap/Manager.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases

Applied to files:

  • ee/packages/abac/src/index.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use descriptive test names that clearly communicate expected behavior

Applied to files:

  • ee/packages/abac/src/index.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • ee/packages/abac/src/index.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file

Applied to files:

  • ee/packages/abac/src/index.spec.ts
📚 Learning: 2025-11-05T20:53:57.761Z
Learnt from: sampaiodiego
Repo: RocketChat/Rocket.Chat PR: 37357
File: apps/meteor/ee/server/startup/federation.ts:39-74
Timestamp: 2025-11-05T20:53:57.761Z
Learning: In Rocket.Chat (apps/meteor/app/settings/server/CachedSettings.ts), the settings.watchMultiple() method immediately invokes its callback with current values if all requested settings exist in the store, then continues watching for subsequent changes. It does not wait for a setting to change before the first invocation.

Applied to files:

  • apps/meteor/ee/server/configuration/ldap.ts
🧬 Code graph analysis (5)
ee/packages/abac/src/index.ts (2)
packages/core-typings/src/IUser.ts (1)
  • IUser (187-258)
packages/core-typings/src/IAbacAttribute.ts (1)
  • IAbacAttributeDefinition (3-14)
packages/core-services/src/types/IAbacService.ts (1)
packages/core-typings/src/IUser.ts (1)
  • IUser (187-258)
ee/packages/abac/src/index.spec.ts (1)
packages/core-typings/src/IAbacAttribute.ts (1)
  • IAbacAttributeDefinition (3-14)
packages/core-typings/src/IUser.ts (1)
packages/core-typings/src/IAbacAttribute.ts (1)
  • IAbacAttributeDefinition (3-14)
apps/meteor/ee/server/lib/ldap/Manager.ts (1)
packages/core-services/src/index.ts (2)
  • License (164-164)
  • Abac (202-202)
🔇 Additional comments (11)
apps/meteor/ee/server/sdk/types/ILDAPEEService.ts (1)

5-5: LGTM!

The new method signature is consistent with the existing sync methods in the interface.

packages/core-typings/src/IUser.ts (1)

1-1: LGTM!

The optional abacAttributes field properly extends the IUser interface with backward compatibility. The import is correctly typed.

Also applies to: 257-257

apps/meteor/ee/server/local-services/ldap/service.ts (1)

21-23: LGTM!

The delegation pattern is consistent with other sync methods in the service class.

apps/meteor/ee/server/settings/ldap.ts (1)

286-308: LGTM!

The ABAC sync settings follow the established pattern for other LDAP sync features. License gating via modules: ['abac', 'ldap-enterprise'] is properly applied, and the enableQuery dependencies are correctly configured.

apps/meteor/ee/server/configuration/ldap.ts (2)

63-68: LGTM!

The ABAC cron job configuration follows the established pattern for other LDAP background sync jobs. The wiring for settings watchers and the LDAP_Enable toggle is consistent with existing sync features.

Also applies to: 73-73, 79-79


90-96: LGTM!

The validation watcher for LDAP_ABAC_AttributeMap follows the same pattern as the existing LDAP_Groups_To_Rocket_Chat_Teams watcher, with proper error handling and logging.

packages/core-services/src/types/IAbacService.ts (1)

1-1: LGTM!

The new addSubjectAttributes method signature properly extends the IAbacService interface. The use of Record<string, string> for the mapping is clear and type-safe.

Also applies to: 21-21

apps/meteor/ee/server/lib/ldap/Manager.ts (1)

106-128: LGTM!

The syncAbacAttributes method follows the established pattern of other sync methods with proper guard clauses, license checks, connection lifecycle management, and error handling.

packages/i18n/src/locales/en.i18n.json (1)

2779-2784: All suggestions are well-supported by implementation and existing patterns.

I've verified the review comment against the codebase:

  1. Replace semantics: Confirmed. The addSubjectAttributes implementation in ee/packages/abac/src/index.ts uses { $set: { abacAttributes: finalAttributes } } (line 67), which replaces the entire field. This is not a merge—it's a full replacement. The suggestion to clarify this is accurate and important.

  2. Interval description: Valid pattern. LDAP_Background_Sync_Interval_Description exists at i18n line 2774 for the standard sync interval. The new ABAC interval at line 2779 lacks this description key, creating inconsistency. The suggestion maintains established UX patterns.

  3. Terminology alignment: Correct. "Subject attributes" terminology is already established in the codebase—ABAC_Attributes is labeled as "Subject attributes" at i18n line 713. Aligning the new LDAP ABAC keys follows this convention.

The settings file (apps/meteor/ee/server/settings/ldap.ts) confirms the interval setting exists but lacks a corresponding description key in i18n, validating the recommendation to add it.

ee/packages/abac/src/index.spec.ts (2)

1-2: LGTM: Clean type import for new test suite.

The import is correctly scoped as a type-only import and matches the interface definition from @rocket.chat/core-typings.


68-205: Excellent test coverage for critical security logic.

This comprehensive test suite thoroughly validates the didSubjectLoseAttributes method, which is essential for triggering subscription re-evaluation when users lose ABAC attributes during LDAP sync. The tests cover:

  • Empty and no-op cases: Correctly handle empty inputs and no changes
  • Addition-only scenarios: Verify no loss detected when attributes/values are only added
  • Removal detection: Properly detect loss of entire attribute keys or individual values
  • Edge cases: Pure function behavior, order-insensitive comparison, duplicate handling
  • Multi-attribute scenarios: Correct behavior with multiple attributes

The test organization is logical and test names clearly communicate expected behavior. This level of coverage is appropriate given the security implications of this method.

Copy link
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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f847b14 and a71f576.

📒 Files selected for processing (10)
  • apps/meteor/ee/server/configuration/ldap.ts (2 hunks)
  • apps/meteor/ee/server/lib/ldap/Manager.ts (4 hunks)
  • apps/meteor/ee/server/local-services/ldap/service.ts (1 hunks)
  • apps/meteor/ee/server/sdk/types/ILDAPEEService.ts (1 hunks)
  • apps/meteor/ee/server/settings/ldap.ts (1 hunks)
  • ee/packages/abac/src/index.spec.ts (2 hunks)
  • ee/packages/abac/src/index.ts (3 hunks)
  • packages/core-services/src/types/IAbacService.ts (2 hunks)
  • packages/core-typings/src/IUser.ts (2 hunks)
  • packages/i18n/src/locales/en.i18n.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • apps/meteor/ee/server/local-services/ldap/service.ts
  • apps/meteor/ee/server/settings/ldap.ts
  • apps/meteor/ee/server/sdk/types/ILDAPEEService.ts
  • packages/i18n/src/locales/en.i18n.json
  • packages/core-typings/src/IUser.ts
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37299
File: apps/meteor/ee/server/lib/ldap/Manager.ts:438-454
Timestamp: 2025-10-24T17:32:05.348Z
Learning: In Rocket.Chat, ABAC attributes can only be set on private rooms and teams (type 'p'), not on public rooms (type 'c'). Therefore, when checking for ABAC-protected rooms/teams during LDAP sync or similar operations, it's sufficient to query only private rooms using methods like `findPrivateRoomsByIdsWithAbacAttributes`.
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37303
File: apps/meteor/tests/end-to-end/api/abac.ts:1125-1137
Timestamp: 2025-10-27T14:38:46.994Z
Learning: In Rocket.Chat ABAC feature, when ABAC is disabled globally (ABAC_Enabled setting is false), room-level ABAC attributes are not evaluated when changing room types. This means converting a private room to public will succeed even if the room has ABAC attributes, as long as the global ABAC setting is disabled.
📚 Learning: 2025-10-27T14:38:46.994Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37303
File: apps/meteor/tests/end-to-end/api/abac.ts:1125-1137
Timestamp: 2025-10-27T14:38:46.994Z
Learning: In Rocket.Chat ABAC feature, when ABAC is disabled globally (ABAC_Enabled setting is false), room-level ABAC attributes are not evaluated when changing room types. This means converting a private room to public will succeed even if the room has ABAC attributes, as long as the global ABAC setting is disabled.

Applied to files:

  • ee/packages/abac/src/index.ts
  • apps/meteor/ee/server/lib/ldap/Manager.ts
  • ee/packages/abac/src/index.spec.ts
📚 Learning: 2025-10-24T17:32:05.348Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37299
File: apps/meteor/ee/server/lib/ldap/Manager.ts:438-454
Timestamp: 2025-10-24T17:32:05.348Z
Learning: In Rocket.Chat, ABAC attributes can only be set on private rooms and teams (type 'p'), not on public rooms (type 'c'). Therefore, when checking for ABAC-protected rooms/teams during LDAP sync or similar operations, it's sufficient to query only private rooms using methods like `findPrivateRoomsByIdsWithAbacAttributes`.

Applied to files:

  • ee/packages/abac/src/index.ts
  • apps/meteor/ee/server/lib/ldap/Manager.ts
  • ee/packages/abac/src/index.spec.ts
📚 Learning: 2025-11-04T16:49:19.107Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37377
File: apps/meteor/ee/server/hooks/federation/index.ts:86-88
Timestamp: 2025-11-04T16:49:19.107Z
Learning: In Rocket.Chat's federation system (apps/meteor/ee/server/hooks/federation/), permission checks follow two distinct patterns: (1) User-initiated federation actions (creating rooms, adding users to federated rooms, joining from invites) should throw MeteorError to inform users they lack 'access-federation' permission. (2) Remote server-initiated federation events should silently skip/ignore when users lack permission. The beforeAddUserToRoom hook only executes for local user-initiated actions, so throwing an error there is correct. Remote federation events are handled separately by the federation Matrix package with silent skipping logic.

Applied to files:

  • ee/packages/abac/src/index.ts
📚 Learning: 2025-11-07T14:50:33.544Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37423
File: packages/i18n/src/locales/en.i18n.json:18-18
Timestamp: 2025-11-07T14:50:33.544Z
Learning: Rocket.Chat settings: in apps/meteor/ee/server/settings/abac.ts, the Abac_Cache_Decision_Time_Seconds setting uses invalidValue: 0 as the fallback when ABAC is unlicensed. With a valid license, admins can still set the value to 0 to intentionally disable the ABAC decision cache.

Applied to files:

  • apps/meteor/ee/server/configuration/ldap.ts
  • apps/meteor/ee/server/lib/ldap/Manager.ts
📚 Learning: 2025-11-05T20:53:57.761Z
Learnt from: sampaiodiego
Repo: RocketChat/Rocket.Chat PR: 37357
File: apps/meteor/ee/server/startup/federation.ts:39-74
Timestamp: 2025-11-05T20:53:57.761Z
Learning: In Rocket.Chat (apps/meteor/app/settings/server/CachedSettings.ts), the settings.watchMultiple() method immediately invokes its callback with current values if all requested settings exist in the store, then continues watching for subsequent changes. It does not wait for a setting to change before the first invocation.

Applied to files:

  • apps/meteor/ee/server/configuration/ldap.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use descriptive test names that clearly communicate expected behavior

Applied to files:

  • ee/packages/abac/src/index.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases

Applied to files:

  • ee/packages/abac/src/index.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file

Applied to files:

  • ee/packages/abac/src/index.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • ee/packages/abac/src/index.spec.ts
🧬 Code graph analysis (4)
packages/core-services/src/types/IAbacService.ts (1)
packages/core-typings/src/IUser.ts (1)
  • IUser (187-258)
ee/packages/abac/src/index.ts (2)
packages/core-typings/src/IUser.ts (1)
  • IUser (187-258)
packages/core-typings/src/IAbacAttribute.ts (1)
  • IAbacAttributeDefinition (3-14)
apps/meteor/ee/server/lib/ldap/Manager.ts (1)
packages/core-services/src/index.ts (2)
  • License (164-164)
  • Abac (202-202)
ee/packages/abac/src/index.spec.ts (1)
packages/core-typings/src/IAbacAttribute.ts (1)
  • IAbacAttributeDefinition (3-14)
⏰ 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: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

Copy link
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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a71f576 and a74d188.

📒 Files selected for processing (5)
  • apps/meteor/ee/server/configuration/ldap.ts (2 hunks)
  • apps/meteor/ee/server/lib/ldap/Manager.ts (4 hunks)
  • apps/meteor/ee/server/local-services/ldap/service.ts (1 hunks)
  • apps/meteor/ee/server/sdk/types/ILDAPEEService.ts (1 hunks)
  • apps/meteor/ee/server/settings/ldap.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/meteor/ee/server/settings/ldap.ts
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37299
File: apps/meteor/ee/server/lib/ldap/Manager.ts:438-454
Timestamp: 2025-10-24T17:32:05.348Z
Learning: In Rocket.Chat, ABAC attributes can only be set on private rooms and teams (type 'p'), not on public rooms (type 'c'). Therefore, when checking for ABAC-protected rooms/teams during LDAP sync or similar operations, it's sufficient to query only private rooms using methods like `findPrivateRoomsByIdsWithAbacAttributes`.
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37303
File: apps/meteor/tests/end-to-end/api/abac.ts:1125-1137
Timestamp: 2025-10-27T14:38:46.994Z
Learning: In Rocket.Chat ABAC feature, when ABAC is disabled globally (ABAC_Enabled setting is false), room-level ABAC attributes are not evaluated when changing room types. This means converting a private room to public will succeed even if the room has ABAC attributes, as long as the global ABAC setting is disabled.
📚 Learning: 2025-11-07T14:50:33.544Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37423
File: packages/i18n/src/locales/en.i18n.json:18-18
Timestamp: 2025-11-07T14:50:33.544Z
Learning: Rocket.Chat settings: in apps/meteor/ee/server/settings/abac.ts, the Abac_Cache_Decision_Time_Seconds setting uses invalidValue: 0 as the fallback when ABAC is unlicensed. With a valid license, admins can still set the value to 0 to intentionally disable the ABAC decision cache.

Applied to files:

  • apps/meteor/ee/server/configuration/ldap.ts
  • apps/meteor/ee/server/lib/ldap/Manager.ts
📚 Learning: 2025-11-05T20:53:57.761Z
Learnt from: sampaiodiego
Repo: RocketChat/Rocket.Chat PR: 37357
File: apps/meteor/ee/server/startup/federation.ts:39-74
Timestamp: 2025-11-05T20:53:57.761Z
Learning: In Rocket.Chat (apps/meteor/app/settings/server/CachedSettings.ts), the settings.watchMultiple() method immediately invokes its callback with current values if all requested settings exist in the store, then continues watching for subsequent changes. It does not wait for a setting to change before the first invocation.

Applied to files:

  • apps/meteor/ee/server/configuration/ldap.ts
📚 Learning: 2025-10-24T17:32:05.348Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37299
File: apps/meteor/ee/server/lib/ldap/Manager.ts:438-454
Timestamp: 2025-10-24T17:32:05.348Z
Learning: In Rocket.Chat, ABAC attributes can only be set on private rooms and teams (type 'p'), not on public rooms (type 'c'). Therefore, when checking for ABAC-protected rooms/teams during LDAP sync or similar operations, it's sufficient to query only private rooms using methods like `findPrivateRoomsByIdsWithAbacAttributes`.

Applied to files:

  • apps/meteor/ee/server/lib/ldap/Manager.ts
📚 Learning: 2025-10-27T14:38:46.994Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37303
File: apps/meteor/tests/end-to-end/api/abac.ts:1125-1137
Timestamp: 2025-10-27T14:38:46.994Z
Learning: In Rocket.Chat ABAC feature, when ABAC is disabled globally (ABAC_Enabled setting is false), room-level ABAC attributes are not evaluated when changing room types. This means converting a private room to public will succeed even if the room has ABAC attributes, as long as the global ABAC setting is disabled.

Applied to files:

  • apps/meteor/ee/server/lib/ldap/Manager.ts
🧬 Code graph analysis (2)
apps/meteor/ee/server/local-services/ldap/service.ts (1)
apps/meteor/ee/server/lib/ldap/Manager.ts (1)
  • LDAPEEManager (25-768)
apps/meteor/ee/server/lib/ldap/Manager.ts (1)
packages/core-services/src/index.ts (2)
  • License (164-164)
  • Abac (202-202)
⏰ 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). (1)
  • GitHub Check: CodeQL-Build

@tassoevan tassoevan merged commit 820f30f into feat/abac Nov 12, 2025
49 checks passed
@tassoevan tassoevan deleted the feat/abac-ldap branch November 12, 2025 19:10
This was referenced Nov 28, 2025
@coderabbitai coderabbitai bot mentioned this pull request Dec 3, 2025
@coderabbitai coderabbitai bot mentioned this pull request Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants