Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$sanitize on Safari 10.3 with CSP  #16503

Closed
@steinm91

Description

@steinm91

I'm submitting a ...

  • bug report
  • feature request
  • other

Current behavior:

In 1.6.5 a new sanitize strategy was introduced for Safari relying on XHR, see this Commit.
Unfortunately these XHR's will be blocked by the Content Security Policy. As a consequence nearly every functionality using the $sanitize service is broken in Safari 10.x, such as ngBindHtml which will not render anything due to the blocked XHR.

Error Message:
Refused to connect to data:text/html;charset=utf-8,%3Cremove%3E%3C/remove%3EHell%3Cem%3Eo%3C/em%3E%20Wor%3Cem%3El%3C/em%3Ed because it appears in neither the connect-src directive nor the default-src directive of the Content Security Policy.

If we allow the scheme-source 'data:' in the directive connect-src it works fine. But since this is considered insecure we don't really want to do that (unless it is safe to do so in this case).

Expected / new behavior:

Components such as ngBindHtml work regardless of the connect-src property.

Minimal reproduction of the problem with instructions:

Do not explicitly allow source data: for the CSP connect-src, see the following plunkr:
http://plnkr.co/edit/fllIl4gQifqIKBKmqFxd?p=preview

AngularJS version: 1.6.5

Browser: Safari 10.3 / iOS 10.3

Anything else:

If there is a CSP setting which is considered secure and works with the current angular version, it would fix this issue for us.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions