-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32816 from RocketChat/release-6.10.1
Release 6.10.1
- Loading branch information
Showing
39 changed files
with
962 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@rocket.chat/meteor': patch | ||
--- | ||
|
||
Bump @rocket.chat/meteor version. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@rocket.chat/meteor": patch | ||
--- | ||
|
||
Fixed issue with livechat agents not being able to leave omnichannel rooms if joining after a room has been closed by the visitor (due to race conditions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@rocket.chat/meteor': patch | ||
--- | ||
|
||
Security Hotfix (https://docs.rocket.chat/docs/security-fixes-and-updates) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@rocket.chat/meteor': patch | ||
--- | ||
|
||
Fixes an issue not displaying all groups in settings list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@rocket.chat/meteor': patch | ||
--- | ||
|
||
Security Hotfix (https://docs.rocket.chat/guides/security/security-updates) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
// Other UI extensions | ||
import './lib/messageTypes/discussionMessage'; | ||
import './createDiscussionMessageAction'; |
16 changes: 0 additions & 16 deletions
16
apps/meteor/app/discussion/client/lib/messageTypes/discussionMessage.js
This file was deleted.
Oops, something went wrong.
100 changes: 100 additions & 0 deletions
100
apps/meteor/app/lib/server/functions/checkUrlForSsrf.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import { lookup } from 'dns'; | ||
|
||
// https://en.wikipedia.org/wiki/Reserved_IP_addresses + Alibaba Metadata IP | ||
const ranges: string[] = [ | ||
'0.0.0.0/8', | ||
'10.0.0.0/8', | ||
'100.64.0.0/10', | ||
'127.0.0.0/8', | ||
'169.254.0.0/16', | ||
'172.16.0.0/12', | ||
'192.0.0.0/24', | ||
'192.0.2.0/24', | ||
'192.88.99.0/24', | ||
'192.168.0.0/16', | ||
'198.18.0.0/15', | ||
'198.51.100.0/24', | ||
'203.0.113.0/24', | ||
'224.0.0.0/4', | ||
'240.0.0.0/4', | ||
'255.255.255.255', | ||
'100.100.100.200/32', | ||
]; | ||
|
||
export const nslookup = async (hostname: string): Promise<string> => { | ||
return new Promise((resolve, reject) => { | ||
lookup(hostname, (error, address) => { | ||
if (error) { | ||
reject(error); | ||
} else { | ||
resolve(address); | ||
} | ||
}); | ||
}); | ||
}; | ||
|
||
export const ipToLong = (ip: string): number => { | ||
return ip.split('.').reduce((acc, octet) => (acc << 8) + parseInt(octet, 10), 0) >>> 0; | ||
}; | ||
|
||
export const isIpInRange = (ip: string, range: string): boolean => { | ||
const [rangeIp, subnet] = range.split('/'); | ||
const ipLong = ipToLong(ip); | ||
const rangeIpLong = ipToLong(rangeIp); | ||
const mask = ~(2 ** (32 - Number(subnet)) - 1); | ||
return (ipLong & mask) === (rangeIpLong & mask); | ||
}; | ||
|
||
export const isIpInAnyRange = (ip: string): boolean => ranges.some((range) => isIpInRange(ip, range)); | ||
|
||
export const isValidIPv4 = (ip: string): boolean => { | ||
const octets = ip.split('.'); | ||
if (octets.length !== 4) return false; | ||
return octets.every((octet) => { | ||
const num = Number(octet); | ||
return num >= 0 && num <= 255 && octet === num.toString(); | ||
}); | ||
}; | ||
|
||
export const isValidDomain = (domain: string): boolean => { | ||
const domainPattern = /^(?!-)(?!.*--)[A-Za-z0-9-]{1,63}(?<!-)\.?([A-Za-z]{2,63}\.?)*[A-Za-z]{2,63}$/; | ||
if (!domainPattern.test(domain)) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
|
||
export const checkUrlForSsrf = async (url: string): Promise<boolean> => { | ||
if (!(url.startsWith('http://') || url.startsWith('https://'))) { | ||
return false; | ||
} | ||
|
||
const [, address] = url.split('://'); | ||
const ipOrDomain = address.includes('/') ? address.split('/')[0] : address; | ||
|
||
if (!(isValidIPv4(ipOrDomain) || isValidDomain(ipOrDomain))) { | ||
return false; | ||
} | ||
|
||
if (isValidIPv4(ipOrDomain) && isIpInAnyRange(ipOrDomain)) { | ||
return false; | ||
} | ||
|
||
if (isValidDomain(ipOrDomain) && /metadata.google.internal/.test(ipOrDomain.toLowerCase())) { | ||
return false; | ||
} | ||
|
||
if (isValidDomain(ipOrDomain)) { | ||
try { | ||
const ipAddress = await nslookup(ipOrDomain); | ||
if (isIpInAnyRange(ipAddress)) { | ||
return false; | ||
} | ||
} catch (error) { | ||
console.log(error); | ||
return false; | ||
} | ||
} | ||
|
||
return true; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import type { IUser, IRoom, IOmnichannelRoom } from '@rocket.chat/core-typings'; | ||
import { isOmnichannelRoom } from '@rocket.chat/core-typings'; | ||
import { LivechatRooms, Subscriptions } from '@rocket.chat/models'; | ||
|
||
import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission'; | ||
import type { CloseRoomParams } from '../../../livechat/server/lib/LivechatTyped'; | ||
import { Livechat } from '../../../livechat/server/lib/LivechatTyped'; | ||
|
||
export const closeLivechatRoom = async ( | ||
user: IUser, | ||
roomId: IRoom['_id'], | ||
{ | ||
comment, | ||
tags, | ||
generateTranscriptPdf, | ||
transcriptEmail, | ||
}: { | ||
comment?: string; | ||
tags?: string[]; | ||
generateTranscriptPdf?: boolean; | ||
transcriptEmail?: | ||
| { | ||
sendToVisitor: false; | ||
} | ||
| { | ||
sendToVisitor: true; | ||
requestData: Pick<NonNullable<IOmnichannelRoom['transcriptRequest']>, 'email' | 'subject'>; | ||
}; | ||
}, | ||
): Promise<void> => { | ||
const room = await LivechatRooms.findOneById(roomId); | ||
if (!room || !isOmnichannelRoom(room)) { | ||
throw new Error('error-invalid-room'); | ||
} | ||
|
||
if (!room.open) { | ||
const subscriptionsLeft = await Subscriptions.countByRoomId(roomId); | ||
if (subscriptionsLeft) { | ||
await Subscriptions.removeByRoomId(roomId); | ||
return; | ||
} | ||
throw new Error('error-room-already-closed'); | ||
} | ||
|
||
const subscription = await Subscriptions.findOneByRoomIdAndUserId(roomId, user._id, { projection: { _id: 1 } }); | ||
if (!subscription && !(await hasPermissionAsync(user._id, 'close-others-livechat-room'))) { | ||
throw new Error('error-not-authorized'); | ||
} | ||
|
||
const options: CloseRoomParams['options'] = { | ||
clientAction: true, | ||
tags, | ||
...(generateTranscriptPdf && { pdfTranscript: { requestedBy: user._id } }), | ||
...(transcriptEmail && { | ||
...(transcriptEmail.sendToVisitor | ||
? { | ||
emailTranscript: { | ||
sendToVisitor: true, | ||
requestData: { | ||
email: transcriptEmail.requestData.email, | ||
subject: transcriptEmail.requestData.subject, | ||
requestedAt: new Date(), | ||
requestedBy: user, | ||
}, | ||
}, | ||
} | ||
: { | ||
emailTranscript: { | ||
sendToVisitor: false, | ||
}, | ||
}), | ||
}), | ||
}; | ||
|
||
await Livechat.closeRoom({ | ||
room, | ||
user, | ||
options, | ||
comment, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export const validateNameChars = (name: string | undefined): boolean => { | ||
if (typeof name !== 'string') { | ||
return false; | ||
} | ||
|
||
const invalidChars = /[<>\\/]/; | ||
if (invalidChars.test(name)) { | ||
return false; | ||
} | ||
|
||
try { | ||
const decodedName = decodeURI(name); | ||
if (invalidChars.test(decodedName)) { | ||
return false; | ||
} | ||
} catch (err) { | ||
return false; | ||
} | ||
|
||
return true; | ||
}; |
Oops, something went wrong.