Introduction
A cross-domain policy file is, in Adobe’s words, “an XML document that grants a web client, such as Adobe Flash Player or Adobe Acrobat permission to handle data across domains”.
When content from one domain asks for data from another, the client looks on the target domain for a policy file that allows it. The usual one is the master policy file: a file called
crossdomain.xml at the root of the domain (http://example.com/crossdomain.xml). Adobe’s “Cross Domain Policy File Specification” (2009) defines the elements; Flash Player has
supported policy files since version 6 and Acrobat since version 9. Which clients still read the file today is not stated in the sources read for this site.
Structure
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only"/>
<allow-access-from domain="*.example.com"/>
<allow-access-from domain="www.example.com"/>
<allow-http-request-headers-from domain="*.adobe.com" headers="SOAPAction"/>
</cross-domain-policy>
This is Example 1.1 of the specification. The root has no attributes; its children are:
| Element | Attributes and rules (Adobe specification, section 1.3) |
|---|---|
site-control | permitted-cross-domain-policies (required by the DTD) sets the meta-policy: none (no policy file is allowed anywhere on the server, this one included),
master-only (only this master file), by-content-type (HTTP and HTTPS only: files served as text/x-cross-domain-policy), by-ftp-filename (FTP only: files named
crossdomain.xml) and all. The default is master-only except for socket policy files, where it is all. Only meaningful in the master file. With
none, “it is invalid to have allow-access-from or a header policy” in the same file, and none takes precedence. |
allow-access-from | Grants a requesting domain the right to read data. domain (required): a named domain or an IP address; subdomains are different domains; * alone matches all
domains, and *. as a prefix matches subdomains of an explicit name. to-ports (sockets only): ports, ranges such as 1000-2000, or *.
secure (HTTPS and sockets only): true or false; in an HTTPS policy file the default is true, and false “is not recommended”. |
allow-http-request-headers-from | Grants a requesting domain the right to send headers. domain and headers (a comma-separated list, with * as a wildcard for all headers or a suffix) are
required; secure as above. |
allow-access-from-identity | Grants access by signing certificate instead of origin: one signatory holding one certificate with a fingerprint (hexadecimal digits; spaces and colons are
ignored) and a fingerprint-algorithm. The only algorithm defined is sha-1, whose fingerprint has 40 hexadecimal digits. Acrobat supports it; Flash Player does not. |
The specification says a non-master policy file can only grant access to data within its own directory and below, that URL policy files should be served as
text/x-cross-domain-policy (other types in the document: text/*, application/xml, application/xhtml+xml), and that granting * to requests
with no domain, such as local files, “is a dangerous practice”.
In the explorer
A file named crossdomain.xml, or any .xml file whose root element is cross-domain-policy, opens here: the XML tree, a Rules tab, and the problems. A problem is an attribute the
specification does not define for an element, a missing required attribute, a meta-policy value that is not allowed, none together with grants, a domain that holds a scheme, port or path (or has the wildcard
in a place the specification does not give), a secure that is not a boolean, a socket-only attribute, a fingerprint of the wrong length, or a second site-control. Any other file named
crossdomain.xml (an HTML error page, other XML) opens as XML or as before. Nothing is fetched. In the real files found on the public web, many sites answer an HTML page at this address; those are not claimed.
Not described
Known, not yet covered
- Reference: the domain-matching examples (specification page 12), socket policy files and the
policy-file-requestexchange, the HTTP and HTTPS content-type rules in full, the X-Permitted-Cross-Domain-Policies header and the DTD and XSD files are named, not described. - Viewer: the wildcard and domain rules are a shape test; the DTD and the XSDs are not applied; the file is not compared with the address it was served from, so the “non-master files only grant their own directory” rule is not checked.
- Viewer: a file whose root is not
cross-domain-policyis not recognised, and its XML is shown as XML.
Unknown
- Reference: whether current Flash-compatible runtimes (Ruffle and others) accept every attribute the 2009 specification lists: no source was read.
Links
Reference
- Cross Domain Policy File Specification – Adobe, 2009 (PDF)
- Cross Domain Configuration – the Acrobat security guide’s page on policy files
- clientaccesspolicy.xml – Microsoft Silverlight’s own policy file, which also reads a crossdomain.xml