Postback Security

大城市里の小女人 提交于 2019-12-24 11:42:42

问题


I've been working with jQuery and *.asmx web services lately, and I'm trying to be security-conscious in doing so.

I figure it would be possible to submit an AJAX request -- even when logged-out -- to a resource that should only be accessible while logged-in.

Thus, I include special keys and hashes with each of these AJAX requests in order to validate the user's state before performing certain server-side actions.

HOWEVER

I always assumed that Postbacks were safe in that regard. That .NET would throw an error if it received a request that had been tampered with.

Is that a safe assumption? Or should I validate ALL requests, whether they're received via AJAX or a non-AJAX HTTP POST?

I suppose both are technically HTTP POSTs, but the AJAX one only submits what you explicitly pass, whereas a normal ASP.NET one includes all viewstate values. Is that correct?


回答1:


You shouldn't trust anything that comes in over HTTP - it's trivial to manufacture a GET or POST request.



来源:https://stackoverflow.com/questions/205887/postback-security

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!