如何保证通过JSONP发送的数据安全?
我需要确保从脚本发送的数据尽可能安全。服务器端语言是PHP。
任何提示将不胜感激。
更新:我的意思是。我需要确保从我的服务器发送的数据不会对正在检索它的其他服务器造成损害。我不担心安全性或人们看到正在发送的数据,只需要确保它不会损害其他站点。
I need to ensure that data sent out from a script is as secure as possible. The server-side language is PHP.
Any tips would be greatly appreciated.
UPDATE: What I mean is. I need to ensure the data sent from my server cannot do damage to the other server that is retrieving it. I'm not worried about the security or people seeing the data that's being sent, just need to make sure it can't harm the other site.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果一切都正确逃脱,那就完全安全了。如果您传递的 JSON 有效,则不存在安全风险(假设对方没有对某些值使用邪恶的
eval
)。It is totally safe if everything is properly escaped. If your delivered JSON is valid, there is no security risk (assuming that the other side does not use evil
eval
on some of the values).JSONP 数据本质上并不安全,因为如果任何人拥有 URL,他们就可以访问它。
尝试发送原始 json(不带回调函数)以提高安全性。
使用 HTTPS / SSL 而不是普通的 http 发送数据也是一个很好的主意,因为它可以在从服务器到客户端的途中被拦截。
JSONP data inherently isn't secure because if anyone has the URL they can access it.
Try sending raw json (without a callback function) to increase security.
It is also a very good idea to send the data using HTTPS / SSL instead of plain http, which can be intercepted on its way from the server to the client.
好吧,如果你说它不安全,你可以让它更安全一点。
顺便说一句:永远不要使用 json 来列出用户名 &&密码等。仅将其用于无害数据
如果您执行类似的操作,
JQUERY: $('#obj').load("json.test.php");
put这些代码位于 json.test.php 的顶部
//您必须阅读 url
希望这会有所帮助
Well you can make it a bit securer, if you say its not secure.
Btw.: never use json to list usernames && passwords or etc. only use it for harmless datas
if you do something like this,
JQUERY: $('#obj').load("json.test.php");
put these codes on the top of the json.test.php
//You have to read the url
Hope this helps