防止 RESTful JSON Web 服务上的垃圾邮件
我有一个在 grails 中实现的 Web 服务来处理来自 GWT 客户端的 POST。如果用户登录,他也可以通过浏览器访问 Web 服务,而无需 GWT。
我现在的问题是,我如何才能以一种方式保护它,使其不可能在登录时通过使用特定帖子(可能是循环)向我的网络服务发送垃圾邮件,例如 1000 个新条目?
对于 Android 客户端也是如此,或者如果我向其他开发人员授予我的 Web 服务,他们可以将数千个数据发布到我的 Web 服务中。
已经有我可以使用的机制了吗?
感谢您的帮助
I have a webservice implemented in grails to deal with POSTs from a GWT client. If the user logges in he also could access as well the webservice without GWT just over the browser.
My question is now how can I secure it in a way that its not possible to spam my webservice with e.g. 1000 new entries just by stress my webservice with a specific posts(maybe over a loop) when logged in?
Same is also for Android clients or if I grant other developers to my webservice and they could POST thousands of data into my webservice.
Is there already a mechanism I can use?
Thanks for your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此 REST api 的用户需要绑定到 API 密钥。 加密随机数通常是首选工具。为了获得此密钥,用户需要解决验证码。每个 API 密钥应限制为特定数量的请求。如果用户发送许多请求,那么您应该使用验证码提示他们(这可能是对 REST 请求的错误响应)。
但是为了强制执行此规则,您必须在每个客户端上保留服务器端状态,因此这不是 RESTful。简而言之,您所要求的并不是简单地通过 REST 就能实现的。
Users of this REST api need to be tied to an API key. A cryptographic nonce is usually the tool of choice. In order to be issued this key the user should be required to solve a captcha. Each API key should be limited to a specific number of requests. If the user is sending to many requests, then you should prompt them with a captcha (Which could be an error response to a REST request).
But in order to enforce this rule then you have to keep server-side state on each client, and there for this would not be RESTful. In short, what you are asking is not simply possible with REST.