Meteor 客户端数据库请求有多安全?

How secure are Meteor client side DB requests?

假设有 3 台机器:

如果我从客户端执行 mongodb 请求,它会连接到 Meteor,还是直接与 mongodb 连接?谢谢。

在客户端 Meteor 中,meteor 运行 MiniMongo,它是 mongoDB 的 js API 实现。

写在docs

On the client, there is no direct connection to the MongoDB database, and in fact a synchronous API to it is not possible (nor probably what you want). Instead, on the client, a collection is a client side cache of the database. This is achieved thanks to the Minimongo library—an in-memory, all JS, implementation of the MongoDB API.

对于写入请求——客户端保存反映在 MiniMongo 中的数据,然后与 Meteor 服务器通信。根据 allow/deny 规则,数据可能会写入 MongoDB 服务器或被拒绝。 (假设 insecure 包已删除)

简而言之,Client(MiniMOngo)和Meteor Server通过DDP通信,Meteor Server和MongoDB通过NodeJS MongoDB Driver通信。来自客户端的所有通信都进入服务器,并根据定义的规则 may/maynot 写入 MongoDB 数据库中。

Meteor 客户端数据库请求的安全性如何?
答案是“It Depends”。根据流星docs, it is not recommended to rely on allow/deny rules for security. It is always preferred to do this through methods as discussed here

一些资源:
Allow/Deny Rules in Meteor
Collections in Meteor
Read about MiniMongo Here