Skip to content

Conversation

@KevLehman
Copy link
Member

@KevLehman KevLehman commented Nov 6, 2025

Proposed changes (including videos or screenshots)

Issue(s)

https://rocketchat.atlassian.net/browse/ABAC-80

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Refactor

    • Removed ABAC enablement and license validation guards from several attribute management API endpoints. These endpoints now operate without prerequisite setting checks, improving accessibility.
  • Tests

    • Updated endpoint tests to reflect removal of ABAC-disabled behavior validations.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Nov 6, 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 6, 2025

⚠️ No Changeset found

Latest commit: 7baebd0

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 6, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This PR removes ABAC enablement guards and license requirements from several API endpoints in the ABAC server implementation, allowing operations to proceed without validating the ABAC_Enabled setting. Corresponding test cases validating ABAC-disabled behavior for these endpoints are also removed.

Changes

Cohort / File(s) Summary
ABAC API Guard Removals
apps/meteor/ee/server/api/abac/index.ts
Removed settings.get('ABAC_Enabled') enablement checks and license annotations (license: ['abac']) from multiple endpoints (list, get, is-in-use workflows), altering control flow to no longer gate these operations on ABAC enabled flag or per-endpoint licensing.
ABAC Test Cleanup
apps/meteor/tests/end-to-end/api/abac.ts
Removed test cases asserting ABAC-disabled behavior for GET list, GET by id, DELETE, and GET is-in-use endpoints within the "ABAC Disabled" test block.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify the business logic rationale for removing ABAC enablement guards and license gating from these specific endpoints
  • Ensure the removal of disabled-endpoint tests aligns with the API changes and confirms the intended access control model

Possibly related PRs

  • RocketChat/Rocket.Chat#37139: Modifies ABAC feature surface and interacts with ABAC_Enabled setting/behavior from the client-side admin settings perspective

Suggested reviewers

  • tassoevan
  • ggazzo
  • lucas-a-pelegrino

Poem

🐰 Guards unshackled, checks set free,
ABAC flows without a key,
Tests retire with graceful ease,
API endpoints now please!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: removing ABAC enablement guards and allowing GET/DELETE endpoints to operate without the ABAC_Enabled setting validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 fix/endpoints

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.

@KevLehman KevLehman requested a review from Copilot November 6, 2025 17:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes license checks and ABAC feature toggle validations from four specific ABAC API endpoints: listing attributes, getting an attribute by ID, deleting an attribute by ID, and checking if an attribute is in use.

  • Removes license: ['abac'] from endpoint configuration objects
  • Removes runtime settings.get('ABAC_Enabled') validation checks
  • Affects only read operations and one delete operation while keeping protections on create/update operations
Comments suppressed due to low confidence (1)

apps/meteor/ee/server/api/abac/index.ts:174

  • Inconsistent authorization pattern: this GET endpoint has had license and ABAC_Enabled checks removed, while other endpoints in the same file (POST /abac/attributes at lines 177-198, PUT /abac/attributes/:_id at lines 201-223, and POST /abac/rooms/:rid/attributes at lines 23-49) retain both checks. Consider whether read operations should bypass ABAC feature validation or if this creates an unintended security gap where attributes can be listed even when ABAC is disabled.
		async function action() {
			const { offset, count } = await getPaginationItems(this.queryParams as Record<string, string | string[] | number | null | undefined>);
			const { key, values } = this.queryParams;

			return API.v1.success(
				await Abac.listAbacAttributes({
					key,
					values,
					offset,
					count,
				}),
			);
		},

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Nov 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.63%. Comparing base (db3fe9f) to head (7baebd0).
⚠️ Report is 1 commits behind head on feat/abac.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##           feat/abac   #37415      +/-   ##
=============================================
+ Coverage      70.62%   70.63%   +0.01%     
=============================================
  Files           3064     3064              
  Lines         106340   106340              
  Branches       18717    18718       +1     
=============================================
+ Hits           75098    75112      +14     
+ Misses         29278    29263      -15     
- Partials        1964     1965       +1     
Flag Coverage Δ
e2e 57.47% <ø> (-0.03%) ⬇️
unit 72.30% <ø> (+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 18:36
@KevLehman KevLehman requested a review from a team as a code owner November 10, 2025 18:36
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: 0

🧹 Nitpick comments (1)
apps/meteor/ee/server/api/abac/index.ts (1)

1-284: Consider documenting the endpoint access policy.

The file now implements a clear and consistent policy: POST/PUT mutations require ABAC enablement and license, while GET/DELETE operations work without these checks. This design allows administrators to inspect and clean up ABAC artifacts even when the feature is disabled.

Consider adding a brief comment at the file level documenting this policy to help future maintainers understand the intentional differentiation between mutation and read/cleanup operations.

Example documentation:

/**
 * ABAC API endpoints
 * 
 * Access policy:
 * - POST/PUT (mutations): Require ABAC_Enabled setting and 'abac' license
 * - GET (reads): Work without ABAC enablement to support inspection/audit
 * - DELETE (cleanup): Work without ABAC enablement to support artifact removal
 */
📜 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 7baebd0.

📒 Files selected for processing (2)
  • apps/meteor/ee/server/api/abac/index.ts (3 hunks)
  • apps/meteor/tests/end-to-end/api/abac.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • apps/meteor/tests/end-to-end/api/abac.ts
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
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/api/abac/index.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/api/abac/index.ts
🔇 Additional comments (3)
apps/meteor/ee/server/api/abac/index.ts (3)

226-244: LGTM! Consistent read-only behavior.

The GET endpoint correctly allows retrieving attribute definitions without requiring ABAC to be enabled. This is consistent with the other GET endpoint at lines 149-175 and aligns with the PR objective of allowing read operations when ABAC is disabled.


246-264: Consistent cleanup behavior across DELETE endpoints.

The DELETE endpoint allows removing attribute definitions without ABAC enablement checks, matching the pattern established in the DELETE endpoints at lines 51-72 and 128-146. This enables administrators to clean up ABAC artifacts even when the feature is disabled.


266-284: LGTM! Consistent read-only behavior for usage checks.

The GET endpoint correctly allows checking attribute usage without requiring ABAC to be enabled. This is consistent with the other GET endpoints and supports administrative workflows where operators need to inspect attribute usage before cleanup operations.

Copy link
Member

@MartinSchoeler MartinSchoeler left a comment

Choose a reason for hiding this comment

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

tested and it is working with the FE

@MartinSchoeler MartinSchoeler merged commit 2c46c8a into feat/abac Nov 10, 2025
116 of 118 checks passed
@MartinSchoeler MartinSchoeler deleted the fix/endpoints branch November 10, 2025 19:35
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.

2 participants