Skip to content

Commit 9aeed87

Browse files
committed
Merge branch 'master' into develop
2 parents 6221282 + 53cfb31 commit 9aeed87

8 files changed

Lines changed: 89 additions & 12 deletions

File tree

‎.github/history-manual.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,14 @@
8888
"KevLehman",
8989
"renatobecker"
9090
]
91+
}],
92+
"3.14.2": [{
93+
"title": "[FIX] Security Hotfix (https://docs.rocket.chat/guides/security/security-updates)",
94+
"userLogin": "sampaiodiego",
95+
"contributors": [
96+
"sampaiodiego",
97+
"KevLehman",
98+
"g-thome"
99+
]
91100
}]
92101
}

‎.github/history.json‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59612,6 +59612,26 @@
5961259612
]
5961359613
}
5961459614
]
59615+
},
59616+
"3.14.2": {
59617+
"node_version": "12.22.1",
59618+
"npm_version": "6.14.1",
59619+
"apps_engine_version": "1.25.0",
59620+
"mongo_versions": [
59621+
"3.4",
59622+
"3.6",
59623+
"4.0"
59624+
],
59625+
"pull_requests": [
59626+
{
59627+
"pr": "48",
59628+
"title": "Update README.md",
59629+
"userLogin": "hehsiao",
59630+
"contributors": [
59631+
"hehsiao"
59632+
]
59633+
}
59634+
]
5961559635
}
5961659636
}
59617-
}
59637+
}

‎HISTORY.md‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,36 @@
11

2+
# 3.14.2
3+
`2021-05-25 · 1 🐛 · 1 🔍 · 4 👩‍💻👨‍💻`
4+
5+
### Engine versions
6+
- Node: `12.22.1`
7+
- NPM: `6.14.1`
8+
- MongoDB: `3.4, 3.6, 4.0`
9+
- Apps-Engine: `1.25.0`
10+
11+
### 🐛 Bug fixes
12+
13+
14+
- Security Hotfix (https://docs.rocket.chat/guides/security/security-updates)
15+
16+
<details>
17+
<summary>🔍 Minor changes</summary>
18+
19+
20+
- Update README.md ([#48](https://github.com/RocketChat/Rocket.Chat/pull/48) by [@hehsiao](https://github.com/hehsiao))
21+
22+
</details>
23+
24+
### 👩‍💻👨‍💻 Contributors 😍
25+
26+
- [@hehsiao](https://github.com/hehsiao)
27+
28+
### 👩‍💻👨‍💻 Core Team 🤓
29+
30+
- [@KevLehman](https://github.com/KevLehman)
31+
- [@g-thome](https://github.com/g-thome)
32+
- [@sampaiodiego](https://github.com/sampaiodiego)
33+
234
# 3.14.1
335
`2021-05-19 · 1 🎉 · 2 🚀 · 4 🐛 · 3 🔍 · 7 👩‍💻👨‍💻`
436

‎app/api/server/lib/cleanQuery.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function clean(v: Query, allowList: string[] = []): Query {
1818
if (v instanceof Object) {
1919
/* eslint-disable guard-for-in */
2020
for (const key in typedParam) {
21-
if (/^$/.test(key) && !allowList.includes(key)) {
21+
if (key.startsWith('$') && !allowList.includes(key)) {
2222
delete typedParam[key];
2323
} else {
2424
clean(typedParam[key], allowList);

‎app/lib/server/functions/createRoom.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export const createRoom = function(type, name, owner, members = [], readOnly, {
5151
}
5252

5353
let room = {
54+
...extraData,
5455
name: getValidRoomName(name, null, validRoomNameOptions),
5556
fname: name,
5657
t: type,
@@ -60,7 +61,6 @@ export const createRoom = function(type, name, owner, members = [], readOnly, {
6061
_id: owner._id,
6162
username: owner.username,
6263
},
63-
...extraData,
6464
ts: now,
6565
ro: readOnly === true,
6666
};

‎app/user-data-download/server/cronProcessDownloads.js‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { TAPi18n } from 'meteor/rocketchat:tap-i18n';
77
import { SyncedCron } from 'meteor/littledata:synced-cron';
88
import archiver from 'archiver';
99
import moment from 'moment';
10+
import { v4 as uuidv4 } from 'uuid';
1011

1112
import { settings } from '../../settings/server';
1213
import { Subscriptions, Rooms, Users, Uploads, Messages, UserDataFiles, ExportOperations, Avatars } from '../../models/server';
@@ -504,12 +505,14 @@ const continueExportOperation = async function(exportOperation) {
504505
}
505506
}
506507

508+
const generatedFileName = uuidv4();
509+
507510
if (exportOperation.status === 'downloading') {
508511
exportOperation.fileList.forEach((attachmentData) => {
509512
copyFile(attachmentData, exportOperation.assetsPath);
510513
});
511514

512-
const targetFile = joinPath(zipFolder, `${ exportOperation.userId }.zip`);
515+
const targetFile = joinPath(zipFolder, `${ generatedFileName }.zip`);
513516
if (await fsExists(targetFile)) {
514517
await fsUnlink(targetFile);
515518
}
@@ -520,7 +523,7 @@ const continueExportOperation = async function(exportOperation) {
520523
if (exportOperation.status === 'compressing') {
521524
createDir(zipFolder);
522525

523-
exportOperation.generatedFile = joinPath(zipFolder, `${ exportOperation.userId }.zip`);
526+
exportOperation.generatedFile = joinPath(zipFolder, `${ generatedFileName }.zip`);
524527
if (!await fsExists(exportOperation.generatedFile)) {
525528
await makeZipFile(exportOperation.exportPath, exportOperation.generatedFile);
526529
}

‎app/utils/lib/getValidRoomName.js‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Meteor } from 'meteor/meteor';
22
import limax from 'limax';
3+
import { escapeHTML } from '@rocket.chat/string-helpers';
34

45
import { settings } from '../../settings';
56
import { Rooms } from '../../models';
@@ -9,17 +10,18 @@ export const getValidRoomName = (displayName, rid = '', options = {}) => {
910
let slugifiedName = displayName;
1011

1112
if (settings.get('UI_Allow_room_names_with_special_chars')) {
13+
const cleanName = limax(displayName);
1214
if (options.allowDuplicates !== true) {
1315
const room = Rooms.findOneByDisplayName(displayName);
1416
if (room && room._id !== rid) {
1517
if (room.archived) {
16-
throw new Meteor.Error('error-archived-duplicate-name', `There's an archived channel with name ${ displayName }`, { function: 'RocketChat.getValidRoomName', channel_name: displayName });
18+
throw new Meteor.Error('error-archived-duplicate-name', `There's an archived channel with name ${ cleanName }`, { function: 'RocketChat.getValidRoomName', channel_name: cleanName });
1719
} else {
18-
throw new Meteor.Error('error-duplicate-channel-name', `A channel with name '${ displayName }' exists`, { function: 'RocketChat.getValidRoomName', channel_name: displayName });
20+
throw new Meteor.Error('error-duplicate-channel-name', `A channel with name '${ cleanName }' exists`, { function: 'RocketChat.getValidRoomName', channel_name: cleanName });
1921
}
2022
}
2123
}
22-
slugifiedName = limax(displayName);
24+
slugifiedName = cleanName;
2325
}
2426

2527
let nameValidation;
@@ -35,9 +37,9 @@ export const getValidRoomName = (displayName, rid = '', options = {}) => {
3537
}
3638

3739
if (!nameValidation.test(slugifiedName) || !validateName(slugifiedName)) {
38-
throw new Meteor.Error('error-invalid-room-name', `${ slugifiedName } is not a valid room name.`, {
40+
throw new Meteor.Error('error-invalid-room-name', `${ escapeHTML(slugifiedName) } is not a valid room name.`, {
3941
function: 'RocketChat.getValidRoomName',
40-
channel_name: slugifiedName,
42+
channel_name: escapeHTML(slugifiedName),
4143
});
4244
}
4345

@@ -52,9 +54,9 @@ export const getValidRoomName = (displayName, rid = '', options = {}) => {
5254
}
5355
slugifiedName = tmpName;
5456
} else if (room.archived) {
55-
throw new Meteor.Error('error-archived-duplicate-name', `There's an archived channel with name ${ slugifiedName }`, { function: 'RocketChat.getValidRoomName', channel_name: slugifiedName });
57+
throw new Meteor.Error('error-archived-duplicate-name', `There's an archived channel with name ${ escapeHTML(slugifiedName) }`, { function: 'RocketChat.getValidRoomName', channel_name: escapeHTML(slugifiedName) });
5658
} else {
57-
throw new Meteor.Error('error-duplicate-channel-name', `A channel with name '${ slugifiedName }' exists`, { function: 'RocketChat.getValidRoomName', channel_name: slugifiedName });
59+
throw new Meteor.Error('error-duplicate-channel-name', `A channel with name '${ escapeHTML(slugifiedName) }' exists`, { function: 'RocketChat.getValidRoomName', channel_name: escapeHTML(slugifiedName) });
5860
}
5961
}
6062
}

‎packages/meteor-jalik-ufs/ufs-methods.js‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,17 @@ if (Meteor.isServer) {
221221
throw new Meteor.Error('invalid-store', 'The store does not exist');
222222
}
223223

224+
let parsedUrl;
225+
try {
226+
parsedUrl = new URL(url);
227+
} catch (e) {
228+
throw new Meteor.Error('invalid-url', 'The url is not valid');
229+
}
230+
231+
if (['localhost', '127.0.0.1', '0.0.0.0'].includes(parsedUrl.hostname)) {
232+
throw new Meteor.Error('invalid-url', 'URL cannot reference localhost');
233+
}
234+
224235
// Extract file info
225236
if (!file.name) {
226237
file.name = url.replace(/\?.*$/, '').split('/').pop();

0 commit comments

Comments
 (0)