我是否需要使用 oAuth 来保护 REST 请求正文的安全?
我正在构建 REST API 并使用 oAuth 进行授权。我的问题是,如果 PUT 和 POST 请求包含数据,我是否需要对请求正文执行任何操作?如果这有什么区别的话,我正在使用 SSL。
在我看来,url 是通过 oAuth 签名验证的,但正文的内容可以是任何内容。不过,我不确定这是否是一个问题,因为如果 URL 签名正确,那么他们就提供了正确的凭据来执行插入或更新。我也使用随机数来防止重放攻击,但我想避免由于误解如何处理请求正文而产生安全问题。
感谢您的任何建议。
I'm building a REST API and using oAuth for authorization. My question is do I need to do anything about the body of the request in the case of PUT and POST requests that contain data? I'm using SSL if that makes any difference.
It seems to me that the url is verified by the oAuth signature, but the contents of the body could be anything. I'm not sure if that's a problem, though, because if the URL is correctly signed then they have provided the correct credentials to do an insert or update. I am using nonce to prevent replay attacks as well, but I want to avoid creating a security issue due to misunderstanding how to treat the request body.
Thanks for any suggestions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过一些 OAuth 库找到了答案。它不是规范的正式部分,但某些服务和库在请求标头中使用“xoauth_body_signature”和“xoauth_body_signature_method”来发送正文内容的签名。
显然,实施方面存在一些挑战,可以通过谷歌搜索 xoauth_body_signature 找到讨论。似乎没有很多人这样做。
I found an answer looking through some OAuth libraries. It's not officially part of the spec but some services and libraries use "xoauth_body_signature" and "xoauth_body_signature_method" in the request headers to send a signature of the body contents.
Apparently there's some challenges implementing and discussions can be found by googling for xoauth_body_signature. It doesn't seem like a lot of people are doing it.