Angular.js: ngSanitize triggers CSP alert/report in Firefox

Created on 20 Feb 2018  ·  9Comments  ·  Source: angular/angular.js

I'm submitting a ...

  • [X] bug report
  • [ ] feature request
  • [ ] other

Current behavior:

If ngSanitize is added as a module dependency and a Content-Security-Policy is set that does not allow inline styles then Firefox shows the following message:

Content Security Policy: The page’s settings observed the loading of a resource at self (“default-src”). A CSP report is being sent.

Our CSP looks like this:

Content-Security-Policy-Report-Only: default-src 'self'; report-uri /foo

If ngSanitize is removed from the module dependencies then the CSP message disappears as well.

Expected / new behavior:

ngSanitize should work in Firefox without triggering CSP alerts, at least if the "ng-csp" mode is enabled.

Minimal reproduction of the problem with instructions:

  1. Set the Content-Security-Policy to: default-src: 'self'
  2. Add 'ngSanitize' as a module dependency.

AngularJS version: 1.6.9

Browser: Firefox 60.0a1 and 59.0b10

Anything else:
I guess the following code triggers the CSP alert, since it adds an inline