为什么Google会优先使用while(1); 他们的JSON响应?

三世轮回 提交于 2020-08-04 15:32:49

问题:

Why does Google prepend while(1); 为什么Google会优先使用while(1); to their (private) JSON responses? 他们的(私有)JSON响应?

For example, here's a response while turning a calendar on and off in Google Calendar : 例如,这是在Google日历中打开和关闭日历时的响应:

while(1);[['u',[['smsSentFlag','false'],['hideInvitations','false'],
  ['remindOnRespondedEventsOnly','true'],
  ['hideInvitations_remindOnRespondedEventsOnly','false_true'],
  ['Calendar ID stripped for privacy','false'],['smsVerifiedFlag','true']]]]

I would assume this is to prevent people from doing an eval() on it, but all you'd really have to do is replace the while and then you'd be set. 我认为这是为了防止人们对它执行eval() ,但是您真正要做的就是替换while ,然后进行设置。 I would assume the eval prevention is to make sure people write safe JSON parsing code. 我认为评估的目的是确保人们编写安全的JSON解析代码。

I've seen this used in a couple of other places, too, but a lot more so with Google (Mail, Calendar, Contacts, etc.) Strangely enough, Google Docs starts with &&&START&&& instead, and Google Contacts seems to start with while(1); &&&START&&& 我已经看到了这个用在其他几个地方也一样,但很多更使谷歌(邮件,日历,联系人等),奇怪的是, 谷歌文档开头&&&START&&& ,而是和谷歌联系人似乎开始与while(1); &&&START&&& while(1); &&&START&&& . while(1); &&&START&&&

What's going on here? 这里发生了什么?


解决方案:

参考一: https://stackoom.com/question/BCVW/为什么Google会优先使用while-他们的JSON响应
参考二: https://oldbug.net/q/BCVW/Why-does-Google-prepend-while-1-to-their-JSON-responses
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!