开发者

Why I should not return a json list as result in web service?

开发者 https://www.devze.com 2023-03-12 11:26 出处:网络
I did try to开发者_开发百科 return a data list as result in my web application. For example @expose(\'json\')

I did try to开发者_开发百科 return a data list as result in my web application. For example

@expose('json')
def getList():
    return ['apple', 'banana', 'orange']

But the web framework TurboGears2 stops me and says

01:50:22,687 ERROR [error] You may not expose with json a list return value. This is because it leaves your application open to CSRF attacks

I don't understand, what's the problem of returning list as result? I can't find any article talking about returning JSON list and CSRF. Why is that?


Here is an article describing the issue.

http://haacked.com/archive/2009/06/25/json-hijacking.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消