Search code examples
actionscript-3apache-flexsecuritysandbox

Security differences between Flex Application class and "normal" application


I have a problematic piece of code that uses Wordnik API to fetch word definitions. This code works fine in "local trusted" security sandbox, but doesn't work online - it produces a "security sandbox violation" (but no common ways of solving sandbox violation helped).

I've consulted this with Wordnik API creators and they didn't solve my problem directly but pointed me to a working example. Indeed their example works, but it uses Flex class "Application".

Same code that doesn't work in a standalone .as class, does work when used in Flex Application.

My question is: what are the differences (especially security differences) between Flex Application class and normal AS3 class extending Sprite?

I'm using Flashdevelop to compile. That can be important as Wordnik guys said that it worked fine in Flash Builder - although they didn't provide the details and I couldn't reproduce it.

I can attach the code if it is needed.


Solution

  • So, I can't understand what is going on exactly, but I see what's happening - and seems, that it is not linked to flash security at all.

    When you use mx app, WordnikClient sends serialized packets, that are different from non-mx app's packets:

    mx app:

    <object type="flex.messaging.messages.CommandMessage">
    

    fl app:

    <object>
    

    And requests:

    <object type="flex.messaging.messages.HTTPMessage">
    

    vs

    <object>
    

    But when you are in local trusted sandbox, client uses GET requests, for example:

    http://api.wordnik.com/v4/word.xml/drama/definitions?limit=1&useCanonical=true&api_key=148404f291e734bbf372b66b13785d85cb962394b22a8384e
    

    Server returns xml.

    So,

    1) I can propose you to use just GET requests and parse XML ;). At least while this problem happening

    2) Try to send this report to support. I think, that the problem can be in serialization process.

    Hope it will help. Regards