Hi,
I have a method which can update an item in the Items collection. There are 2 fields I consider important: companyId and apartmentIds. If these are restricted, the user can only “hack” his own items.
Is there a mongodb operator I’m not thinking about which can cause trouble if my method looks like this:
run({ _id, companyId, apartmentIds, ...doc }) {
if (Meteor.isServer) {
doc.companyId = this.companyId // it's provided by a validated method mixin
doc.apartmentIds = restrictApartmentIds(companyId, apartmentIds) // remove the apIds not owned by this companyId
return Items.update({ _id }, { $set: doc })
}
}