Skip to content

Replace references to the "sync-xhr" policy-controlled feature #419

@sideshowbarker

Description

@sideshowbarker

whatwg/xhr#322 drops the sync-xhr policy-controlled feature from XHR.

There are two references to the sync-xhr feature that should therefore be be replaced in the Permissions Policy spec:

new_frame.allow = 'sync-xhr';
// This will be true, as the iframe is allowed to use sync-xhr at whatever URL is
// mentioned in its src attribute, even though that attribute is not yet set.
const is_sync_xhr_allowed = new_frame.permissionsPolicy.allowsFeature('sync-xhr');

<div class="example">
<p>As a practical (though contrived) example, consider a document which uses
synchronous XMLHttpRequest to determine whether a user has sufficient
privileges to access the page:</p>
<pre>
&lt;!DOCTYPE html&gt;
&lt;h1&gt;Welcome to SecureCorp!&lt;/h1&gt;
&lt;script&gt;
var req = new XMLHttpRequest();
req.open("GET", "/api/security_check.json", false);
req.send();
if (req.response == "untrusted user") {
// User is not logged in; redirect to a safe page
location.href = "/security_check_failed.html";
}
&lt;/script&gt;
&lt;!-- Page continues with assumption that user is logged in --&gt;
</pre>
<p>If this document is embedded by a page which disables the
"<code>sync-xhr</code>" feature, the call to `XMLHttpRequest.open()` would
fail, and the security check would be bypassed.</p>
</div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions