Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/file-upload/lib/FileUploadBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ UploadFS.config.defaultStorePermissions = new UploadFS.StorePermissions({
return true;
}

// allows inserts from omnichannel visitors
if (doc.visitorToken) {
Copy link
Member

Choose a reason for hiding this comment

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

you should not allow any document just because if has a visitorToken, it could lead to undesired results..

I think the permission validation was fixed by #19468

can you please test again removing this code and getting the latest changes from develop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @sampaiodiego It seems that the latest changes on develop branch have fixed all the above error which I was facing.

Its also worth mentioning that this change is also not required, since the of this validator which canAccessRoom calls returns true if the visitor belongs to the same room.

return true;
}

// allow inserts from slackbridge (message_id = slack-timestamp-milli)
if (doc && doc.message_id && doc.message_id.indexOf('slack-') === 0) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion app/file-upload/server/lib/FileUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const FileUpload = {
const room = Rooms.findOneById(file.rid);
const directMessageAllowed = settings.get('FileUpload_Enabled_Direct');
const fileUploadAllowed = settings.get('FileUpload_Enabled');
if (user?.type !== 'app' && canAccessRoom(room, user, file) !== true) {
if (user && user.type !== 'app' && canAccessRoom(room, user, file) !== true) {
Copy link
Contributor

@shiqimei shiqimei Nov 3, 2020

Choose a reason for hiding this comment

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

return false;
}
const language = user ? user.language : 'en';
Expand Down