Skip to content

Commit

Permalink
[FIX] NoSQL injection in listEmojiCustom Meteor method (#643)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagoevanp authored and ggazzo committed Feb 14, 2023
1 parent 31f0e01 commit ef0fd4b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions apps/meteor/app/emoji-custom/server/methods/listEmojiCustom.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
import { Meteor } from 'meteor/meteor';
import { EmojiCustom } from '@rocket.chat/models';
import { check, Match } from 'meteor/check';

import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger';

/**
* @deprecated Will be removed in future versions.
*/

Meteor.methods({
async listEmojiCustom(options = {}) {
methodDeprecationLogger.warn('listEmojiCustom will be removed in future versions of Rocket.Chat');

const user = Meteor.user();

if (!user) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', {
method: 'listEmojiCustom',
});
}

check(options, {
name: Match.Optional(String),
aliases: Match.Optional([String]),
});

return EmojiCustom.find(options).toArray();
},
});

0 comments on commit ef0fd4b

Please sign in to comment.