Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

163
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!