我可以防止客户端使用Meteor设置Mongodb $吗?
问题描述:
我需要帮助,不允许访问者在流星应用程序的浏览器控制台中增加他们的分数。
Meteor.users.update({_。ID:Meteor.userId()},{$组:
目前 “黑客” 可以通过在控制台输入此增加他的场均得分{“profile.score “:1000000}})
答
删除'不安全'和'autopublish'软件包,Khai说。 并添加
Meteor.users.allow({
update:function(){
return false;
}
})
在服务器端
答
@Vasil Nedyalkov的回答可能是正确的考虑,但我会做到这一点,而不是:
Meteor.users.deny({
insert() { return true; },
update() { return true; },
remove() { return true; },
});
以及消除insecure
和autopublish
他说的那样。
这是一个很好的解释: https://guide.meteor.com/security.html#allow-deny
提问之前请仔细阅读流星的文档。您要查找的是允许/拒绝规则(http://docs.meteor.com/api/collections.html#Mongo-Collection-allow)。 –