Violar la directiva de Política de Seguridad de Contenido después de la actualización ember-cli 0.0.47


He actualizado mi aplicación ember-cli a 0.0.47 y ahora estoy recibiendo un montón de errores en la consola de mi navegador relacionados con la política de seguridad de contenido. ¿Cómo soluciono este problema?

Refused to load the script 'http://use.typekit.net/abcdef.js' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' localhost:35729".
 login:1
Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' localhost:35729". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution.
 login:20
Refused to load the script 'http://connect.facebook.net/en_US/all.js' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' localhost:35729".
 login:1
Refused to load the script 'http://maps.googleapis.com/maps/api/js?libraries=places' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' localhost:35729".

Aquí están las líneas en mi app/index.archivo html:

<script type="text/javascript" src="//use.typekit.net/abcdef.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?libraries=places"></script>
Author: Stephen R, 2014-10-04

2 answers

Después de leer algunos documentos en http://content-security-policy.com / y https://github.com/rwjblue/ember-cli-content-security-policy , agregué algunas políticas a mi config/environment.archivo js así:

module.exports = function(environment) {
  var ENV = {
    contentSecurityPolicy: {
      'default-src': "'none'",
      'script-src': "'self' 'unsafe-inline' 'unsafe-eval' use.typekit.net connect.facebook.net maps.googleapis.com maps.gstatic.com",
      'font-src': "'self' data: use.typekit.net",
      'connect-src': "'self'",
      'img-src': "'self' www.facebook.com p.typekit.net",
      'style-src': "'self' 'unsafe-inline' use.typekit.net",
      'frame-src': "s-static.ak.facebook.com static.ak.facebook.com www.facebook.com"
    },

  // ...
};

Esto hizo que todos los errores inmediatos desaparecieran, pero tan pronto como comencé a navegar por mi aplicación, aparecieron nuevos relacionados con las fuentes de medios S3.

Estoy seguro de que esto funciona para aplicaciones que no incluyen ningún recurso externo, pero he decidido eliminar ""ember-cli-content-security-policy" de mi paquete.archivo json.

 126
Author: Peter Brown,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-10-04 11:34:25

Tuve que usar esto al enlazar a fuentes de Google:

<link rel='stylesheet' href='http://fonts.googleapis.com/css?family=Lato:400,700,900'>

En el archivo config/environment.js utilicé

contentSecurityPolicy: {
  'font-src': "'self' data: fonts.gstatic.com",
  'style-src': "'self' 'unsafe-inline' fonts.googleapis.com"
},
 18
Author: superlogical,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-03-13 00:39:03