Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

115
Visualizações
Allowlist CSP for Javascript code passed in SRC to defer

I want to defer inline Javascript code passed in src and allowlist in CSP (Content-Security-Policy)

For deferring inline JS code, I referred: How to defer inline Javascript?

But I don't see a way to allowlist this in CSP.

Code

<script defer type="text/javascript" src="data:text/javascript,<code>"></script>

If I include data* in script-src directive I receive the violation

The source list for the Content Security Policy directive 'script-src' contains an invalid source: `data*`. It will be ignored.

Another approach I see is to use nonce but this will prevent other scripts from loading which do not have the nonce value.

I understand that there are other ways to defer the script including defining the script in an another local file or hosting it some external location but these two somehow does not work for me, due to other factors. Also I need the script to work globally hence module type will do no good.

Simply put, I want a way to allowlist Javascript code when passed in the SRC field instead of the script content.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda