0

我是 RoR 应用程序的新手..并且已经将 Devise 实现为身份验证。一切都很好.. 直到我发现,我可以通过 curl 命令通过 POST 方法创建用户,如下所示:

curl -d "user[username]=hacker&user[email]=hacker@test.com&user[password]=password&user[password_confirmation]=password&user[admin]=1" http://lvh.me:3000/users/

如果有人在无限循环中运行 curl 命令怎么办.. 有没有办法保护它?

如果我使用 attribute_accessible 不公开字段,那么我将无法从应用程序本身创建用户..

我在谷歌也找不到任何东西。请帮助我了解这是否正常。?

更新1:

这是部署到 heroku http://intense-cliffs-5986.herokuapp.com/的示例应用程序

现在使用 curl 命令

curl -d "user[name]=Somename&user[email]=Someone@test.com&user[password]=password&user[password_confirmation]=password" http://intense-cliffs-5986.herokuapp.com/users

从浏览器访问 URL 时,您将看到创建了一个新用户。

这正常吗...请帮助我理解。

更新2:

提出来设计,让我们看看他们是否能回答。设计问题 2613

更新3:

设计团队已在 github 上回答。似乎它是一个理想的功能。他们关闭了这个问题。我现在必须找到另一种方法。

4

0 回答 0