I just noticed that Meteor.call, the concept that prevent user from invoke collection's insert, update, remove method, still able to be invoked from JavaScript console.
For client's example:
// client
...
Meteor.call('insertProduct', productInfo);
...
Here's the server part:
// server
Meteor.methods({
insertProduct: function( productInfo ){
Product.insert(...);
}
})
OK, I know people can't invoke Product.insert() directly from their JavaScript console.
But if they try a little bit more, they'd find out there's Meteor.call() in client's JavaScript from Developer tool's resource tab.
So now they can try to invoke Meteor.call from their console, then try to guessing what should be productInfo's properties.
So I wonder how can we prevent this final activity?
Does Meteor.call done the job well enough?
or I'm missing something important?
As you know by now that you can't really block calling
Meteor.callfrom Javascript console, what i'd like to add as a suggestion with @Stephen and @thatgibbyguy that, be sure to check your user'srolewhen adding documents into the collection.Simple-Schemawill help you prevent inserting/updating garbage data into the collection. andalanning:rolespackage certainly makes your app secure by controlling who has the permission to write/read/update your collection documents.Alanning:roles Package