Skip to content

Commit

Permalink
Merge pull request #31202 from RocketChat/release-6.5.1
Browse files Browse the repository at this point in the history
Release 6.5.1
  • Loading branch information
ggazzo authored Dec 26, 2023
2 parents 2a33067 + 4e49fcc commit 89be910
Show file tree
Hide file tree
Showing 165 changed files with 1,008 additions and 539 deletions.
5 changes: 5 additions & 0 deletions .changeset/bump-patch-1702298298384.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Bump @rocket.chat/meteor version.
5 changes: 5 additions & 0 deletions .changeset/fair-suns-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Security improvements
5 changes: 5 additions & 0 deletions .changeset/fresh-radios-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed issue with the new `custom-roles` license module not being checked throughout the application
5 changes: 5 additions & 0 deletions .changeset/gold-stingrays-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

fix: stop refetching banner data each 5 minutes
5 changes: 5 additions & 0 deletions .changeset/lucky-apricots-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed an issue allowing admin user cancelling subscription when license's trial param is provided
5 changes: 5 additions & 0 deletions .changeset/lucky-cycles-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed Country select component at Organization form from `onboarding-ui` package
6 changes: 6 additions & 0 deletions .changeset/nasty-islands-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rocket.chat/rest-typings': minor
'@rocket.chat/meteor': minor
---

fix Federation Regression, builds service correctly
7 changes: 7 additions & 0 deletions .changeset/new-avocados-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@rocket.chat/meteor": patch
---

fix: Wrong `Message Roundtrip Time` metric

Removes the wrong metric gauge named `rocketchat_messages_roundtrip_time` and replace it by a new summary metric named `rocketchat_messages_roundtrip_time_summary`. Add new percentiles `0.5, 0.95 and 1` to all summary metrics.
7 changes: 7 additions & 0 deletions .changeset/popular-beds-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@rocket.chat/ddp-client': patch
'@rocket.chat/core-typings': patch
'@rocket.chat/meteor': patch
---

Exceeding API calls when sending OTR messages
5 changes: 5 additions & 0 deletions .changeset/real-items-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/ddp-client": patch
---

SDK login methods not saving token
5 changes: 5 additions & 0 deletions .changeset/remove-license-31189.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/ddp-client': patch
---

removed @rocket.chat/license as a dependency of ddp client
5 changes: 5 additions & 0 deletions .changeset/resume-login-31301.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/ddp-client': patch
---

fixed an issue with the ddp client reconnection not resuming the login
5 changes: 5 additions & 0 deletions .changeset/save-token-31278.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/ddp-client': patch
---

fixed an issue with the ddp client account not saving credentials correctly
6 changes: 6 additions & 0 deletions .changeset/sharp-rings-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rocket.chat/meteor": patch
---

Fixed a problem with the subscription creation on Omnichannel rooms.
Rooms were being created as seen, causing sound notifications to not work
6 changes: 6 additions & 0 deletions .changeset/sour-kids-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rocket.chat/meteor": patch
"@rocket.chat/ddp-client": patch
---

Fixed a problem where chained callbacks' return value was being overrided by some callbacks returning something different, causing callbacks with lower priority to operate on invalid values
5 changes: 5 additions & 0 deletions .changeset/spicy-kiwis-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fix desktop notification routing for direct rooms
5 changes: 5 additions & 0 deletions .changeset/spotty-suns-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Improved the experience of receiving conference calls on the mobile app by disabling the push notification for the "new call" message if a push is already being sent to trigger the phone's ringing tone.
5 changes: 5 additions & 0 deletions .changeset/tame-drinks-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed verify the account through email link
5 changes: 5 additions & 0 deletions .changeset/violet-pears-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixed the filter for file type in the list of room files
11 changes: 9 additions & 2 deletions apps/meteor/app/2fa/client/TOTPPassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Accounts } from 'meteor/accounts-base';
import { Meteor } from 'meteor/meteor';

import { process2faReturn } from '../../../client/lib/2fa/process2faReturn';
import { isTotpInvalidError, reportError } from '../../../client/lib/2fa/utils';
import { isTotpInvalidError, isTotpMaxAttemptsError, reportError } from '../../../client/lib/2fa/utils';
import { dispatchToastMessage } from '../../../client/lib/toast';
import { t } from '../../utils/lib/i18n';

Expand Down Expand Up @@ -47,6 +47,14 @@ Meteor.loginWithPassword = function (email, password, cb) {
emailOrUsername: email,
onCode: (code) => {
Meteor.loginWithPasswordAndTOTP(email, password, code, (error) => {
if (isTotpMaxAttemptsError(error)) {
dispatchToastMessage({
type: 'error',
message: t('totp-max-attempts'),
});
cb();
return;
}
if (isTotpInvalidError(error)) {
dispatchToastMessage({
type: 'error',
Expand All @@ -55,7 +63,6 @@ Meteor.loginWithPassword = function (email, password, cb) {
cb();
return;
}

cb(error);
});
},
Expand Down
37 changes: 22 additions & 15 deletions apps/meteor/app/2fa/server/code/EmailCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,26 +69,26 @@ ${t('If_you_didnt_try_to_login_in_your_account_please_ignore_this_email')}
return false;
}

if (!user.services || !Array.isArray(user.services?.emailCode)) {
if (!user.services?.emailCode) {
return false;
}

// Remove non digits
codeFromEmail = codeFromEmail.replace(/([^\d])/g, '');

await Users.removeExpiredEmailCodesOfUserId(user._id);
const { code, expire } = user.services.emailCode;

for await (const { code, expire } of user.services.emailCode) {
if (expire < new Date()) {
continue;
}
if (expire < new Date()) {
return false;
}

if (await bcrypt.compare(codeFromEmail, code)) {
await Users.removeEmailCodeByUserIdAndCode(user._id, code);
return true;
}
if (await bcrypt.compare(codeFromEmail, code)) {
await Users.removeEmailCodeOfUserId(user._id);
return true;
}

await Users.incrementInvalidEmailCodeAttempt(user._id);

return false;
}

Expand All @@ -109,7 +109,7 @@ ${t('If_you_didnt_try_to_login_in_your_account_please_ignore_this_email')}
}

public async processInvalidCode(user: IUser): Promise<IProcessInvalidCodeResult> {
await Users.removeExpiredEmailCodesOfUserId(user._id);
await Users.removeExpiredEmailCodeOfUserId(user._id);

// Generate new code if the there isn't any code with more than 5 minutes to expire
const expireWithDelta = new Date();
Expand All @@ -119,13 +119,15 @@ ${t('If_you_didnt_try_to_login_in_your_account_please_ignore_this_email')}

const emailOrUsername = user.username || emails[0];

const hasValidCode = user.services?.emailCode?.filter(({ expire }) => expire > expireWithDelta);
if (hasValidCode?.length) {
const hasValidCode =
user.services?.emailCode?.expire &&
user.services?.emailCode?.expire > expireWithDelta &&
!(await this.maxFaildedAttemtpsReached(user));
if (hasValidCode) {
return {
emailOrUsername,
codeGenerated: false,
codeCount: hasValidCode.length,
codeExpires: hasValidCode.map((i) => i.expire),
codeExpires: user.services?.emailCode?.expire,
};
}

Expand All @@ -136,4 +138,9 @@ ${t('If_you_didnt_try_to_login_in_your_account_please_ignore_this_email')}
emailOrUsername,
};
}

public async maxFaildedAttemtpsReached(user: IUser) {
const maxAttempts = settings.get<number>('Accounts_TwoFactorAuthentication_Max_Invalid_Email_Code_Attempts');
return (await Users.maxInvalidEmailCodeAttemptsReached(user._id, maxAttempts)) as boolean;
}
}
5 changes: 3 additions & 2 deletions apps/meteor/app/2fa/server/code/ICodeCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import type { IUser } from '@rocket.chat/core-typings';

export interface IProcessInvalidCodeResult {
codeGenerated: boolean;
codeCount?: number;
codeExpires?: Date[];
codeExpires?: Date;
emailOrUsername?: string;
}

Expand All @@ -15,4 +14,6 @@ export interface ICodeCheck {
verify(user: IUser, code: string, force?: boolean): Promise<boolean>;

processInvalidCode(user: IUser): Promise<IProcessInvalidCodeResult>;

maxFaildedAttemtpsReached(user: IUser): Promise<boolean>;
}
4 changes: 4 additions & 0 deletions apps/meteor/app/2fa/server/code/PasswordCheckFallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@ export class PasswordCheckFallback implements ICodeCheck {
codeGenerated: false,
};
}

public async maxFaildedAttemtpsReached(_user: IUser): Promise<boolean> {
return false;
}
}
4 changes: 4 additions & 0 deletions apps/meteor/app/2fa/server/code/TOTPCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ export class TOTPCheck implements ICodeCheck {
codeGenerated: false,
};
}

public async maxFaildedAttemtpsReached(_user: IUser): Promise<boolean> {
return false;
}
}
9 changes: 9 additions & 0 deletions apps/meteor/app/2fa/server/code/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,15 @@ export async function checkCodeForUser({ user, code, method, options = {}, conne

const valid = await selectedMethod.verify(existingUser, code, options.requireSecondFactor);
if (!valid) {
const tooManyFailedAttempts = await selectedMethod.maxFaildedAttemtpsReached(existingUser);
if (tooManyFailedAttempts) {
throw new Meteor.Error('totp-max-attempts', 'TOTP Maximun Failed Attempts Reached', {
method: selectedMethod.name,
...data,
availableMethods,
});
}

throw new Meteor.Error('totp-invalid', 'TOTP Invalid', {
method: selectedMethod.name,
...data,
Expand Down
21 changes: 8 additions & 13 deletions apps/meteor/app/2fa/server/loginHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,14 @@ Accounts.registerLoginHandler('totp', function (options) {
callbacks.add(
'onValidateLogin',
async (login) => {
if (login.methodName === 'verifyEmail') {
throw new Meteor.Error('verify-email', 'E-mail verified');
}

if (login.type === 'resume' || login.type === 'proxy' || (login.type === 'password' && login.methodName === 'resetPassword')) {
return login;
}
// CAS login doesn't yet support 2FA.
if (login.type === 'cas') {
return login;
}

if (!login.user) {
if (
!login.user ||
login.type === 'resume' ||
login.type === 'proxy' ||
login.type === 'cas' ||
(login.type === 'password' && login.methodName === 'resetPassword') ||
login.methodName === 'verifyEmail'
) {
return login;
}

Expand Down
9 changes: 2 additions & 7 deletions apps/meteor/app/api/server/v1/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ API.v1.addRoute(
this.token ||
crypto
.createHash('md5')
.update(this.requestIp + this.request.headers['user-agent'])
.update(this.requestIp + this.user._id)
.digest('hex');

const rateLimiterInput = {
Expand Down Expand Up @@ -594,12 +594,7 @@ API.v1.addRoute(

const { method, params, id } = data;

const connectionId =
this.token ||
crypto
.createHash('md5')
.update(this.requestIp + this.request.headers['user-agent'])
.digest('hex');
const connectionId = this.token || crypto.createHash('md5').update(this.requestIp).digest('hex');

const rateLimiterInput = {
userId: this.userId || undefined,
Expand Down
4 changes: 4 additions & 0 deletions apps/meteor/app/api/server/v1/oauthapps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ API.v1.addRoute(
{ authRequired: true, validateParams: isOauthAppsGetParams },
{
async get() {
if (!(await hasPermissionAsync(this.userId, 'manage-oauth-apps'))) {
return API.v1.unauthorized();
}

const oauthApp = await OAuthApps.findOneAuthAppByIdOrClientId(this.queryParams);

if (!oauthApp) {
Expand Down
10 changes: 8 additions & 2 deletions apps/meteor/app/cloud/server/functions/buildRegistrationData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ export async function buildWorkspaceRegistrationData<T extends string | undefine
const firstUser = await Users.getOldest({ projection: { name: 1, emails: 1 } });
const contactName = firstUser?.name || '';

const { organizationType, industry, size: orgSize, country, language, serverType: workspaceType, registerServer } = stats.wizard;
const country = settings.get<string>('Country');
const language = settings.get<string>('Language');
const organizationType = settings.get<string>('Organization_Type');
const industry = settings.get<string>('Industry');
const orgSize = settings.get<string>('Organization_Size');
const workspaceType = settings.get<string>('Server_Type');

const seats = await Users.getActiveLocalUserCount();
const [macs] = await LivechatRooms.getMACStatisticsForPeriod(moment.utc().format('YYYY-MM'));

Expand Down Expand Up @@ -94,7 +100,7 @@ export async function buildWorkspaceRegistrationData<T extends string | undefine
...(license && { license }),
enterpriseReady: true,
setupComplete: setupWizardState === 'completed',
connectionDisable: !registerServer,
connectionDisable: false,
npsEnabled,
MAC: macs?.contactsCount ?? 0,
// activeContactsBillingMonth: stats.omnichannelContactsBySource.contactsCount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { buildVersionUpdateMessage } from '../../../../version-check/server/func
import { generateWorkspaceBearerHttpHeader } from '../getWorkspaceAccessToken';
import { supportedVersionsChooseLatest } from './supportedVersionsChooseLatest';

declare module '@rocket.chat/license' {
declare module '@rocket.chat/core-typings' {
interface ILicenseV3 {
supportedVersions?: SignedSupportedVersions;
}
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/app/lib/server/functions/createRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ async function createUsersSubscriptions({
const extra: Partial<ISubscriptionExtraData> = options?.subscriptionExtra || {};
extra.open = true;
extra.ls = now;
extra.roles = ['owner'];

if (room.prid) {
extra.prid = room.prid;
Expand Down
Loading

0 comments on commit 89be910

Please sign in to comment.