0

I'm looking at my browser's console and I see the following error:

enter image description here

These all pertain to the same JS file.

I'm trying to figure out what's the quickest way to make these error go away. I'm guessing I can put the given hash in my script declaration, something like:

<script src="/assets/scripts/main.js" integrity="sha256-oB/JYOK782SSJ0f0XEuF36INIpCa5BTEt/q8IEny8x8="></script>

Questions:

  1. Is putting that hash as the value of the integrity attribute that correct way to handle this problem?
  2. Why does it seem like one file has three hashes?
1
  • If it shows up with 3 different hashes which all use the same hash algorithms (sha256) then it is not the same content. It might be the same URL which for each request creates a slightly different content though. In this case you cannot rely on a specific hash of the resource content, but need to rely on a magic nonce instead - see MDN nonce on how to use it. Nov 3, 2021 at 5:51

1 Answer 1

5

If it shows up with 3 different hashes which all use the same hash algorithms (sha256) then it is not the same content. It might be the same URL which for each request creates a slightly different content though. In this case you cannot rely on a specific hash of the resource content, but need to rely on a magic nonce instead - see MDN nonce on how to use it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .