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