At their simplest, HTML-based AIR applications that use
network content consist of a root user interface (UI) file, the
data and files they download, and some application files (in the
application sandbox). However, if the external content and some
user interface files operate in non-application sandboxes and the
application files operate in an application sandbox, how does the
non-application sandbox content and application sandbox content
interact with each other?
The AIR solution is the
sandbox bridge
API, which enables
indirect communication between different sandboxes. Developers can
craft functions that call AIR APIs and then expose those “mediating”
functions on the sandbox bridge. These bridge functions essentially
“sit on the bridge” and wait for code in the non-application sandbox
to call them.
This architecture accomplishes two goals. First, non-application
sandbox content does not have direct access to the AIR APIs and
application content is protected from external data which is unknown
and potentially malicious. Second, only those APIs that the developer
explicitly chooses to expose via the bridge mechanism are exposed.
While the sandbox bridge does not guarantee security, developers
hold the keys for reducing risk in how they expose the AIR APIs
to untrusted content. Much like a client-server model, the server
should never trust the client, and the client should never trust
data loaded from third parties. Likewise, developers should not
use or trust code loading on the server as that could compromise
the server, which in turn has access to the operating system. So
for the client-server model in both the browser and in the AIR sandbox
bridge, primitive system APIs, like
writeFile()
and
readFile()
,
should always be protected from attack.
Adobe AIR security is designed with the web application development community
in mind. Adobe supports standards and methodologies that help to mitigate
security risks. Organizations such as the OpenAjax Alliance are
further helping to publicize these best practices:
-
Isolate untrusted content in a frame or
iframe
,
as leveraging the same-origin policy makes it difficult for attackers
to access the full DOM tree.
-
Data loaded to a frame from a different domain should be
given a unique JavaScript execution context and DOM tree.
-
Do not generate and execute code dynamically.
-
Avoid inserting HTML content that is not from a trusted source.
-
Use JSON securely.
AIR
provides the mechanisms for developers to follow these best practices
and thereby enhance the security of their HTML-based applications.
For more information, see
Ajax and Mashup Security
at the OpenAjax
Alliance.
The developer must explicitly bridge sandboxes.