Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

164
Vistas
How to use nonce or sha with connect-src(csp)?

Is it possible to use nonce with an API request so that connect-src in CSP will detect that it is not a malicious address?

Until now I have seen that nonce can only be used in script-src or style-src, not in connect-src

So far I have only been able to put the URL list in connect-src...

If anyone has an example in Angular or js please share

thats how look like my csp:

connect-src 'self' data: https://url wss://url 'nonce-the_nonce'; script-src 'self' 'nonce-the_nonce';

the fetch request with a nonce(THIS URL IS NOT INCLUDED IN MY connect-src data URLs list, I want that to work with a nonce):

  <script nonce="the_nonce">

    fetch(`https://url`,{method:'GET'}).then(res=>{
      console.log(res.status);
    },err=>{
      console.log(err.errorStatusCode);
    });

  </script>

the error I get:

Refused to connect to 'https://url' because it violates the following Content Security Policy directive: "connect-src 'self' data: https://url wss://url 'nonce-the_nonce".

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda