chore: Expose workspace hashed url in workspace admin page and startup logs - #40685
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 introduces SHA-256 hashing of workspace URLs in the License module and exposes both plain and hashed workspace URLs through the server API, client UI, startup message, and license validation logic. ChangesWorkspace URL Hashing Feature
🎯 3 (Moderate) | ⏱️ ~25 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #40685 +/- ##
===========================================
- Coverage 70.12% 69.86% -0.26%
===========================================
Files 3355 3376 +21
Lines 129225 129657 +432
Branches 22333 22529 +196
===========================================
- Hits 90616 90586 -30
- Misses 35315 35777 +462
Partials 3294 3294
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
6f035b5 to
eaaeeea
Compare
9d8018f to
599ae75
Compare
599ae75 to
0a5e2a9
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
ee/packages/license/src/validation/validateLicenseUrl.ts (1)
45-64: ⚡ Quick winRemove the new inline implementation comments here.
These two explanatory blocks should be expressed by helper names or structure instead of source comments, to stay consistent with the TS/JS repo convention.
As per coding guidelines, "
**/*.{ts,tsx,js}: ... Avoid code comments in the implementation`."🤖 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 `@ee/packages/license/src/validation/validateLicenseUrl.ts` around lines 45 - 64, The inline explanatory comments inside validateLicenseUrl.ts should be removed and their intent expressed via clearer code structure: extract the conditional checks into well-named helpers or boolean variables (e.g., looksLikeHash(url.value) using /^[a-f0-9]{64}$/i, looksLikeUrl(url.value) maybe reusing validateUrl heuristics) and/or small helper functions like shouldValidateAsHashFallback(url, hashedWorkspaceUrl) and shouldValidateAsUrlFallback(url, workspaceUrl), then replace the commented blocks with those helpers in the if statements and keep the existing logger.warn calls (adjusting message if needed); locate the logic around url.type, validateHash, validateUrl, hashedWorkspaceUrl, workspaceUrl and logger.warn to apply these renames so intent is conveyed by names not comments.Source: Coding guidelines
🤖 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/api/server/lib/getServerInfo.ts`:
- Around line 18-20: getServerInfo currently returns License.getWorkspaceUrl and
License.getHashedWorkspaceUrl which exposes workspace identifiers on the public
/info payload; remove these two fields from the public return value in the
getServerInfo function and either (a) only include them when the same
admin/permission check used by the /info route passes, or (b) move them to a new
privileged endpoint (e.g., getAdminServerInfo) that requires the appropriate
admin permission; update any callers that need these values to use the new
guarded path or permission-checked return.
In `@apps/meteor/server/startup/serverRunning.ts`:
- Around line 52-53: The banner prints the raw Site_Url from settings but the
hashed line uses License.getHashedWorkspaceUrl(), causing mismatch; change the
plain URL source to the canonical value returned by License.getWorkspaceUrl()
instead of settings.get<string>('Site_Url') so both lines use the same
normalized workspace URL (keep License.getHashedWorkspaceUrl() for the digest).
---
Nitpick comments:
In `@ee/packages/license/src/validation/validateLicenseUrl.ts`:
- Around line 45-64: The inline explanatory comments inside
validateLicenseUrl.ts should be removed and their intent expressed via clearer
code structure: extract the conditional checks into well-named helpers or
boolean variables (e.g., looksLikeHash(url.value) using /^[a-f0-9]{64}$/i,
looksLikeUrl(url.value) maybe reusing validateUrl heuristics) and/or small
helper functions like shouldValidateAsHashFallback(url, hashedWorkspaceUrl) and
shouldValidateAsUrlFallback(url, workspaceUrl), then replace the commented
blocks with those helpers in the if statements and keep the existing logger.warn
calls (adjusting message if needed); locate the logic around url.type,
validateHash, validateUrl, hashedWorkspaceUrl, workspaceUrl and logger.warn to
apply these renames so intent is conveyed by names not comments.
🪄 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: fc26a2bb-88ef-4cec-b034-2fa51aa19ed6
📒 Files selected for processing (8)
apps/meteor/app/api/server/lib/getServerInfo.tsapps/meteor/client/views/admin/workspace/DeploymentCard/DeploymentCard.tsxapps/meteor/server/startup/serverRunning.tsee/packages/license/src/license.tsee/packages/license/src/validation/validateLicenseUrl.spec.tsee/packages/license/src/validation/validateLicenseUrl.tspackages/core-typings/src/IWorkspaceInfo.tspackages/i18n/src/locales/en.i18n.json
📜 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). (7)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Hacktron Security Check
- GitHub Check: 🔨 Test Unit / Unit Tests
- GitHub Check: 🔎 Code Check / TypeScript
- GitHub Check: 🔎 Code Check / Code Lint
- GitHub Check: 🔨 Test Storybook / Test Storybook
- GitHub Check: 📦 Meteor Build (coverage)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{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/startup/serverRunning.tsapps/meteor/client/views/admin/workspace/DeploymentCard/DeploymentCard.tsxpackages/core-typings/src/IWorkspaceInfo.tsee/packages/license/src/license.tsee/packages/license/src/validation/validateLicenseUrl.spec.tsapps/meteor/app/api/server/lib/getServerInfo.tsee/packages/license/src/validation/validateLicenseUrl.ts
**/*.spec.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use.spec.tsextension for test files (e.g.,login.spec.ts)
Files:
ee/packages/license/src/validation/validateLicenseUrl.spec.ts
🧠 Learnings (7)
📚 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/startup/serverRunning.tspackages/core-typings/src/IWorkspaceInfo.tsee/packages/license/src/license.tsee/packages/license/src/validation/validateLicenseUrl.spec.tsapps/meteor/app/api/server/lib/getServerInfo.tsee/packages/license/src/validation/validateLicenseUrl.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/startup/serverRunning.tspackages/core-typings/src/IWorkspaceInfo.tsee/packages/license/src/license.tsee/packages/license/src/validation/validateLicenseUrl.spec.tsapps/meteor/app/api/server/lib/getServerInfo.tsee/packages/license/src/validation/validateLicenseUrl.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/startup/serverRunning.tsapps/meteor/client/views/admin/workspace/DeploymentCard/DeploymentCard.tsxpackages/core-typings/src/IWorkspaceInfo.tsee/packages/license/src/license.tsee/packages/license/src/validation/validateLicenseUrl.spec.tsapps/meteor/app/api/server/lib/getServerInfo.tsee/packages/license/src/validation/validateLicenseUrl.ts
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.
Applied to files:
apps/meteor/client/views/admin/workspace/DeploymentCard/DeploymentCard.tsx
📚 Learning: 2025-12-10T21:00:43.645Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:43.645Z
Learning: Adopt the monorepo-wide Jest testMatch pattern: <rootDir>/src/**/*.spec.{ts,js,mjs} (represented here as '**/src/**/*.spec.{ts,js,mjs}') to ensure spec files under any package's src directory are picked up consistently across all packages in the Rocket.Chat monorepo. Apply this pattern in jest.config.ts for all relevant packages to maintain uniform test discovery.
Applied to files:
ee/packages/license/src/validation/validateLicenseUrl.spec.ts
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.
Applied to files:
ee/packages/license/src/validation/validateLicenseUrl.spec.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.
Applied to files:
ee/packages/license/src/validation/validateLicenseUrl.spec.ts
🔇 Additional comments (1)
packages/i18n/src/locales/en.i18n.json (1)
2541-2541: LGTM!
There was a problem hiding this comment.
2 issues found across 8 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/server/startup/serverRunning.ts">
<violation number="1" location="apps/meteor/server/startup/serverRunning.ts:52">
P2: The displayed Site URL comes from the raw `Site_Url` setting (which may include scheme and trailing slash), but the Hashed Site URL is computed from `License.getWorkspaceUrl()` which strips those. This means the two displayed values won't correspond — the hash isn't of the URL shown next to it. Use `License.getWorkspaceUrl()` for the plain URL as well to keep them consistent.</violation>
</file>
<file name="apps/meteor/app/api/server/lib/getServerInfo.ts">
<violation number="1" location="apps/meteor/app/api/server/lib/getServerInfo.ts:19">
P1: These fields are returned unconditionally, but the `/info` endpoint is unauthenticated (`authRequired: false`). This exposes `workspaceUrl` and `hashedWorkspaceUrl` to any anonymous caller. Move these fields inside the `hasPermissionToViewStatistics` guard or to a privileged endpoint to avoid publicly disclosing workspace identifiers.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| const cloudWorkspaceId = settings.get<string | undefined>('Cloud_Workspace_Id'); | ||
|
|
||
| return { | ||
| workspaceUrl: License.getWorkspaceUrl(), |
There was a problem hiding this comment.
P1: These fields are returned unconditionally, but the /info endpoint is unauthenticated (authRequired: false). This exposes workspaceUrl and hashedWorkspaceUrl to any anonymous caller. Move these fields inside the hasPermissionToViewStatistics guard or to a privileged endpoint to avoid publicly disclosing workspace identifiers.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/meteor/app/api/server/lib/getServerInfo.ts, line 19:
<comment>These fields are returned unconditionally, but the `/info` endpoint is unauthenticated (`authRequired: false`). This exposes `workspaceUrl` and `hashedWorkspaceUrl` to any anonymous caller. Move these fields inside the `hasPermissionToViewStatistics` guard or to a privileged endpoint to avoid publicly disclosing workspace identifiers.</comment>
<file context>
@@ -15,6 +16,8 @@ export async function getServerInfo(userId?: string): Promise<IWorkspaceInfo> {
const cloudWorkspaceId = settings.get<string | undefined>('Cloud_Workspace_Id');
return {
+ workspaceUrl: License.getWorkspaceUrl(),
+ hashedWorkspaceUrl: License.getHashedWorkspaceUrl(),
version: getTrimmedServerVersion(),
</file context>
| ` Platform: ${process.platform}`, | ||
| ` Process Port: ${process.env.PORT}`, | ||
| ` Site URL: ${settings.get('Site_Url')}`, | ||
| ` Site URL: ${settings.get<string>('Site_Url')}`, |
There was a problem hiding this comment.
P2: The displayed Site URL comes from the raw Site_Url setting (which may include scheme and trailing slash), but the Hashed Site URL is computed from License.getWorkspaceUrl() which strips those. This means the two displayed values won't correspond — the hash isn't of the URL shown next to it. Use License.getWorkspaceUrl() for the plain URL as well to keep them consistent.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/meteor/server/startup/serverRunning.ts, line 52:
<comment>The displayed Site URL comes from the raw `Site_Url` setting (which may include scheme and trailing slash), but the Hashed Site URL is computed from `License.getWorkspaceUrl()` which strips those. This means the two displayed values won't correspond — the hash isn't of the URL shown next to it. Use `License.getWorkspaceUrl()` for the plain URL as well to keep them consistent.</comment>
<file context>
@@ -48,7 +49,8 @@ Meteor.startup(async () => {
` Platform: ${process.platform}`,
` Process Port: ${process.env.PORT}`,
- ` Site URL: ${settings.get('Site_Url')}`,
+ ` Site URL: ${settings.get<string>('Site_Url')}`,
+ ` Hashed Site URL: ${License.getHashedWorkspaceUrl()}`,
];
</file context>
| ` Site URL: ${settings.get<string>('Site_Url')}`, | |
| ` Site URL: ${License.getWorkspaceUrl()}`, |
Proposed changes (including videos or screenshots)
Issue(s)
Steps to test or reproduce
Further comments
Summary by CodeRabbit
New Features
Improvements
Documentation