Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SlackBridge images aren't coming across #5791

Closed
mrplow opened this issue Jan 26, 2017 · 8 comments · Fixed by #6910
Closed

SlackBridge images aren't coming across #5791

mrplow opened this issue Jan 26, 2017 · 8 comments · Fixed by #6910
Assignees
Milestone

Comments

@mrplow
Copy link

mrplow commented Jan 26, 2017

Rocket.Chat Version: Official docker image 0.50.1
Running Instances: 1
DB Replicaset OpLog: mongodb://mongo:27017/local
Node Version: whatever is included in official docker image

SlackBridge images aren't coming across again.

Messages to/from rc/slack are working as expected.

No error in log when sending image from RC, log from sending image from slack to RC below.

[34mI20170126-05:54:31.024(0) �[34mSlackBridge ➔ Events.debug OnSlackEvent-MESSAGE: { type: 'message', subtype: 'file_share', text: '<@redacted|mrplowdan> uploaded a file: <https://redacted.slack.com/files/mrplowdan/redacted/logo.png|logo.png>', file: { id: 'redacted', created: 1485410069, timestamp: 1485410069, name: 'logo.png', title: 'logo.png', mimetype: 'image/png', filetype: 'png', pretty_type: 'PNG', user: 'redacted', editable: false, size: 30727, mode: 'hosted', is_external: false, external_type: '', is_public: true, public_url_shared: false, display_as_bot: false, username: '', url_private: 'https://files.slack.com/files-pri/redacted-redacted/logo.png', url_private_download: 'https://files.slack.com/files-pri/redacted-redacted/download/logo.png', thumb_64: 'https://files.slack.com/files-tmb/redacted-redacted-redacted/logo_64.png', thumb_80: 'https://files.slack.com/files-tmb/redacted-redacted-redacted/logo_80.png', thumb_360: 'https://files.slack.com/files-tmb/redacted-redacted-redacted/logo_360.png', thumb_360_w: 246, thumb_360_h: 246, thumb_160: 'https://files.slack.com/files-tmb/redacted-redacted-redacted/logo_160.png', image_exif_rotation: 1, original_w: 246, original_h: 246, permalink: 'https://redacted.slack.com/files/mrplowdan/redacted/logo.png', permalink_public: 'https://slack-files.com/redacted-redacted-redacted', channels: [ 'redacted' ], groups: [], ims: [], comments_count: 0 }, user: 'redacted', upload: true, display_as_bot: false, username: '<@redacted|mrplowdan>', bot_id: null, team: 'redacted', source_team: 'redacted', user_team: 'redacted', user_profile: { avatar_hash: '678126fd7289', image_72: 'https://avatars.slack-edge.com/2016-12-12/redacted_72.jpg', first_name: 'Dan', real_name: 'Dan', name: 'mrplowdan' }, channel: 'redacted', ts: '1485410070.000113' } �[34mI20170126-05:54:31.933(0) Exception in callback of async function: Error: Forbidden [forbidden] at Object.<anonymous> (/app/bundle/programs/server/packages/jalik_ufs.js:1066:27) at packages/matb33_collection-hooks.js:352:26 at Array.forEach (native) at Function._.each._.forEach (packages/underscore.js:139:11) at Object.<anonymous> (packages/matb33_collection-hooks.js:351:9) at Object.collection.(anonymous function) [as insert] (packages/matb33_collection-hooks.js:146:21) at [object Object].insert (/app/bundle/programs/server/packages/mongo.js:3944:38) at ModelsBaseDb.insert (/app/bundle/programs/server/packages/rocketchat_lib.js:8777:54) at [object Object].model.insert (/app/bundle/programs/server/packages/rocketchat_lib.js:8590:24) at [object Object].self.create (/app/bundle/programs/server/packages/jalik_ufs.js:887:31) at /app/bundle/programs/server/packages/rocketchat_slackbridge.js:855:35 at runWithEnvironment (packages/meteor.js:1176:24)

@mrplow
Copy link
Author

mrplow commented Feb 11, 2017

Are others experiencing this issue as well? Could it be a server issue?

@adumesny
Copy link

adumesny commented Feb 11, 2017

yes seeing the same issue.

Weird thing is that it also seems to add all slack users from my company to the general list, even though my bot is only tied to one channel with a handful of users. Separate issue I suppose.

@RichardFoxworthy
Copy link

RichardFoxworthy commented Feb 11, 2017 via email

@marceloschmidt
Copy link
Member

We're getting Error: Forbidden [forbidden] on images uploaded by our slackbridge code, when calling const fileId = Meteor.fileStore.create(details);. I'm trying to figure out why that is happening. @rodrigok let me know if you have any clue, as I think this is related to the jalik_ufs package.

@engelgabriel engelgabriel modified the milestones: 0.52.0, 0.53.0 Feb 14, 2017
@engelgabriel engelgabriel modified the milestones: 0.54.0, 0.53.0 Mar 3, 2017
@engelgabriel
Copy link
Member

@rodrigok and @sampaiodiego any ideas?

@ajwittman
Copy link

I am getting the same issue. Images won't go through RC to Slack or Slack to RC. No error showing on RC to Slack but on Slack to RC I get:

Exception in callback of async function: Error: Forbidden [forbidden]
  at Object.<anonymous> (/opt/Rocket.Chat/programs/server/packages/jalik_ufs.js:2174:31)
  at packages/matb33_collection-hooks.js:352:26
  at Array.forEach (native)
  at Function._.each._.forEach (packages/underscore.js:139:11)
  at Object.<anonymous> (packages/matb33_collection-hooks.js:351:9)
  at Object.collection.(anonymous function) [as insert] (packages/matb33_collection-hooks.js:146:21)
  at [object Object].insert (/opt/Rocket.Chat/programs/server/packages/mongo.js:3944:38)
  at ModelsBaseDb.insert (/opt/Rocket.Chat/programs/server/packages/rocketchat_lib.js:8838:54)
  at [object Object].model.insert (/opt/Rocket.Chat/programs/server/packages/rocketchat_lib.js:8651:24)
  at Store.self.create (/opt/Rocket.Chat/programs/server/packages/jalik_ufs.js:1993:35)
  at /opt/Rocket.Chat/programs/server/packages/rocketchat_slackbridge.js:855:35
  at runWithEnvironment (packages/meteor.js:1176:24)

@engelgabriel engelgabriel modified the milestones: 0.54.0, 0.55.0 Mar 22, 2017
@engelgabriel engelgabriel modified the milestones: 0.55.0, 0.56.0 Apr 13, 2017
@nonth
Copy link

nonth commented Apr 25, 2017

Hi I'm investigate this issue and found that in FileUploadBase.js line 6 it's return undefined that cause Forbidden error from jalik-ufs when it try to check permission before insert data (ufs-store.js line 339)

I'm don't know why userId in FileUploadBase.js is undefined but below is just quick fix this issue not sure is it a good way or not or should I use the same way to check permission as it shown in update and remove functions ?

UploadFS.config.defaultStorePermissions = new UploadFS.StorePermissions({
	insert(userId/*, doc*/) {
		if (userId) {
		    return userId;
		}
		return true;
	},
	update(userId, doc) {
		return RocketChat.authz.hasPermission(Meteor.userId(), 'delete-message', doc.rid) || (RocketChat.settings.get('Message_AllowDeleting') && userId === doc.userId);
	},
	remove(userId, doc) {
		return RocketChat.authz.hasPermission(Meteor.userId(), 'delete-message', doc.rid) || (RocketChat.settings.get('Message_AllowDeleting') && userId === doc.userId);
	}
});

@engelgabriel engelgabriel removed this from the Short-term milestone May 9, 2017
@mrplow
Copy link
Author

mrplow commented May 10, 2017

💗💙💚💛💜
Can't wait to test this out!
Thanks a bunch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants