AS3 安全性測試-雜記
ActionScript3.0 2007/10/02 07:40 測式範例說明:
從A.com載Q.JPG及Q.SWF回B.COM
下載完成後
你企圖用Event.target.content.width去改變大小,Q.SWF會有安全性限制的警告
Q.JPG任人宰割(前提是A.com/crossdomain.xml要allow B.COM)
結論:
LOAD SWF 和 JPG(不做編輯存取)是沒有限制的,怎麼LOAD都可以!
a.LOAD圖片後編輯只要圖片的機器crossdomain.xml有allow 就OK
b.LOAD SWF後編輯,SWF的機器有沒有crossdomain.xml都沒差,但被編輯的SWF需要下System.Security.allowDomain("*")
c.LOAD XML或存取像ASP這種SERVER SCRIPT 需要文件上的機器crossdomain.xml有allow 方可存取
d.不同DOMAIN的SWF要使用
觀念:
來自網際網路的資源 (包括 SWF 檔) 分類置入不同的安全執行程序中,這些程序會分別對應於這些資源之來源網站的原始網域>>也就是說一個網域一個安全執行程序(sandbox)
參考:
You can load content from any accessible source. (除了文件隨你怎麼LOAD都可以)
Loading is not allowed if the calling SWF file is in a network sandbox and the file to be loaded is local.(網路上的SWF不可以LOAD LOCAL端的檔案)
If the loaded content is a SWF file, it cannot be scripted by a SWF file in another security sandbox unless that cross-scripting arrangement was approved through a call to the SWF files written in ActionScript 1.0 or 2.0, which are loaded as AVM1Movie objects, cannot cross-script SWF files written in ActionScript 3.0, which are loaded as Sprite or MovieClip objects. You can use the LocalConnection class to have these files communicate with each other. (若被LOAD的SWF是用AS2或AS1寫的,則無法cross-scripting,若要溝通需靠LocalConnection 才能完成)
If the loaded content is an image, its data cannot be accessed by a SWF file outside of the security sandbox, unless the domain of that SWF file was included a cross-domain policy file at the origin domain of the image. (若LOAD 外部DOMAIN的圖片檔案,而想存取該圖片的資訊(EX:做遮罩)除非該圖的機器的crossdomain.xml allow LOAD檔的SWF的DOMAIN)
Movie clips in the local-with-file-system sandbox cannot cross-script movie clips in the local-with-networking sandbox, and the reverse is also prevented.
You can prevent a SWF file from using this method by setting the
從A.com載Q.JPG及Q.SWF回B.COM
下載完成後
你企圖用Event.target.content.width去改變大小,Q.SWF會有安全性限制的警告
Q.JPG任人宰割(前提是A.com/crossdomain.xml要allow B.COM)
結論:
LOAD SWF 和 JPG(不做編輯存取)是沒有限制的,怎麼LOAD都可以!
a.LOAD圖片後編輯只要圖片的機器crossdomain.xml有allow 就OK
b.LOAD SWF後編輯,SWF的機器有沒有crossdomain.xml都沒差,但被編輯的SWF需要下System.Security.allowDomain("*")
c.LOAD XML或存取像ASP這種SERVER SCRIPT 需要文件上的機器crossdomain.xml有allow 方可存取
d.不同DOMAIN的SWF要使用
LocalConnection,偵聽的SWF需要使用 LocalConnection.allowDomain() 方法,授予 傳送的SWF 傳送的權限,觀念:
來自網際網路的資源 (包括 SWF 檔) 分類置入不同的安全執行程序中,這些程序會分別對應於這些資源之來源網站的原始網域>>也就是說一個網域一個安全執行程序(sandbox)
參考:
Security.allowDomain() method in the loaded content file. .(LOAD 外部DOMAIN的SWF檔案時,被LOAD的SWF檔不能被LOAD他的SWF控制(改大小、呼叫變數函數等等),除非被LOAD的SWF有呼叫Security.allowDomain() 這行指令來允許cross-scripting)
allowNetworking parameter of the the object and embed tags in the HTML page that contains the SWF content.
對位於不同安全執行程序中的 SWF 檔,偵聽程式必須使用 LocalConnection.allowDomain() 方法,授予傳送者權限。您傳遞做為 LocalConnection.allowDomain() 方法之引數的字串可以包含下列任何項目:精確的網域名稱、IP 位址,以及 * 萬用字元。
Trackback Address :: http://diary.tw/allenliao/trackback/313

