TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

MongoDB will not prevent NoSQL injections in your Node.js app

36 点作者 ecares超过 8 年前

5 条评论

starptech超过 8 年前
&quot;NoSQL means Not-injectable, right?&quot; makes no sense for me. It doesnt matter which type of database technology you are using. As any other database there are security roles. No mongodb query should be executed as an admin. You can restrict that up to document level. You can even create read-only views. You should always validate you payload. Use e.g Joi <a href="https:&#x2F;&#x2F;github.com&#x2F;hapijs&#x2F;joi" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;hapijs&#x2F;joi</a>. Someone who doesn&#x27;t validate his payload and pass it up to the driver should not be surprised.
asher_超过 8 年前
This isn&#x27;t injection at all. No commands other than the find are being performed. Little Bobby Tables (Little Bobby Collections?) will not have any luck here.<p>In addition to the fact that you can&#x27;t execute arbitrary commands with this example, the example itself is flawed. If the programmer&#x27;s intention was to exclude &quot;secret projects&quot; from all searches, then they should have written the query to do that. They didn&#x27;t, and allowed multiple other ways of accessing those records.<p>Writing some code that does something different to what you intended it to do is not a NoSQL injection, it&#x27;s just bad code.
评论 #13190788 未加载
overcast超过 8 年前
Every time I read these MongoDB articles, I question why RethinkDB didn&#x27;t rise up.
评论 #13185171 未加载
评论 #13185432 未加载
评论 #13185474 未加载
评论 #13185167 未加载
taylorwc超过 8 年前
Noob question. I get that this is a problem and what it could do, but wouldn&#x27;t doing simple checks and validations of any client input solve this problem?
评论 #13185252 未加载
评论 #13185462 未加载
评论 #13185327 未加载
评论 #13185231 未加载
mnarayan01超过 8 年前
If you&#x27;re letting users query against a collection using a fairly arbitrary filter, then not having something to ensure they are authorized to view (or update, etc.) the results is almost certainly a mistake. Also describing $gte as a &quot;command&quot; seems misleading; if you could use $where in embedded queries it would maybe be a different story, but since I don&#x27;t think you can, this seems hyperbolic.