简体   繁体   English

Facebook会话代理如何提高安全性?

[英]How does a Facebook session proxy improve security?

I'm writing an iPhone app that's using Facebook Connect. 我正在编写一个使用Facebook Connect的iPhone应用程序。 While testing, you normally embed your app secret directly into the code and set up Facebook with this call: 在测试时,您通常会将您的应用程序秘密直接嵌入到代码中并使用此调用设置Facebook:

session = [FBSession sessionForApplication:myApiKey secret:myAppSecret delegate:self];

However, for production code it's recommended to use a session proxy instead of embedding your app secret into your code: 但是,对于生产代码,建议使用会话代理而不是将应用程序机密嵌入代码:

session = [FBSession sessionForApplication:myApiKey getSessionProxy:myURL delegate:self];

I can see how giving away your "secret" is probably a bad thing -- it allows anybody to take actions that appear to originate from your app -- But I don't see how using a proxy solves that problem. 我可以看到如何放弃你的“秘密”可能是一件坏事 - 它允许任何人采取看起来源自你的应用程序的行动 - 但我不知道使用代理如何解决这个问题。 An attacker can simply point his code to your session proxy. 攻击者可以简单地将他的代码指向您的会话代理。 The proxy doesn't do any kind of verification that the request is coming from your app. 代理不会对请求来自您的应用进行任何形式的验证。 In other words, you're not giving away the keys to the kingdom, but you're giving day passes to absolutely anybody who asks! 换句话说,你并没有放弃王国的钥匙,但你绝对会向任何要求的人提供日间通行证!

So where is the added security? 那么增加的安全性在哪里? Are there extra privileges that the app secret gives you that a proxied session does not? 是否有额外的权限,应用程序秘密为您提供代理会话不具备的权限?

Answering my own question, yes, there are extra privileges associated with the app secret. 回答我自己的问题,是的,还有与app秘密相关的额外权限。 This page identifies the API methods that require the app secret vs. those that can use a session secret: 此页面标识需要应用程序机密的API方法与可以使用会话机密的API方法:

http://wiki.developers.facebook.com/index.php/Session_Secret_and_API_Methods http://wiki.developers.facebook.com/index.php/Session_Secret_and_API_Methods

From what I can see from looking at http://wiki.developers.facebook.com/index.php/Session_Proxy 从我看到的http://wiki.developers.facebook.com/index.php/Session_Proxy可以看出

The proxy implementation is down to you, so you can add code to it to authenticate clients etc 代理实现由您决定,因此您可以向其添加代码以对客户端进行身份验证等

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM