1
我正在使用PHP代理脚本将来自Facebook的图像加载到Flash中,而没有任何沙箱侵犯。它来自这里的指南:http://www.permadi.com/blog/2010/12/loading-facebook-profile-picture-into-flash-swf-using-open-graph-api/。相关的PHP代码是:Facebook代理加载器安全
<?php
$path=$_GET['path'];
if (stristr($path, "fbcdn.")==FALSE && stristr($path, "facebook.")==FALSE)
{
echo "ERROR";
exit;
}
header("Content-Description: Facebook Proxied File");
header("Content-Type: image");
header("Content-Disposition: attachment; filename=".$path);
@readfile($path);
?>
本指南提到,对于真实世界的应用程序,建议采用其他安全措施。还有哪些其他措施适用于此?也许某种从Flash传递到PHP的密钥?
我意识到我没有办法完全保护Flash免遭反编译,但是我可以防止脚本被恶意使用吗?
谢谢,你给了我很多想法。我将从这些开始。 – shanethehat 2011-05-19 13:15:31
你可否详细说一下第一点?你是否意味着请求中包含已知Facebook服务器列表中的名称? – shanethehat 2011-05-19 13:17:54
是的。使用parse_url可以确保域名(不是URL的任何其他部分)以已知的域名结尾。只需检查第二级域名(.facebook.com,.fbcdn.net结束等等)。 – 2011-05-19 13:35:22